本文整理汇总了PHP中Menu::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Menu::add方法的具体用法?PHP Menu::add怎么用?PHP Menu::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
public static function main($args)
{
$pancakeHouseMenu = new Menu("PANCAKE HOUSE MENU", "Breakfast");
$dinerMenu = new Menu("DINER MENU", "Lunch");
$cafeMenu = new Menu("CAFE MENU", "Dinner");
$dessertMenu = new Menu("DESSERT MENU", "Dessert of course!");
$coffeeMenu = new Menu("COFFEE MENU", "Stuff to go with your afternoon coffee");
$allMenus = new Menu("ALL MENUS", "All menus combined");
$allMenus->add($pancakeHouseMenu);
$allMenus->add($dinerMenu);
$allMenus->add($cafeMenu);
$pancakeHouseMenu->add(new MenuItem("K&B's Pancake Breakfast", "Pancakes with scrambled eggs, and toast", TRUE, 2.99));
$pancakeHouseMenu->add(new MenuItem("Regular Pancake Breakfast", "Pancakes with fried eggs, sausage", FALSE, 2.99));
$pancakeHouseMenu->add(new MenuItem("Blueberry Pancakes", "Pancakes made with fresh blueberries, and blueberry syrup", TRUE, 3.49));
$pancakeHouseMenu->add(new MenuItem("Waffles", "Waffles, with your choice of blueberries or strawberries", TRUE, 3.59));
$dinerMenu->add(new MenuItem("Vegetarian BLT", "(Fakin') Bacon with lettuce & tomato on whole wheat", TRUE, 2.99));
$dinerMenu->add(new MenuItem("BLT", "Bacon with lettuce & tomato on whole wheat", FALSE, 2.99));
$dinerMenu->add(new MenuItem("Soup of the day", "A bowl of the soup of the day, with a side of potato salad", FALSE, 3.29));
$dinerMenu->add(new MenuItem("Hotdog", "A hot dog, with saurkraut, relish, onions, topped with cheese", FALSE, 3.05));
$dinerMenu->add(new MenuItem("Steamed Veggies and Brown Rice", "Steamed vegetables over brown rice", TRUE, 3.99));
$dinerMenu->add(new MenuItem("Pasta", "Spaghetti with Marinara Sauce, and a slice of sourdough bread", TRUE, 3.89));
$dinerMenu->add($dessertMenu);
$dessertMenu->add(new MenuItem("Apple Pie", "Apple pie with a flakey crust, topped with vanilla icecream", TRUE, 1.59));
$dessertMenu->add(new MenuItem("Cheesecake", "Creamy New York cheesecake, with a chocolate graham crust", TRUE, 1.99));
$dessertMenu->add(new MenuItem("Sorbet", "A scoop of raspberry and a scoop of lime", TRUE, 1.89));
$cafeMenu->add(new MenuItem("Veggie Burger and Air Fries", "Veggie burger on a whole wheat bun, lettuce, tomato, and fries", TRUE, 3.99));
$cafeMenu->add(new MenuItem("Soup of the day", "A cup of the soup of the day, with a side salad", FALSE, 3.69));
$cafeMenu->add(new MenuItem("Burrito", "A large burrito, with whole pinto beans, salsa, guacamole", TRUE, 4.29));
$cafeMenu->add($coffeeMenu);
$coffeeMenu->add(new MenuItem("Coffee Cake", "Crumbly cake topped with cinnamon and walnuts", TRUE, 1.59));
$coffeeMenu->add(new MenuItem("Bagel", "Flavors include sesame, poppyseed, cinnamon raisin, pumpkin", FALSE, 0.6899999999999999));
$coffeeMenu->add(new MenuItem("Biscotti", "Three almond or hazelnut biscotti cookies", TRUE, 0.89));
$waitress = new Waitress($allMenus);
$waitress->printMenu();
}
示例2: generateMainMenu
/**
* Generates a menu layout based on the current action.
* @param string $actionString A dotted-pair action string of the form
* "module.action" .
* @return object MenuLayout
* @static
*/
static function generateMainMenu()
{
$harmoni = Harmoni::instance();
list($module, $action) = explode(".", $harmoni->request->getRequestedModuleAction());
$mainMenu = new Menu(new YLayout(), 1);
// :: Home ::
$mainMenu_item = new MenuItemLink(_("Home"), $harmoni->request->quickURL("home", "welcome"), $module == "home" && $action == "welcome" ? TRUE : FALSE, 1);
$mainMenu->add($mainMenu_item, "100%", null, LEFT, CENTER);
// $mainMenu_item = new MenuItemLink(
// _("Plugin Tests"),
// $harmoni->request->quickURL("plugin_manager", "test"),
// ($module == "plugin_manager")?TRUE:FALSE,1);
// $mainMenu->add($mainMenu_item, "100%", null, LEFT, CENTER);
$mainMenu_item = new MenuItemLink(_("Portal"), $harmoni->request->quickURL('portal', "list"), $module == "portal" && $action == 'list' ? TRUE : FALSE, 1);
$mainMenu->add($mainMenu_item, "100%", null, LEFT, CENTER);
if (defined('DATAPORT_SEGUE1_URL') && defined('DATAPORT_SEGUE1_SECRET_KEY') && defined('DATAPORT_SEGUE1_SECRET_VALUE')) {
$mainMenu_item = new MenuItemLink(_("Migrate Sites"), $harmoni->request->quickURL('dataport', "choose_site"), $module == "dataport" && $action == 'choose_site' ? TRUE : FALSE, 1);
$mainMenu->add($mainMenu_item, "100%", null, LEFT, CENTER);
}
$mainMenu_item8 = new MenuItemLink(_("User Tools"), $harmoni->request->quickURL("user", "main"), preg_match("/^user\$/", $module) ? TRUE : FALSE, 1);
$mainMenu->add($mainMenu_item8, "100%", null, LEFT, CENTER);
$mainMenu_item7 = new MenuItemLink(_("Admin Tools"), $harmoni->request->quickURL("admin", "main"), preg_match("/^admin\$/", $module) ? TRUE : FALSE, 1);
$mainMenu->add($mainMenu_item7, "100%", null, LEFT, CENTER);
return $mainMenu;
}
示例3: add
/**
* Creates a sub Item
*
* @param string $title
* @param string|array $options
* @return void
*/
public function add($title, $options)
{
if (!is_array($options)) {
$options = array('url' => $options);
}
$options['pid'] = $this->id;
return $this->manager->add($title, $options);
}
示例4: llxHeader
function llxHeader($head = '', $title='', $help_url='', $morehtml='')
{
global $conf,$langs,$user;
$langs->load("ftp");
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
$menu = new Menu();
$MAXFTP=20;
$i=1;
while ($i <= $MAXFTP)
{
$paramkey='FTP_NAME_'.$i;
//print $paramkey;
if (! empty($conf->global->$paramkey))
{
$link="/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i;
$menu->add($link, dol_trunc($conf->global->$paramkey,24));
}
$i++;
}
left_menu($menu->liste, $help_url, $morehtml, '', 1);
main_area();
}
示例5: menu
public static function menu()
{
\Menu::add(['index' => 0, 'icon-class' => 'fa fa-dashboard', 'name' => 'dashboard', 'label' => trans('backend/dashboard.dashboard'), 'url' => url('backend/c/dashboard')]);
\Menu::add(['index' => 10, 'icon-class' => 'fa fa-cube', 'name' => 'article', 'label' => trans('backend/article.articles')]);
\Menu::addChild(['index' => 10, 'group' => true, 'target' => 'article', 'name' => 'navigation', 'label' => trans('backend/general.navigation')]);
\Menu::addChild(['index' => 10, 'target' => 'article', 'target_group' => 'navigation', 'label' => trans('backend/general.show_all'), 'url' => url('backend/c/article')]);
\Menu::addChild(['index' => 20, 'target' => 'article', 'target_group' => 'navigation', 'label' => trans('backend/article.add'), 'url' => url('backend/c/article/a/add')]);
}
示例6: llxHeader
/**
* Replace the default llxHeader function
* @param $head
* @param $title
* @param $help_url
* @param $target
* @param $disablejs
* @param $disablehead
* @param $arrayofjs
* @param $arrayofcss
*/
function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='')
{
global $db, $user, $conf, $langs;
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
$menu = new Menu();
// Entry for each bank account
if ($user->rights->banque->lire)
{
$sql = "SELECT rowid, label, courant, rappro, courant";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql.= " WHERE entity = ".$conf->entity;
$sql.= " AND clos = 0";
$sql.= " ORDER BY label";
$resql = $db->query($sql);
if ($resql)
{
$numr = $db->num_rows($resql);
$i = 0;
if ($numr > 0) $menu->add('/compta/bank/index.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire);
while ($i < $numr)
{
$objp = $db->fetch_object($resql);
$menu->add('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
if ($objp->rappro && $objp->courant != 2 && ! $objp->clos) // If not cash account and not closed and can be reconciliate
{
$menu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
}
$i++;
}
}
else dol_print_error($db);
$db->free($resql);
}
left_menu('', $help_url, '', $menu->liste, 1);
main_area();
}
示例7: action_new
public function action_new()
{
$this->auto_render = FALSE;
if (Menu::add(Core::post('title'), Core::post('url'), Core::post('target'), Core::post('icon'))) {
Alert::set(Alert::SUCCESS, __('Menu created'));
} else {
Alert::set(Alert::ERROR, __('Menu not created'));
}
HTTP::redirect(Route::url('oc-panel', array('controller' => 'menu', 'action' => 'index')));
}
示例8: render
/**
* Вывод
*
* @return string
*/
public function render()
{
if (!$this->object()->options) {
return '';
}
$menu = new Menu(array('name' => $this->object()->machine_name, 'template' => $this->object()->options->template, 'show_empty' => FALSE, 'render' => FALSE, 'multiple' => $this->object()->options->multiple, 'title' => $this->object()->options->title, 'titleActiveOnly' => TRUE, 'autoactive' => TRUE));
if ($items = $this->getItems()) {
foreach ($items as $item) {
$menu->add(array('label' => $item->label, 'link' => $item->link, 'order' => $item->thread));
}
}
$tpl = new Template('Menu/Db/templates/menu');
$tpl->menu = $menu;
$tpl->object = $this->object();
return $tpl->render();
}
示例9: Menu
function admin_menu()
{
$return_string = '';
$allowed_modules = 0;
$menu = new Menu($this->connection, $this->path_information);
foreach ($this->installed_modules as $modul) {
if (in_array($modul['Name'], $this->allowed_modules)) {
$return_string .= $menu->add($modul['Name'], $modul['LongName'], '/' . INSTALL_PATH . '/' . $modul['Icon']);
$allowed_modules++;
}
}
if ($allowed_modules == 0) {
$return_string .= 'Ihre Zugangsberechtigung gilt nicht für diesen Bereich.';
}
$return_string .= $menu->menu_print();
return Html::h('1', PROJECT_NAME . ' Verwaltungs Bereich') . 'Guten Tag, ' . $_SESSION['RheinaufCMS_User']['Name'] . '. ' . Html::a('/Admin?logout=' . $_SESSION['RheinaufCMS_User']['Name'], '(Abmelden)', array('style' => 'font-size:9px')) . Html::div($return_string, array('id' => 'admin'));
}
示例10: generateMenu
public function generateMenu()
{
$this->execQuery();
$menu = new Menu();
while ($row = $this->getRow()) {
$url = $row['url'];
if ($row['intern'] == 1 && session::isAdmin()) {
if (strpos($url, "?") === false) {
$url .= "?";
} else {
$url .= "&";
}
$url .= "akey=" . session::makeKey();
}
// Note that changing the standard naming will also remove any translations.
$menu->add($url, Language::get($row['descr']));
}
return $menu;
}
示例11: app
<?php
\Menu::add('admincp-menu', 'custom-page', ['link' => '', 'name' => 'Custom Pages']);
\Menu::add('sub-menu-custom-page', 'lists', ['link' => \URL::to('admincp/custom/pages/'), 'name' => 'Lists']);
\Menu::add('sub-menu-custom-page', 'add', ['link' => \URL::to('admincp/custom/pages/add'), 'name' => 'Add New Page']);
$customRepository = app('App\\Addons\\Custompage\\Classes\\CustomPageRepository');
foreach ($customRepository->getList(null, true) as $page) {
app('menu')->add('site-menu', $page->slug, ['name' => $page->title, 'link' => \URL::to('_' . $page->slug), 'ajaxify' => true, 'icon' => '<i class="icon ion-clipboard"></i>']);
}
if (\Config::get('enable-recent-pages')) {
app('widget')->add('custompage::side', ['user-home', 'user-search', 'user-discover', 'notifications', 'user-community', 'user-pages'], ['all' => true]);
}
示例12: Menu
<?php
header("Content-type: application/json; charset=iso-8859-1", true);
require_once '../../lib/php/conn.php';
require_once '../../models/Menu.php';
$data = new Menu();
foreach ($_REQUEST as $key => $value) {
$_REQUEST[$key] = utf8_decode($value);
}
if ($_REQUEST['acao'] == 1 && $_REQUEST['operacao'] == 2) {
if ($data->add()) {
echo json_encode(array('success' => 1));
} else {
echo json_encode(array('success' => 0));
}
} elseif ($_REQUEST['acao'] == 2 && $_REQUEST['operacao'] == 2) {
if ($data->edit()) {
echo json_encode(array('success' => 1));
} else {
echo json_encode(array('success' => 0));
}
} elseif ($_REQUEST['acao'] == 3 && $_REQUEST['operacao'] == 2) {
if ($data->delete()) {
echo json_encode(array('success' => 1));
} else {
echo json_encode(array('success' => 0));
}
}
示例13: Menu
<?php
require_once '../autoload.php';
// $menu #1
$main = new Menu();
$main->add('<span class="glyphicon glyphicon-home"></span>', '');
$about = $main->add('about', 'about');
$about->add('Who we are?', 'who-we-are?');
$about->add('What we do?', 'what-we-do?');
$main->add('Services', 'services');
$main->add('Portfolio', 'portfolio');
$main->add('Contact', 'contact');
// menu #2
$user = new Menu();
$user->add('login', 'login');
$profile = $user->add('Profile', 'profile');
$profile->add('Account', 'account')->link->prepend('<span class="glyphicon glyphicon-user"></span> ');
$profile->add('Settings', 'settings')->link->prepend('<span class="glyphicon glyphicon-cog"></span> ');
?>
<html>
<head>
<title>Bootstrap Navbar</title>
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
示例14: myAutoload
spl_autoload_extensions('.php');
//设置加载后缀名
function myAutoload($className)
{
require_once $className . '.php';
//直接根据类名跟文件关系包含文件
}
spl_autoload_register("myAutoload");
//注册自动加载函数
//测试代码开始
$pancakeHouseMenu = new Menu("PANCAKE HOUSE MENU", "早餐");
$dinerMenu = new Menu("DINER MENU", "午餐");
$cafeMenu = new Menu("CAFE MENU", "晚餐");
$dessertMenu = new Menu("DESSERT MENU", "甜点!");
$allMenus = new Menu("ALL MENUS", "All menus combined");
$allMenus->add($pancakeHouseMenu);
$allMenus->add($dinerMenu);
$allMenus->add($cafeMenu);
//早餐菜单项
$pancakeHouseMenu->add(new MenuItem("K&B's Pancake Breakfast", "Pancakes with scrambled eggs, and toast", true, 2.99));
$pancakeHouseMenu->add(new MenuItem("Regular Pancake Breakfast", "Pancakes with fried eggs,sausage", false, 2.99));
$pancakeHouseMenu->add(new MenuItem("Blueberry Pancakes", "Pancakes made with fresh blueberries", true, 3.49));
$pancakeHouseMenu->add(new MenuItem("Waffles", "Waffles, with your choice of blueberries or strawberries", true, 3.59));
//午餐菜单项
$dinerMenu->add(new MenuItem("Pasta", "Spaghetti with Marinara Sauce,and a slice of sourdough bread", true, 3.89));
$dinerMenu->add(new MenuItem("Vegetarian BLT", "(Fakin') Bacon with lettuce & tomato on whole wheat", true, 2.99));
$dinerMenu->add(new MenuItem("BLT", "Bacon with lettuce & tomato on whole wheat", false, 2.99));
$dinerMenu->add(new MenuItem("Soup of the day", "Soup of the day, with a side of potato salad", false, 3.29));
$dinerMenu->add(new MenuItem("Hotdog", "A hot dog,with saurkraut relish, onions, topped with cheese", false, 3.05));
$dinerMenu->add($dessertMenu);
//甜点
示例15: md5
}
}
Weapon::fire(array('plugin_after', 'plugin_' . md5($k) . '_after'));
}
Weapon::fire('plugins_after');
/**
* Check the Plugin(s) Order
* -------------------------
*/
// var_dump($plugins); exit;
/**
* Loading Menu(s)
* ---------------
*/
foreach (Get::state_menu() as $key => $value) {
Menu::add($key, $value);
}
/**
* Handle Shortcode(s) in Content
* ------------------------------
*/
function do_shortcode($content)
{
if (strpos($content, '{{') === false) {
return $content;
}
foreach (Get::state_shortcode() as $key => $value) {
$key = preg_quote($key, '#');
// %[a,b,c]: option(s) ... accept `a`, `b`, or `c`
if (strpos($key, '%\\[') !== false) {
$key = preg_replace_callback('#%\\\\\\[(.*?)\\\\\\]#', function ($matches) {