예제 #1
0
 protected function _t_user_box()
 {
     $t = $this->_template;
     $this->_user = \Trouble\Agent::mapper()->create_object($this->_auth->user_data());
     $t['user'] = $this->_user;
     $t['_user_box'] = $t->render('user_box.php');
 }
예제 #2
0
 protected function _edit_agent()
 {
     $t = $this->_template;
     $t->add('_jsapps', 'agent_form');
     $storage = \Core\Storage::container()->get_storage('Agent');
     $mapper = \Trouble\Agent::mapper()->attach_storage($storage);
     $t->errors = array();
     if ($this->_args['alias']) {
         $t->title = "Edit Agent";
         $agent = \Trouble\Agent::container()->get_by_alias($this->_args['alias']);
         $this->_auth->check_admin('agent', $agent->id);
     } else {
         try {
             $t->title = "Edit Yourself";
             $agent = \Trouble\Agent::container()->get_by_id($this->_auth->user_id());
         } catch (\Core\AuthNotLoggedInError $e) {
             $t->title = "Agent Application";
             $t->new = True;
             $agent = \Trouble\Agent::create();
         }
     }
     $t->agent = $agent;
     return $t->render('forms/agent.php');
 }