예제 #1
0
 public function generateTextRankingHTML($text, $index)
 {
     $html = '';
     $html .= '<li class="li-ranking">';
     $html .= '<div class="text-ranking" data-just-added="true">';
     $html .= '<div class="text-ranking-category-color" style="background: #' . $text->color_code . '" title="' . $text->cat_title . '"></div>';
     $html .= '<div class="text-ranking-index">';
     $html .= '<div class="text-ranking-index-left"></div>';
     $html .= '<div class="text-ranking-index-center">' . $index . '</div>';
     $html .= '<div class="text-ranking-index-right"></div>';
     $html .= '</div>';
     $html .= '<div class="save-container" data-text-id="' . $text->id . '">';
     if (is_null($text->saved)) {
         $html .= '<div class="text-ranking-save-icon" title="' . JText::_('SAVE') . '" data-text-id="' . $text->id . '"></div>';
     } else {
         $html .= '<div class="text-ranking-saved-icon" title="' . JText::_('UNARCHIVE') . '" data-text-id="' . $text->id . '"></div>';
     }
     $html .= '</div>';
     if (!is_null($text->image_name)) {
         $html .= '<div class="text-ranking-title with-image">';
         $html .= '<a href="' . JRoute::_(ContentHelperRoute::getArticleRoute($text->id, $text->catid)) . '">';
         //$html .= ideary::truncate_chars($text->title, 21);
         $html .= '<div class="r-t-title">';
         $html .= $text->title;
         $html .= '</div>';
         $html .= '</a>';
         $html .= '</div>';
         $html .= '<div class="text-ranking-img">';
         $html .= '<a href="' . JRoute::_(ContentHelperRoute::getArticleRoute($text->id, $text->catid)) . '">';
         $html .= '<img src="' . JURI::base() . "templates/beez_20/images/texts/" . $text->id . "/ranking/" . $text->image_name . '">';
         $html .= '</a>';
         $html .= '</div>';
         $html .= '<div class="text-ranking-content with-image">' . $text->introtext . '</div>';
     } else {
         $html .= '<div class="text-ranking-title">';
         $html .= '<a href="' . JRoute::_(ContentHelperRoute::getArticleRoute($text->id, $text->catid)) . '">';
         //$html .= ideary::truncate_chars($text->title, 21);
         $html .= '<div class="r-t-title">';
         $html .= $text->title;
         $html .= '</div>';
         $html .= '</a>';
         $html .= '</div>';
         $html .= '<div class="text-ranking-content">' . $text->introtext . '</div>';
     }
     $html .= '<div class="author-applauses">';
     $html .= '<div class="text-ranking-author">' . JText::_('BY') . ' <a style="color: #acacac;" href="' . JRoute::_('index.php?option=com_contact&view=public&id=' . $text->created_by) . '">' . $text->name . '</a></div>';
     $countApplauses = Ideary::getCountApplausesByTextId($text->id);
     if ($text->applauses > 0) {
         $html .= '<div class="text-ranking-applauses applauses-clickable" data-text-id="' . $text->id . '" data-text-title="' . $text->title . '">';
         $html .= '<div class="text-ranking-applauses-icon"></div>';
         $html .= '<div class="text-ranking-applauses-num">' . $text->applauses . '</div>';
         $html .= '</div>';
     }
     $html .= '</div>';
     $html .= '</div>';
     $html .= '</li>';
     return $html;
 }
예제 #2
0
 public function get_users_who_applauded_text()
 {
     // Get the application object.
     $app = JFactory::getApplication();
     $text_id = JRequest::getInt('text_id');
     $limit = JRequest::getInt('limit');
     $offset = JRequest::getInt('offset');
     $users = Ideary::getUsersWhoApplaudedText($text_id, $offset, $limit);
     $usersHtml = Ideary::generateUserListContent($users);
     $clapCount = Ideary::getCountApplausesByTextId($text_id);
     echo json_encode(array('usersHtml' => $usersHtml, 'clapCount' => $clapCount));
     $app->close();
 }