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


PHP Menu::get方法代码示例

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


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

示例1: find_menu_item_test

 public function find_menu_item_test()
 {
     $menu = new Menu(true);
     $menu->append(Menu::factory("link")->id("element_1"))->append(Menu::factory("dialog")->id("element_2"))->append(Menu::factory("submenu")->id("element_3")->append(Menu::factory("link")->id("element_3_1")));
     $this->assert_equal("element_2", $menu->get("element_2")->id);
     $this->assert_equal("element_3_1", $menu->get("element_3")->get("element_3_1")->id);
 }
开发者ID:andyst,项目名称:gallery3,代码行数:7,代码来源:Menu_Test.php

示例2: Page

 function Page()
 {
     parent::BasePage();
     $role = Users::ROLE_GUEST;
     if ($this->userdata != null) {
         $role = $this->userdata["role"];
     }
     $content = new Contents();
     $menu = new Menu();
     $this->smarty->assign('menulist', $menu->get($role, $this->serverurl));
     $this->smarty->assign('usefulcontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEUSEFUL, $role));
     $this->smarty->assign('articlecontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEARTICLE, $role));
     $this->smarty->assign('main_menu', $this->smarty->fetch('mainmenu.tpl'));
     $this->smarty->assign('useful_menu', $this->smarty->fetch('usefullinksmenu.tpl'));
     $this->smarty->assign('article_menu', $this->smarty->fetch('articlesmenu.tpl'));
     $category = new Category();
     if ($this->userdata != null) {
         $parentcatlist = $category->getForMenu($this->userdata["categoryexclusions"]);
     } else {
         $parentcatlist = $category->getForMenu();
     }
     $this->smarty->assign('parentcatlist', $parentcatlist);
     $searchStr = '';
     if ($this->page == 'search' && isset($_REQUEST["id"])) {
         $searchStr = (string) $_REQUEST["id"];
     }
     $this->smarty->assign('header_menu_search', $searchStr);
     if (isset($_REQUEST["t"])) {
         $this->smarty->assign('header_menu_cat', $_REQUEST["t"]);
     }
     $header_menu = $this->smarty->fetch('headermenu.tpl');
     $this->smarty->assign('header_menu', $header_menu);
 }
开发者ID:ehsanguru,项目名称:nnplus,代码行数:33,代码来源:page.php

示例3: getProductMenu

 public function getProductMenu()
 {
     if ($this->dataRecord->Menu()->exists()) {
         return $this->dataRecord->Menu();
     }
     return Menu::get()->first();
 }
开发者ID:helpfulrobot,项目名称:burnbright-silverstripe-shop-menu,代码行数:7,代码来源:MenuPage.php

示例4: postCargar

 /**
  * cargar menus, mantenimiento
  * POST /menu/cargar
  *
  * @return Response
  */
 public function postCargar()
 {
     //si la peticion es ajax
     if (Request::ajax()) {
         $menus = Menu::get(Input::all());
         return Response::json(array('rst' => 1, 'datos' => $menus));
     }
 }
开发者ID:lueimg,项目名称:activista,代码行数:14,代码来源:MenuController.php

示例5: __construct

 public function __construct()
 {
     parent::__construct();
     $role = Users::ROLE_GUEST;
     if ($this->userdata != null) {
         $role = $this->userdata["role"];
     }
     $content = new Contents(['Settings' => $this->settings]);
     $menu = new Menu($this->settings);
     $this->smarty->assign('menulist', $menu->get($role, $this->serverurl));
     $this->smarty->assign('usefulcontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEUSEFUL, $role));
     $this->smarty->assign('articlecontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEARTICLE, $role));
     $this->smarty->assign('main_menu', $this->smarty->fetch('mainmenu.tpl'));
     $this->smarty->assign('useful_menu', $this->smarty->fetch('usefullinksmenu.tpl'));
     $this->smarty->assign('article_menu', $this->smarty->fetch('articlesmenu.tpl'));
     $category = new Category(['Settings' => $content->pdo]);
     if ($this->userdata != null) {
         $parentcatlist = $category->getForMenu($this->userdata["categoryexclusions"]);
     } else {
         $parentcatlist = $category->getForMenu();
     }
     // Add in system types to console categories to make the boot strap drop down list less long.
     $consoleCatList = array();
     foreach ($parentcatlist as $parent) {
         if ($parent['title'] === 'Console') {
             foreach ($parent['subcatlist'] as $consoleCat) {
                 if (preg_match('/^XBOX/i', $consoleCat['title'])) {
                     $consoleCatList['Microsoft'][] = $consoleCat;
                 } else {
                     if (preg_match('/^([3N]DS|N?GC)$|^WII/i', $consoleCat['title'])) {
                         $consoleCatList['Nintendo'][] = $consoleCat;
                     } else {
                         if (preg_match('/PS[\\dXP ]/i', $consoleCat['title'])) {
                             $consoleCatList['Sony'][] = $consoleCat;
                         } else {
                             $consoleCatList['Other'][] = $consoleCat;
                         }
                     }
                 }
             }
             break;
         }
     }
     $this->smarty->assign('consolecatlist', $consoleCatList);
     $this->smarty->assign('parentcatlist', $parentcatlist);
     $searchStr = '';
     if ($this->page == 'search' && isset($_REQUEST["id"])) {
         $searchStr = (string) $_REQUEST["id"];
     }
     $this->smarty->assign('header_menu_search', $searchStr);
     if (isset($_REQUEST["t"])) {
         $this->smarty->assign('header_menu_cat', $_REQUEST["t"]);
     } else {
         $this->smarty->assign('header_menu_cat', '');
     }
     $header_menu = $this->smarty->fetch('headermenu.tpl');
     $this->smarty->assign('header_menu', $header_menu);
 }
开发者ID:Jay204,项目名称:nZEDb,代码行数:58,代码来源:Page.php

示例6: CustomMenu

 public function CustomMenu($slug = NULL)
 {
     if ($slug != NULL) {
         if ($Menu = Menu::get()->filter('Slug', $slug)->First()) {
             return $Menu->MenuItems();
         } else {
             return NULL;
         }
     }
 }
开发者ID:helpfulrobot,项目名称:plumpss-menus,代码行数:10,代码来源:CustomMenu.php

示例7: manager

 /**
  * Widget Manager
  * --------------
  *
  * [1]. Widget::manager('MENU');
  * [2]. Widget::manager('BAR');
  *
  */
 public static function manager($type = 'MENU')
 {
     if (!Guardian::happy()) {
         return "";
     }
     $T1 = TAB;
     if ($type === 'MENU') {
         $menus = array();
         if ($_menus = Mecha::A(Config::get('manager_menu'))) {
             $_menus = Mecha::eat($_menus)->order('ASC', 'stack', true, 10)->vomit();
             foreach ($_menus as $k => $v) {
                 // < 1.1.3
                 if (is_string($v)) {
                     $menus[$k] = $v;
                 } else {
                     $stack = isset($v['stack']) ? $v['stack'] : 10;
                     $_k = (strpos($v['icon'], '<') === false ? '<i class="fa fa-fw fa-' . $v['icon'] . '"></i>' : $v['icon']) . ' <span class="label">' . $k . '</span>' . (isset($v['count']) && ($v['count'] === '&infin;' || (double) $v['count'] > 0) ? ' <span class="counter">' . $v['count'] . '</span>' : "");
                     $menus[$_k] = isset($v['url']) ? $v['url'] : null;
                 }
             }
         }
         $html = O_BEGIN . '<div class="widget widget-manager widget-manager-menu" id="widget-manager-menu-' . self::$id['manager_menu'] . '">' . NL;
         self::$id['manager_menu']++;
         $html .= Menu::get($menus, 'ul', $T1, 'manager:');
         $html .= '</div>' . O_END;
         $html = Filter::apply('widget', $html);
         return Filter::apply('widget:manager.menu', Filter::apply('widget:manager', $html));
     }
     if ($type === 'BAR') {
         $html = O_BEGIN . '<div class="widget widget-manager widget-manager-bar" id="widget-manager-bar-' . self::$id['manager_bar'] . '">' . NL;
         self::$id['manager_bar']++;
         $bars = array();
         if ($_bars = Mecha::A(Config::get('manager_bar'))) {
             $_bars = Mecha::eat($_bars)->order('ASC', 'stack', true, 10)->vomit();
             foreach ($_bars as $k => $v) {
                 if (is_string($v)) {
                     $bar = $v;
                 } else {
                     $t = ' data-tooltip="' . Text::parse(isset($v['description']) ? $v['description'] : $k, '->encoded_html') . '"';
                     $bar = isset($v['url']) ? '<a class="item" href="' . Converter::url($v['url']) . '"' . $t . '>' : '<span class="item a"' . $t . '>';
                     $bar .= isset($v['icon']) ? strpos($v['icon'], '<') === false ? Jot::icon($v['icon']) : $v['icon'] : $k;
                     $bar .= ' <span class="label">' . $k . '</span>';
                     if (isset($v['count']) && ($v['count'] === '&infin;' || (double) $v['count'] > 0)) {
                         $bar .= ' <span class="counter">' . $v['count'] . '</span>';
                     }
                     $bar .= isset($v['url']) ? '</a>' : '</span>';
                 }
                 $bars[] = Filter::apply('manager:bar.item', $bar);
             }
         }
         $html .= $T1 . Filter::apply('manager:bar', implode(' ', $bars)) . NL;
         $html .= '</div>';
         return Filter::apply('widget:manager.bar', Filter::apply('widget:manager', $html));
     }
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:63,代码来源:widget.php

示例8: menuReorder

 public function menuReorder()
 {
     $ajax = Request::ajax();
     $arrPost = Input::all();
     unset($arrPost['_token']);
     $updated = false;
     if (!empty($arrPost)) {
         $frontend = Permission::can($this->layout->admin, 'menusfrontend_edit_all');
         $backend = Permission::can($this->layout->admin, 'menusbackend_edit_all');
         foreach ($arrPost as $type => $menu) {
             if (empty($menu)) {
                 continue;
             }
             if ($type == 'backend' && !$backend) {
                 continue;
             } else {
                 if (in_array($type, ['header', 'footer']) && !$frontend) {
                     continue;
                 }
             }
             $menu = json_decode($menu);
             foreach ($menu as $key => $value) {
                 $i = 1;
                 Menu::where('id', $value->id)->update(['parent_id' => 0, 'order_no' => $key + 1, 'level' => $i]);
                 if (isset($value->children)) {
                     Menu::updateRecursiveChildOrder($value->children, $value->id, $i + 1);
                 }
             }
             $updated = true;
         }
         if ($updated) {
             Menu::clearCache();
         }
         if ($ajax) {
             if ($updated) {
                 $sidebar = Menu::get(["sidebar" => true]);
                 $arrParent = Menu::getCache(['parent' => true]);
                 $arrReturn = ['status' => 'ok', 'sidebar' => $sidebar, 'parent' => $arrParent];
             } else {
                 $arrReturn = ['status' => 'warning', 'message' => 'Nothing was changed.'];
             }
             $response = Response::json($arrReturn);
             $response->header('Content-Type', 'application/json');
             return $response;
         }
         return Redirect::to(URL . '/admin/menus')->with(['flash_success' => $updated ? 'Menu has been re-ordered.' : 'Nothing was change.']);
     }
     if ($ajax) {
         $response = Response::json(['status' => 'error', 'message' => 'We found nothing to re-order. Please check again.']);
         $response->header('Content-Type', 'application/json');
         return $response;
     }
     return Redirect::to(URL . '/admin/menus');
 }
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:54,代码来源:MenusController.php

示例9: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     \Menu::make('BreadCrumb', function ($menu) {
         $mainNav = \Menu::get('MainNav');
         foreach ($mainNav->items as $key => $item) {
             if ($item->attr('class') == 'active') {
                 $menu->add($item->title, $item->link->path['url']);
             }
         }
     });
     return $next($request);
 }
开发者ID:EuropeanRespiratorySociety,项目名称:ERSTemplate-dev,代码行数:19,代码来源:Breadcrumb.php

示例10: run

	public function run($widgetParams, $orient, $request)
	{
		$menu = Menu::get($widgetParams['menu']);
		if ($menu != null)
		{
			$this->widgetMenu = $menu;
			return $this->render('aside/menu');
		}
		else
		{
			return 'Menu not found';
		}
	}
开发者ID:nathansamson,项目名称:CoOrg,代码行数:13,代码来源:menu.aside.php

示例11: action_index

 /**
  * overwrites the default crud index
  * @param  string $view nothing since we don't use it
  * @return void      
  */
 public function action_index($view = NULL)
 {
     //template header
     $this->template->title = __('Menu');
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Menu')));
     $this->template->styles = array('css/sortable.css' => 'screen');
     $this->template->scripts['footer'][] = 'js/jquery-sortable-min.js';
     $this->template->scripts['footer'][] = 'js/oc-panel/menu.js';
     //find all, for populating form select fields
     list($categories, $order_categories) = Model_Category::get_all();
     // d($categories);
     $this->template->content = View::factory('oc-panel/pages/menu', array('menu' => Menu::get(), 'categories' => $categories, 'order_categories' => $order_categories));
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:18,代码来源:menu.php

示例12: getCMSFields

 public function getCMSFields($params = array())
 {
     $fields = new FieldList(DropdownField::create("ProductID", "Product", Product::get()->map()->toArray())->setHasEmptyDefault(true));
     $menu = $this->Menu();
     if (!$menu->exists()) {
         $menu = isset($params["MenuID"]) ? Menu::get()->byID((int) $params["MenuID"]) : null;
     }
     if ($menu && $menu->exists()) {
         $fields->push(DropdownField::create("GroupID", 'Menu Group', MenuGroup::get()->filter("ParentID", $this->MenuID)->map('ID', 'Title')->toArray())->setHasEmptyDefault(true));
     }
     if ($this->Product()->exists() && !$this->Product()->canPurchase()) {
         $fields->push(LiteralField::create("purchasenote", "<p class=\"message warning\">This product can't be purchased, so it won't show up in menus</p>"));
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:burnbright-silverstripe-shop-menu,代码行数:15,代码来源:MenuProductSelection.php

示例13: parentTrue

 /**
  * 检测上级分类是否合法
  *
  * @param  $item
  * @param  $parentId
  */
 protected function parentTrue($item = 0, $parentId = 0)
 {
     $subCategory = Menu::get($item, $this->_menu);
     if (empty($subCategory)) {
         $getCategory[] = $item;
     } else {
         foreach ((array) $subCategory as $row) {
             $getCategory[] = $row['id'];
         }
         //将本身ID加入检测对象
         array_push($getCategory, $item);
     }
     if (in_array($parentId, $getCategory)) {
         $this->message('error', Yii::t('admin', 'Selected Category is Current Category or Children Category'));
     }
 }
开发者ID:redtreelchao,项目名称:wander-moon,代码行数:22,代码来源:MenuController.php

示例14: save

	public function save($menuID, $language, $title, $entryID, $data)
	{
		$menu = Menu::get($menuID);
		if ($menu == null)
		{
			$this->error(t('Menu not found'));
			$this->redirect('admin', 'menu', $language);
			return;
		}
	
		$entry = new MenuEntry;
		$entry->menuID = $menuID;
		$entry->title = $title;
		$entry->data = $data;
		$entry->entryID = $entryID;
		$entry->language = $language;
		
		try
		{
			$entry->save();
			$this->notice(t('Menu entry added'));
			if ($language == I18n::getLanguage())
			{
				$this->redirect('admin', 'menu', 'edit', $menuID);
			}
			else
			{
				$this->redirect('admin', 'menu', 'edit', $menuID, $language);
			}
		}
		catch (ValidationException $e)
		{
			$this->menu = $menu;	
			$this->adminlanguage = $language;	
			$this->providerActionCombos = Menu::providerActionCombos($language);
			$this->newEntry = $entry;
			$this->error(t('Entry was not saved'));
			$this->render('edit');
		}
	}
开发者ID:nathansamson,项目名称:CoOrg,代码行数:40,代码来源:admin.menu.entry.controller.php

示例15: __construct

 /**
  * Default constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $role = Users::ROLE_GUEST;
     if ($this->userdata != null) {
         $role = $this->userdata["role"];
     }
     $content = new Contents(['Settings' => $this->settings]);
     $f = new Forum();
     $menu = new Menu($this->settings);
     $this->smarty->assign('menulist', $menu->get($role, $this->serverurl));
     $this->smarty->assign('usefulcontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEUSEFUL, $role));
     $this->smarty->assign('articlecontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEARTICLE, $role));
     if ($this->userdata != null) {
         $this->smarty->assign('recentforumpostslist', $f->getRecentPosts($this->settings->getSetting('showrecentforumposts')));
     }
     $this->smarty->assign('main_menu', $this->smarty->fetch('mainmenu.tpl'));
     $this->smarty->assign('useful_menu', $this->smarty->fetch('usefullinksmenu.tpl'));
     $this->smarty->assign('article_menu', $this->smarty->fetch('articlesmenu.tpl'));
     $category = new Category(['Settings' => $content->pdo]);
     if ($this->userdata != null) {
         $parentcatlist = $category->getForMenu($this->userdata["categoryexclusions"]);
     } else {
         $parentcatlist = $category->getForMenu();
     }
     $this->smarty->assign('parentcatlist', $parentcatlist);
     $searchStr = '';
     if ($this->page == 'search' && isset($_REQUEST["id"])) {
         $searchStr = (string) $_REQUEST["id"];
     }
     $this->smarty->assign('header_menu_search', $searchStr);
     if (isset($_REQUEST["t"])) {
         $this->smarty->assign('header_menu_cat', $_REQUEST["t"]);
     } else {
         $this->smarty->assign('header_menu_cat', '');
     }
     $header_menu = $this->smarty->fetch('headermenu.tpl');
     $this->smarty->assign('header_menu', $header_menu);
 }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:42,代码来源:Page.php


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