예제 #1
0
 /**
  * Display the full list of people who likes this stream item
  *
  * @param <type> $objResponse
  * @param <type> $actid
  * @param <type> $like_type
  * @param <type> $like_id
  */
 private function _streamShowLikes($objResponse, $actid, $like_type, $like_id, $target = '')
 {
     $my = CFactory::getUser();
     $like = new CLike();
     $likes = $like->getWhoLikes($like_type, $like_id);
     $canUnlike = false;
     $likeHTML = '';
     $likeUsers = array();
     foreach ($likes as $user) {
         $likeUsers[] = '<a href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a>';
         if ($my->id == $user->id) {
             $canUnlike = true;
         }
     }
     if (count($likeUsers) != 0) {
         if ($target === 'popup') {
             $tmpl = new CTemplate();
             $tmpl->set('users', $likes);
             $likeHTML = $tmpl->fetch('ajax.stream.showothers');
         } else {
             $likeHTML .= implode(", ", $likeUsers);
             $likeHTML = CStringHelper::isPlural(count($likeUsers)) ? JText::sprintf('COM_COMMUNITY_LIKE_THIS_MANY_LIST', $likeHTML) : JText::sprintf('COM_COMMUNITY_LIKE_THIS_LIST', $likeHTML);
         }
     }
     return $likeHTML;
 }
예제 #2
0
 public function ajaxshowLikedUser($wallId)
 {
     $like = new CLike();
     $users = $like->getWhoLikes('comment', $wallId);
     $tmpl = new CTemplate();
     $tmpl->set('users', $users);
     $html = $tmpl->fetch('ajax.stream.showothers');
     $json = array('html' => $html);
     die(json_encode($json));
 }
예제 #3
0
 /**
  * Display the full list of people who likes this stream item
  *
  * @param <type> $objResponse
  * @param <type> $actid
  * @param <type> $like_type
  * @param <type> $like_id
  */
 private function _streamShowLikes($objResponse, $actid, $like_type, $like_id)
 {
     CFactory::load('libraries', 'like');
     CFactory::load('helpers', 'url');
     $my = CFactory::getUser();
     $like = new CLike();
     $likes = $like->getWhoLikes($like_type, $like_id);
     $canUnlike = false;
     $likeHTML = '';
     $likeUsers = array();
     foreach ($likes as $user) {
         $likeUsers[] = '<a href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a>';
         if ($my->id == $user->id) {
             $canUnlike = true;
         }
     }
     if (count($likeUsers) == 0) {
         $likeHTML = JText::_('COM_COMMUNITY_NO_ONE_LIKE_THIS');
     } else {
         $likeHTML = implode(", ", $likeUsers);
         $likeHTML = CStringHelper::isPlural(count($likeUsers)) ? JText::sprintf('COM_COMMUNITY_LIKE_THIS_MANY_LIST', $likeHTML) : JText::sprintf('COM_COMMUNITY_LIKE_THIS_LIST', $likeHTML);
     }
     // Append (Unlike) if necessary
     //if( $canUnlike )
     //{
     //	$likeHTML .= ' <a href="#unlike" onclick="jax.call(\'community\', \'system,ajaxStreamUnlike\', \''.$actid. '\' );return false;">Unlike</a>';
     //}
     // When we show all, we hide the count, the "3 people like this"
     $objResponse->addScriptCall("joms.jQuery('*[id\$=profile-newsfeed-item{$actid}] .wallicon-like').html", "{$likeHTML}");
 }