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); }
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); }
public function getProductMenu() { if ($this->dataRecord->Menu()->exists()) { return $this->dataRecord->Menu(); } return Menu::get()->first(); }
/** * 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)); } }
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); }
public function CustomMenu($slug = NULL) { if ($slug != NULL) { if ($Menu = Menu::get()->filter('Slug', $slug)->First()) { return $Menu->MenuItems(); } else { return NULL; } } }
/** * 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'] === '∞' || (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'] === '∞' || (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)); } }
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'); }
/** * 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); }
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'; } }
/** * 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)); }
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; }
/** * 检测上级分类是否合法 * * @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')); } }
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'); } }
/** * 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); }
public function testUpdateNameExists() { $menu = new Menu; $menu->name = 'Taken'; $menu->save(); $menu = new Menu; $menu->name = 'Not taken'; $menu->save(); $menu = Menu::get('Not taken'); $menu->name = 'Taken'; try { $menu->save(); $this->fail('Exception expected'); } catch (ValidationException $e) { } }
--> <body class="@yield('body_class', 'sidebar-left-pinned header-fixed-top')"> @section('body_content') <!-- Left Sidebar --> <!-- In the PHP version you can set the following options from the config file --> <!-- If you add the class .enable-hover, then a small portion of left sidebar will be visible and it can be opened with a mouse hover (> 1200px) (may affect website performance) --> <div id="sidebar-left" class="enable-hover"> <!-- Sidebar Content --> <div class="sidebar-content"> <!-- Wrapper for scrolling functionality --> <div class="sidebar-left-scroll"> @section('sidebar_left') <!-- Sidebar Navigation --> <?php $menu = Menu::get('adminMenu'); ?> @if($menu) {!! $menu->asUl(['class' => 'sidebar-nav']) !!} @endif <!-- END Sidebar Navigation --> @show </div> <!-- END Wrapper for scrolling functionality --> </div> <!-- END Sidebar Content --> </div> <!-- END Left Sidebar --> <!-- Right Sidebar --> <!-- In the PHP version you can set the following options from the config file -->
<?php /* requires $menuid */ $menu = Menu::get($menuid); $menuname = $menu->getProperty('name'); $menudesc = $menu->getProperty('description');
<ul class="nav nav-tabs"> <?php Menu::make('menu', function ($menu) { $menu->add('Home', ''); // Menu com subMenu $menu->add('Sobre Nós', 'teste'); $menu->sobreNos->add('Who We are', 'who-we-are'); $menu->add('Corpo Clínico', 'corpoclinico'); $menu->add('Notícias', 'noticias'); $menu->add('Tecnologia', 'tecnologias'); $menu->add('Depoimentos', 'depoimentos'); $menu->add('Contato', 'contato'); }); $menu = Menu::get('menu')->roots(); ?> @include(config('laravel-menu.views.bootstrap-items'), array('items' => $menu)) </ul> </div> </div> @endif {!!@$pagina!!}
public static function getCache($arrCondition = []) { $cacheKey = md5(serialize($arrCondition)); if (isset($arrCondition['frontend'])) { $cacheManager = Cache::tags('menu', 'frontend'); } else { if (isset($arrCondition['backend'])) { $cacheManager = Cache::tags('menu', 'backend'); } else { $cacheManager = Cache::tags('menu'); } } if ($cacheManager->has('menu_' . $cacheKey)) { $cache = $cacheManager->get('menu_' . $cacheKey); } else { $cache = Menu::get($arrCondition); $cacheManager->forever('menu_' . $cacheKey, $cache); } return $cache; }
public function testDelete() { $this->login('dvorak'); $this->request('admin/menu/delete', array('name'=>'main')); $this->assertRedirected('admin/menu'); $this->assertFlashNotice('Deleted menu "main"'); $this->assertNull(Menu::get('main', 'en')); }
</tr> <tr> <td class="tb_title"><?php echo $form->labelEx($model, 'parent_id'); ?> :</td> </tr> <tr > <td ><select name="Menu[parent_id]" id="Menu_parent_id"> <option value="0">==<?php echo Yii::t('admin', 'Top Category'); ?> ==</option> <?php foreach ((array) Menu::get(0, $this->_menu) as $menu) { ?> <option value="<?php echo $menu['id']; ?> " <?php Helper::selected($menu['id'], $model->parent_id); ?> ><?php echo $menu['str_repeat']; echo $menu['menu_name']; ?> </option> <?php } ?>
echo (Request::current()->controller() !== 'faq' and Theme::get('fixed_toolbar') == 1) ? 'navbar-fixed-top' : ''; ?> "> <div class="container resiz-cont"> <div class="btn-group pull-right btn-header-group"> <?php echo View::factory('widget_login'); ?> </div> <div class="navbar-collapse bs-navbar-collapse collapse" id="mobile-menu-panel"> <ul class="nav navbar-nav"> <?php if (class_exists('Menu') and count($menus = Menu::get()) > 0) { ?> <?php foreach ($menus as $menu => $data) { ?> <li class="<?php echo Request::current()->uri() == $data['url'] ? 'active' : ''; ?> " > <a href="<?php echo $data['url']; ?> " target="<?php echo $data['target']; ?> ">
private function getMenu($slug) { return Menu::get()->filter('Slug', $slug)->First(); }
<div class="widget clearfix"> <div class="title"><h3>Site Links</h3></div> {{-- Display Front Menu --}} <?php $menuItems = Menu::get('menu-front')->roots(); ?> <ul class="list"> @forelse($menuItems as $item) <?php $subMenuClass = $item->hasChildren() ? 'nav-submenu' : ''; ?> <li class="{{ $item->attributes() != "" ? 'active' : '' }} {{ $subMenuClass }}"> <a href="{{ $item->url() }}"> {!! $item->title !!} </a> </li> @empty <div class="text-center">No Available Links</div> @endforelse </ul> </div>
public function get_all() { $menus = Menu::get(); $this->layout->page_title = "Navigation Management"; $this->layout->page_content = View::make('admin.menus.all')->with('menus', $menus); }
<?php if ($config->url_current == $config->url) { ?> <h1 class="blog-title"><?php echo $config->title; ?> </h1> <?php } else { ?> <h1 class="blog-title"><a href="<?php echo $config->url; ?> "><?php echo $config->title; ?> </a></h1> <?php } ?> <p class="blog-slogan"><?php echo $config->slogan; ?> </p> </header> <nav class="blog-navigation"> <?php echo Menu::get(); ?> </nav> <div class="blog-content">
} catch (Exception $e) { $errormsg = $e->getMessage(); trigger_error($errormsg, E_USER_WARNING); $formmessage = 'Cannot add category.'; $formmessageclass = 'red'; break; } } else { header("Location: logout"); exit; } } } while (1 == 0); try { include "common/token.php"; $menu = Menu::get($menuid, $userid); $menuname = $menu->getProperty('name'); $dataowneruserid = $menu->getProperty('dataowneruserid'); $restaurantrow = $menu->getRestaurant(); $restaurantid = $restaurantrow[0]['id']; $restaurantname = $restaurantrow[0]['name']; $locationrow = $menu->getLocation(); $locationid = $locationrow[0]['id']; $locationname = $locationrow[0]['name']; $categoryname = ''; $categorydesc = ''; $categoryid = ''; $publish = 1; } catch (Exception $e) { trigger_error($e->getMessage()); header("Location: restaurants");
<?php // Route::get('admin/pages/settings', 'Shoulderscms\Pages\Controllers\PagesController@settings'); Route::get('/', ['as' => 'home', 'uses' => 'Shoulderscms\\Pages\\Controllers\\PagesController@home']); Route::resource('admin/pages', 'Shoulderscms\\Pages\\Controllers\\PagesController'); Route::get('page/{slug}', 'Shoulderscms\\Pages\\Controllers\\PagesController@show'); Menu::get('AdminNav')->add('Pages', array('url' => 'admin/pages', 'icon' => 'fa fa-file-o', 'class' => 'test'))->data('order', 10); Menu::get('AdminNav')->pages->add('Create Page', 'admin/pages/create'); Menu::get('AdminNav')->pages->add('Manage Pages', 'admin/pages'); Menu::get('AdminNav')->pages->add('Pages Settings', 'admin/pages/settings');
<?php Menu::add("Методички", "?c=showMetod&f=show", "files.png"); Menu::add("Задати питання", "", "edit-user - Copy.png", "modal", "#basicModal"); Menu::add("Нотатки", "?c=showStudDoc&f=showGroup", "browser.png"); Menu::add("Пройти тест", "?c=testing&f=show", "list-view.png"); print Menu::get(); ?> </div> </div> <div class="modal fade" id="basicModal" tabindex="-1" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"><button class="close" type="button" data-dismiss="modal">x</button> <h4 class="modal-title" id="myModalLabel">Задати питання</h4> </div> <div class="modal-body"> <div class="form-group''"> <form enctype="multipart/form-data" role="form" method="post" id="form_id" action=""> <div class="form-group"> <div class="panel-body"> <div class="col-xs-9 col-sm-10 col-md-10 col-lg-7"> <br/> <input type="hidden" id="name" name="name" value="<?php print SC::getSession('id'); ?> " /></br> <input type="text" id="email" name="email" placeholder="Email *" class="form-control" /></br> <textarea rows="4" cols="37" id="text" name="text" placeholder="Текст *"></textarea> </div> <br /><br /><br> </div>