Finds and displays menu items..

@Route("/{id}/items", name="admin_menu_items")
@Method("GET")
@Template()
320915
public function itemsAction(Menu $menu)
    {
        $em = $this->getDoctrine()->getManager();
        //$entities = $em->getRepository('FlowcodePageBundle:MenuItem')->findBy(array("menu" => $menu->getId()));
        $entities = $em->getRepository('AmulenPageBundle:MenuItem')->childrenHierarchy(null, false, array(
            "childSort" => array("position" => "ASC"),
        ), null);

        return array(
            'menu' => $menu,
            'entities' => $entities,
        );
    }
359076
public function show($id)
    {
      if ( \Auth::user()->roles[0]->can('menu-read' ) ) {
        $menu = $this->menus->findOrFail($id);
        return view('admin.menus.show', compact('menu'));
      }
      return \Redirect::route('admin.menus.index')->withErrors(trans('acl::dashboard.unauthorized_access'));
    }
363493
protected function manageItems()
    {
        foreach ($this->_items as $item) {

            if ($item instanceof Rule) {
                $item_exist = $this->_auth->getRule($item->name);
            } elseif ($item instanceof Role) {
                $item_exist = $this->_auth->getRole($item->name);
            } elseif ($item instanceof Permission) {
                $item_exist = $this->_auth->getPermission($item->name);
            } else {
                throw new InvalidParamException('Adding unsupported object type.');
            }

            if ($item_exist) {
                if ($item_exist instanceof __PHP_Incomplete_Class) {
                    $need_update = true;
                } else if ($item_exist instanceof Rule) {
                    $item->updatedAt = $item_exist->updatedAt;
                    $need_update = serialize($item_exist) != serialize($item);
                } else {
                    $need_update = $item_exist->description != $item->description || $item_exist->ruleName != $item->ruleName || $item_exist->data != $item->data;
                }

                if ($need_update) {
                    Console::stdout("Updating $item->name item data.\n");
                    $this->_auth->update($item->name, $item);
                }

            } else {
                Console::stdout("New item added: $item->name\n");
                $this->_auth->add($item);
            }
        }

        /** @var Role|Permission|Rule $items */
        $items = ArrayHelper::merge($this->_auth->getRules(), $this->_auth->getRules(), $this->_auth->getPermissions());

        foreach ($items as $existing_item) {
            if (!isset($this->_items[$existing_item->name])) {
                Console::stdout(Console::ansiFormat('Item removed: ' . $existing_item->name . "\n", [Console::FG_RED]));
                $this->_auth->remove($existing_item);
            }
        }
    }
649838
def show_item(name, id_):
    '''
    
    '''
    status, result = _query(action=name, command=id_)
    return result
382492
public function get_item($id)
	{
		// Element empty!
		if (count($this->_items) === 0)
			return FALSE;

		if (array_key_exists($id, $this->_items))
		{ // By ID
			return $this->_items[$id];
		} else
		{ // By route
			$path = $this->get_tree_index(Route::get($id));

			if($path != false)
			{
				$levels = count($path);

				$item = $this->_items[$path[0]];

				if($levels > 1)
				{
					for($i=1; $i<$levels; $i++)
					{
						$item = $item->siblings[$path[$i]];
					}
				}
				return $item;
			}
		}
		return FALSE;
	}
752416
public function get_items() {
        global $CFG;
        $items = array();
        // Make sure that navigation is initialised
        if (!$this->has_items()) {
            return $items;
        }
        if ($this->items !== null) {
            return $this->items;
        }

        if (count($this->children) > 0) {
            // Add the custom children.
            $items = array_reverse($this->children);
        }

        // Check if navigation contains the active node
        if (!$this->ignoreactive) {
            // We will need to ensure the navigation has been initialised.
            $this->page->navigation->initialise($this->page);
            // Now find the active nodes on both the navigation and settings.
            $navigationactivenode = $this->page->navigation->find_active_node();
            $settingsactivenode = $this->page->settingsnav->find_active_node();

            if ($navigationactivenode && $settingsactivenode) {
                // Parse a combined navigation tree
                while ($settingsactivenode && $settingsactivenode->parent !== null) {
                    if (!$settingsactivenode->mainnavonly) {
                        $items[] = new breadcrumb_navigation_node($settingsactivenode);
                    }
                    $settingsactivenode = $settingsactivenode->parent;
                }
                if (!$this->includesettingsbase) {
                    // Removes the first node from the settings (root node) from the list
                    array_pop($items);
                }
                while ($navigationactivenode && $navigationactivenode->parent !== null) {
                    if (!$navigationactivenode->mainnavonly) {
                        $items[] = new breadcrumb_navigation_node($navigationactivenode);
                    }
                    if (!empty($CFG->navshowcategories) &&
                            $navigationactivenode->type === self::TYPE_COURSE &&
                            $navigationactivenode->parent->key === 'currentcourse') {
                        foreach ($this->get_course_categories() as $item) {
                            $items[] = new breadcrumb_navigation_node($item);
                        }
                    }
                    $navigationactivenode = $navigationactivenode->parent;
                }
            } else if ($navigationactivenode) {
                // Parse the navigation tree to get the active node
                while ($navigationactivenode && $navigationactivenode->parent !== null) {
                    if (!$navigationactivenode->mainnavonly) {
                        $items[] = new breadcrumb_navigation_node($navigationactivenode);
                    }
                    if (!empty($CFG->navshowcategories) &&
                            $navigationactivenode->type === self::TYPE_COURSE &&
                            $navigationactivenode->parent->key === 'currentcourse') {
                        foreach ($this->get_course_categories() as $item) {
                            $items[] = new breadcrumb_navigation_node($item);
                        }
                    }
                    $navigationactivenode = $navigationactivenode->parent;
                }
            } else if ($settingsactivenode) {
                // Parse the settings navigation to get the active node
                while ($settingsactivenode && $settingsactivenode->parent !== null) {
                    if (!$settingsactivenode->mainnavonly) {
                        $items[] = new breadcrumb_navigation_node($settingsactivenode);
                    }
                    $settingsactivenode = $settingsactivenode->parent;
                }
            }
        }

        $items[] = new breadcrumb_navigation_node(array(
            'text' => $this->page->navigation->text,
            'shorttext' => $this->page->navigation->shorttext,
            'key' => $this->page->navigation->key,
            'action' => $this->page->navigation->action
        ));

        if (count($this->prependchildren) > 0) {
            // Add the custom children
            $items = array_merge($items, array_reverse($this->prependchildren));
        }

        $last = reset($items);
        if ($last) {
            $last->set_last(true);
        }
        $this->items = array_reverse($items);
        return $this->items;
    }
9371
public function findActiveItem()
    {
        foreach ($this->items as $index => $item) {
            $index++;

            if ($item->number == $this->currentPage) {
                $item->active = true;
            }
        }
    }
1151480
public function index()
    {
        save_resource_url();

        $items = User::with('roles')->whereRole(Role::$BASE_ADMIN)->get();

        return $this->view('titan::accounts.administrators.index', compact('items'));
    }
61999
private function embed_submenu_items() {
            $item_template = $this->_menu->is_top_level() ?
                '<span class="fs-submenu-item %s %s %s">%s</span>' :
                '<span class="fs-submenu-item fs-sub %s %s %s">%s</span>';

            $top_level_menu_capability = $this->get_top_level_menu_capability();

            ksort( $this->_menu_items );

            $is_first_submenu_item = true;

            foreach ( $this->_menu_items as $priority => $items ) {
                foreach ( $items as $item ) {
                    $capability = ( ! empty( $item['capability'] ) ? $item['capability'] : $top_level_menu_capability );

                    $menu_item = sprintf(
                        $item_template,
                        $this->get_unique_affix(),
                        $item['menu_slug'],
                        ! empty( $item['class'] ) ? $item['class'] : '',
                        $item['menu_title']
                    );

                    $top_level_menu_slug = $this->get_top_level_menu_slug();
                    $menu_slug           = $this->_menu->get_slug( $item['menu_slug'] );

                    if ( ! isset( $item['url'] ) ) {
                        $hook = FS_Admin_Menu_Manager::add_subpage(
                            $item['show_submenu'] ?
                                $top_level_menu_slug :
                                null,
                            $item['page_title'],
                            $menu_item,
                            $capability,
                            $menu_slug,
                            $item['render_function']
                        );

                        if ( false !== $item['before_render_function'] ) {
                            add_action( "load-$hook", $item['before_render_function'] );
                        }
                    } else {
                        FS_Admin_Menu_Manager::add_subpage(
                            $item['show_submenu'] ?
                                $top_level_menu_slug :
                                null,
                            $item['page_title'],
                            $menu_item,
                            $capability,
                            $menu_slug,
                            array( $this, '' )
                        );
                    }

                    if ( $item['show_submenu'] && $is_first_submenu_item ) {
                        if ( $this->_is_network_active && ! empty( $this->_dynamically_added_top_level_page_hook_name ) ) {
                            /**
                             * If the top-level menu has been dynamically created, remove the first submenu item that
                             * WordPress automatically creates when there's no submenu item whose slug matches the
                             * parent's. In the following example, the `Awesome Plugin` submenu item will be removed.
                             *
                             * Awesome Plugin
                             *     - Awesome Plugin <-- we want to remove this since there's no real setting page for the top-level
                             *
                             * @author Leo Fajardo (@leorw)
                             */
                            remove_submenu_page( $top_level_menu_slug, $top_level_menu_slug );
                        }

                        $is_first_submenu_item = false;
                    }
                }
            }
        }
918948
public function getItem($id)
    {
        foreach ($this->items as $item) {
            if ($item->getId() == $id) {
                return ($item);
            }
        }

        return null;
    }
656698
protected function generateItems($items)
    {
        foreach ($items as $id => &$values) {
            $values = $this->setDefaultValues($id, $values);

            if (!$this->checkAccess($values)) {
                unset($items[$id]);
                continue;
            }

            $values['title'] = $this->getTitle($id, $values['title']);

            $values['url'] = $this->generateUrl($values);

            if (isset($values['submenu'])) {
                $values['submenu'] = $this->generateItems($values['submenu']);
            }

            if ($this->isActiveUrl($values)) {
                $values['active'] = true;
                $this->currentId = $id;
            } elseif (isset ($values['submenu'])) {
                // Check if there is an active item in the submenu, if
                // so it'll mark the current item as active as well.
                foreach ($values['submenu'] as $subitem) {
                    if ($subitem['active']) {
                        $values['active'] = true;
                        break;
                    }
                }
            }

            if ($values['active']) {
                $values['class'] .= ' '.$this->activeClass;
            }

            if ($values['submenu']) {
                $values['class'] .= ' '.$this->dropDownClass;
            }

            $values['class'] = trim($values['class']);

            unset(
                $values['callback'], $values['logged'], $values['roles'], $values['secure'],
                $values['params'], $values['route'], $values['action'], $values['full_url'],
                $values['allows'], $values['check'], $values['denies'], $values['exact']
            );
        }

        return $items;
    }
582436
public function showItemsTable()
    {
        $table = new AdminItems(Item::query());

        $table->with('seller');

        if (mustard_loaded('feedback')) {
            $table->with('seller.feedbackReceived');
        }

        return view('mustard::admin.items', [
            'table' => $table,
            'items' => $table->paginate(),
        ]);
    }
13583
public function populate_db_object_items() {
		$locators = array(
			'post',
			'term',
			'user',
		);

		foreach ( $locators as $locator_name ) {
			$items = $this->generate_locator_items( $locator_name );
			$this->get_trail()->add_item( $items );
		}
	}
683048
public function filter_wp_nav_menu_objects( $menu_items ) {
		foreach ( $menu_items as &$item ) {
			if ( 'page' !== $item->object || (int) $item->object_id !== $this->post_id ) {
				continue;
			}

			if ( is_singular( $this->post_type ) ) {
				$item->current_item_parent = true;
				$item->classes[]           = 'current-menu-parent';

				$menu_items = \Types\menu_items_ancestors( $item, $menu_items );
			}

			if ( is_post_type_archive( $this->post_type ) ) {
				$item->classes[] = 'current-menu-item';
				$item->current   = true;

				$menu_items = \Types\menu_items_ancestors( $item, $menu_items );
			}
		}

		return $menu_items;
	}
480068
public function getItems(): array
    {
        $available = [];
        $assigned = [];

        if ($this->type == Item::TYPE_ROLE) {
            foreach (array_keys($this->manager->getRoles()) as $name) {
                $available[$name] = 'role';
            }
        }
        foreach (array_keys($this->manager->getPermissions()) as $name) {
            $available[$name] = $name[0] == '/' ? 'route' : 'permission';
        }

        foreach ($this->manager->getChildren($this->_item->name) as $item) {
            $assigned[$item->name] = $item->type == 1 ? 'role' : ($item->name[0] == '/' ? 'route' : 'permission');
            unset($available[$item->name]);
        }

        unset($available[$this->name]);

        return [
            'available' => $available,
            'assigned' => $assigned,
        ];
    }
1171194
def admin_menu 
      @admin_menu ||= [
        ['overview', :dashboard, {controller: 'gricer/dashboard', action: 'overview'}],
        ['visitors', :menu, [
          ['entry_pages', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'entry_path'}],
          ['referers', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'referer_host'}],
          ['search_engines', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'search_engine'}],
          ['search_terms', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'search_query'}],
          ['countries', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'country'}],
          ['domains', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'domain'}],
          ['locales', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'requested_locale_major'}]
        ] ],
        ['pages', :menu, [
          ['views', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'path'}],
          ['hosts', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'host'}],
          ['methods', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'method'}],
          ['protocols', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'protocol'}],
        ] ],
        ['browsers', :menu, [
          ['browsers', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'agent.name'}],
          ['operating_systems', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'agent.os'}],
          ['engines', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'agent.engine_name'}],
          ['javascript', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'javascript'}],
          ['java', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'java'}],
          ['silverlight', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'silverlight_major_version'}],
          ['flash', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'flash_major_version'}],
          ['screen_sizes', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'screen_size'}],
          ['color_depths', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'screen_depth'}]
        ] ]
      ]
    end
1062915
public function fetchItem()
    {
        list ($source, $title, $url, $options) = func_get_args();
        $url = Router::url($url);

        return $this->_view->Html->link($title, $url, $options);
    }