• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP MenuItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: loadModel

 public function loadModel($id)
 {
     if (($model = MenuItem::model()->findByPk($id)) === null) {
         throw new CHttpException(404, 'Страница не найдена');
     }
     return $model;
 }
开发者ID:kuzmina-mariya,项目名称:unizaro-kamin,代码行数:7,代码来源:MenuitemBackendController.php


示例17: deleteCategoryInfo

 public function deleteCategoryInfo($slug)
 {
     $results = \MenuCategory::where('menu_category_slug', '=', $slug)->get();
     foreach ($results as $result) {
         $id = $result->menu_category_id;
     }
     $items_using_cat = \MenuItem::where('menu_item_category_fk', '=', $id)->get();
     foreach ($items_using_cat as $item_using_cat) {
         if ($item_using_cat) {
             return \Redirect::to("admin/category/edit/{$slug}")->with('message', '<div class="alert alert-dismissible alert-danger alert-link">Unable to delete category. Please make sure no items are using this category.</p></div>');
         }
     }
     //if an item exists that has this cat's fk, reload the page with an error
     if (\Auth::check()) {
         \DB::beginTransaction();
         try {
             $statement = \MenuCategory::find($id);
             $statement->delete();
         } catch (ValidationException $e) {
             DB::rollback();
             throw $e;
         }
         \DB::commit();
         return \Redirect::to('admin')->with('message', '<div class="alert alert-dismissible alert-success alert-link">Category has been deleted</p></div>');
     }
     return \Redirect::to('admin');
 }
开发者ID:adamyWA,项目名称:Menu-CMS,代码行数:27,代码来源:DeleteMenuCategory.php


示例18: run

 public function run()
 {
     $array = array(['name' => 'Peluang Bisnis', 'link' => 'peluang', 'order' => '0', 'menu_id' => '1', 'visible' => '1'], ['name' => 'Artikel', 'link' => 'kategori/uncategorized', 'order' => '1', 'menu_id' => '1', 'visible' => '1'], ['name' => 'Syarat & Ketentuan', 'link' => 'pages/syarat-ketentuan', 'order' => '0', 'menu_id' => '2', 'visible' => '1'], ['name' => 'Privacy Policy', 'link' => 'pages/privacy-policy', 'order' => '1', 'menu_id' => '2', 'visible' => '1'], ['name' => 'Disclaimer', 'link' => 'pages/disclaimer', 'order' => '2', 'menu_id' => '2', 'visible' => '1']);
     foreach ($array as $item) {
         MenuItem::create($item);
     }
 }
开发者ID:arbuuuud,项目名称:gnt-aops,代码行数:7,代码来源:MenuItemsTableSeeder.php


示例19: get

 /**
  * @method GET
  */
 function get($type)
 {
     $list = MenuItem::GetMenuItemsForType(SITE_ID, $type);
     $menu = array();
     foreach ($list as $row) {
         $scope = 'external';
         $pageUniqId = '';
         // set the scope of the link
         if ($row['PageId'] != '-1') {
             $scope = 'internal';
             $page = Page::GetByPageId($row['PageId']);
             if ($page != NULL) {
                 $pageUniqId = $page['PageUniqId'];
             }
         }
         // set the item
         $item = array('MenuItemUniqId' => $row['MenuItemUniqId'], 'Name' => $row['Name'], 'Url' => $row['Url'], 'PageUniqId' => $pageUniqId, 'Scope' => $scope);
         // push the item to the array
         array_push($menu, $item);
     }
     // return a json response
     $response = new Tonic\Response(Tonic\Response::OK);
     $response->contentType = 'application/json';
     $response->body = json_encode($menu);
     return $response;
 }
开发者ID:eavesmonkey,项目名称:respond,代码行数:29,代码来源:menu.php


示例20: actionView

 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id = null, $path = null)
 {
     //if path is given, find the content_id from the menu item
     if ($path) {
         $Content = Content::model()->findByAttributes(array('path' => $path));
     } else {
         $Content = $this->loadModel($id);
     }
     $Content = $this->loadModel($id);
     $MI = MenuItem::model()->findByAttributes(array('content_id' => $Content->id));
     if (!Yii::app()->user->checkAccess('Update Content')) {
         $today = new DateTime();
         $publish_on = new DateTime($Content->publish_on);
         $unpublish_on = new DateTime($Content->unpublish_on);
         if (!$Content->published || $publish_on > $today || $unpublish_on < $today) {
             throw new CHttpException(403, Yii::t('yii', 'You are not authorized to perform this action.'));
         }
     }
     //$this->layout = '//layouts/column1';
     $view = 'view';
     if ($this->getLayoutFile('//layouts/content_types/' . $Content->type)) {
         $this->layout = '//layouts/content_types/' . $Content->type;
     }
     if ($this->getViewFile($Content->type)) {
         $view = $Content->type;
     }
     $this->meta_keywords = CHtml::value($Content, 'meta_keywords');
     $this->meta_description = CHtml::value($Content, 'meta_description');
     $this->meta_author = CHtml::value($Content, 'UserCreated.full_name');
     //Used by the admin bar
     $this->Content = $Content;
     $this->render($view, array('Content' => $Content, 'MenuItem' => $MI));
 }
开发者ID:snapfrozen,项目名称:snapcms,代码行数:37,代码来源:ContentController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Menu_helper类代码示例发布时间:2022-05-23
下一篇:
PHP Menu类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap