예제 #1
0
 public function get_texts_archived_of_author_url()
 {
     // Get the application object.
     $app = JFactory::getApplication();
     $author_id = JRequest::getInt('author_id');
     //$user_id = JFactory::getUser()->get('id');
     $authorsection = JRequest::getInt('authorsection');
     $texts = ideary::getFavArchTexts(0);
     $countAllTexts = ideary::getCountFavArchTexts(0);
     $textHtmlArray = array();
     if (!empty($texts)) {
         foreach ($texts as $index => $text) {
             $textHtmlArray[] = ideary::removeNewLinesFromString(ideary::generateTextContent($text, $author_id, $index, $authorsection));
         }
     }
     /*else{
     			$textHtmlArray[] = '<div class="text"><div class="text-data" style="margin-left: 0px !important;">Aun no has guardado ningun text</div></div>';
     		}*/
     echo json_encode(array('texts' => $textHtmlArray, 'countAllTexts' => $countAllTexts));
     $app->close();
 }
예제 #2
0
 public function get_more_texts_of_author()
 {
     // Get the application object.
     $app = JFactory::getApplication();
     $userId = JRequest::getInt('userId');
     $offset = JRequest::getInt('offset');
     $text_type = JRequest::getString('text_type');
     switch ($text_type) {
         case "published":
             $texts = ideary::getTextsOfUser($userId, 1, $offset);
             $profile = 1;
             $authorsection = 1;
             $type = 'mine';
             break;
         case "draft":
             $texts = ideary::getTextsOfUser($userId, 0, $offset);
             $profile = 1;
             $authorsection = 1;
             $type = 'draft';
             break;
         case "favourites":
             $texts = ideary::getFavArchTexts(1, $offset);
             $profile = 1;
             $authorsection = 0;
             $type = 'default';
             break;
         case "applauded":
             $texts = ideary::getTextsApplaudedByUser($userId, $offset);
             $profile = 1;
             $authorsection = 0;
             $type = 'default';
             break;
         case "archived":
             $texts = ideary::getFavArchTexts(0, $offset);
             $profile = 0;
             $authorsection = 0;
             $type = 'default';
             break;
     }
     $textHtmlArray = array();
     if (!empty($texts)) {
         foreach ($texts as $index => $text) {
             $textHtmlArray[] = ideary::removeNewLinesFromString(ideary::generateTextContent($text, $userId, $offset + $index, $profile, $authorsection, false, $type));
         }
     }
     echo json_encode(array('texts' => $textHtmlArray));
     $app->close();
 }