Exemplo n.º 1
0
 /**
  * Generates html block with question info.
  *
  * @todo also get count and N first
  * followers
  * Followers to be selected from USERS collection
  * using find() by a_f_q and using limit 5
  * and then link to 'show more' if i_flwrs in Question is > 5
  *
  *
  * @param Question $Question
  * @return string
  */
 public function getHtml(Question $Question)
 {
     $this->Question = $Question;
     $tagsBlock = \tplBoxrecent::parse(array('title' => '@@Question tags@@', 'id' => 'question_tags', $this->getTags()), false);
     $ret = \tplQuestionInfo::parse(array('tags' => $tagsBlock, 'asked' => TimeAgo::format(new \DateTime(str_replace(' AEST', ' UTC+10', $Question['hts']))) . ' ago', 'updated' => TimeAgo::format(new \DateTime(date('r', $Question['i_lm_ts']))) . ' ago', 'views' => $this->Question['i_views'], 'ans_count' => $this->Question->getAnswerCount(), 'asked_label' => '@@Asked@@', 'updated_label' => '@@Last updated@@', 'ans_count_label' => '@@Number of Answers@@', 'views_label' => '@@Number of Views@@'));
     return $ret;
 }
 /**
  * Generates html block with question info.
  *
  * @todo also get count and N first
  * followers
  * Followers to be selected from USERS collection
  * using find() by a_f_q and using limit 5
  * and then link to 'show more' if i_flwrs in Question is > 5
  *
  *
  * @param Question $Question
  */
 public function getHtml(Question $Question)
 {
     $this->Question = $Question;
     $Tr = $this->Registry->Tr;
     /**
      * @todo translate Title string
      */
     $tagsBlock = \tplBoxrecent::parse(array('title' => $Tr['Topic tags'], 'id' => 'question_tags', $this->getTags()), false);
     /**
      * @todo translate labels used
      * in tplQuestionsInfo template
      *
      */
     $ret = \tplQuestionInfo::parse(array('tags' => $tagsBlock, 'asked' => TimeAgo::format(new \DateTime($Question['hts'])) . ' ago', 'updated' => TimeAgo::format(new \DateTime(date('r', $Question['i_lm_ts']))) . ' ago', 'views' => $this->Question['i_views'], 'ans_count' => $this->Question->getAnswerCount(), 'asked_label' => $Tr['Posted'], 'updated_label' => $Tr['Last updated'], 'ans_count_label' => $Tr['Number of posts'], 'views_label' => $Tr['Number of Views']));
     d('$ret: ' . $ret);
     return $ret;
 }
 public function getHtml()
 {
     $edit = '';
     $lastActive = $this->User['i_lm_ts'];
     $lastActive = !empty($lastActive) ? $lastActive : $this->User['i_reg_ts'];
     $pp = $this->User->getProfitPoint();
     d('pp: ' . $pp);
     $uid = $this->User->getUid();
     $isSameUser = $this->Registry->Viewer->getUid() === $uid;
     if ($isSameUser || $this->Registry->Viewer->isModerator()) {
         $edit = '<div class="fl middle"><span class="icoc key">&nbsp;</span><a href="/editprofile/' . $uid . '" class="edit middle">Edit profile</a></div>';
     }
     $desc = \trim($this->User['description']);
     $desc = empty($desc) ? '' : Utf8String::factory($desc, 'utf-8', true)->linkify()->valueOf();
     $vars = array('editLink' => $edit, 'username' => $this->User->username, 'avatar' => $this->User->getAvatarImgSrc(), 'profitpoint' => $pp, 'name' => $this->User->getDisplayName(), 'genderLabel' => 'Gender', 'gender' => $this->getGender(), 'since' => date('F j, Y', $this->User->i_reg_ts), 'lastActivity' => TimeAgo::format(new \DateTime(date('r', $lastActive))), 'website' => $this->User->getUrl(), 'twitter' => '<div id="my_tw">' . $this->getTwitterAccount($isSameUser) . '</div>', 'age' => $this->User->getAge(), 'facebook' => '<div id="my_fb">' . $this->getFacebookAccount($isSameUser) . '</div>', 'tumblr' => '<div id="my_tm">' . $this->getTumblrAccount($isSameUser) . '</div>', 'blogger' => '<div id="my_bg">' . $this->getBloggerAccount($isSameUser) . '</div>', 'linkedin' => '<div id="my_li">' . $this->getLinkedInAccount($isSameUser) . '</div>', 'location' => $this->User->getLocation(), 'description' => \wordwrap($desc, 50), 'editRole' => Usertools::getHtml($this->Registry, $this->User), 'followButton' => $this->makeFollowButton(), 'followers' => ShowFollowers::factory($this->Registry)->getUserFollowers($this->User), 'following' => ShowFollowers::factory($this->Registry)->getUserFollowing($this->User));
     return \tplUserInfo::parse($vars);
 }