Exemple #1
0
 public function __construct()
 {
     parent::__construct();
     if (empty($this->enabled_modules)) {
         // if not list any enabled modules then, do it!
         $this->enabled_modules = $this->listEnabledModules();
     }
 }
Exemple #2
0
 /**
  * Получение пути к файлу шаблона
  * @param bool|false $tpl
  * @return bool|string
  */
 public function getPath($tpl = false)
 {
     $mod = $this->Modules->current();
     $template = 'default';
     if (!empty($mod['name'])) {
         if (file_exists($tpl)) {
             return $tpl;
         } elseif (file_exists($this->ROOT_DIR . '/templates/' . $template . '/modules/' . $mod['name'] . '/' . $tpl)) {
             return $this->ROOT_DIR . '/templates/' . $template . '/modules/' . $mod['name'] . '/' . $tpl;
         } elseif (file_exists($this->ROOT_DIR . '/modules/' . $mod['name'] . '/template/' . $tpl)) {
             return $this->ROOT_DIR . '/modules/' . $mod['name'] . '/template/' . $tpl;
         } else {
             $this->Exception->error('Запрашиваемый шаблон не существует');
         }
     } else {
         $this->Exception->error('Не существует активного модуля');
     }
 }
 public function action_module($account_id = '', $module_system_name = '')
 {
     // clear redirect referrer
     \Session::delete('submitted_redirect');
     // check permission
     if (\Model_AccountLevelPermission::checkAdminPermission('acperm_perm', 'acperm_manage_user_perm') == false) {
         \Session::set_flash('form_status', array('form_status' => 'error', 'form_status_message' => \Lang::get('admin_permission_denied', array('page' => \Uri::string()))));
         \Response::redirect(\Uri::create('admin'));
     }
     // load language
     \Lang::load('account');
     // if account id not set
     if (!is_numeric($account_id)) {
         $cookie_account = \Model_Accounts::forge()->getAccountCookie('admin');
         $account_id = 0;
         if (isset($cookie_account['account_id'])) {
             $account_id = $cookie_account['account_id'];
         }
         unset($cookie_account);
     }
     $output['account_id'] = $account_id;
     // check target account
     $account_check_result = $this->checkAccountData($account_id);
     $output['account_check_result'] = is_object($account_check_result) || is_array($account_check_result) ? true : $account_check_result;
     $output['account_username'] = is_object($account_check_result) || is_array($account_check_result) ? $account_check_result->account_username : null;
     $output['account_level'] = $account_check_result->account_level;
     // set level group for check
     $level_group_check = array();
     foreach ($account_check_result->account_level as $lvl) {
         $level_group_check[] = $lvl->level_group_id;
     }
     $output['level_group_check'] = $level_group_check;
     unset($level_group_check);
     // check if this module really has permission.
     if (\Library\Modules::forge()->hasPermission($module_system_name) == false) {
         \Response::redirect(\Uri::create('admin/account-permission/index/' . $account_id));
     }
     // read flash message for display errors.
     $form_status = \Session::get_flash('form_status');
     if (isset($form_status['form_status']) && isset($form_status['form_status_message'])) {
         $output['form_status'] = $form_status['form_status'];
         $output['form_status_message'] = $form_status['form_status_message'];
     }
     unset($form_status);
     // set to make sure these are NOT core controllers permissions
     $output['permission_core'] = 0;
     $output['module_system_name'] = $module_system_name;
     // list permissions from app/classes/controller (core controllers)
     $output['list_permissions'] = \Library\Modules::forge()->fetchPermissionModule($module_system_name);
     $output['list_permissions_check'] = \Model_AccountPermission::listPermissionChecked($account_id, 0, $module_system_name);
     // read module data from file
     $output['module'] = \Library\Modules::forge()->readModuleMetadataFromModuleName($module_system_name);
     // <head> output ----------------------------------------------------------------------------------------------
     $output['page_title'] = $this->generateTitle(\Lang::get('acperm_user_permission'));
     // <head> output ----------------------------------------------------------------------------------------------
     // breadcrumb -------------------------------------------------------------------------------------------------
     $page_breadcrumb = [];
     $page_breadcrumb[0] = ['name' => \Lang::get('admin_admin_home'), 'url' => \Uri::create('admin')];
     $page_breadcrumb[1] = ['name' => \Lang::get('acperm_user_permission'), 'url' => \Uri::create('admin/account-permission')];
     $page_breadcrumb[2] = ['name' => \Lang::get('acperm_module_permissison'), 'url' => \Uri::main()];
     $output['page_breadcrumb'] = $page_breadcrumb;
     unset($page_breadcrumb);
     // breadcrumb -------------------------------------------------------------------------------------------------
     return $this->generatePage('admin/templates/accountpermission/module_v', $output, false);
 }
 public function action_module($module_system_name = '')
 {
     // clear redirect referrer
     \Session::delete('submitted_redirect');
     // check permission
     if (\Model_AccountLevelPermission::checkAdminPermission('acperm_perm', 'acperm_manage_level_perm') == false) {
         \Session::set_flash('form_status', array('form_status' => 'error', 'form_status_message' => \Lang::get('admin_permission_denied', array('page' => \Uri::string()))));
         \Response::redirect(\Uri::create('admin'));
     }
     // check if this module really has permission.
     if (\Library\Modules::forge()->hasPermission($module_system_name) == false) {
         \Response::redirect(\Uri::create('admin/account-level-permission'));
     }
     // read flash message for display errors.
     $form_status = \Session::get_flash('form_status');
     if (isset($form_status['form_status']) && isset($form_status['form_status_message'])) {
         $output['form_status'] = $form_status['form_status'];
         $output['form_status_message'] = $form_status['form_status_message'];
     }
     unset($form_status);
     // set to make sure these are NOT core controllers permissions
     $output['permission_core'] = 0;
     $output['module_system_name'] = $module_system_name;
     // list permissions, levels, checked permissions ------------------------------------------------------------
     $output['list_permissions'] = \Library\Modules::forge()->fetchPermissionModule($module_system_name);
     $output['list_permissions_check'] = \Model_AccountLevelPermission::listPermissionChecked(0, $module_system_name);
     $output['list_levels'] = \Model_AccountLevelGroup::listLevels();
     // read module data from file
     $output['module'] = \Library\Modules::forge()->readModuleMetadataFromModuleName($module_system_name);
     // <head> output ----------------------------------------------------------------------------------------------
     $output['page_title'] = $this->generateTitle(\Lang::get('acperm_level_permission'));
     // <head> output ----------------------------------------------------------------------------------------------
     // breadcrumb -------------------------------------------------------------------------------------------------
     $page_breadcrumb = [];
     $page_breadcrumb[0] = ['name' => \Lang::get('admin_admin_home'), 'url' => \Uri::create('admin')];
     $page_breadcrumb[1] = ['name' => \Lang::get('acperm_level_permission'), 'url' => \Uri::create('admin/account-level-permission')];
     $page_breadcrumb[2] = ['name' => \Lang::get('acperm_module_permissison'), 'url' => \Uri::main()];
     $output['page_breadcrumb'] = $page_breadcrumb;
     unset($page_breadcrumb);
     // breadcrumb -------------------------------------------------------------------------------------------------
     return $this->generatePage('admin/templates/accountlevelpermission/module_v', $output, false);
 }
Exemple #5
0
    ?>
 
                                    </ul>
                                </li>
                                <?php 
}
// end permission check for top parent menu
?>
<!--end accounts, levels, permissions menu-->
                                <!--components menu-->
                                <li><a href="#" onclick="return false;"><?php 
echo __('admin_components');
?>
</a>
                                    <?php 
echo \Library\Modules::forge()->listAdminNavbar();
?>
 
                                </li>
                                <!--end components menu-->
                                <?php 
// permission check for top parent menu.
if (checkAdminPermission('siteman_perm', 'siteman_viewsites_perm')) {
    ?>
<!--extensions menu-->
                                <li><a href="#" onclick="return false;"><?php 
    echo __('admin_extensions');
    ?>
</a>
                                    <ul>
                                        <?php