array('model' => 'user_token'), 'group' => array('through' => 'account_group'), 'invoice' => array(), 'payment'=>array(), 'service' => array(), ); // Complete our login public function complete_login() {} /** * Return an account name */ public function name($withcompany=FALSE) { if ($withcompany) return sprintf('%s %s (%s)',$this->first_name,$this->last_name,$this->company); else return sprintf('%s %s',$this->first_name,$this->last_name); } public function accnum() { return sprintf('%02s-%06s',Config::siteid(),$this->id); } public function date_last() { return Config::date($this->date_last); } public function title($name) { return StaticList_Title::form($name,$this->title); } public function currency($name) { return StaticListModule::form($name,'currency',$this->currency_id,'id','name',array()); } public function country($name) { return StaticListModule::form($name,'country',$this->country_id,'id','name',array()); } public function language($name) { // @todo To setup return 'en'; } /** * Get the groups that an account belongs to */ public function groups() { return $this->group->find_all()->as_array(); } public function admin() { // @todo Define admins in the config file or DB $admins = array('Root'); foreach ($this->groups() as $go) if (in_array($go->name,$admins)) return TRUE; return FALSE; } }