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


PHP UserDAO::getDetails方法代码示例

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


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

示例1: testFetchInstanceUserInfo

 function testFetchInstanceUserInfo()
 {
     $tc = new TwitterCrawler($this->instance, $this->logger, $this->api, $this->db);
     $tc->fetchInstanceUserInfo();
     $udao = new UserDAO($this->db, $this->logger);
     $user = $udao->getDetails(36823);
     $this->assertTrue($user->id == 1);
     $this->assertTrue($user->user_id == 36823);
     $this->assertTrue($user->username == 'anildash');
     $this->assertTrue($user->found_in == 'Owner Status');
 }
开发者ID:ukd1,项目名称:thinktank,代码行数:11,代码来源:twittercrawler_test.php

示例2: testFavByOwner

 public function testFavByOwner()
 {
     $item = $this->getJSONStringFromFile("fav_by_owner.json");
     $this->json_parser->parseJSON($item);
     $posts = $this->favs_dao->getAllFavoritePosts(2768241, 'twitter', 10);
     $this->assertEqual(sizeof($posts), 1);
     // test users added
     $user = $this->user_dao->getDetails(9207632, 'twitter');
     $this->assertEqual($user->user_id, 9207632);
     $user = $this->user_dao->getDetails(2768241, 'twitter');
     $this->assertEqual($user->user_id, 2768241);
 }
开发者ID:rmanalan,项目名称:ThinkUp,代码行数:12,代码来源:TestOfTwitterJSONStreamParser.php

示例3: control

 public function control()
 {
     /*
      * Check if the view is cached and, if it is, return the cached version before any of the application login
      * is executed.
      */
     if ($this->view_mgr->isViewCached()) {
         if ($this->view_mgr->is_cached('json.tpl', $this->getCacheKeyString())) {
             // set the json data to keep the ThinkUpController happy.
             $this->setJsonData(array());
             return $this->generateView();
         }
     }
     /*
      * Check if the API is disabled and, if it is, throw the appropriate exception.
      *
      * Docs: http://thinkupapp.com/docs/userguide/api/errors/apidisabled.html
      */
     $is_api_disabled = Config::getInstance()->getValue('is_api_disabled');
     if ($is_api_disabled) {
         throw new APIDisabledException();
     }
     // fetch the correct PostDAO and UserDAO from the DAOFactory
     $this->post_dao = DAOFactory::getDAO('PostDAO');
     $this->user_dao = DAOFactory::getDAO('UserDAO');
     /*
      * Use the information gathered from the query string to retrieve a
      * User object. This will be the standard object with which to get
      * User information from in API calls.
      */
     if ($this->user_id != null) {
         $this->user = $this->user_dao->getDetails($this->user_id, $this->network);
     } else {
         if ($this->username != null) {
             $this->user = $this->user_dao->getUserByName($this->username, $this->network);
         } else {
             $this->user = null;
         }
     }
     //Privacy checks
     if (substr($this->type, 0, 4) == 'user') {
         //user-related API call
         if (is_null($this->user)) {
             // Check why the User object is null. Could be missing required fields or not found.
             if (is_null($this->user_id) && is_null($this->username)) {
                 $m = 'A request of type ' . $this->type . ' requires a user_id or username to be specified.';
                 throw new RequiredArgumentMissingException($m);
             } else {
                 throw new UserNotFoundException();
             }
         } elseif ($this->user->is_protected) {
             //user is protected on originating network
             throw new UserNotFoundException();
         } else {
             $instance_dao = DAOFactory::getDAO('InstanceDAO');
             $instance = $instance_dao->getByUsernameOnNetwork($this->user->username, $this->user->network);
             if (isset($instance)) {
                 if (!$instance->is_public) {
                     //user is protected on ThinkUp
                     throw new UserNotFoundException();
                 }
             }
         }
     } else {
         //post-related API call
         if ($this->network == "facebook") {
             //assume all Facebook posts are private
             throw new PostNotFoundException();
         }
     }
     /*
      * This switch statement is the main part of this function. It decides
      * what type of posts will be fetched depending on the "type" GET
      * variable and use the PostDAO to fetch the appropriate posts from
      * the database.
      *
      * If a required field is missing it will create an error field to
      * output in JSON.
      */
     switch ($this->type) {
         /*
          * Gets a post.
          *
          * Required arguments: post_id
          *
          * Optional arguments: network, include_entities, include_replies, trim_user
          *
          * Docs: http://thinkupapp.com/docs/userguide/api/posts/post.html
          */
         case 'post':
             if (is_null($this->post_id)) {
                 $m = 'A request of type ' . $this->type . ' requires a post_id to be specified.';
                 throw new RequiredArgumentMissingException($m);
             } else {
                 $data = $this->post_dao->getPost($this->post_id, $this->network, $this->is_public);
             }
             break;
             /*
              * Gets all retweets to a post.
              *
//.........这里部分代码省略.........
开发者ID:randomecho,项目名称:ThinkUp,代码行数:101,代码来源:class.PostAPIController.php

示例4: serialize

         $db->closeConnection($conn);
         die;
     }
 }
 // save the session instance network username to the current instance
 $_SESSION['network_username'] = $i->network_username;
 $_SESSION['instance'] = serialize($i);
 if (!$s->is_cached('index.tpl', $i->network_username . "-" . $_SESSION['user'])) {
     $cfg = new Config($i->network_username, $i->network_user_id);
     $u = new Utils();
     // instantiate data access objects
     $ud = new UserDAO($db);
     $pd = new PostDAO($db);
     $fd = new FollowDAO($db);
     // pass data to smarty
     $owner_stats = $ud->getDetails($i->network_user_id);
     $s->assign('owner_stats', $owner_stats);
     $s->assign('instance', $i);
     $s->assign('instances', $id->getByOwner($owner));
     $s->assign('cfg', $cfg);
     $total_follows_with_errors = $fd->getTotalFollowsWithErrors($cfg->twitter_user_id);
     $s->assign('total_follows_with_errors', $total_follows_with_errors);
     $total_follows_with_full_details = $fd->getTotalFollowsWithFullDetails($cfg->twitter_user_id);
     $s->assign('total_follows_with_full_details', $total_follows_with_full_details);
     $total_follows_protected = $fd->getTotalFollowsProtected($cfg->twitter_user_id);
     $s->assign('total_follows_protected', $total_follows_protected);
     //TODO: Get friends with full details and also friends with errors, same as with followers
     $total_friends_loaded = $fd->getTotalFriends($cfg->twitter_user_id);
     $s->assign('total_friends', $total_friends_loaded);
     $total_friends_with_errors = $fd->getTotalFriendsWithErrors($cfg->twitter_user_id);
     $s->assign('total_friends_with_errors', $total_friends_with_errors);
开发者ID:ukd1,项目名称:thinktank,代码行数:31,代码来源:index.php

示例5: testGetDetailsUserDoesNotExist

 function testGetDetailsUserDoesNotExist()
 {
     $udao = new UserDAO($this->db, $this->logger);
     $user = $udao->getDetails(13);
     $this->assertTrue(!isset($user));
 }
开发者ID:BenBtg,项目名称:thinktank,代码行数:6,代码来源:userdao_test.php

示例6: SmartyThinkTank

     if (!isset($i) && $i == null) {
         echo 'You have no Twitter accounts configured. <a href="' . $THINKTANK_CFG['site_root_path'] . 'account/">Set up a Twitter account here</a>';
         $db->closeConnection($conn);
         die;
     }
 }
 $s = new SmartyThinkTank();
 if (!$s->is_cached('index.tpl', $i->twitter_username . "-" . $_SESSION['user'])) {
     $cfg = new Config($i->twitter_username, $i->twitter_user_id);
     $u = new Utils();
     // instantiate data access objects
     $ud = new UserDAO($db);
     $td = new TweetDAO($db);
     $fd = new FollowDAO($db);
     // pass data to smarty
     $owner_stats = $ud->getDetails($cfg->twitter_user_id);
     $s->assign('owner_stats', $owner_stats);
     $s->assign('instance', $i);
     $s->assign('instances', $id->getByOwner($owner));
     $s->assign('cfg', $cfg);
     $total_follows_with_errors = $fd->getTotalFollowsWithErrors($cfg->twitter_user_id);
     $s->assign('total_follows_with_errors', $total_follows_with_errors);
     $total_follows_with_full_details = $fd->getTotalFollowsWithFullDetails($cfg->twitter_user_id);
     $s->assign('total_follows_with_full_details', $total_follows_with_full_details);
     $total_follows_protected = $fd->getTotalFollowsProtected($cfg->twitter_user_id);
     $s->assign('total_follows_protected', $total_follows_protected);
     //TODO: Get friends with full details and also friends with errors, same as with followers
     $total_friends_loaded = $fd->getTotalFriends($cfg->twitter_user_id);
     $s->assign('total_friends', $total_friends_loaded);
     $total_friends_with_errors = $fd->getTotalFriendsWithErrors($cfg->twitter_user_id);
     $s->assign('total_friends_with_errors', $total_friends_with_errors);
开发者ID:nickthornley,项目名称:thinktank,代码行数:31,代码来源:index.php


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