Beispiel #1
0
 /**
  * Get all roles as id=>name array
  * @return array|null
  */
 public function getRoleList()
 {
     return Role::getIdNameAll();
 }
Beispiel #2
0
 /**
  * Get user role object
  * @return \Apps\ActiveRecord\Role|null
  */
 public function getRole()
 {
     return Role::get($this->role_id);
 }
Beispiel #3
0
 /**
  * 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]);
 }