Ejemplo n.º 1
0
 public static function _getArticleHTML($userid, $limit, $limitstart, $row, $app, $total, $cat, $params)
 {
     JPluginHelper::importPlugin('content');
     $dispatcher = JDispatcher::getInstance();
     $html = "";
     if (!empty($row)) {
         $html .= '<div class="joms-app--myarticle">';
         $html .= '<ul class="joms-list">';
         foreach ($row as $data) {
             $text_limit = $params->get('limit', 50);
             $result = $dispatcher->trigger('onPrepareContent', array(&$data, &$params, 0));
             if (empty($cat[$data->catid])) {
                 $cat[$data->catid] = "";
             }
             $data->sectionid = empty($data->sectionid) ? 0 : $data->sectionid;
             $link = plgCommunityMyArticles::buildLink($data->id, $data->alias, $data->catid, $cat[$data->catid], $data->sectionid);
             $created = new JDate($data->created);
             $date = CTimeHelper::timeLapse($created);
             $html .= '	<li>';
             $html .= '		<a href="' . $link . '">' . htmlspecialchars($data->title) . '</a>';
             $html .= '<span class="joms-block joms-text--small joms-text--light">' . $date . '</span>';
             $html .= '	</li>';
         }
         $html .= '</ul>';
         $showall = CRoute::_('index.php?option=com_community&view=profile&userid=' . $userid . '&task=app&app=myarticles');
         $html .= "<div class='joms-gap'></div><div class='list-articles--button'><small><a class='joms-button--link' href='" . $showall . "'>" . JText::_('PLG_MYARTICLES_SHOWALL') . "</a></small></div>";
         $html .= '</div>';
     } else {
         $html .= "<p>" . JText::_("PLG_MYARTICLES_NO_ARTICLES") . "</p>";
     }
     return $html;
 }
Ejemplo n.º 2
0
        public static function _getArticleHTML($userid, $limit, $limitstart, $row, $app, $total, $cat, $myblogItemId, $introtext, $params)
        {
            JPluginHelper::importPlugin('content');
            $dispatcher = JDispatcher::getInstance();
            $html = "";
            if (!empty($row)) {
                $html .= '<div id="application-myarticles" class="joms-tab__app">';
                $html .= '<ul class="list-articles cResetList">';
                foreach ($row as $data) {
                    $text_limit = $params->get('limit', 50);
                    if (JString::strlen($data->introtext) > $text_limit) {
                        $content = strip_tags(JString::substr($data->introtext, 0, $text_limit));
                        $content .= " .....";
                    } else {
                        $content = $data->introtext;
                    }
                    $data->text = $content;
                    $result = $dispatcher->trigger('onPrepareContent', array(&$data, &$params, 0));
                    if (empty($data->permalink)) {
                        $myblog = 0;
                        $permalink = "";
                    } else {
                        $myblog = 1;
                        $permalink = $data->permalink;
                    }
                    if (empty($cat[$data->catid])) {
                        $cat[$data->catid] = "";
                    }
                    $data->sectionid = empty($data->sectionid) ? 0 : $data->sectionid;
                    $link = plgCommunityMyArticles::buildLink($data->id, $data->alias, $data->catid, $cat[$data->catid], $data->sectionid, $myblog, $permalink, $myblogItemId);
                    $created = new JDate($data->created);
                    $date = CTimeHelper::timeLapse($created);
                    $html .= '	<li>';
                    $html .= '		<span class="joms-text--small">' . $date . '</span>';
                    $html .= '		<a href="' . $link . '">' . htmlspecialchars($data->title) . '</a>';
                    if ($introtext == 1) {
                        $html .= '<p>' . $content . '</p>';
                    }
                    $html .= '	</li>';
                }
                $html .= '</ul>';
                if ($app == 1) {
                    jimport('joomla.html.pagination');
                    $pagination = new JPagination($total, $limitstart, $limit);
                    $html .= '
                    <div class="list-articles--button">
						' . $pagination->getPagesLinks() . '
					</div>';
                } else {
                    $showall = CRoute::_('index.php?option=com_community&view=profile&userid=' . $userid . '&task=app&app=myarticles');
                    $html .= "<div class='list-articles--button'><a class='joms-button--link' href='" . $showall . "'>" . JText::_('PLG_MYARTICLES_SHOWALL') . "</a></div>";
                }
                $html .= '</div>';
            } else {
                $html .= "<p>" . JText::_("PLG_MYARTICLES_NO_ARTICLES") . "</p>";
            }
            return $html;
        }