Exemple #1
0
 $_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);
     $total_friends_protected = $fd->getTotalFriendsProtected($cfg->twitter_user_id);
     $s->assign('total_friends_protected', $total_friends_protected);
     //Percentages
     $percent_followers_loaded = $u->getPercentage($owner_stats->follower_count, $total_follows_with_full_details + $total_follows_with_errors);
     $percent_followers_loaded = $percent_followers_loaded > 100 ? 100 : $percent_followers_loaded;
 function testGetTotalFollowsWithErrors()
 {
     $dao = new FollowDAO($this->db, $this->logger);
     $total_follower_errors = $dao->getTotalFollowsWithErrors(13);
     $this->assertTrue($total_follower_errors == 1);
 }