예제 #1
0
 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);
 }
예제 #2
0
 public function get_texts_ranking()
 {
     // Get the application object.
     $app = JFactory::getApplication();
     $period = JRequest::getString('period');
     $user_id = JFactory::getUser()->get('id');
     $texts = ideary::getTextsRanking($user_id, $period);
     $countAllTexts = ideary::getCountTextsRanking($period);
     $html = "";
     $i = 1;
     foreach ($texts as $text) {
         $html .= ideary::generateTextRankingHTML($text, $i);
         $i++;
     }
     echo json_encode(array('text_count' => count($texts), 'text_html' => $html, 'countAllTexts' => $countAllTexts));
     $app->close();
 }