コード例 #1
0
 function getPermissionUi($all_admin_permission, $base_path, $form_name)
 {
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_framework'] . '/lib/lib.adminmanager.php';
     $lang =& DoceboLanguage::createInstance('menu', 'lms');
     $out =& $GLOBALS['page'];
     $aclManager =& Docebo::user()->getAclManager();
     $admin_manager = new AdminManager();
     // Retriving main menu
     $main_area = $this->getLevelOne();
     $html = '';
     while (list($id_page, $area_info) = each($main_area)) {
         // retriving modules of the main menu
         $query_menu = "\r\n\t\t\tSELECT idUnder, module_name, default_name, default_op, associated_token, class_file, class_name\r\n\t\t\tFROM " . $this->table_level_two . "\r\n\t\t\tWHERE idMenu = '" . $id_page . "'\r\n\t\t\tORDER BY sequence";
         $re_menu = sql_query($query_menu);
         $html .= '<div class="admin_menu_perm_title">' . $area_info['name'] . '</div>' . '<div class="admin_menu_perm_modules">';
         while (list($id, $modname, $name, $op, $token, $class_file, $class_name) = sql_fetch_row($re_menu)) {
             if ($class_file != '' || $class_name != '') {
                 require_once $GLOBALS['where_lms'] . '/admin/class.module/' . $class_file;
                 $module = eval("return new {$class_name}();");
                 // Retriving all token for this module
                 $all_module_token =& $module->getAllToken($op);
                 // Retriving appropiated idst
                 $all_module_idst =& $admin_manager->fromRolePathToIdst($base_path . '/' . $modname, $all_module_token);
                 // Match with the real user permission
                 $module_perm =& $admin_manager->modulePermissionAsToken($all_admin_permission, $all_module_idst);
                 $html .= '<div class="edit_menu_module">' . $module->getPermissionUi($name != '' ? $lang->def($name) : $lang->def('_' . strtoupper($modname)), $modname, $op, $form_name, $module_perm) . '</div>';
             }
             //end if
         }
         //end inner while
         $html .= '</div>';
     }
     //end while
     return $html;
 }
コード例 #2
0
 function getPermissionUi($all_admin_permission, $form_name)
 {
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_framework'] . '/lib/lib.adminmanager.php';
     $out =& $GLOBALS['page'];
     $aclManager =& Docebo::user()->getAclManager();
     $admin_manager = new AdminManager();
     // Retriving main menu
     $main_area = $this->getLevelOne();
     $html = '';
     while (list($id_page, $area_info) = each($main_area)) {
         // retriving modules of the main menu
         $query_menu = "\r\n\t\t\tSELECT idUnder, idMenu, module_name, default_name, default_op, associated_token, class_file, class_name, of_platform \r\n\t\t\tFROM " . $this->table_level_two . " \r\n\t\t\tWHERE idMenu = '" . $id_page . "' \r\n\t\t\tORDER BY sequence";
         $re_menu = sql_query($query_menu);
         if (mysql_num_rows($re_menu)) {
             $all_tokens = array();
             $name_menu = array();
             $html .= '<div class="admin_menu_perm_modules">';
             while (list($id, $son_of, $modname, $name, $op, $token, $class_file, $class_name, $of_platform) = sql_fetch_row($re_menu)) {
                 if ($class_file != '' && $class_name != '') {
                     if ($of_platform == NULL) {
                         $of_platform = $this->platform;
                     }
                     $real_class_file = $GLOBALS['where_' . $of_platform] . ($of_platform != 'framework' ? '/admin' : '') . '/class.module/' . $class_file;
                     if (file_exists($real_class_file)) {
                         require_once $real_class_file;
                         if (class_exists($class_name)) {
                             $module = new $class_name();
                             // Retriving all token for this module
                             $all_module_token =& $module->getAllToken($op);
                             $all_tokens = array_merge($all_tokens, $all_module_token);
                             if (!isset($name_menu[$son_of])) {
                                 $name_menu[$son_of] = $name != '' ? $this->lang->def($name) : $this->lang->def('_' . strtoupper($modname));
                             }
                         }
                     }
                 }
                 //end if
             }
             //end inner while
             $tb = new Table(0, '', $this->lang->def('_EDIT_SETTINGS'));
             $type = array('align_left');
             $c_head = array();
             $c_head[] = $area_info['name'] != '' ? $area_info['name'] . ' : ' . $this->lang->def('_MODULE_NAME') : (isset($name_menu[$id_page]) ? $name_menu[$id_page] : '');
             foreach ($all_tokens as $k => $token) {
                 $type[] = 'image';
                 $c_head[] = '<img src="' . getPathImage($this->platform) . $token['image'] . '" alt="' . $this->lang_perm->def($token['name']) . '"' . ' title="' . $this->lang_perm->def($token['name']) . '" />';
             }
             $tb->setColsStyle($type);
             $tb->addHead($c_head);
             $re_menu = sql_query($query_menu);
             while (list($id, $son_of, $modname, $name, $op, $token, $class_file, $class_name, $of_platform) = sql_fetch_row($re_menu)) {
                 if ($class_file != '' && $class_name != '') {
                     if ($of_platform == NULL) {
                         $of_platform = $this->platform;
                     }
                     $real_class_file = $GLOBALS['where_' . $of_platform] . ($of_platform != 'framework' ? '/admin' : '') . '/class.module/' . $class_file;
                     if (file_exists($real_class_file)) {
                         require_once $real_class_file;
                         if (class_exists($class_name)) {
                             $module = new $class_name();
                             // Retriving all token for this module
                             $all_module_token =& $module->getAllToken($op);
                             // Retriving appropiated idst
                             $all_module_idst =& $admin_manager->fromRolePathToIdst('/' . $of_platform . '/admin/' . $modname, $all_module_token);
                             // Match with the real user permission
                             $module_perm =& $admin_manager->modulePermissionAsToken($all_admin_permission, $all_module_idst);
                             $line = $module->getPermissionUi($name != '' ? $this->lang->def($name) : $this->lang->def('_' . strtoupper($modname)), $modname, $op, $form_name, $module_perm, $all_tokens);
                             //echo '<pre>'.print_r($line, true);
                             $tb->addBody($line);
                         }
                     }
                 }
                 //end if
             }
             //end inner while
             $html .= $tb->getTable() . '</div>';
         }
         // if no module
     }
     //end while
     return $html;
 }