Example #1
0
 /**
  * Fetches the wall content template and returns the wall data in HTML format
  *
  * @param    appType            The application type to load the walls from
  * @param    uniqueId        The unique id for the specific application
  * @param    isOwner            Boolean value if the current browser is owner of the specific app or profile
  * @param    limit            The limit to display the walls
  * @param    templateFile    The template file to use.
  * */
 public static function getWallContents($appType, $uniqueId, $isOwner, $limit = 0, $limitstart = 0, $templateFile = 'wall/content', $processFunc = '', $param = null, $banned = 0)
 {
     CError::assert($appType, '', '!empty', __FILE__, __LINE__);
     //CError::assert($uniqueId, '', '!empty', __FILE__, __LINE__);
     $config = CFactory::getConfig();
     $html = '<div class="joms-comment joms-js--comments joms-js--comments-' . $uniqueId . '" data-id="' . $uniqueId . '" data-type="' . $appType . '">';
     $model = CFactory::getModel('wall');
     if ($limit == 0) {
         $limit = 20000;
         // let there be no limit at all
     }
     if ($appType == 'albums' || $appType == 'photos' || $appType == 'videos') {
         $order = 'DESC';
         $walls = $model->getPost($appType, $uniqueId, $limit, $limitstart, $order);
         if (count($walls)) {
             $walls = array_reverse($walls);
         }
     } else {
         // Special 'discussions'
         $order = 'DESC';
         $walls = $model->getPost($appType, $uniqueId, $limit, $limitstart, $order);
     }
     // Special 'discussions'
     $discussionsTrigger = false;
     //$order = $config->get('group_discuss_order');
     if ($appType == 'discussions' && $order == 'DESC') {
         $walls = array_reverse($walls);
         $discussionsTrigger = true;
     }
     if ($walls) {
         //Process wall comments
         $wallComments = array();
         $comment = new CComment();
         for ($i = 0; $i < count($walls); $i++) {
             // Set comments
             $wall = $walls[$i];
             $wallComments[] = $wall->comment;
             if (CFactory::getUser($wall->post_by)->block) {
                 $wall->comment = JText::_('COM_COMMUNITY_CENSORED');
             } else {
                 $wall->comment = $comment->stripCommentData($wall->comment);
             }
             // Change '->created to lapse format if stream uses lapse format'
             if ($config->get('activitydateformat') == 'lapse') {
                 //$wall->date = CTimeHelper::timeLapse($wall->date);
             }
         }
         // Trigger the wall applications / plugins
         CWall::triggerWallComments($walls);
         for ($i = 0; $i < count($walls); $i++) {
             if ($banned == 1) {
                 $html .= CWallLibrary::_getWallHTML($walls[$i], $wallComments[$i], $appType, $isOwner, $processFunc, $templateFile, $banned);
             } else {
                 $html .= CWallLibrary::_getWallHTML($walls[$i], $wallComments[$i], $appType, $isOwner, $processFunc, $templateFile);
             }
         }
         // if ($appType == 'discussions') {
         //     $wallCount = CWallLibrary::getWallCount('discussions', $uniqueId);
         //     $limitStart = $limitstart + $limit;
         //     if ($wallCount > $limitStart) {
         //         $groupId = JRequest::getInt('groupid');
         //         $groupId = empty($groupId) ? $param : $groupId;
         //         if ($discussionsTrigger) {
         //             $html = CWallLibrary::_getOlderWallsHTML($groupId, $uniqueId, $limitStart) . $html;
         //         } else {
         //             $html .= CWallLibrary::_getOlderWallsHTML($groupId, $uniqueId, $limitStart);
         //         }
         //     }
         // }
     }
     $html .= '</div>';
     return $html;
 }
Example #2
0
 /**
  * Fill up the 'all comment fields with.. all comments
  *
  */
 public function ajaxStreamShowComments($actid, $type = false)
 {
     if ($type) {
         $this->ajaxWallShowComments($actid, $type);
         return;
     }
     $filter = JFilterInput::getInstance();
     $actid = $filter->clean($actid, 'int');
     $wallModel = CFactory::getModel('wall');
     // Pull the activity record and find out the actor
     // only allow comment if the actor is a friend of current user
     $act = JTable::getInstance('Activity', 'CTable');
     $act->load($actid);
     $params = new CParameter($act->params);
     if ($act->comment_type == 'photos' && $params->get('batchcount', 0) > 1) {
         $act->comment_type = 'albums';
         $act->comment_id = $act->cid;
     } else {
         if ($act->comment_type == 'videos.linking') {
             $act->comment_type = 'videos';
             $act->comment_id = $act->cid;
         }
     }
     $comments = $wallModel->getAllPost($act->comment_type, $act->comment_id);
     $commentsHTML = '';
     CWall::triggerWallComments($comments, false);
     foreach ($comments as $row) {
         $row->params = new CParameter($row->get('params', '{}'));
         if ($row->type == 'albums' && $row->params->get('activityId', NULL) != $actid && $params->get('batchcount', 0) > 1) {
             continue;
         }
         $commentsHTML .= CWall::formatComment($row);
     }
     $json = array();
     $json['success'] = true;
     $json['html'] = $commentsHTML;
     die(json_encode($json));
 }
Example #3
0
 /**
  * Fetches the wall content template and returns the wall data in HTML format
  *
  * @param	appType			The application type to load the walls from
  * @param	uniqueId		The unique id for the specific application	 
  * @param	isOwner			Boolean value if the current browser is owner of the specific app or profile
  * @param	limit			The limit to display the walls
  * @param	templateFile	The template file to use.
  **/
 function getWallContents($appType, $uniqueId, $isOwner, $limit = 0, $limitstart = 0, $templateFile = 'wall.content', $processFunc = '', $param = null)
 {
     CError::assert($appType, '', '!empty', __FILE__, __LINE__);
     CError::assert($uniqueId, '', '!empty', __FILE__, __LINE__);
     $config = CFactory::getConfig();
     $html = '<div id="wall-containter">';
     $model = CFactory::getModel('wall');
     //@rule: If limit is not set, then we need to use Joomla's limit
     if ($limit == 0) {
         $jConfig =& JFactory::getConfig();
         $limit = $jConfig->getValue('list_limit');
     }
     // Special 'discussions'
     $order = 'DESC';
     //if($appType == 'discussions'){
     //$order = $config->get('group_discuss_order');
     //$discussionsTrigger = true;
     //}
     $walls = $model->getPost($appType, $uniqueId, $limit, $limitstart, $order);
     // Special 'discussions'
     $discussionsTrigger = false;
     $order = $config->get('group_discuss_order');
     if ($appType == 'discussions' && $order == 'ASC') {
         $walls = array_reverse($walls);
         $discussionsTrigger = true;
     }
     if ($walls) {
         //Process wall comments
         CFactory::load('libraries', 'comment');
         $wallComments = array();
         $comment = new CComment();
         for ($i = 0; $i < count($walls); $i++) {
             $wall = $walls[$i];
             $wallComments[] = $wall->comment;
             $wall->comment = $comment->stripCommentData($wall->comment);
         }
         // Trigger the wall applications / plugins
         CWall::triggerWallComments($walls);
         for ($i = 0; $i < count($walls); $i++) {
             $html .= CWallLibrary::_getWallHTML($walls[$i], $wallComments[$i], $appType, $isOwner, $processFunc, $templateFile);
         }
         if ($appType == 'discussions') {
             $wallCount = CWallLibrary::getWallCount('discussions', $uniqueId);
             $limitStart = $limitstart + $limit;
             //$limitStart		= $wallCount - $limit;
             //$limitStart		= $limit;
             if ($wallCount > $limitStart) {
                 $groupId = JRequest::getInt('groupid');
                 $groupId = empty($groupId) ? $param : $groupId;
                 if ($discussionsTrigger) {
                     $html = CWall::_getOlderWallsHTML($groupId, $uniqueId, $limitStart) . $html;
                 } else {
                     $html .= CWall::_getOlderWallsHTML($groupId, $uniqueId, $limitStart);
                 }
             }
         }
     }
     $html .= '</div>';
     return $html;
 }
Example #4
0
    ?>

        <?php 
    if ($act->commentCount > 0) {
        ?>
            <?php 
        #echo $act->commentLast;
        $comments = $act->commentsAll;
        #echo "<pre>";var_dump($comments);die();
        #$comments = $comments[$act->id];
        $commentLimit = $config->get('stream_default_comments');
        $comments = array_reverse($comments);
        if ($act->commentCount > $commentLimit) {
            $comments = array_slice($comments, sizeof($comments) - $commentLimit, $commentLimit);
        }
        CWall::triggerWallComments($comments, false);
        foreach ($comments as $comment) {
            $comment->params = new CParameter($comment->params);
            echo CWall::formatComment($comment);
        }
        ?>
        <?php 
    }
    ?>
    </div>

    <?php 
    if ($allowComment) {
        ?>
        <div class="joms-comment__reply joms-js--newcomment joms-js--newcomment-<?php 
        echo $act->id;