本文整理汇总了PHP中Menu类的典型用法代码示例。如果您正苦于以下问题:PHP Menu类的具体用法?PHP Menu怎么用?PHP Menu使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Menu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionPerform
function actionPerform(&$skin, $moduleID)
{
$menu = new Menu($skin->main, 'siteMap', 'Tree');
$content = $menu->getMenuScript();
//Assign codeBehind variable
$skin->main->controlVariables["siteMap"] = array('content' => $content);
}
示例2: documents_handle_on_build_menu
/**
* Build menu
*
* @param Menu $menu
* @param User $user
* @return array
*/
function documents_handle_on_build_menu(&$menu, &$user)
{
if ($user->isAdministrator() || $user->getSystemPermission('can_use_documents')) {
$menu->addToGroup(array(new MenuItem('documents', lang('Docs'), assemble_url('documents'), get_image_url('icon.gif', DOCUMENTS_MODULE))), 'main');
}
// if
}
示例3: testMenuRetrieval
public function testMenuRetrieval()
{
$menu = new Menu();
$menu->getMenu();
$returned_response = $menu->getJsonString();
$this->assertTrue($returned_response != Null, 'Menu Retrieval Unsuccessful');
}
示例4: common
public function common($uid)
{
$result = array();
$menuModel = new Menu();
//顶部菜单/底部菜单
for ($i = 1; $i < 7; $i++) {
$sql = "select * from {{menu}} where sort = {$i} and position = 1 and userid = {$uid} and pid = 0 ";
$data["upmenu_{$i}"] = $menuModel->findBySql($sql);
$sql = "select * from {{menu}} where sort = {$i} and position = 2 and userid = {$uid} and pid = 0";
$data["downmenu_{$i}"] = $menuModel->findBySql($sql);
}
//下拉菜单
$sql = "select * from {{menu}} where pid = (select id from {{menu}} where position = 1 and userid = {$uid} and sort = 3 and pid = 0) and position = 1 and userid = {$uid} order by sort asc ";
$data["uplistmenu_3"] = $menuModel->findAllBySql($sql);
//视频列表
$mvModel = new Mv();
$sql = "select * from {{mv}} where userid = {$uid} order by sort asc ";
$data['mvlist'] = $mvModel->findAllBySql($sql);
//音乐列表
// $songModel = new Song();
// $sql = "select * from {{song}} where userid = $uid order by sort asc ";
// $data['musiclist'] = $songModel->findAllBySql($sql);
//网站个性配置
$webModel = new Config();
$sql = "select * from {{webconfig}} where userid = {$uid} ";
$data['webconfig'] = $webModel->findBySql($sql);
$data['url'] = "http://" . Yii::app()->params['bucket'] . "." . Yii::app()->params['domain'] . "/";
$data['uid'] = $uid;
return $data;
}
示例5: 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();
}
示例6: timetracking_handle_on_build_menu
/**
* Add options to main menu
*
* @param Menu $menu
* @param User $user
* @return null
*/
function timetracking_handle_on_build_menu(&$menu, &$user)
{
if ($user->isAdministrator() || $user->getSystemPermission('use_time_reports')) {
$menu->addToGroup(array(new MenuItem('time', lang('Time'), 'https://www.healingcrystals.com/admin/timeSheets.php', get_image_url('navigation/time.gif'))), 'main');
}
// if
}
示例7: run
public function run()
{
DB::table('menus')->delete();
DB::table('dish_menu')->delete();
DB::table('recommendations')->delete();
$menu = new Menu();
$menu->menu_date = "2014-03-30";
$menu->save();
foreach (Dish::all() as $dish) {
$menu->dishes()->save($dish);
}
$menu = new Menu();
$menu->menu_date = "2014-04-23";
$menu->save();
foreach (Dish::all() as $dish) {
$menu->dishes()->save($dish);
}
$recommendation = new Recommendation();
$recommendation->menu_id = 1;
$recommendation->recommendation = "Today, we has abcxyz for menu 1";
$recommendation->save();
$recommendation = new Recommendation();
$recommendation->menu_id = 2;
$recommendation->recommendation = "Today, we has abcxyz for menu 2";
$recommendation->save();
}
示例8: disp
function disp()
{
$t = new Template('../template/system');
$t->set_file('f', 'left.html');
$t->set_block('f', 'row', 'r');
$t->set_block('f', 'menu', 'm');
$t->set_var('addstr', $this->getAddStr('img'));
//设置主菜单
$mo = new Menu(&$this->dbObj);
$str = $this->loginObj->_baseRuleToStr();
$rule = $mo->cugleMenutree(0, $str);
foreach ($rule as $v) {
$t->set_var($v);
if ($v['ruleimg']) {
$t->set_var('img', '<img onMouseOver="event.cancelBubble = true;" onMouseOut="event.cancelBubble = true;" onClick="event.cancelBubble = true;" src="' . WEB_ADMIN_HTTPCOMMON . '/img/' . $v['ruleimg'] . '" align="absmiddle" border="0">');
} else {
$t->set_var('img', '');
}
$t->parse('m', 'menu', true);
}
/*
$menuData = $this->menuObj->getMenuTreeArr(0);
foreach ($menuData as $v){
$t -> set_var($v);
$t -> set_var('updstr',$this->getUpdStr($v['importer'],$v['ruleid'],'img'));
$t -> set_var('delstr',$this->getDelStr($v['importer'],$v['ruleid'],'img'));
$t -> parse('r','row',true);
}
*/
$t->set_var('path', WEB_ADMIN_HTTPPATH . '/common/');
$t->parse('out', 'f');
$t->p('out');
}
示例9: create
public static function create(Menu $xMenu)
{
if ($xMenu->hasScreen()) {
throw new \RuntimeException('The menu already has an another screen');
}
return new static($xMenu);
}
示例10: getMenu
function getMenu()
{
$menu = new Menu($this->getName());
$menu->addItem(new Menu_Item("?modus=news_create", "create"));
$menu->addItem(new Menu_Item("?modus=news_show", "show"));
return $menu->getMenu();
}
示例11: smarty_function_links
function smarty_function_links($params, &$skin)
{
$menuName = empty($params['menuName']) ? 'MainMenu' : $params['menuName'];
$type = empty($params['type']) ? 'Horizontal' : $params['type'];
$menu = new Menu($skin->main, $menuName, $type);
return $menu->getMenuScript();
}
示例12: 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);
}
示例13: 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();
}
示例14: _fetch
/**
* Function which actially fetch the data from the database
* @param object $options
* @return nested array of menu nodes.
*/
private function _fetch($options = array())
{
App::import('Model', 'Cakemenu.Menu');
$menu = new Menu();
if (isset($options['subtree'])) {
$parent = true;
if (isset($options['subtree']['parent'])) {
$parent = $options['subtree']['parent'];
unset($options['subtree']['parent']);
}
$subtree = $menu->find('first', array('conditions' => $options['subtree']));
if ($subtree != false) {
if ($parent == true) {
$conditions = array('Menu.lft >=' => $subtree['Menu']['lft'], 'Menu.rght <=' => $subtree['Menu']['rght']);
} else {
$conditions = array('Menu.lft >' => $subtree['Menu']['lft'], 'Menu.rght <' => $subtree['Menu']['rght']);
}
if (isset($options['conditions'])) {
$options['conditions'] = am($options['conditions'], $conditions);
} else {
$options['conditions'] = $conditions;
}
}
unset($options['subtree']);
}
$nodes = $menu->find('threaded', am(array('order' => 'Menu.lft ASC'), $options));
return $nodes;
}
示例15: disp
function disp()
{
$t = new Template(WEB_ADMIN_TMPPATH);
$dispObj = new DispAttachRule(&$this->dbObj, $this->getUid());
$t->set_file('f', 'pageconfig.html');
$t->set_block('f', 'row', 'r');
$p = $_GET['pageid'] + 0;
$sql = "\r\n\t\t\tSELECT c.configvalue AS userdefalut,o.* FROM " . WEB_ADMIN_TABPOX . "otherrule o \r\n\t\t\t\tLEFT OUTER JOIN " . WEB_ADMIN_TABPOX . "config c ON ( (o.otherruleid = c.otherruleid) AND (c.userid = " . $this->getUid() . ") ) \r\n\t\t\tWHERE (o.isrule = 0) AND (o.issystemvar = 0) AND (o.ruleid = {$p})\r\n\t\t";
$rs = $this->dbObj->GetArray($sql);
foreach ($rs as $v) {
$t->set_var($dispObj->disp($v, $v['userdefalut']));
$t->parse('r', 'row', true);
}
$r = '';
$m = new Menu(&$this->dbObj);
$s = $m->getRelating($p);
for ($i = 0; $i < count($s); $i++) {
if ($i == 0) {
$r = $s[$i]['rulename'];
} else {
$r .= ' > ' . $s[$i]['rulename'];
}
}
$t->set_var('updid', $p);
$t->set_var('address', $r);
$t->set_var('path', WEB_ADMIN_HTTPPATH . '/common/');
$t->parse('out', 'f');
$t->p('out');
}