Passed
Push — master ( 24e026...1404fe )
by Mihail
08:11
created

User::actionGrouplist()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Apps\Controller\Admin;
4
5
use Apps\ActiveRecord\Role;
6
use Apps\Model\Admin\User\FormUserGroupUpdate;
7
use Apps\Model\Admin\User\FormUserSettings;
8
use Extend\Core\Arch\AdminController;
9
use Ffcms\Core\App;
10
11
/**
12
 * Class User. Admin controller of user application.
13
 * @package Apps\Controller\Admin
14
 */
15
class User extends AdminController
16
{
17
    const VERSION = '1.0.1';
18
    const ITEM_PER_PAGE = 10;
19
20
    public $type = 'app';
21
22
    use User\ActionIndex {
0 ignored issues
show
Bug introduced by
The trait Apps\Controller\Admin\User\ActionIndex requires the property $query which is not provided by Apps\Controller\Admin\User.
Loading history...
23
        index as actionIndex;
24
    }
25
26
    use User\ActionUpdate {
27
        update as actionUpdate;
28
    }
29
30
    use User\ActionDelete {
0 ignored issues
show
introduced by
The trait Apps\Controller\Admin\User\ActionDelete requires some properties which are not provided by Apps\Controller\Admin\User: $users, $query
Loading history...
31
        delete as actionDelete;
32
    }
33
34
    use User\ActionInvite {
35
        invite as actionInvite;
36
    }
37
38
    use User\ActionRoleList {
39
        listing as actionRolelist;
40
    }
41
42
    use User\ActionRoleUpdate {
43
        roleUpdate as actionRoleupdate;
44
    }
45
46
    /**
47
     * User identity settings
48
     * @return string|null
49
     * @throws \Ffcms\Core\Exception\SyntaxException
50
     */
51
    public function actionSettings(): ?string
52
    {
53
        // load model and pass property's as argument
54
        $model = new FormUserSettings($this->getConfigs());
55
56
        if ($model->send()) {
57
            if ($model->validate()) {
58
                $this->setConfigs($model->getAllProperties());
59
                App::$Session->getFlashBag()->add('success', __('Settings is successful updated'));
60
                $this->response->redirect('user/index');
61
            } else {
62
                App::$Session->getFlashBag()->add('error', __('Form validation is failed'));
63
            }
64
        }
65
66
        // render view
67
        return $this->view->render('user/settings', [
68
            'model' => $model
69
        ]);
70
    }
71
}
72