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


PHP MenuItem类代码示例

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


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

示例1: getPostDetailMenuItems

    public function getPostDetailMenuItems($post) {
        $template_path = Utils::getPluginViewDirectory('hellothinkup').'hellothinkup.inline.view.tpl';
        $menu_items = array();

        //Define a menu item
        $hello_menu_item_1 = new MenuItem("Data vis 1", "First data visualization", $template_path,
        'Hello ThinkUp Plugin Menu Header');
        //Define a dataset to be displayed when that menu item is selected
        $hello_menu_item_dataset_1 = new Dataset("replies_1", 'PostDAO', "getRepliesToPost",
        array($post->post_id, $post->network, 'location') );
        //Associate dataset with menu item
        $hello_menu_item_1->addDataset($hello_menu_item_dataset_1);
        //Add menu item to menu items array
        $menu_items['data_vis_1'] = $hello_menu_item_1;

        //Define a menu item
        $hello_menu_item_2 = new MenuItem("Data vis 2", "Second data visualization", $template_path);
        //Define a dataset to be displayed when that menu item is selected
        $hello_menu_item_dataset_2 = new Dataset("replies_2", 'PostDAO', "getRepliesToPost",
        array($post->post_id, $post->network, 'location') );
        //Associate dataset with menu item
        $hello_menu_item_2->addDataset($hello_menu_item_dataset_2);
        //Add menu item to menu items array
        $menu_items['data_vis_2'] = $hello_menu_item_2;

        return $menu_items;
    }
开发者ID:rkabir,项目名称:ThinkUp,代码行数:27,代码来源:class.HelloThinkUpPlugin.php

示例2: getPostDetailMenuItems

    public function getPostDetailMenuItems($post) {
        $menus = array();
        $map_template_path = Utils::getPluginViewDirectory('geoencoder').'geoencoder.map.tpl';

        //Define a menu item
        $map_menu_item = new MenuItem("Response Map", "", $map_template_path, 'Geoencoder');
        //Define a dataset to be displayed when that menu item is selected
        $map_menu_item_dataset_1 = new Dataset("geoencoder_map", 'PostDAO', "getRelatedPosts",
        array($post->post_id, $post->network, 'location') );
        //Associate dataset with menu item
        $map_menu_item->addDataset($map_menu_item_dataset_1);
        //Add menu item to menu
        $menus["geoencoder_map"] = $map_menu_item;

        $nearest_template_path = Utils::getPluginViewDirectory('geoencoder').'geoencoder.nearest.tpl';
        //Define a menu item
        $nearest_menu_item = new MenuItem("Nearest Responses", "", $nearest_template_path);
        //Define a dataset to be displayed when that menu item is selected
        $nearest_dataset = new Dataset("geoencoder_nearest", 'PostDAO', "getRelatedPosts",
        array($post->post_id, $post->network, !Session::isLoggedIn()));
        //Associate dataset with menu item
        $nearest_menu_item->addDataset($nearest_dataset);
        $nearest_dataset_2 = new Dataset("geoencoder_options", 'PluginOptionDAO', 'getOptionsHash',
        array('geoencoder', true));
        $nearest_menu_item->addDataset($nearest_dataset_2);
        //Add menu item to menu
        $menus["geoencoder_nearest"] = $nearest_menu_item;

        return $menus;
    }
开发者ID:rkabir,项目名称:ThinkUp,代码行数:30,代码来源:class.GeoEncoderPlugin.php

示例3: write_child

 function write_child()
 {
     $all_childs = $this->data["childs"];
     $child = new MenuItem($this->menu_layout_dir, $all_childs[$this->current_index], $this->level + 1);
     $this->current_index += 1;
     $child->render();
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:7,代码来源:MenuItem.class.php

示例4: __construct

 function __construct()
 {
     //-----vytvorenie objektu menu
     $menu = new MenuItem();
     $menu->menuAction();
     //-----vytvorenie objektu node
     $node = new node();
     $node->nodeAction();
     MT::addContent($menu->render(), 'leftHolder');
     try {
         if (isset($_GET['id_menu_item']) or isset($_GET['addMenuItem']) or isset($_GET['changeMenuItem'])) {
             MT::addTemplate(APP_DIR . '/templates/admin/modulHolder.phtml', 'modulHolder');
             MT::addVar('modulHolder', 'type_modul', dibi::fetchAll("SELECT * FROM [type_modul] WHERE visible_for_user='1'"));
         }
         //zobrazenie zmeny polozky pre menu
         if (isset($_GET['changeMenuItem'])) {
             $menu->showChangeMenuItem($_GET['id_menu_item']);
         }
         if (isset($_GET['id_menu_item']) and !isset($_GET['changeMenuItem'])) {
             $node->showModul();
         }
         //pridanie polozky do menu
         if (isset($_GET['addMenuItem'])) {
             $menu->showAddMenuItem();
         }
         //zachytenie vynimie
     } catch (NodeException $e) {
         echo '<div style="border: 2px solid red; padding: 5px;">' . $e->getMessage() . '</div>';
         exit;
     }
 }
开发者ID:oaki,项目名称:demoshop,代码行数:31,代码来源:cms.php

示例5: __construct

 function __construct($page_object, $array_menu)
 {
     parent::__construct();
     $this->render = new Menu();
     $wsp_admin_url = WSP_ADMIN_URL;
     $menu_items = new MenuItems();
     foreach ($array_menu['MenuItems']['MenuItem'] as $menuitems) {
         eval("\$page_icon_16 = \"" . $menuitems['Menu_attr']['icon_16'] . "\";");
         if (find($menuitems['Menu_attr']['name'], "__(", 0, 0) > 0) {
             eval("\$page_title = " . $menuitems['Menu_attr']['name'] . ";");
         } else {
             eval("\$page_title = \"" . $menuitems['Menu_attr']['name'] . "\";");
         }
         eval("\$page_link = \"" . $menuitems['Menu_attr']['url'] . "\";");
         if ($menuitems['Menu_attr']['url'] == "\$wsp_admin_url/admin.html") {
             $page_title = "";
         }
         $menu_item = new MenuItem($page_title, $page_link, $page_icon_16);
         if (isset($_GET['menu'])) {
             if ($page_link == $wsp_admin_url . "/admin.html?menu=" . $_GET['menu']) {
                 $menu_item->setCurrent();
             }
         }
         $menu_items->add($menu_item);
         $sub_menu_items = new MenuItems();
         if (!isset($menuitems['MenuItems']['MenuItem'][0])) {
             $sub_menuitems = $menuitems['MenuItems'];
         } else {
             $sub_menuitems = $menuitems['MenuItems']['MenuItem'];
         }
         $nb_sub_menu = 0;
         foreach ($sub_menuitems as $menuitem) {
             eval("\$page_icon_16 = \"" . $menuitem['Menu_attr']['icon_16'] . "\";");
             if (find($menuitem['Menu_attr']['name'], "__(", 0, 0) > 0) {
                 eval("\$page_title = " . $menuitem['Menu_attr']['name'] . ";");
             } else {
                 eval("\$page_title = \"" . $menuitem['Menu_attr']['name'] . "\";");
             }
             eval("\$page_link = \"" . $menuitem['Menu_attr']['url'] . "\";");
             $sub_menu_item = new MenuItem($page_title, $page_link, $page_icon_16);
             if ($page_link == $_GET['p'] . ".html") {
                 $sub_menu_item->setCurrent();
                 $menu_item->setCurrent();
             }
             $sub_menu_items->add($sub_menu_item);
             $nb_sub_menu++;
         }
         if ($nb_sub_menu > 0) {
             $menu_item->setMenuItems($sub_menu_items);
         }
     }
     $this->render->setMenuItems($menu_items);
     $this->render->activateSupersubs();
     list($strAdminLogin, $strAdminPasswd, $strAdminRights) = getWspUserRightsInfo("admin");
     if ($strAdminLogin == "admin" && $strAdminPasswd == sha1("admin")) {
         $modalbox = new DialogBox(__(CHANGE_PASSWD), new Url($page_object->getBaseLanguageURL() . "wsp-admin/change-passwd.call"));
         $modalbox->modal()->setWidth(400);
         $page_object->addObject($modalbox);
     }
 }
开发者ID:kxopa,项目名称:WebSite-PHP,代码行数:60,代码来源:admin-menu.inc.php

示例6: createItem

    public function createItem($name, array $options = array())
    {
        $item = new MenuItem($name, $this);

        $options = array_merge(
            array(
                'uri' => null,
                'label' => null,
                'attributes' => array(),
                'linkAttributes' => array(),
                'childrenAttributes' => array(),
                'labelAttributes' => array(),
                'display' => true,
                'displayChildren' => true,
            ),
            $options
        );

        $item
            ->setUri($options['uri'])
            ->setLabel($options['label'])
            ->setAttributes($options['attributes'])
            ->setLinkAttributes($options['linkAttributes'])
            ->setChildrenAttributes($options['childrenAttributes'])
            ->setLabelAttributes($options['labelAttributes'])
            ->setDisplay($options['display'])
            ->setDisplayChildren($options['displayChildren'])
        ;

        return $item;
    }
开发者ID:naderman,项目名称:KnpMenu,代码行数:31,代码来源:MenuFactory.php

示例7: addItem

 /**
  * Adiciona um item ao menu.
  * @param	string $name Texto que será exibido ao usuário
  * @param	string $link Link do item do menu
  * @return	MenuItem O item do menu recém adicionado
  */
 public function addItem($name, $link)
 {
     $menuItem = new MenuItem();
     $anchor = $menuItem->addChild(new Anchor($link));
     $anchor->addChild(new Text($name));
     $this->addChild($menuItem);
     return $menuItem;
 }
开发者ID:rcastardo,项目名称:mvc-na-pratica,代码行数:14,代码来源:Menu.php

示例8: build

 static function build($menu_name, $content_dir_name)
 {
     $final_root = self::get_menu_entries($content_dir_name);
     $final_root["key"] = $menu_name;
     $menu_layout_dir = new Dir(self::MENU_LAYOUT_FOLDER . $menu_name . "/");
     $root_item = new MenuItem($menu_layout_dir, $final_root, 0);
     $root_item->render();
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:8,代码来源:MenuBuilder.class.php

示例9: createFromNode

 /**
  * Create a menu item from a NodeInterface
  *
  * @param NodeInterface $node
  * @return MenuItem
  */
 public function createFromNode(NodeInterface $node)
 {
     $item = new MenuItem($node->getName(), $this->getUriFromNode($node), $node->getAttributes());
     $item->setLabel($node->getLabel());
     foreach ($node->getChildren() as $childNode) {
         $item->addChild($this->createFromNode($childNode));
     }
     return $item;
 }
开发者ID:rogchap,项目名称:Diakonia,代码行数:15,代码来源:MenuFactory.php

示例10: __construct

 /**
  * MenuItem constructor.
  */
 public function __construct($id)
 {
     $this->id = $id;
     if (is_null(static::$current)) {
         static::$current = $this;
         $this->level(0);
     } else {
         static::$current = addItem($this);
         $this->level(static::$current->level() + 1);
     }
 }
开发者ID:OscarDuranX,项目名称:MenuWithAuthentication,代码行数:14,代码来源:MenuItem.php

示例11: testConstructor

 /**
  * Test constructor
  */
 public function testConstructor()
 {
     $tab = new MenuItem('my_short_name', "Name of My Tab");
     $this->assertEqual($tab->short_name, 'my_short_name');
     $this->assertEqual($tab->name, 'Name of My Tab');
     $this->assertEqual($tab->description, '');
     $this->assertEqual($tab->view_template, 'inline.view.tpl');
     $datasets = $tab->getDatasets();
     $this->assertIsA($datasets, 'array');
     $this->assertEqual(sizeof($datasets), 0);
 }
开发者ID:kalion,项目名称:ThinkUp,代码行数:14,代码来源:TestOfMenuItem.php

示例12: MenuItem

 /**
  * Creates new menuitem and adds it to items list
  *
  * @param string $name
  *            Internal name of item
  * @param string $text
  *            Text to show
  * @param string $url
  *            Optional url for linking
  *
  * @return MenuItem Reference to the created child item.
  */
 public function &createItem($name, $text, $url = '')
 {
     $menu_item = new MenuItem();
     $menu_item->setName($name);
     $menu_item->setText($text);
     if ($url) {
         $menu_item->setUrl($url);
     }
     $this->items[$name] = $menu_item;
     return $this->items[$name];
 }
开发者ID:tekkla,项目名称:core-framework,代码行数:23,代码来源:MenuItemAbstract.php

示例13: buildTree

 /**
  * Recursively creates a tree from the pages array
  *
  * @param   MenuItem parent         MenuItem object under which the tree is build
  * @param   array    pageIdx        indices of pages for this tree
  */
 private function buildTree(MenuItem &$parent, $pageIdx)
 {
     foreach ($pageIdx as $i) {
         if ($this->pages[$i]->parent == $parent->get('id')) {
             $child = $parent->addChild($this->pages[$i]);
             $this->buildTree($child, array_diff($pageIdx, array($i)));
             if ($this->pid == $this->pages[$i]->id) {
                 $parent->getRoot()->setCurrentItem($child);
             }
         }
     }
 }
开发者ID:schulzp,项目名称:stamm_leo_website,代码行数:18,代码来源:class.menubuilder.php

示例14: 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

示例15: loadModel

 /**
  * Возвращает модель по указанному идентификатору
  * Если модель не будет найдена - возникнет HTTP-исключение.
  *
  * @param integer идентификатор нужной модели
  *
  * @return void
  *
  * @throws CHttpException If MenuItem record not found
  */
 public function loadModel($id)
 {
     if (($model = MenuItem::model()->findByPk($id)) === null) {
         throw new CHttpException(404, Yii::t('MenuModule.menu', 'Page was not found!'));
     }
     return $model;
 }
开发者ID:kuzmina-mariya,项目名称:4seasons,代码行数:17,代码来源:MenuitemBackendController.php


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