當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。