/** * 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; }
/** * 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; }