当前位置: 首页>>代码示例>>PHP>>正文


PHP Rights::hasRight方法代码示例

本文整理汇总了PHP中Rights::hasRight方法的典型用法代码示例。如果您正苦于以下问题:PHP Rights::hasRight方法的具体用法?PHP Rights::hasRight怎么用?PHP Rights::hasRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rights的用法示例。


在下文中一共展示了Rights::hasRight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: return_navigation_array

function return_navigation_array()
{
    $navigation = array();
    $menu_navigation = array();
    $possible_tabs = get_tabs();
    // Campus Homepage
    if (api_get_setting('show_tabs', 'campus_homepage') == 'true') {
        $navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
    } else {
        $menu_navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
    }
    if (api_get_user_id() && !api_is_anonymous()) {
        // My Courses
        if (api_get_setting('show_tabs', 'my_courses') == 'true') {
            $navigation['mycourses'] = $possible_tabs['mycourses'];
        } else {
            $menu_navigation['mycourses'] = $possible_tabs['mycourses'];
        }
        // My Profile
        if (api_get_setting('show_tabs', 'my_profile') == 'true' && api_get_setting('allow_social_tool') != 'true') {
            $navigation['myprofile'] = $possible_tabs['myprofile'];
        } else {
            $menu_navigation['myprofile'] = $possible_tabs['myprofile'];
        }
        // My Agenda
        if (api_get_setting('show_tabs', 'my_agenda') == 'true') {
            $navigation['myagenda'] = $possible_tabs['myagenda'];
        } else {
            $menu_navigation['myagenda'] = $possible_tabs['myagenda'];
        }
        // Gradebook
        if (api_get_setting('gradebook_enable') == 'true') {
            if (api_get_setting('show_tabs', 'my_gradebook') == 'true') {
                $navigation['mygradebook'] = $possible_tabs['mygradebook'];
            } else {
                $menu_navigation['mygradebook'] = $possible_tabs['mygradebook'];
            }
        }
        // Reporting
        if (api_get_setting('show_tabs', 'reporting') == 'true') {
            if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
                $navigation['session_my_space'] = $possible_tabs['session_my_space'];
            } else {
                $navigation['session_my_space'] = $possible_tabs['session_my_progress'];
            }
        } else {
            if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
                $menu_navigation['session_my_space'] = $possible_tabs['session_my_space'];
            } else {
                $menu_navigation['session_my_space'] = $possible_tabs['session_my_progress'];
            }
        }
        // Social Networking
        if (api_get_setting('show_tabs', 'social') == 'true') {
            if (api_get_setting('allow_social_tool') == 'true') {
                $navigation['social'] = isset($possible_tabs['social']) ? $possible_tabs['social'] : null;
            }
        } else {
            $menu_navigation['social'] = isset($possible_tabs['social']) ? $possible_tabs['social'] : null;
        }
        // Dashboard
        if (api_get_setting('show_tabs', 'dashboard') == 'true') {
            if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) {
                $navigation['dashboard'] = isset($possible_tabs['dashboard']) ? $possible_tabs['dashboard'] : null;
            }
        } else {
            $menu_navigation['dashboard'] = isset($possible_tabs['dashboard']) ? $possible_tabs['dashboard'] : null;
        }
        // Administration
        if (api_is_platform_admin(true)) {
            if (api_get_setting('show_tabs', 'platform_administration') == 'true') {
                $navigation['platform_admin'] = $possible_tabs['platform_admin'];
            } else {
                $menu_navigation['platform_admin'] = $possible_tabs['platform_admin'];
            }
        }
        // Reports
        if (!empty($possible_tabs['reports'])) {
            if (api_get_setting('show_tabs', 'reports') == 'true') {
                if ((api_is_platform_admin() || api_is_drh() || api_is_session_admin()) && Rights::hasRight('show_tabs:reports')) {
                    $navigation['reports'] = $possible_tabs['reports'];
                }
            } else {
                $menu_navigation['reports'] = $possible_tabs['reports'];
            }
        }
        // Custom tabs
        $customTabs = getCustomTabs();
        if (!empty($customTabs)) {
            foreach ($customTabs as $tab) {
                if (api_get_setting($tab['variable'], $tab['subkey']) == 'true' && isset($possible_tabs[$tab['subkey']])) {
                    $possible_tabs[$tab['subkey']]['url'] = api_get_path(WEB_PATH) . $possible_tabs[$tab['subkey']]['url'];
                    $navigation[$tab['subkey']] = $possible_tabs[$tab['subkey']];
                } else {
                    if (isset($possible_tabs[$tab['subkey']])) {
                        $possible_tabs[$tab['subkey']]['url'] = api_get_path(WEB_PATH) . $possible_tabs[$tab['subkey']]['url'];
                        $menu_navigation[$tab['subkey']] = $possible_tabs[$tab['subkey']];
                    }
                }
            }
//.........这里部分代码省略.........
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:101,代码来源:banner.lib.php

示例2: returnNavigationArray

 /**
  * Gets the main menu
  *
  * @return array
  */
 public function returnNavigationArray()
 {
     $navigation = array();
     $menu_navigation = array();
     $possible_tabs = $this->getTabs();
     // Campus Homepage
     /*if (api_get_setting('show_tabs', 'campus_homepage') == 'true') {
           $navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
       } else {
           $menu_navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
       }*/
     if (api_get_user_id() && !api_is_anonymous()) {
         // My Courses
         /*if (api_get_setting('show_tabs', 'my_courses') == 'true') {
               $navigation['mycourses'] = $possible_tabs['mycourses'];
           } else {
               $menu_navigation['mycourses'] = $possible_tabs['mycourses'];
           }*/
         // My Profile
         /*
                     if (api_get_setting('show_tabs', 'my_profile') == 'true' && api_get_setting('social.allow_social_tool') != 'true') {
                         if (isset($possible_tabs['myprofile'])) {
                             $navigation['myprofile'] = $possible_tabs['myprofile'];
                         }
                     } else {
                         if (isset($possible_tabs['myprofile'])) {
                             $menu_navigation['myprofile'] = $possible_tabs['myprofile'];
                         }
                     }*/
         // My Agenda
         /*
                     if (api_get_setting('show_tabs', 'my_agenda') == 'true') {
                         $navigation['myagenda'] = $possible_tabs['myagenda'];
                     } else {
                         $menu_navigation['myagenda'] = $possible_tabs['myagenda'];
                     }*/
         // Gradebook
         /*
                     if (api_get_setting('gradebook_enable') == 'true') {
                         if (api_get_setting('show_tabs', 'my_gradebook') == 'true') {
                             $navigation['mygradebook'] = $possible_tabs['mygradebook'];
                         } else {
                             $menu_navigation['mygradebook'] = $possible_tabs['mygradebook'];
                         }
                     }*/
         // Reporting
         /*
                     if (api_get_setting('show_tabs', 'reporting') == 'true') {
                         if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
                             $navigation['session_my_space'] = $possible_tabs['session_my_space'];
                         } else {
                             $navigation['session_my_space'] = $possible_tabs['session_my_progress'];
                         }
                     } else {
                         if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
                             $menu_navigation['session_my_space'] = $possible_tabs['session_my_space'];
                         } else {
                             $menu_navigation['session_my_space'] = $possible_tabs['session_my_progress'];
                         }
                     }*/
         /*
                     // Social Networking
                     if (api_get_setting('show_tabs', 'social') == 'true') {
                         if (api_get_setting('social.allow_social_tool') == 'true') {
                             $navigation['social'] = $possible_tabs['social'];
                         }
                     } else {
                         $menu_navigation['social'] = isset($possible_tabs['social']) ? $possible_tabs['social'] : null;
                     }
         */
         // Dashboard
         /*
                     if (api_get_setting('show_tabs', 'dashboard') == 'true') {
                         if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) {
                             $navigation['dashboard'] = $possible_tabs['dashboard'];
                         }
                     } else {
                         $menu_navigation['dashboard'] = isset($possible_tabs['dashboard']) ? $possible_tabs['dashboard'] : null;
                     }*/
         if (isset($possible_tabs['admin'])) {
             $navigation['platform_admin'] = $possible_tabs['admin'];
             $navigation['platform_admin'] = $possible_tabs['admin'];
         }
         // Reports
         if (!empty($possible_tabs['reports'])) {
             if (api_get_setting('show_tabs', 'reports') == 'true') {
                 if ((api_is_platform_admin() || api_is_drh() || api_is_session_admin()) && Rights::hasRight('show_tabs:reports')) {
                     $navigation['reports'] = $possible_tabs['reports'];
                 }
             } else {
                 $menu_navigation['reports'] = $possible_tabs['reports'];
             }
         }
         // Custom tabs
         for ($i = 1; $i <= 3; $i++) {
//.........这里部分代码省略.........
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:Template.php


注:本文中的Rights::hasRight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。