コード例 #1
0
ファイル: UpdateColumns.php プロジェクト: houzhenggang/cobalt
 public function execute()
 {
     //get the location of the page
     $loc = $this->getInput()->get('loc');
     //get new data to insert into user tables
     $column = $this->getInput()->get('column');
     //get model
     $model = new UserModel();
     $model->updateColumns($loc, $column);
 }
コード例 #2
0
ファイル: Html.php プロジェクト: houzhenggang/cobalt
 public function render($tpl = null)
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     //application
     $app = \Cobalt\Container::fetch('app');
     //display title
     $document = JFactory::getDocument();
     //load model
     $layout = $this->getLayout();
     $model = new UsersModel();
     $model->set("_layout", $layout);
     //add toolbar buttons to manage users
     if ($layout == 'default') {
         $this->toolbar = new Toolbar();
         $this->toolbar->addNew();
         $this->toolbar->addDeleteRow();
         //get users
         $users = $model->getUsers();
         // Initialise variables.
         $this->state = $model->getState();
         //assign refs
         $this->users = $users;
         $this->listOrder = $this->state->get('Users.filter_order');
         $this->listDirn = $this->state->get('Users.filter_order_Dir');
     } elseif ($this->getLayout() == 'edit') {
         $model = new UserModel();
         $model->set("_layout", $layout);
         $this->toolbar = new Toolbar();
         $this->toolbar->save();
         $this->toolbar->cancel();
         //get id
         $id = $app->input->getInt('id', null);
         //plugins
         //$app->triggerEvent('onBeforeCRMUserEdit', array(&$id));
         //get user
         $this->user = $model->getUser($id);
         //view data
         $roles = DropdownHelper::getMemberRoles();
         $teamId = UsersHelper::getTeamId($id);
         $teams = UsersHelper::getTeams($teamId);
         $managers = DropdownHelper::getManagers($id);
         $this->member_roles = $roles;
         $this->teams = $teams;
         $this->managers = $managers;
     }
     /** Menu Links **/
     $menu = MenuHelper::getMenuModules();
     $this->menu = $menu;
     //display
     return parent::render();
 }
コード例 #3
0
ファイル: SaveProfile.php プロジェクト: houzhenggang/cobalt
 public function execute()
 {
     //set error
     $error = true;
     $data['id'] = UsersHelper::getUserId();
     //get model and store data
     $model = new UserModel();
     if ($model->store()) {
         $error = false;
     }
     //return results
     $results = array('error' => $error);
     if (array_key_exists('fullscreen', $data)) {
         $append = UsersHelper::isFullscreen() ? "/?&tmpl=component" : "";
         $results['url'] = RouteHelper::_($data['url'] . $append);
     }
     echo json_encode($results);
 }