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


PHP MenuItem::getId方法代码示例

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


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

示例1: testGetId

 /**
  * @covers MenuItem::getId
  */
 public function testGetId()
 {
     $id = $this->menuItem->getId();
     $actual = "" . $id;
     $excepted = "dashboard";
     $this->assertSame($excepted, $actual);
 }
开发者ID:fruition-sciences,项目名称:phpfw,代码行数:10,代码来源:MenuItemTest.php

示例2: getItems

 public function getItems()
 {
     $user = Transaction::getInstance()->getUser();
     $items = array();
     foreach ($this->xml->item as $element) {
         $item = new MenuItem($this, $element);
         if ($item->getId() == $this->mainMenuId) {
             $item->setSelected(true);
         }
         if (!$item->isAdminOnly() || $user->isAdmin()) {
             $items[] = $item;
         }
     }
     return $items;
 }
开发者ID:fruition-sciences,项目名称:phpfw,代码行数:15,代码来源:Menu.php

示例3: __construct

 public function __construct($menu, $xmlElement)
 {
     $this->attributes = self::getXmlElementAttributes($xmlElement);
     $this->menu = $menu;
     $this->id = $xmlElement['id'];
     $this->adminOnly = $xmlElement['adminOnly'];
     $this->name = $xmlElement->name;
     $this->href = $xmlElement->href;
     $this->onclick = $xmlElement->onclick;
     $this->class = $xmlElement->class;
     $this->content = $xmlElement->content;
     $this->subcontent = $xmlElement->subcontent;
     $this->add = $xmlElement->add;
     $this->display = $xmlElement->disp;
     $this->xmlElement = $xmlElement;
     foreach ($xmlElement->item as $childItem) {
         $item = new MenuItem($this->menu, $childItem);
         if ($item->getId() == $menu->getSubMenuId()) {
             $item->setSelected(true);
         }
         $this->items[] = $item;
     }
 }
开发者ID:fruition-sciences,项目名称:phpfw,代码行数:23,代码来源:MenuItem.php

示例4: getAddEditForm

 public function getAddEditForm($target = '/admin/Menu')
 {
     require_once 'Menu.php';
     if (isset($_REQUEST['id'])) {
         $item = new MenuItem($_REQUEST['id']);
     }
     $status = array('active' => 'Active', 'disabled' => 'Disabled');
     $defaultValues['status'] = @array($item->status);
     $menu = new Menu();
     $parent = $menu->toArray();
     $defaultValues['parent'] = @array($item->parent);
     $form = new Form('menu_addedit', 'POST', $target, '', array('class' => 'admin'));
     if (@$item) {
         $form->setConstants(array('id' => $item->getId(), 'section' => 'addedit'));
         $form->addElement('hidden', 'id');
         $links = $menu->getLinkables($item->module_id);
     } else {
         $form->setConstants(array('section' => 'addedit'));
     }
     $form->addElement('hidden', 'section');
     $form->addElement('text', 'display', 'Display Name', array('value' => @$item->display));
     $active = Config::getActiveModules();
     $linkableType = array();
     foreach ($active as $module) {
         $modulename = 'Module_' . $module['module'];
         include_once SITE_ROOT . '/modules/' . $module['module'] . '/' . $module['module'] . '.php';
         $obj = new $modulename();
         $test = new ReflectionClass($modulename);
         if ($test->hasMethod('getValidLinks')) {
             $linkableType[$module['id']] = $obj->linkType();
         }
     }
     if (@(!$item)) {
         $keys = array_keys($linkableType);
         $links = $menu->getLinkables($keys[0]);
     }
     $defaultValues['link'] = @array($item->link_id);
     $defaultValues['linktype'] = @array($item->module_id);
     $defaultValues['target'] = @array($item->target);
     $form->addElement('select', 'status', 'Status', $status);
     $form->addElement('select', 'linktype', 'Link Type', $linkableType);
     $form->addElement('select', 'link', 'Link To', $links);
     $form->addElement('select', 'target', 'Open In', array('same' => 'Same Window', 'new' => 'New Window'));
     $form->addElement('select', 'parent', 'Parent Item', $parent);
     $form->addElement('submit', 'submit', 'Save');
     $form->applyFilter('display', 'trim');
     $form->addRule('display', 'Please enter a display name', 'required', null, 'client');
     $form->addRule('parent', 'Please choose a parent', 'required', null, 'client');
     $form->addRule('linktype', 'Please choose a link type', 'required', null, 'client');
     $form->addRule('link', 'Please choose a link page', 'required', null, 'client');
     $form->addRule('target', 'Please choose a target', 'required', null, 'client');
     $form->addRule('status', 'Please choose a status', 'required', null, 'client');
     $form->setDefaults($defaultValues);
     if (isset($_REQUEST['submit']) && $form->validate()) {
         $this->template = 'admin/menu.tpl';
         $this->doMenuSubmit();
         return false;
     } else {
         if (isset($_REQUEST['submit'])) {
             $formArray['errors'] = $form->_errors;
         }
     }
     return $form;
 }
开发者ID:swat30,项目名称:safeballot,代码行数:64,代码来源:MenuItem.php

示例5: _extractMenuItemToArray

 private function _extractMenuItemToArray(MenuItem $menuItem)
 {
     $menu['id'] = $menuItem->getId();
     $menu['menuTitle'] = $menuItem->getMenuTitle();
     $menu['level'] = $menuItem->getLevel();
     $menu['module'] = '';
     $menu['action'] = '';
     $menu['subMenuItems'] = array();
     $screen = $menuItem->getScreen();
     if ($screen instanceof Screen) {
         $menu['module'] = $screen->getModule()->getName();
         $menu['action'] = $screen->getActionUrl();
         $menu['urlExtras'] = $menuItem->getUrlExtras();
     }
     return $menu;
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:16,代码来源:MenuService.php

示例6: MenuItem

 $menu_item->setName('ABOUT US');
 $menu_item->setParentId($root_id);
 $menu_item->setUri('about');
 $menu_item->save();
 $menu_item = new MenuItem();
 $menu_item->setWeight($weight++);
 $menu_item->setMenuId($menu->getId());
 $menu_item->setName('CONTACT');
 $menu_item->setParentId($root_id);
 $menu_item->setUri('contact');
 $menu_item->save();
 $menu_item = new MenuItem();
 $menu_item->setWeight($weight++);
 $menu_item->setMenuId($menu->getId());
 $menu_item->setName('Student service');
 $menu_item->setParentId($menu_item_1->getId());
 $menu_item->setUri('services/student');
 $menu_item->save();
 $menu_item = new MenuItem();
 $menu_item->setWeight($weight++);
 $menu_item->setMenuId($menu->getId());
 $menu_item->setName('Immigration service');
 $menu_item->setParentId($menu_item_1->getId());
 $menu_item->setUri('services/immigration');
 $menu_item->save();
 $menu = new Menu();
 $menu->setName('底部LINKS');
 $menu->setReserved(1);
 $menu->save();
 $menu_item = new MenuItem();
 $menu_item->setWeight($weight++);
开发者ID:jeffreycai,项目名称:ct21,代码行数:31,代码来源:fixture.php

示例7: MenuItem

    /// proceed submission
    // proceed for $name
    $object->setName($name);
    // proceed for $country_id
    $object->setCountryId($country_id);
    if ($error_flag == false) {
        if ($object->save()) {
            // create root menu_it
            $menu_item = new MenuItem();
            $menu_item->setWeight(0);
            $menu_item->setMenuId($object->getId());
            $menu_item->setName('root');
            $menu_item->setParentId(null);
            $menu_item->setUri('');
            $menu_item->save();
            $object->setRootMenuItemId($menu_item->getId());
            $object->save();
            Message::register(new Message(Message::SUCCESS, i18n(array("en" => "Record saved", "zh" => "记录保存成功"))));
            HTML::forwardBackToReferer();
        } else {
            Message::register(new Message(Message::DANGER, i18n(array("en" => "Record failed to save", "zh" => "记录保存失败"))));
        }
    }
}
$html = new HTML();
$html->renderOut('core/backend/html_header', array('title' => i18n(array('en' => 'Create Menu', 'zh' => 'Create 菜单'))));
$html->output('<div id="wrapper">');
$html->renderOut('core/backend/header');
$html->renderOut('menu/backend/menu_create', array('object' => $object));
$html->output('</div>');
$html->renderOut('core/backend/html_footer');
开发者ID:jeffreycai,项目名称:ct21,代码行数:31,代码来源:menu_create.php

示例8: addInstanceToPool

 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      MenuItem $value A MenuItem object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(MenuItem $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
开发者ID:navid045,项目名称:maxlaptop,代码行数:22,代码来源:BaseMenuItemPeer.php


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