예제 #1
0
 /**
  * Get all roles as id=>name array
  * @return array|null
  */
 public function getRoleList()
 {
     return Role::getIdNameAll();
 }
예제 #2
0
파일: User.php 프로젝트: phpffcms/ffcms
 /**
  * Get user role object
  * @return \Apps\ActiveRecord\Role|null
  */
 public function getRole()
 {
     return Role::get($this->role_id);
 }
예제 #3
0
파일: User.php 프로젝트: phpffcms/ffcms
 /**
  * Edit and add groups
  * @param int $id
  * @return string
  * @throws \Ffcms\Core\Exception\SyntaxException
  * @throws \Ffcms\Core\Exception\NativeException
  */
 public function actionGroupUpdate($id)
 {
     // find role or create new object
     $role = Role::findOrNew($id);
     $model = new FormUserGroupUpdate($role);
     if ($model->send()) {
         // work with post request
         if ($model->validate()) {
             $model->save();
             App::$Session->getFlashBag()->add('success', __('Data was successful updated'));
         } else {
             App::$Session->getFlashBag()->add('error', __('Form validation is failed'));
         }
     }
     // render view
     return $this->view->render('group_update', ['model' => $model]);
 }