This is an optional menu that can be added to a layout by a theme. It contains the
menu for the course administration, only on the course main page.

@return string
484475
public function context_header_settings_menu() {
        $context = $this->page->context;
        $menu = new action_menu();

        $items = $this->page->navbar->get_items();
        $currentnode = end($items);

        $showcoursemenu = false;
        $showfrontpagemenu = false;
        $showusermenu = false;

        // We are on the course home page.
        if (($context->contextlevel == CONTEXT_COURSE) &&
                !empty($currentnode) &&
                ($currentnode->type == navigation_node::TYPE_COURSE || $currentnode->type == navigation_node::TYPE_SECTION)) {
            $showcoursemenu = true;
        }

        $courseformat = course_get_format($this->page->course);
        // This is a single activity course format, always show the course menu on the activity main page.
        if ($context->contextlevel == CONTEXT_MODULE &&
                !$courseformat->has_view_page()) {

            $this->page->navigation->initialise();
            $activenode = $this->page->navigation->find_active_node();
            // If the settings menu has been forced then show the menu.
            if ($this->page->is_settings_menu_forced()) {
                $showcoursemenu = true;
            } else if (!empty($activenode) && ($activenode->type == navigation_node::TYPE_ACTIVITY ||
                            $activenode->type == navigation_node::TYPE_RESOURCE)) {

                // We only want to show the menu on the first page of the activity. This means
                // the breadcrumb has no additional nodes.
                if ($currentnode && ($currentnode->key == $activenode->key && $currentnode->type == $activenode->type)) {
                    $showcoursemenu = true;
                }
            }
        }

        // This is the site front page.
        if ($context->contextlevel == CONTEXT_COURSE &&
                !empty($currentnode) &&
                $currentnode->key === 'home') {
            $showfrontpagemenu = true;
        }

        // This is the user profile page.
        if ($context->contextlevel == CONTEXT_USER &&
                !empty($currentnode) &&
                ($currentnode->key === 'myprofile')) {
            $showusermenu = true;
        }

        if ($showfrontpagemenu) {
            $settingsnode = $this->page->settingsnav->find('frontpage', navigation_node::TYPE_SETTING);
            if ($settingsnode) {
                // Build an action menu based on the visible nodes from this navigation tree.
                $skipped = $this->build_action_menu_from_navigation($menu, $settingsnode, false, true);

                // We only add a list to the full settings menu if we didn't include every node in the short menu.
                if ($skipped) {
                    $text = get_string('morenavigationlinks');
                    $url = new moodle_url('/course/admin.php', array('courseid' => $this->page->course->id));
                    $link = new action_link($url, $text, null, null, new pix_icon('t/edit', $text));
                    $menu->add_secondary_action($link);
                }
            }
        } else if ($showcoursemenu) {
            $settingsnode = $this->page->settingsnav->find('courseadmin', navigation_node::TYPE_COURSE);
            if ($settingsnode) {
                // Build an action menu based on the visible nodes from this navigation tree.
                $skipped = $this->build_action_menu_from_navigation($menu, $settingsnode, false, true);

                // We only add a list to the full settings menu if we didn't include every node in the short menu.
                if ($skipped) {
                    $text = get_string('morenavigationlinks');
                    $url = new moodle_url('/course/admin.php', array('courseid' => $this->page->course->id));
                    $link = new action_link($url, $text, null, null, new pix_icon('t/edit', $text));
                    $menu->add_secondary_action($link);
                }
            }
        } else if ($showusermenu) {
            // Get the course admin node from the settings navigation.
            $settingsnode = $this->page->settingsnav->find('useraccount', navigation_node::TYPE_CONTAINER);
            if ($settingsnode) {
                // Build an action menu based on the visible nodes from this navigation tree.
                $this->build_action_menu_from_navigation($menu, $settingsnode);
            }
        }

        return $this->render($menu);
    }
771388
public function toActiveBranchElement()
    {
        $request    = $this->_getOriginalRequest();
        $activePath = $this->_findPath($request);

        if (! $activePath) {
            return null;
        }

        $this->setBranchVisible($activePath);

        $activeItem = array_pop($activePath);

        if (! $activeItem instanceof \Gems_Menu_SubMenuItem) {
            return null;
        }
        // \MUtil_Echo::track($activeItem->get('label'));

        $parameterSources[] = $request;

        if ($this->_menuParameters) {
            $parameterSources[] = $this->_menuParameters;
        }

        $source = new \Gems_Menu_ParameterCollector($parameterSources);
        // self::$verbose = true;

        $nav = $this->_toNavigationArray($source);

        $ul = $this->renderFirst();

        foreach ($nav as $item => $sub) {
            if ($sub['label'] === $activeItem->get('label')) {

                if (isset($sub['pages'])) {
                    $this->renderItems($ul, $sub['pages'], true);
                }

                return $ul;
            }
        }

        return null;
    }
731901
public function theme()
    {
        // nothing set, skip theme
        if (!$this->theme || !isset($this->theme->name)) {
            return false;
        }

        // only theme name is set
        if (is_string($this->theme)) {
            return (object)[
                'name'     => $this->theme,
                'mods'     => [],
                'options'  => [],
                'menus'    => [],
                'sidebars' => []
            ];
        }

        // read theme setting
        return (object)[
            'name'     => $this->theme->name,
            'mods'     => isset($this->theme->mods) ? $this->theme->mods : [],
            'options'  => isset($this->theme->options) ? $this->theme->options : [],
            'menus'    => isset($this->theme->menus) ? $this->theme->menus : [],
            'sidebars' => isset($this->theme->sidebars) ? $this->theme->sidebars : []
        ];
    }
633143
public function menu()
    {
        $tree = (new Menu())->toTree();
        if ($this->isAdmin()) {
            return $tree;
        }

        ///
        $permissions = array_get($this->allPermissions(), 'GET');
        return $this->permissionsToMenu($permissions, $tree);
    }
772957
public function getMenus()
    {
        if ($this->_normalizeMenus === null) {
            $mid = '/' . $this->getUniqueId() . '/';
            // resolve core menus
            $this->_normalizeMenus = [];

            $config = components\Configs::instance();
            $conditions = [
                'user' => $config->db && $config->db->schema->getTableSchema($config->userTable),
                'assignment' => ($userClass = Yii::$app->getUser()->identityClass) && is_subclass_of($userClass, 'yii\db\BaseActiveRecord'),
                'menu' => $config->db && $config->db->schema->getTableSchema($config->menuTable),
            ];
            foreach ($this->_coreItems as $id => $lable) {
                if (!isset($conditions[$id]) || $conditions[$id]) {
                    $this->_normalizeMenus[$id] = ['label' => Yii::t('rbac-admin', $lable), 'url' => [$mid . $id]];
                }
            }
            foreach (array_keys($this->controllerMap) as $id) {
                $this->_normalizeMenus[$id] = ['label' => Yii::t('rbac-admin', Inflector::humanize($id)), 'url' => [$mid . $id]];
            }

            // user configure menus
            foreach ($this->_menus as $id => $value) {
                if (empty($value)) {
                    unset($this->_normalizeMenus[$id]);
                    continue;
                }
                if (is_string($value)) {
                    $value = ['label' => $value];
                }
                $this->_normalizeMenus[$id] = isset($this->_normalizeMenus[$id]) ? array_merge($this->_normalizeMenus[$id], $value)
                : $value;
                if (!isset($this->_normalizeMenus[$id]['url'])) {
                    $this->_normalizeMenus[$id]['url'] = [$mid . $id];
                }
            }
        }
        return $this->_normalizeMenus;
    }
963048
public function createAdminSideMenu()
    {
        $groups = $this->adminPool->getDashboardGroups();
        $adminMenu = $this->factory->createItem('admin_side_menu');

        if (!$this->authorizationChecker->isGranted('ROLE_SONATA_ADMIN')) {
            return $adminMenu;
        }

        $iconSize = 'large';
        $firstLevelClass = 'first-level';

        $largeMenu = $adminMenu->addChild(
            'large',
            [
                'attributes' => ['class' => 'nav-custom'], ]
        );
        $smallMenu = $adminMenu->addChild(
            'small',
            [
                'attributes' => ['class' => 'nav-custom nav-custom-small', 'style' => 'margin-top: 50px;'], ]
        );

        $largeMenu->addChild(
            $this->translator->trans('admin.menu.dashboard', [], 'PageAdmin'),
            [
                'uri' => $this->router->generate('sonata_admin_dashboard'),
                'current' => $this->request->get('_sonata_admin') ? false : true,
                'attributes' => ['class' => $firstLevelClass, 'icon' => 'glyphicon glyphicon-dashboard', 'icon_size' => 'glyphicon-'.$iconSize],
                'linkAttributes' => ['class' => 'pull-left first-level-text'],
            ]
        );

        $menu = $largeMenu;
        foreach ($this->menuGroups as $key => $item) {
            foreach ($item['items'] as $mainMenu) {
                if (array_key_exists($mainMenu, $groups)) {
                    $group = $groups[$mainMenu];
                    if (count($group['items']) > 0) {
                        $first = reset($group['items']);
                        if ($first instanceof AdminInterface && $first->hasRoute('list')) {
                            $current = false;
                            $icon = 'glyphicon-unchecked';
                            $iconType = 'glyphicon';

                            if ($this->request->get('_sonata_admin') == $first->getCode()) {
                                $current = true;
                            }

                            if (method_exists($first, 'getIcon')) {
                                $icon = $first->getIcon();
                            }

                            if ($first->getExtensions()) {
                                foreach ($first->getExtensions() as $extension) {
                                    if (method_exists($extension, 'getIcon')) {
                                        $icon = $extension->getIcon();
                                        break;
                                    }
                                }
                            }

                            if (substr($icon, 0, '2') == 'fa') {
                                $iconType = 'fa';
                            }

                            $mainItem = $menu->addChild(
                                $this->translator->trans($group['label'], [], $group['label_catalogue'] != 'SonataAdminBundle' ? $group['label_catalogue'] : $first->getTranslationDomain()),
                                [
                                    'uri' => $first->generateUrl('list'),
                                    'current' => $current,
                                    'attributes' => ['class' => $firstLevelClass, 'icon' => sprintf('%s %s', $iconType, $icon), 'icon_size' => sprintf('%s-%s', $iconType, $iconSize)],
                                    'linkAttributes' => ['class' => 'pull-left first-level-text'],
                                ]
                            );

                            if (count($group['items']) > 1) {
                                foreach ($group['items'] as $subItem) {
                                    $current = false;
                                    if ($this->request->get('_sonata_admin') == $subItem->getCode()) {
                                        $current = true;
                                    }
                                    if ($subItem instanceof AdminInterface && $subItem->hasRoute('list')) {
                                        $mainItem->addChild(
                                            $this->translator->trans($subItem->getLabel(), [], $subItem->getTranslationDomain()),
                                            [
                                                'uri' => $subItem->generateUrl('list'),
                                                'current' => $current,
                                                'attributes' => ['class' => 'second-level', 'icon' => $icon, 'icon_size' => $iconSize],
                                            ]
                                        );
                                    }
                                }
                            }
                        }
                    }
                }
            }

            $iconSize = 'small';
            $firstLevelClass = 'first-level-small';
            $this->showOnlyCurrentChildren($menu);
            $menu = $smallMenu;
        }

        return $adminMenu;
    }
303570
function admin_menu()
	{
		// add page
		$page = add_submenu_page('edit.php?post_type=acf', __('Add-ons','acf'), __('Add-ons','acf'), 'manage_options', 'acf-addons', array($this,'html'));
		
		
		// actions
		add_action('load-' . $page, array($this,'load'));
		add_action('admin_print_scripts-' . $page, array($this, 'admin_print_scripts'));
		add_action('admin_print_styles-' . $page, array($this, 'admin_print_styles'));
		add_action('admin_head-' . $page, array($this,'admin_head'));
	}
871431
public function dashboardAction()
    {
        $translator = $this->container->get('translator');

        /** @var \Wanjee\Shuwee\AdminBundle\Manager\AdminManager $adminManager */
        $adminManager = $this->get('shuwee_admin.admin_manager');

        $sections = [];
        /** @var \Wanjee\Shuwee\AdminBundle\Admin\AdminInterface $admin */
        foreach ($adminManager->getAdmins() as $alias => $admin) {
            $section = $admin->getOption('menu_section');
            if (!is_string($section)) {
                throw new \Exception(
                    sprintf('"menu_section" option must return a string, %s returned.', gettype($section))
                );
            }

            // Create parent menu item if it does not exist yet
            if (!isset($sections[$section])) {
                $sections[$section]['label'] = ucfirst(
                    $translator->trans($section, [], 'ShuweeAdminBundle')
                );
                $sections[$section]['admins'] = [];
            }

            $sections[$section]['admins'][] = $admin;
        }

        return $this->render(
            'ShuweeAdminBundle:Admin:dashboard.html.twig',
            [
                'sections' => $sections,
            ]
        );
    }
667241
public function getMenu()
    {
        if ($this->_menu === null) {
            $this->_menu = Yii::$app->get('menu');
        }

        return $this->_menu;
    }
1352628
public function afficheMenu()
    {
        $html                                    = "";
        $t                                       = new Template('modules/archi/templates/');
        $t->set_filenames((array('administration'=>'administration.tpl')));
        $menu                                    = array();
        $u                                       = new archiUtilisateur();
        $a                                       = new archiAuthentification();
        $idUtilisateur                           = $a->getIdUtilisateur();
        if ($u->isAuthorized('admin_droits', $idUtilisateur)) {
            $menu = array_merge($menu, array(_("Droits")=>$this->creerUrl('', 'adminDroits')));
        }
        if ($u->isAuthorized('admin_actualites', $idUtilisateur)) {
            $menu = array_merge($menu, array(_("Actualités")=>$this->creerUrl('', 'adminActualites')));
        }
        $menu[_("Pages")] = $this->creerUrl('', 'adminPages', array());
        if ($u->isAuthorized('admin_actualites', $idUtilisateur)) {
            $menu = array_merge($menu, array(_("Compteur de dons")=>$this->creerUrl('', 'adminCompteur')));
        }
        if ($u->isAuthorized('admin_sources', $idUtilisateur)) {
            $menu = array_merge($menu, array(_("Sources")=>$this->creerUrl('', 'administration', array('tableName'=>'source'))));
        }
        if ($u->isAuthorized('admin_types_sources', $idUtilisateur)) {
            $menu = array_merge($menu, array(_("Types de sources")=>$this->creerUrl('', 'administration', array('tableName'=>'typeSource'))));
        }
        if ($u->isAuthorized('admin_types_structures', $idUtilisateur)) {
            $menu = array_merge($menu, array(_("Types de structures")=>$this->creerUrl('', 'administration', array('tableName'=>'typeStructure'))));
        }
        if ($u->isAuthorized('admin_courants_architecturaux', $idUtilisateur)) {
            $menu = array_merge($menu, array(_("Courant architecturaux")=>$this->creerUrl('', 'administration', array('tableName'=>'courantArchitectural'))));
        }
        $menu[_("Gestion des personnes")] = array();
        if ($u->isAuthorized('admin_metiers', $idUtilisateur)) {
            $menu[_("Gestion des personnes")] = array_merge($menu[_("Gestion des personnes")], array(_("Métiers")=>$this->creerUrl('', 'administration', array('tableName'=>'metier'))));
        }
        if ($u->isAuthorized('admin_personnes', $idUtilisateur)) {
            $menu[_("Gestion des personnes")] = array_merge($menu[_("Gestion des personnes")], array(_("Modifier une personne")=>$this->creerUrl('', 'adminPersonne', array())));
        }
        $menu[_("Gestion des adresses")] = array();
        if ($u->isAuthorized('admin_adresses', $idUtilisateur)) {
            $menu[_("Gestion des adresses")] = array_merge($menu[_("Gestion des adresses")], array(_("Ajout d'éléments d'adresse (rue, sous-quartier, quartier, ville, pays)")=>$this->creerUrl('', 'ajoutNouvelleAdresse', array())));
        }
        if ($u->isAuthorized('admin_rues', $idUtilisateur)) {
            $menu[_("Gestion des adresses")] = array_merge($menu[_("Gestion des adresses")], array(_("Gérer les rues")=>$this->creerUrl('', 'adminElementAdresse', array('tableName'=>'rue'))));
        }
        if ($u->isAuthorized('admin_sousQuartiers', $idUtilisateur)) {
            $menu[_("Gestion des adresses")] = array_merge($menu[_("Gestion des adresses")], array(_("Gérer les sous-quartiers")=>$this->creerUrl('', 'adminElementAdresse', array('tableName'=>'sousQuartier'))));
        }
        if ($u->isAuthorized('admin_quartiers', $idUtilisateur)) {
            $menu[_("Gestion des adresses")] = array_merge($menu[_("Gestion des adresses")], array(_("Gérer les quartiers")=>$this->creerUrl('', 'adminElementAdresse', array('tableName'=>'quartier'))));
        }
        if ($u->isAuthorized('admin_villes', $idUtilisateur)) {
            $menu[_("Gestion des adresses")] = array_merge($menu[_("Gestion des adresses")], array(_("Gérer les villes")=>$this->creerUrl('', 'adminElementAdresse', array('tableName'=>'ville'))));
        }
        if ($u->isAuthorized('admin_pays', $idUtilisateur)) {
            $menu[_("Gestion des adresses")] = array_merge($menu[_("Gestion des adresses")], array(_("Gérer les pays")=>$this->creerUrl('', 'adminElementAdresse', array('tableName'=>'pays'))));
        }
        if ($u->isAuthorized('admin_affiche_resultats_sondages', $idUtilisateur)) {
            $menu = array_merge($menu, array(_("Voir les statistiques des sondages")=>$this->creerUrl('', 'adminSondages', array())));
        }
        if ($u->isAuthorized('admin_parcours', $idUtilisateur)) {
            $menu = array_merge($menu, array(_("Gérer les parcours")=>$this->creerUrl('', 'adminListeParcours', array())));
        }
        if ($u->isAuthorized('admin_traduction', $idUtilisateur)) {
            $menu[_("Traduction")] = array(_("Traduction")=>$this->tradLink, _("Détecter les nouvelles chaines à traduire")=>"script/updateTranslation.php", _("Appliquer les nouvelles traductions")=>"script/applyTranslation.php");;
            //$menu[_("Détecter les nouvelles chaines à traduire")] = "script/updateTranslation.php";
            //$menu[_("Appliquer les nouvelles traductions")] = "script/applyTranslation.php";
        }
        foreach ($menu as $nom=>$url) {
            if (is_array($url)) {
                $menuHTML=$nom._(" :");
                $menuHTML.="<ul>";
                foreach ($url as $subName=>$subURL) {
                    $menuHTML.="<li><a href='".$subURL."'>".$subName."</a></li>";
                }
                $menuHTML.="</ul>";
            } else {
                $menuHTML="<a href='".$url."'>".$nom."</a>";
                //<a href="{listeMenu.url}">{listeMenu.nom}</a>
            }
            $t->assign_block_vars('listeMenu', array("menu"=>$menuHTML));
        }
        ob_start();
        $t->pparse('administration');
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }
1110968
public function mainMenu()
    {
        if ($this->mainMenu === null) {
            $options = null;

            if ($this instanceof DashboardContainerInterface) {
                $dashboardConfig = $this->dashboardConfig();

                if (isset($dashboardConfig['secondary_menu'])) {
                    $options = $dashboardConfig['secondary_menu'];
                }
            }

            $this->mainMenu = $this->createMainMenu($options);
        }

        return $this->mainMenu;
    }
706986
public function Menu() {
		$list = new ArrayList();

		$list->push(new ArrayData(array(
			'Link' => sprintf('naut/project/%s', $this->Name),
			'Title' => 'Deploy',
			'IsActive' => Controller::curr()->getAction() == 'project'
		)));

		if(DNRoot::FlagSnapshotsEnabled()) {
			$list->push(new ArrayData(array(
				'Link' => sprintf('naut/project/%s/snapshots', $this->Name),
				'Title' => 'Snapshots',
				'IsActive' => Controller::curr()->getAction() == 'snapshots'
			)));
		}

		$this->extend('updateMenu', $list);

		return $list;
	}
538280
public function SectionTitle()
    {
        $title = $this->menu_title();
        if ($title) {
            return $title;
        }

        foreach ($this->MainMenu() as $menuItem) {
            if ($menuItem->LinkingMode != 'link') {
                return $menuItem->Title;
            }
        }
        return null;
    }
149457
public function getMenuList()
    {
        $result = $this->httpRaw(self::WECHAT_MENU_GET_URL . 'access_token=' . $this->getAccessToken());
        return isset($result['menu']['button']) ? $result['menu']['button'] : false;
    }
1029085
public function course_header() {
        global $CFG;
        if ($this->page->course->id == SITEID) {
            // return immediately and do not include /course/lib.php if not necessary
            return '';
        }
        require_once($CFG->dirroot.'/course/lib.php');
        $courseformat = course_get_format($this->page->course);
        if (($obj = $courseformat->course_header()) !== null) {
            return $courseformat->get_renderer($this->page)->render($obj);
        }
        return '';
    }
1127774
public function menu()
    {
        //buduje menu jeśli podano root i jest nawigator
        return $this->_getHtml(($this->_root && self::$_navigation) ? self::$_navigation->seek($this->_root) : []);
    }
402858
private function mainMenuIdent($options = null)
    {
        if ($this->mainMenuIdentLoaded === false) {
            $mainMenuIdent = null;

            if (isset($this['main_menu_item'])) {
                $mainMenuIdent = $this['main_menu_item'];
            }

            if (!(empty($options) && !is_numeric($options))) {
                if (is_string($options)) {
                    $mainMenuIdent = $options;
                } elseif (is_array($options)) {
                    if (isset($options['widget_options']['ident'])) {
                        $mainMenuIdent = $options['widget_options']['ident'];
                    }
                }
            }

            // Get main menu from the obj_type
            $objType = filter_input(INPUT_GET, 'obj_type', FILTER_SANITIZE_STRING);
            if ($objType) {
                $secondaryMenuItems = $this->adminConfig('secondary_menu');
                foreach ($secondaryMenuItems as $main => $item) {
                    if ($this->isObjTypeInSecondaryMenuItem($objType, $item)) {
                        $mainMenuIdent = $main;
                        break;
                    }
                }
            }

            // Choose main menu with a get parameter
            $mainMenuFromRequest = filter_input(INPUT_GET, 'main_menu', FILTER_SANITIZE_STRING);
            if ($mainMenuFromRequest) {
                $mainMenuIdent = $mainMenuFromRequest;
            }

            $this->mainMenuIdent = $mainMenuIdent;
            $this->mainMenuIdentLoaded = true;
        }

        return $this->mainMenuIdent;
    }