function display() { $rows = $this->get('Items'); if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $params = $app->getParams(); $doc->link = JRoute::_('index.php?option=com_authorlist&view=authors'); foreach ($rows as $row) { $title = $this->escape($row->name); $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8'); $row->slug = $row->alias ? $row->userid . ':' . $row->alias : $row->userid; $link = JRoute::_(AuthorListHelperRoute::getAuthorRoute($row->slug), false); // strip html from feed item description text // TODO: Only pull fulltext if necessary (actually, just get the necessary fields). $description = $row->description; $item = new JFeedItem(); $item->title = $title; $item->link = $link; $item->description = $description; $doc->addItem($item); } }
function display() { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $params = $app->getParams(); $feedEmail = @$app->getCfg('feed_email') ? $app->getCfg('feed_email') : 'author'; // Get some data from the model $app->input->set('limit', $app->getCfg('feed_limit')); $rows = $this->get('Items'); $state = $this->get('State'); $author_id = $state->get('author.id'); $doc->link = JRoute::_(AuthorListHelperRoute::getAuthorRoute($author_id)); foreach ($rows as $row) { // strip html from feed item title $title = $this->escape($row->title); $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8'); // Compute the article slug $row->slug = $row->alias ? $row->id . ':' . $row->alias : $row->id; // url link to article // & used instead of & as this is converted by feed creator $link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid), false); // strip html from feed item description text // TODO: Only pull fulltext if necessary (actually, just get the necessary fields). $description = $params->get('feed_summary', 0) ? $row->introtext : $row->introtext; $author = $row->created_by_alias ? $row->created_by_alias : $row->author; @($date = $row->created ? date('r', strtotime($row->created)) : ''); // load individual item creator class $item = new JFeedItem(); $item->title = $title; $item->link = $link; $item->description = $description; $item->date = $date; $item->category = $row->category; $item->author = $author; if ($feedEmail == 'site') { $item->authorEmail = $siteEmail; } else { $item->authorEmail = $row->author_email; } // loads item info into rss array $doc->addItem($item); } }
public static function getAssociations($id = 0, $view = null) { jimport('helper.route', JPATH_COMPONENT_SITE); $app = JFactory::getApplication(); $jinput = $app->input; $view = is_null($view) ? $jinput->get('view') : $view; $id = empty($id) ? $jinput->getInt('id') : $id; if ($view == 'author') { if ($id) { $associations = JLanguageAssociations::getAssociations('com_authorlist', '#__authorlist', 'com_authorlist.author', $id, 'id', '', ''); $return = array(); foreach ($associations as $tag => $item) { $author_slug = AuthorListHelperRoute::getAuthorSlug($item->id); $return[$tag] = AuthorListHelperRoute::getAuthorRoute($author_slug, $item->language); } return $return; } } return array(); }
public function getBlock1($context, &$row, &$params, $page = 0) { $app = JFactory::getApplication(); $template = $app->getTemplate(); $show_name = $this->params->get('show_name'); $show_image = $this->params->get('show_image'); $title = $link = $image = $desc = $gplus = $clr = ''; $author = $this->getAuthor($row->created_by); if (!($name = $author->displayName) || $author->state != 1) { return; } if ($show_name == 1 || $show_image == 1) { if ($author->display_alias) { $slug = $author->id . ':' . JApplication::stringURLSafe($author->display_alias); } else { $slug = $author->alias ? $author->id . ':' . $author->alias : $author->id; } $link = JRoute::_(AuthorListHelperRoute::getAuthorRoute($slug)); } if ($this->params->get('show_desc')) { $desc = $author->description; $limit = $this->params->get('limit_desc'); if ($limit && is_numeric($limit)) { $desc = strip_tags($desc); if (strlen($desc) > $limit) { $desc = substr($desc, 0, $limit) . '...'; } } } $tmpl = $this->getTmpl($template, 'default'); ob_start(); require $tmpl; $html = ob_get_contents(); ob_end_clean(); return $html; }
public static function getList(&$params) { $model = JModelLegacy::getInstance('Authors', 'AuthorListModel', array('ignore_request' => true)); $app = JFactory::getApplication(); $appParams = $app->getParams(); $model->setState('params', $appParams); $model->setState('list.start', 0); $model->setState('list.limit', (int) $params->get('count', '')); $model->setState('filter.published', 1); $access = !JComponentHelper::getParams('com_authorlist')->get('show_noauth'); $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id')); $model->setState('filter.access', $access); $model->setState('filter.language', $app->getLanguageFilter()); $ordering = $params->get('ordering', 'order'); $show_name = $params->get('show_name', 'name'); $use_alias = $params->get('use_alias', 0); $author_ids = $params->get('author_ids', ''); $author_articles = $params->get('count_articles', 0); $ids = array(); if ($author_ids) { $ids = array_map('trim', explode(',', $author_ids)); $filter_type = $params->get('filter_type', 0); } $model->setState('filter.group_id', $params->get('gid', 0)); $orderCol = 'a.ordering'; $orderDir = 'ASC'; if ($ordering != 'order') { if ($ordering == 'rand') { $orderCol = 'RAND()'; $orderDir = ''; } else { $orderCol = $show_name; $orderDir = strtoupper($ordering); } } $model->setState('list.ordering', $orderCol); $model->setState('list.direction', $orderDir); $items = $model->getItems(); $i = -1; foreach ($items as &$item) { $i++; if (count($ids)) { if (in_array($item->id, $ids) != $filter_type) { unset($items[$i]); continue; } } $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id; if ($item->display_alias) { $item->name = $item->display_alias; $item->slug = $item->id . ':' . JApplication::stringURLSafe($item->display_alias); } elseif ($show_name != 'name') { $item->name = $item->username; } if ($access || in_array($item->access, $authorised)) { $item->link = JRoute::_(AuthorListHelperRoute::getAuthorRoute($item->slug)); } else { $item->link = JRoute::_('index.php?option=com_users&view=login'); } if ($params->get('show_image') && ($item->image or $params->get('def_image'))) { $item->image = modAuthorListHelper::getThumbnail($item, $params); } if ((int) $author_articles) { $item->articles = modAuthorListHelper::getArticles($item->userid, $params); } } return $items; }
?> <td class="item-title"> <?php if ($item->access_edit) { ?> <span class="list-edit pull-left width-50"> <?php echo JHtml::_('icono.edit', $item, $this->params); ?> </span> <?php } ?> <a href="<?php echo JRoute::_(AuthorListHelperRoute::getAuthorRoute($item->slug)); ?> " title="" data-original-title="<?php echo sprintf(JText::_('COM_AUTHORLIST_TITLE_VIEW_AUTHOR'), $item->displayName); ?> " class="hasTooltip"> <?php echo $item->displayName; ?> </a> </td> <?php if ($this->params->get('show_articles_count', 1)) { ?> <td align="center" class="item-articles_count"> <?php