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


PHP Menu::render方法代码示例

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


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

示例1: s_menu_replace

function s_menu_replace(array $matches)
{
    if (isset($matches[1])) {
        $dD = new DataStore();
        $o_Menu = new Menu($dD->get_menu_data_from_name($matches[1]));
        return $o_Menu->render();
    }
}
开发者ID:Divian,项目名称:flot,代码行数:8,代码来源:items.php

示例2: prepare

 /**
  * Prepare menues
  */
 public function prepare(){
     $cogear = getInstance();
     $menu = new Menu('admin.sidebar');
     $root = Url::gear('admin');
     $menu->{$root} = icon('dashboard','fugue').t('Dashboard');
     $menu->{$root.'gears'} = icon('gear','fugue').t('Gears');
     $menu->{$root.'theme'} = icon('layout').t('Theme');
     $menu->{$root.'site'} = icon('toolbox','fugue').t('Site');
     $menu->{$root.'site/clear_cache'} = icon('bin').t('Clear cache');
     prepend('sidebar',$menu->render('Admin_Menu.sidebar_menu'));
     css($this->folder.'/css/menu.css');
     $menu = new Menu('admin.top');
     Template::bindGlobal('top_menu',$menu);
 }
开发者ID:nishushable,项目名称:cogear,代码行数:17,代码来源:Gear.php

示例3: testCorrectLinkIsAutomaticallyMarkedAsActive

 public function testCorrectLinkIsAutomaticallyMarkedAsActive()
 {
     // Make a dummy request to populate Request::current()
     Request::$current = Request::factory('tasks', array(), FALSE);
     $menu_config = self::_get_test_config();
     $menu_config['guess_active_item'] = TRUE;
     $menu = new Menu($menu_config);
     $menu->render();
     // Check that an item was marked as active
     $menu_items = $menu->get_items();
     foreach ($menu_items as $item) {
         if ($item->url === 'tasks') {
             $this->assertTrue(in_array('active', $item->classes));
         }
     }
 }
开发者ID:vedmant,项目名称:kohana-menu,代码行数:16,代码来源:MenuTest.php

示例4: Item

$item1 = new Item('#link-item1', 'Item 1');
$item2 = new Item('#link-item2', 'Item 2');
$item3 = new Item('#link-item3', 'Item 3');
$item4 = new Item('#link-item4', 'Item 4');
$menu->addChild($item1);
$menu->addChild($item2);
$menu->addChild($item3);
$menu->addChild($item4);
$subMenu2->addChild($item1);
$subMenu2->addChild($item2);
$subMenu2->addChild($item3);
$subMenu2->addChild($item4);
$subMenu->addChild($item1);
$subMenu->addChild($item2);
$subMenu->addChild($subMenu2);
$subMenu->addChild($item3);
$menu->addChild($subMenu);
?>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Design Patterns Composit</title>
</head>
<body>
	<?php 
echo $menu->render();
?>
	
</body>
</html>
开发者ID:YurePereira,项目名称:fypa-design-patterns,代码行数:31,代码来源:test.php

示例5: Theme

 function test_menu_components()
 {
     $theme = new Theme("", "");
     $heading = new MenuItemHeading("hoho", 3);
     $this->assertIdentical($heading->getType(), MENU_ITEM_HEADING);
     $this->assertIdentical($heading->getDisplayName(), "hoho");
     //			$comp->render($theme);
     $comp = new MenuItemLink("Google", "http://www.google.com", true, 1, "_BLANK", "g", "Go to the Google search page");
     $this->assertIdentical($comp->getDisplayName(), "Google");
     $this->assertIdentical($comp->getURL(), "http://www.google.com");
     $this->assertTrue($comp->isSelected());
     $this->assertIdentical($comp->getTarget(), "_BLANK");
     $this->assertIdentical($comp->getAccessKey(), "g");
     $this->assertIdentical($comp->getToolTip(), "Go to the Google search page");
     $this->assertIdentical($comp->getType(), MENU_ITEM_LINK_SELECTED);
     $comp->setDisplayName("1");
     $comp->setURL("2");
     $comp->setSelected(false);
     $comp->setTarget("4");
     $comp->setAccessKey("5");
     $comp->setToolTip("6");
     $this->assertIdentical($comp->getDisplayName(), "1");
     $this->assertIdentical($comp->getURL(), "2");
     $this->assertFalse($comp->isSelected());
     $this->assertIdentical($comp->getTarget(), "4");
     $this->assertIdentical($comp->getAccessKey(), "5");
     $this->assertIdentical($comp->getToolTip(), "6");
     $this->assertIdentical($comp->getType(), MENU_ITEM_LINK_UNSELECTED);
     $comp = new MenuItemLink("Google", "http://www.google.com", true, 1, "_BLANK", "g", "Go to the Google search page");
     $comp->addAttribute("name", "haha");
     //			$comp->render($theme);
     $menuStyle = new StyleCollection("*.menu", "menu", "Menu Style", "Style for the menu.");
     $menuStyle->addSP(new BackgroundColorSP("#997755"));
     $menuStyle->addSP(new BorderSP("1px", "solid", "#FFFFFF"));
     $menu = new Menu(new XLayout(), 4, $menuStyle);
     $this->assertTrue(!isset($comp->_selectedId));
     $menu->add($comp, "100px", null, CENTER);
     $this->assertIdentical($menu->_selectedId, 1);
     $this->assertIdentical($comp->isSelected(), true);
     $this->assertReference($menu->getSelected(), $comp);
     $comp1 = $comp;
     $menu->add($comp1, "100px", null, CENTER);
     $this->assertIdentical($menu->_selectedId, 2);
     $this->assertIdentical($comp1->isSelected(), true);
     $this->assertIdentical($comp->isSelected(), false);
     $this->assertReference($menu->getSelected(), $comp1);
     $comp2 = $comp;
     $comp2->setSelected(false);
     $menu->add($comp2, "100px", null, CENTER);
     $this->assertIdentical($menu->_selectedId, 2);
     $this->assertIdentical($comp->isSelected(), false);
     $this->assertIdentical($comp1->isSelected(), true);
     $this->assertIdentical($comp2->isSelected(), false);
     $this->assertReference($menu->getSelected(), $comp1);
     $menu->select(3);
     $this->assertIdentical($comp->isSelected(), false);
     $this->assertIdentical($comp1->isSelected(), false);
     $this->assertIdentical($comp2->isSelected(), true);
     $this->assertReference($menu->getSelected(), $comp2);
     $menu->add($heading, "100px", null, CENTER);
     echo "<style>";
     echo $menuStyle->getCSS();
     echo "</style>";
     $menu->render($theme);
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:65,代码来源:ComponentsTestCase.class.php

示例6: testAdditionalAttributeCanBeAddedToMenuItemsFromConfig

 /**
  * @group m1
  */
 public function testAdditionalAttributeCanBeAddedToMenuItemsFromConfig()
 {
     $config['items'][0] = ['attributes' => ['data-id' => '5'], 'url' => 'test'];
     $menu = new Menu($config);
     $this->assertContains('data-id="5"', $menu->render());
 }
开发者ID:vedmant,项目名称:kohana-menu,代码行数:9,代码来源:ItemTest.php

示例7: generateMenu

 public function generateMenu()
 {
     $menu = new Menu();
     /******************************************
      * Horux menu
      */
     $horux = new MenuItem('null', 'Horux', '#');
     $horux->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-controlPanel.png\" />'", Prado::localize('Control Panel', array(), "messages"), $this->Service->constructUrl('controlPanel.ControlPanel'), 1));
     $horux->addSplit();
     $horux->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-superUser.png\" />'", Prado::localize('Super User', array(), "messages"), $this->Service->constructUrl('superuser.userList'), $this->isAccess('superuser.userList')));
     $horux->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-superGroupUser.png\" />'", Prado::localize('Super User Group', array(), "messages"), $this->Service->constructUrl('superuser.userGroupList'), $this->isAccess('superuser.userGroupList')));
     $horux->addSplit();
     $horux->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-configure.png\" />'", Prado::localize('Configuration', array(), "messages"), $this->Service->constructUrl('configuration.config'), $this->isAccess('configuration.config')));
     /******************************************
      * System menu
      */
     $system = new MenuItem('null', Prado::localize('System', array(), "messages"), '#');
     $system->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-site.png\" />'", Prado::localize('Site', array(), "messages"), $this->Service->constructUrl('site.Site'), $this->isAccess('site.Site')));
     if ($this->isAccess('site.Site')) {
         $this->systemMenuCount++;
     }
     $system->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-department.png\" />'", Prado::localize('Department', array(), "messages"), $this->Service->constructUrl('site.department'), $this->isAccess('site.department')));
     if ($this->isAccess('site.department')) {
         $this->systemMenuCount++;
     }
     $system->addSplit();
     $system->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-horuxcontroller.png\" />'", Prado::localize('Horux Controller', array(), "messages"), $this->Service->constructUrl('horuxController.horuxController'), $this->isAccess('horuxController.horuxController')));
     if ($this->isAccess('horuxController.horuxController')) {
         $this->systemMenuCount++;
     }
     $system->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-hardware.png\" />'", Prado::localize('Hardware', array(), "messages"), $this->Service->constructUrl('hardware.HardwareList'), $this->isAccess('hardware.HardwareList')));
     if ($this->isAccess('hardware.HardwareList')) {
         $this->systemMenuCount++;
     }
     $system->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-openLevel.png\" />'", Prado::localize('Open time', array(), "messages"), $this->Service->constructUrl('openTime.openTimeList'), $this->isAccess('openTime.openTimeList')));
     if ($this->isAccess('openTime.openTimeList')) {
         $this->systemMenuCount++;
     }
     $system->addSplit();
     $system->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-notification.png\" />'", Prado::localize('Notification', array(), "messages"), $this->Service->constructUrl('system.Notification'), $this->isAccess('system.Notification')));
     if ($this->isAccess('system.Notification')) {
         $this->systemMenuCount++;
     }
     $system->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-alarm.png\" />'", Prado::localize('Alarms', array(), "messages"), $this->Service->constructUrl('system.Alarms'), $this->isAccess('system.Alarms')));
     if ($this->isAccess('system.Alarms')) {
         $this->systemMenuCount++;
     }
     $system->addSplit();
     $system->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-service.png\" />'", Prado::localize('Horux Service', array(), "messages"), $this->Service->constructUrl('system.Service'), $this->isAccess('system.Service')));
     if ($this->isAccess('system.Service')) {
         $this->systemMenuCount++;
     }
     $system->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-standalone.png\" />'", Prado::localize('Standalone', array(), "messages"), $this->Service->constructUrl('system.Standalone'), $this->isAccess('system.Standalone')));
     if ($this->isAccess('system.Standalone')) {
         $this->systemMenuCount++;
     }
     $system->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-systemStatus.png\" />'", Prado::localize('System Status', array(), "messages"), $this->Service->constructUrl('system.Status'), $this->isAccess('system.Status')));
     if ($this->isAccess('system.Status')) {
         $this->systemMenuCount++;
     }
     /******************************************
      * access menu
      */
     $access = new MenuItem('null', Prado::localize('Access', array(), "messages"), '#');
     $access->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-user2.png\" />'", Prado::localize('User', array(), "messages"), $this->Service->constructUrl('user.UserList'), $this->isAccess('user.UserList')));
     if ($this->isAccess('user.UserList')) {
         $this->accessMenuCount++;
     }
     $access->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-userGroup.png\" />'", Prado::localize('User group', array(), "messages"), $this->Service->constructUrl('userGroup.UserGroupList'), $this->isAccess('userGroup.UserGroupList')));
     if ($this->isAccess('userGroup.UserGroupList')) {
         $this->accessMenuCount++;
     }
     $access->addSplit();
     $access->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-key.png\" />'", Prado::localize('Key', array(), "messages"), $this->Service->constructUrl('key.KeyList'), $this->isAccess('key.KeyList')));
     if ($this->isAccess('key.KeyList')) {
         $this->accessMenuCount++;
     }
     $access->addSplit();
     $access->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-accessLevel.png\" />'", Prado::localize('Access Level', array(), "messages"), $this->Service->constructUrl('accessLevel.accessLevelList'), $this->isAccess('accessLevel.accessLevelList')));
     if ($this->isAccess('accessLevel.accessLevelList')) {
         $this->accessMenuCount++;
     }
     $access->addMenuItem(new MenuItem("'<img src=\"./themes/letux/images/menu/icon-16-nonWorkingDay.png\" />'", Prado::localize('Non Working Days', array(), "messages"), $this->Service->constructUrl('nonWorkingDay.nonWorkingDay'), $this->isAccess('nonWorkingDay.nonWorkingDay')));
     if ($this->isAccess('nonWorkingDay.nonWorkingDay')) {
         $this->accessMenuCount++;
     }
     /******************************************
      * Component menu
      */
     $componnents = new MenuItem('null', Prado::localize('Components', array(), "messages"), '#');
     $db = $this->Application->getModule('horuxDb')->DbConnection;
     if (!$db) {
         return $menu->render();
     }
     $db->Active = true;
     $cmd = $db->createCommand("SELECT * FROM hr_install WHERE type='component'");
     $data = $cmd->query();
     $data = $data->readAll();
     foreach ($data as $d) {
         $cmd = $db->createCommand("SELECT * FROM hr_install AS i LEFT JOIN hr_component as c ON c.id_install=i.id WHERE i.type='component' AND c.parentmenu=0 AND i.id=" . $d['id']);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:horux-svn,代码行数:101,代码来源:HeaderBox.php


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