Пример #1
0
 protected function init()
 {
     $this->userSeed = $this->session->get('user');
     $this->setting = new \Libs\Setting('Cores');
     $this->twoColsLayout = new DefaultLayout($this->context);
     $this->twoColsLayout->setTemplatesDirectory(dirname(__DIR__) . '/Views');
     $this->twoColsLayout->setBrand($this->setting->getSetting('themeBrand'))->setCompanyWebsite($this->setting->getSetting('themeCompanyWebsite'))->setUser($this->user())->setSideMenu(new Menu(null, null, null, array('user' => new Menu('user', '<i class="fa fa-user"></i> Tài khoản', url('/admin/user')), 'group' => new Menu('group', '<i class="fa fa-folder-open"></i> Nhóm', url('/admin/group')), 'setting' => new Menu('setting', '<i class="fa fa-cog"></i> Cấu hình hệ thống', url('/admin/setting')), 'app' => new Menu('app', '<i class="fa fa-th-large"></i> Quản lý ứng dụng', url('/admin/application')))));
     $this->contentOnlyLayout = new ContentOnlyLayout($this->context);
     $this->contentOnlyLayout->setTemplatesDirectory(dirname(__DIR__) . '/Views');
 }
Пример #2
0
 function setting()
 {
     $this->requireAdmin();
     $appId = $this->req->get('appId');
     $groupName = $this->req->get('group');
     if (!$appId || !$groupName) {
         foreach (\Libs\Setting::getAllApp() as $appId) {
             $setting = new \Libs\Setting($appId);
             if (!$setting->xml->settings) {
                 continue;
             }
             foreach ($setting->xml->settings->group as $groupXml) {
                 $this->resp->redirect(url('/admin/setting?appId=' . $appId . '&group=' . $groupXml->attributes()->name));
                 return;
             }
         }
     }
     $this->twoColsLayout->render('Setting/setting.phtml', array('pAppId' => $appId, 'pGroupName' => $groupName));
 }
Пример #3
0
 /**
  * Trả về danh sách tất cả quyền của ứng dụng
  */
 function getBasePermissions()
 {
     $this->requireAdmin();
     $ret = array();
     foreach (\Libs\Setting::getAllApp() as $appId) {
         $setting = new \Libs\Setting($appId);
         if ($setting->xml->attributes()->active != 'true') {
             continue;
         }
         $app = array('name' => (string) $setting->xml->attributes()->name, 'groups' => array());
         foreach ($setting->xml->permissions->group as $groupXml) {
             $group = array('name' => (string) $groupXml->attributes()->name, 'permissions' => array());
             foreach ($groupXml->pem as $pem) {
                 $group['permissions'][] = array('id' => (string) $pem->attributes()->id, 'name' => (string) $pem->attributes()->name);
             }
             $app['groups'][] = $group;
         }
         $ret[] = $app;
     }
     $this->resp->setBody(Json::encode($ret));
 }