function display($tpl = null) { // Initialise variables. $app = JFactory::getApplication(); $user = JFactory::getUser(); $userId = $user->get('id'); $dispatcher = JDispatcher::getInstance(); $this->print = JRequest::getBool('print'); $this->state = $this->get('State'); $this->user = $user; $this->period = isset($_POST['period']) ? $_POST['period'] : 'LAST-WEEK'; $this->texts = ideary::getTextsRanking($userId, $this->period); $this->offset = count($this->texts); $this->countTextsRanking = ideary::getCountTextsRanking($this->period); //$this->_prepareDocument(); parent::display($tpl); }
public function generateMoreApplaudedTextsBox() { $html = '<div id="more-applauded-texts-box">'; $html .= '<div id="more-applauded-texts-title">' . JText::_('TEN_MOST_ACCLAIMED_TEXTS') . '</div>'; $html .= '<div id="more-applauded-texts-container">'; foreach (ideary::getTextsRanking(0, 'LAST-WEEK', 0, 5) as $index => $text) { $html .= '<div class="more-applauded-text">'; $html .= '<div class="more-applauded-text-index">' . ($index + 1) . '</div>'; $html .= '<div class="more-applauded-text-title">'; $html .= '<a href="' . JRoute::_(ContentHelperRoute::getArticleRoute($text->id, $text->catid)) . '">'; //$html .= ideary::truncate_chars($text->title, 30, '...'); $html .= $text->title; $html .= '</a>'; $html .= '</div>'; $html .= '<div style="clear: both;"></div>'; $html .= '</div>'; } $html .= '</div>'; $html .= '<a href="' . JRoute::_("index.php?option=com_content&view=ranking", true) . '" id="view-remaining-texts-link">'; $html .= '<div id="view-remaining-texts">' . JText::_('VIEW_REMAINING_TEXTS') . '</div>'; $html .= '</a>'; $html .= '</div>'; return $html; }
public function get_more_texts_ranking() { // Get the application object. $app = JFactory::getApplication(); $texts_array_html = array(); $period = JRequest::getString('period'); $userId = JRequest::getString('userId'); $offset = JRequest::getInt('offset'); $texts = ideary::getTextsRanking($userId, $period, $offset); $index = 1; foreach ($texts as $text) { $texts_array_html[] = ideary::removeNewLinesFromString(ideary::generateTextRankingHTML($text, $index + $offset)); $index++; } echo json_encode(array('texts_array_html' => $texts_array_html)); $app->close(); }