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


PHP MenuItem::addDataset方法代码示例

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


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

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

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

示例3: getPostDetailMenuItems

 public function getPostDetailMenuItems($post)
 {
     $facebook_data_tpl = Utils::getPluginViewDirectory('facebook') . 'facebook.post.likes.tpl';
     $menus = array();
     if ($post->network == 'facebook' || $post->network == 'facebook page') {
         $likes_menu_item = new MenuItem("Likes", "Those who liked this post", $facebook_data_tpl);
         //if not logged in, show only public fav'd info
         $liked_dataset = new Dataset("likes", 'FavoritePostDAO', "getUsersWhoFavedPost", array($post->post_id, $post->network, !Session::isLoggedIn()));
         $likes_menu_item->addDataset($liked_dataset);
         $menus['likes'] = $likes_menu_item;
     }
     return $menus;
 }
开发者ID:dgw,项目名称:ThinkUp,代码行数:13,代码来源:class.FacebookPlugin.php

示例4: getPostDetailMenuItems

 /**
  * @param Post $post
  * @return array MenuItems
  */
 public function getPostDetailMenuItems($post)
 {
     $twitter_data_tpl = Utils::getPluginViewDirectory('twitter') . 'twitter.post.retweets.tpl';
     $menus = array();
     if ($post->network == 'twitter') {
         $retweets_menu_item = new MenuItem("Retweets", "Retweets of this tweet", $twitter_data_tpl, 'Twitter');
         //if not logged in, show only public retweets
         $retweets_dataset = new Dataset("retweets", 'PostDAO', "getRetweetsOfPost", array($post->post_id, 'twitter', 'default', 'km', !Session::isLoggedIn()));
         $retweets_menu_item->addDataset($retweets_dataset);
         $menus['fwds'] = $retweets_menu_item;
         // aju
         $favd_menu_item = new MenuItem("Favorited", "Those who favorited this tweet", $twitter_data_tpl);
         //if not logged in, show only public fav'd info
         $favd_dataset = new Dataset("favds", 'FavoritePostDAO', "getFavdsOfPost", array($post->post_id, 'twitter', !Session::isLoggedIn()));
         $favd_menu_item->addDataset($favd_dataset);
         $menus['favs'] = $favd_menu_item;
     }
     return $menus;
 }
开发者ID:narpaldhillon,项目名称:ThinkUp,代码行数:23,代码来源:class.TwitterPlugin.php

示例5: getDashboardMenuItems

 /**
  * Get Dashboard menu
  * @param $instance Instance
  * @return array of MenuItem objects (Tweets, Friends, Followers, etc)
  */
 public function getDashboardMenuItems($instance)
 {
     // An array to store our list of menu items in
     $menus = array();
     // Set the view template to checkins.tpl
     $checkins_data_tpl = Utils::getPluginViewDirectory('foursquare') . 'checkins.tpl';
     // Add a checkins link to the list of pages on the left
     $checkins_menu_item = new MenuItem("Checkins", "Your checkins", $checkins_data_tpl);
     // Get the data for our checkins link
     $checkins_menu_ds_1 = new Dataset("all_checkins", 'PostDAO', "getAllCheckins", array($instance->network_user_id, $instance->network, 15, "#page_number#"));
     $checkins_menu_ds_1->addHelp('userguide/listings/foursquare/dashboard_posts');
     $checkins_menu_item->addDataset($checkins_menu_ds_1);
     // Add the checkins to our array of items
     $menus['posts'] = $checkins_menu_item;
     // Return the list of items we want to display
     return $menus;
 }
开发者ID:randomecho,项目名称:ThinkUp,代码行数:22,代码来源:class.FoursquarePlugin.php

示例6: getPostDetailMenuItems

 /**
  * @param Post $post
  * @return array MenuItems
  */
 public function getPostDetailMenuItems($post)
 {
     $twitter_data_tpl = Utils::getPluginViewDirectory('twitter') . 'twitter.post.retweets.tpl';
     $menus = array();
     $rt_plugin_active = false;
     $plugin_dao = DAOFactory::getDAO('PluginDAO');
     $plugin_id = $plugin_dao->getPluginId('twitterrealtime');
     if (isset($plugin_id)) {
         $rt_plugin_active = $plugin_dao->isPluginActive($plugin_id);
     }
     if ($post->network == 'twitter') {
         $retweets_menu_item = new MenuItem("Retweets", "Retweets of this tweet", $twitter_data_tpl);
         //if not logged in, show only public retweets
         $retweets_dataset = new Dataset("retweets", 'PostDAO', "getRetweetsOfPost", array($post->post_id, 'twitter', 'default', 'km', !Session::isLoggedIn()));
         $retweets_menu_item->addDataset($retweets_dataset);
         $menus['fwds'] = $retweets_menu_item;
         if ($rt_plugin_active) {
             $favd_menu_item = new MenuItem("Favorited", "Those who favorited this tweet", $twitter_data_tpl);
             //if not logged in, show only public fav'd info
             $favd_dataset = new Dataset("favds", 'FavoritePostDAO', "getUsersWhoFavedPost", array($post->post_id, 'twitter', !Session::isLoggedIn()));
             $favd_menu_item->addDataset($favd_dataset);
             $menus['favs'] = $favd_menu_item;
         }
     }
     return $menus;
 }
开发者ID:randomecho,项目名称:ThinkUp,代码行数:30,代码来源:class.TwitterPlugin.php

示例7: getDashboardMenuItems

    public function getDashboardMenuItems($instance) {
        $fb_data_tpl = Utils::getPluginViewDirectory('facebook').'facebook.inline.view.tpl';

        $menus = array();

        //All tab
        $alltab = new MenuItem("All", '', $fb_data_tpl, 'Posts');
        $alltabds = new Dataset("all_facebook_posts", 'PostDAO', "getAllPosts",
        array($instance->network_user_id, $instance->network, 15, "#page_number#"),
        'getAllPostsIterator', array($instance->network_user_id, $instance->network, GridController::MAX_ROWS), false );
        $alltab->addDataset($alltabds);
        $menus["all_facebook_posts"] = $alltab;

        // Most replied-to tab
        $mrttab = new MenuItem("Most replied-to", "Posts with most replies", $fb_data_tpl);
        $mrttabds = new Dataset("most_replied_to_posts", 'PostDAO', "getMostRepliedToPosts",
        array($instance->network_user_id, $instance->network, 15, '#page_number#'));
        $mrttab->addDataset($mrttabds);
        $menus["mostreplies"] = $mrttab;

        //Questions tab
        $qtab = new MenuItem("Inquiries", "Inquiries, or posts with a question mark in them",
        $fb_data_tpl);
        $qtabds = new Dataset("all_facebook_posts", 'PostDAO', "getAllQuestionPosts",
        array($instance->network_user_id, $instance->network, 15, "#page_number#"));
        $qtab->addDataset($qtabds);
        $menus["questions"] = $qtab;

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

示例8: getDashboardMenuItems

 public function getDashboardMenuItems($instance)
 {
     $menus = array();
     $posts_data_tpl = Utils::getPluginViewDirectory('googleplus') . 'posts.tpl';
     $posts_menu_item = new MenuItem("Posts", "Post insights", $posts_data_tpl);
     $posts_menu_ds_1 = new Dataset("all_posts", 'PostDAO', "getAllPosts", array($instance->network_user_id, $instance->network, 3, "#page_number#"), 'getAllPostsIterator', array($instance->network_user_id, $instance->network, GridController::getMaxRows()), false);
     $posts_menu_item->addDataset($posts_menu_ds_1);
     $posts_menu_ds_2 = new Dataset("most_replied_to", 'PostDAO', "getMostRepliedToPosts", array($instance->network_user_id, $instance->network, 3, '#page_number#'));
     $posts_menu_item->addDataset($posts_menu_ds_2);
     $posts_menu_ds_3 = new Dataset("plus_oned", 'PostDAO', "getMostFavedPosts", array($instance->network_user_id, $instance->network, 3, '#page_number#'));
     $posts_menu_item->addDataset($posts_menu_ds_3);
     $posts_menu_ds_4 = new Dataset("questions", 'PostDAO', "getAllQuestionPosts", array($instance->network_user_id, $instance->network, 3, "#page_number#"));
     $posts_menu_item->addDataset($posts_menu_ds_4);
     $menus['posts'] = $posts_menu_item;
     $gp_data_tpl = Utils::getPluginViewDirectory('googleplus') . 'googleplus.inline.view.tpl';
     //All tab
     $alltab = new MenuItem("All posts", 'All posts', $gp_data_tpl, 'posts');
     $alltabds = new Dataset("gplus_posts", 'PostDAO', "getAllPosts", array($instance->network_user_id, $instance->network, 15, "#page_number#"), 'getAllPostsIterator', array($instance->network_user_id, $instance->network, GridController::getMaxRows()), false);
     $alltabds->addHelp('userguide/listings/googleplus/dashboard_all_gplus_posts');
     $alltab->addDataset($alltabds);
     $menus["posts-all"] = $alltab;
     // Most replied-to tab
     $mrttab = new MenuItem("Most discussed", "Posts with the most comments", $gp_data_tpl, 'posts');
     $mrttabds = new Dataset("gplus_posts", 'PostDAO', "getMostRepliedToPosts", array($instance->network_user_id, $instance->network, 15, '#page_number#'));
     $mrttabds->addHelp('userguide/listings/googleplus/dashboard_mostreplies');
     $mrttab->addDataset($mrttabds);
     $menus["posts-mostreplies"] = $mrttab;
     // Most liked posts
     $mltab = new MenuItem("Most +1'ed", "Posts with most +1s", $gp_data_tpl, 'posts');
     $mltabds = new Dataset("gplus_posts", 'PostDAO', "getMostFavedPosts", array($instance->network_user_id, $instance->network, 15, '#page_number#'));
     $mltabds->addHelp('userguide/listings/googleplus/dashboard_mostlikes');
     $mltab->addDataset($mltabds);
     $menus["posts-mostplusones"] = $mltab;
     //Questions tab
     $qtab = new MenuItem("Inquiries", "Inquiries, or posts with a question mark in them", $gp_data_tpl, 'posts');
     $qtabds = new Dataset("gplus_posts", 'PostDAO', "getAllQuestionPosts", array($instance->network_user_id, $instance->network, 15, "#page_number#"));
     $qtabds->addHelp('userguide/listings/googleplus/dashboard_questions');
     $qtab->addDataset($qtabds);
     $menus["posts-questions"] = $qtab;
     return $menus;
 }
开发者ID:kuthulas,项目名称:ProjectX,代码行数:41,代码来源:class.GooglePlusPlugin.php

示例9: getDashboardMenu

 public function getDashboardMenu($instance)
 {
     $twitter_data_tpl = Utils::getPluginViewDirectory('twitter') . 'twitter.inline.view.tpl';
     $menus = array();
     $tweets_menu = new Menu('Tweets');
     //All tab
     $all_mi = new MenuItem("tweets-all", "All Tweets", "All tweets", $twitter_data_tpl);
     $all_mi_ds = new Dataset("all_tweets", 'PostDAO', "getAllPosts", array($instance->network_user_id, 'twitter', 15, "#page_number#"), 'getAllPostsIterator', array($instance->network_user_id, 'twitter', GridController::MAX_ROWS));
     $all_mi->addDataset($all_mi_ds);
     $tweets_menu->addMenuItem($all_mi);
     //Questions
     $q_mi = new MenuItem("tweets-questions", "Inquiries", "Inquiries, or tweets with a question mark in them", $twitter_data_tpl);
     $q_mi_ds = new Dataset("all_tweets", 'PostDAO', "getAllQuestionPosts", array($instance->network_user_id, 'twitter', 15, "#page_number#"));
     $q_mi->addDataset($q_mi_ds);
     $tweets_menu->addMenuItem($q_mi);
     // Most replied-to
     $mrt_mi = new MenuItem("tweets-mostreplies", "Most replied-to", "Tweets with most replies", $twitter_data_tpl);
     $mrt_mi_ds = new Dataset("most_replied_to_tweets", 'PostDAO', "getMostRepliedToPosts", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $mrt_mi->addDataset($mrt_mi_ds);
     $tweets_menu->addMenuItem($mrt_mi);
     // Most shared
     $mstab = new MenuItem("tweets-mostretweeted", "Most retweeted", "Most retweeted tweets", $twitter_data_tpl);
     $mstabds = new Dataset("most_retweeted", 'PostDAO', "getMostRetweetedPosts", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $mstab->addDataset($mstabds);
     $tweets_menu->addMenuItem($mstab);
     array_push($menus, $tweets_menu);
     $replies_menu = new Menu('Replies');
     if (Session::isLoggedIn()) {
         //show protected tweets
         //All Mentions
         $amtab = new MenuItem("mentions-all", "All Mentions", "Any post that mentions you", $twitter_data_tpl);
         $amtabds1 = new Dataset("all_tweets", 'PostDAO', "getAllPosts", array($instance->network_user_id, 'twitter', 15), "getAllMentionsIterator", array($instance->network_username, GridController::MAX_ROWS, 'twitter'));
         $amtabds2 = new Dataset("all_mentions", 'PostDAO', "getAllMentions", array($instance->network_username, 15, $instance->network, '#page_number#'));
         $amtab->addDataset($amtabds1);
         $amtab->addDataset($amtabds2);
         $replies_menu->addMenuItem($amtab);
         //All Replies
         $artab = new MenuItem("mentions-allreplies", "Replies", "Posts that directly reply to you (i.e., start with your name)", $twitter_data_tpl);
         $artabds = new Dataset("all_replies", 'PostDAO', "getAllReplies", array($instance->network_user_id, 'twitter', 15));
         $artab->addDataset($artabds);
         $replies_menu->addMenuItem($artab);
         //All Orphan Mentions
         $omtab = new MenuItem("mentions-orphan", "Not Replies or Forwards", "Mentions that are not associated with a specific post", $twitter_data_tpl);
         $omtabds1 = new Dataset("all_tweets", 'PostDAO', "getAllPosts", array($instance->network_user_id, 'twitter', 15));
         $omtabds2 = new Dataset("orphan_replies", 'PostDAO', "getOrphanReplies", array($instance->network_username, 5, $instance->network));
         $omtab->addDataset($omtabds1);
         $omtab->addDataset($omtabds2);
         $replies_menu->addMenuItem($omtab);
         //All Mentions Standalone
         $sttab = new MenuItem("mentions-standalone", "Standalone Mentions", "Mentions you have marked as standalone", $twitter_data_tpl);
         $sttabds1 = new Dataset("standalone_replies", 'PostDAO', "getStandaloneReplies", array($instance->network_username, 'twitter', 15));
         $sttabds2 = new Dataset("all_tweets", 'PostDAO', "getAllPosts", array($instance->network_user_id, 'twitter', 15));
         $sttab->addDataset($sttabds1);
         $sttab->addDataset($sttabds2);
         $replies_menu->addMenuItem($sttab);
     } else {
         //All public mentions
         $amtab = new MenuItem("mentions-all", "All Mentions", "Any post that mentions you", $twitter_data_tpl);
         $amtabds2 = new Dataset("all_mentions", 'PostDAO', "getAllMentions", array($instance->network_username, 15, $instance->network, '#page_number#', true));
         $amtab->addDataset($amtabds2);
         $replies_menu->addMenuItem($amtab);
     }
     // Conversations
     $convotab = new MenuItem("tweets-convo", "Conversations", "Exchanges between you and other users", $twitter_data_tpl);
     $convotabds = new Dataset("author_replies", 'PostDAO', "getPostsAuthorHasRepliedTo", array($instance->network_user_id, 15, 'twitter', '#page_number#'));
     $convotab->addDataset($convotabds);
     $replies_menu->addMenuItem($convotab);
     array_push($menus, $replies_menu);
     $friends_menu = new Menu('Who You Follow');
     //Most Active Friends
     $motab = new MenuItem("friends-mostactive", 'Chatterboxes', '', $twitter_data_tpl);
     $motabds = new Dataset('people', 'FollowDAO', "getMostActiveFollowees", array($instance->network_user_id, 'twitter', 15));
     $motab->addDataset($motabds);
     $friends_menu->addMenuItem($motab);
     //Least Active Friends
     $latab = new MenuItem("friends-leastactive", 'Deadbeats', '', $twitter_data_tpl);
     $latabds = new Dataset("people", 'FollowDAO', "getLeastActiveFollowees", array($instance->network_user_id, 'twitter', 15));
     $latab->addDataset($latabds);
     $friends_menu->addMenuItem($latab);
     //Popular friends
     $poptab = new MenuItem("friends-mostfollowed", 'Popular', '', $twitter_data_tpl);
     $poptabds = new Dataset("people", 'FollowDAO', "getMostFollowedFollowees", array($instance->network_user_id, 'twitter', 15));
     $poptab->addDataset($poptabds);
     $friends_menu->addMenuItem($poptab);
     if (Session::isLoggedIn()) {
         //Former Friends
         $fftab = new MenuItem("friends-former", "Former", '', $twitter_data_tpl);
         $fftabds = new Dataset("people", 'FollowDAO', "getFormerFollowees", array($instance->network_user_id, 'twitter', 15));
         $fftab->addDataset($fftabds);
         $friends_menu->addMenuItem($fftab);
         //Not Mutual Friends
         $nmtab = new MenuItem("friends-notmutual", "Not Mutual", '', $twitter_data_tpl);
         $nmtabds = new Dataset("people", 'FollowDAO', "getFriendsNotFollowingBack", array('twitter', $instance->network_user_id));
         $nmtab->addDataset($nmtabds);
         $friends_menu->addMenuItem($nmtab);
     }
     array_push($menus, $friends_menu);
     $followers_menu = new Menu('Followers');
     //Follower count history
     $follower_history_tpl = Utils::getPluginViewDirectory('twitter') . 'twitter.followercount.tpl';
//.........这里部分代码省略.........
开发者ID:kalion,项目名称:ThinkUp,代码行数:101,代码来源:class.TwitterPlugin.php


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