id_user.'" '); } public function projects() { } public function password($password) { } public static function facebook($id) { return self::q(' select user.* from user left join user_auth using(id_user) where user_auth.auth="'.Cana::db()->escape($id).'" and user_auth.`type`="facebook" and user.active=1 and user_auth.active=1 '); } public function presets() { if (!isset($this->_presets)) { $this->_presets = Preset::q(' select * from preset where id_user="'.$this->id_user.'" '); } return $this->_presets; } public function preset($id_restaurant) { foreach ($this->presets() as $preset) { if ($preset->id_restaurant == $id_restaurant) { return $preset; } } return false; } public function exports() { $out = $this->properties(); foreach ($this->presets() as $preset) { $out['presets'][$preset->id_restaurant] = $preset->exports(); } return $out; } public function __construct($id = null) { parent::__construct(); $this ->table('user') ->idVar('id_user') ->load($id); } }