public function display($tpl = null) { $state = $this->get('State'); $params = $state->get('params'); $this->params = $params; $item = $this->item; if (!$item) { $item = $this->get('Item'); } if ($item) { if ($media = $item->media) { if (isset($media->image)) { $image = clone $media->image; if ($params->get('mt_image_show_feed_image', 1)) { $title = $this->escape($item->title); $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8'); $link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->slug, $item->catid, true, -1)); if ($size = $params->get('mt_image_feed_size', 'o')) { if (isset($image->url) && !empty($image->url)) { $image_url_ext = JFile::getExt($image->url); $image_url = str_replace('.' . $image_url_ext, '_' . $size . '.' . $image_url_ext, $image->url); $image->url = JURI::root() . $image_url; echo '<a href="' . $link . '"><img src="' . $image->url . '" alt="' . $title . '"/></a>'; } elseif (isset($image->url_hover) && !empty($image->url_hover)) { $image_url_ext = JFile::getExt($image->url_hover); $image_url = str_replace('.' . $image_url_ext, '_' . $size . '.' . $image_url_ext, $image->url_hover); $image->url_hover = JURI::root() . $image_url; echo '<a href="' . $link . '"><img src="' . $image->url . '" alt="' . $title . '"/></a>'; } } } } } } }
public static function getList(&$params) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $catid = $params->get('catid', array()); $query->select(' count(t.id) as total, t.*'); $query->select('CASE WHEN CHAR_LENGTH(t.alias) THEN CONCAT_WS(":", t.id, t.alias) ELSE t.id END as tagslug'); $query->from('#__tz_portfolio_plus_tags AS t'); $query->where('t.published = 1'); $query->join('LEFT', '#__tz_portfolio_plus_tag_content_map AS tm ON tm.tagsid = t.id'); $query->join('LEFT', '#__tz_portfolio_plus_content AS c ON (tm.contentid = c.id)'); $query->where('c.state = 1'); $query->join('LEFT', '#__tz_portfolio_plus_content_category_map AS cm ON (cm.contentid = c.id)'); $query->join('LEFT', '#__tz_portfolio_plus_categories AS cc ON cc.id = cm.catid'); $query->where('cc.published = 1'); if (is_array($catid)) { $catid = array_filter($catid); if (count($catid)) { $query->where('cm.catid IN (' . implode(',', $catid) . ')'); } } else { $query->where('cm.catid = ' . $catid); } $query->group('t.alias'); $db->setQuery($query, 0, $params->get('tag_limit')); if ($items = $db->loadObjectList()) { foreach ($items as $item) { $cloud[] = $item->total; } $max_size = $params->get('maxfont', 300); $min_size = $params->get('minfont', 75); $max_qty = max(array_values($cloud)); $min_qty = min(array_values($cloud)); $spread = $max_qty - $min_qty; if (0 == $spread) { $spread = 1; } $step = ($max_size - $min_size) / $spread; foreach ($items as $tag) { $size = $min_size + ($tag->total - $min_qty) * $step; $size = ceil($size); $tag->size = $size; $tag->link = TZ_Portfolio_PlusHelperRoute::getTagRoute($tag->tagslug, 0, 'auto'); } return $items; } return false; }
static function getList(&$params) { //get database $db = JFactory::getDbo(); $query = $db->getQuery(true); $subQuery = $db->getQuery(true); $query->select('MONTH(created) AS created_month, created, id, title, YEAR(created) AS created_year'); $query->from('#__tz_portfolio_plus_content'); $query->where('checked_out = 0'); $query->where('state = 1'); $query->group('created_year DESC, created_month DESC'); $subQuery->select('COUNT(*)'); $subQuery->from('#__tz_portfolio_plus_content'); $subQuery->where('checked_out = 0'); $subQuery->where('MONTH(created) = created_month AND YEAR(created) = created_year'); $subQuery->where('state = 1'); $query->select('(' . $subQuery->__toString() . ') AS total'); // Filter by language if (JFactory::getApplication()->getLanguageFilter()) { $query->where('language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')'); } $db->setQuery($query, 0, $params->get('count')); $rows = (array) $db->loadObjectList(); $i = 0; $lists = array(); if ($rows) { foreach ($rows as $row) { $date = JFactory::getDate($row->created); $created_month = $date->format('n'); $created_year = $date->format('Y'); $created_year_cal = JHtml::_('date', $row->created, 'Y'); $month_name_cal = JHtml::_('date', $row->created, 'F'); $lists[$i] = new stdClass(); // $lists[$i]->link = JRoute::_('index.php?option=com_tz_portfolio_plus&view=date&year=' // . $created_year . '&month=' . $created_month . '&Itemid=' . $params->get('tzmenuitem')); $lists[$i]->link = TZ_Portfolio_PlusHelperRoute::getDateRoute($created_year, $created_month, 0, $params->get('tzmenuitem')); $lists[$i]->text = JText::sprintf('MOD_TZ_PORTFOLIO_ARTICLES_ARCHIVE_DATE', $month_name_cal, $created_year_cal); $lists[$i]->total = 0; if (isset($row->total)) { $lists[$i]->total = $row->total; } $i++; } } return $lists; }
public static function getList(&$params) { $db = JFactory::getDbo(); $categoryName = null; $total = null; $catIds = null; $catIds = $params->get('catid'); if ($params->get('show_total', 1)) { $total = ',(SELECT COUNT(*) FROM #__tz_portfolio_plus_content_category_map AS c WHERE c.catid = a.id) AS total'; } $query = $db->getQuery(true); $query->select('a.*'); $query->select('l.title AS language_title,ag.title AS access_level'); $query->select('ua.name AS author_name' . $total); $query->from($db->quoteName('#__tz_portfolio_plus_categories') . ' AS a'); $query->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language'); $query->join('LEFT', $db->quoteName('#__users') . ' AS uc ON uc.id=a.checked_out'); $query->join('LEFT', $db->quoteName('#__viewlevels') . ' AS ag ON ag.id = a.access'); $query->join('LEFT', $db->quoteName('#__users') . ' AS ua ON ua.id = a.created_user_id'); $query->where('a.published = 1'); if (is_array($catIds)) { $catIds = array_filter($catIds); if (count($catIds)) { $query->where('a.id IN(' . implode(',', $catIds) . ')'); } } else { $query->where('a.id = ' . $catIds); } $query->where('extension = ' . $db->quote('com_tz_portfolio_plus')); $query->group('a.id'); $query->order('a.lft ASC'); $db->setQuery($query); if ($items = $db->loadObjectList()) { jimport('joomla.filesystem.file'); foreach ($items as $item) { $item->link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getCategoryRoute($item->id)); $item->params = new JRegistry($item->params); } return $items; } return false; }
/** * Method to get the associations for a given item * * @param integer $id Id of the item * @param string $view Name of the view * * @return array Array of associations for the item * * @since 3.0 */ 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 == 'article') { if ($id) { // $associations = JLanguageAssociations::getAssociations('com_tz_portfolio_plus', // '#__tz_portfolio_plus_content', '#__tz_portfolio_plus.item', $id); $associations = self::getArticleAssociations($id); $return = array(); foreach ($associations as $tag => $item) { $return[$tag] = TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->id, $item->catid, $item->language); } return $return; } } if ($view == 'category' || $view == 'categories') { return self::getCategoryAssociations($id, 'com_tz_portfolio_plus'); } return array(); }
function display($tpl = null) { $doc = JFactory::getDocument(); $menus = JMenu::getInstance('site'); $active = $menus->getActive(); $state = $this->get('State'); $this->state = $state; $params = $state->params; // Set value again for option tz_portfolio_plus_redirect if ($params->get('tz_portfolio_plus_redirect') == 'default') { $params->set('tz_portfolio_plus_redirect', 'article'); } $items = $this->get('Items'); if ($items) { $user = JFactory::getUser(); $userId = $user->get('id'); $guest = $user->get('guest'); $content_ids = array(); if ($items) { $content_ids = JArrayHelper::getColumn($items, 'id'); } $mainCategories = TZ_Portfolio_PlusFrontHelperCategories::getCategoriesByArticleId($content_ids, array('main' => true)); $second_categories = TZ_Portfolio_PlusFrontHelperCategories::getCategoriesByArticleId($content_ids, array('main' => false)); $tags = null; if (count($content_ids) && $params->get('show_tags', 1)) { $tags = TZ_Portfolio_PlusFrontHelperTags::getTagsByArticleId($content_ids, array('orderby' => 'm.contentid', 'reverse_contentid' => true)); } $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); TZ_Portfolio_PlusPluginHelper::importPlugin('content'); TZ_Portfolio_PlusPluginHelper::importPlugin('mediatype'); $dispatcher->trigger('onAlwaysLoadDocument', array('com_tz_portfolio_plus.users')); $dispatcher->trigger('onLoadData', array('com_tz_portfolio_plus.users', $items, $params)); foreach ($items as $i => &$item) { if ($mainCategories && isset($mainCategories[$item->id])) { $mainCategory = $mainCategories[$item->id]; if ($mainCategory) { $item->catid = $mainCategory->id; $item->category_title = $mainCategory->title; $item->catslug = $mainCategory->id . ':' . $mainCategory->alias; $item->category_link = $mainCategory->link; } } else { // Create main category's link $item->category_link = TZ_Portfolio_PlusHelperRoute::getCategoryRoute($item->catid); } // Get all second categories $item->second_categories = null; if (isset($second_categories[$item->id])) { $item->second_categories = $second_categories[$item->id]; } // Get article's tags $item->tags = null; if ($tags && count($tags) && isset($tags[$item->id])) { $item->tags = $tags[$item->id]; } /*** New source ***/ $tmpl = null; if ($item->params->get('tz_use_lightbox', 0)) { $tmpl = '&tmpl=component'; } $config = JFactory::getConfig(); $ssl = -1; if ($config->get('force_ssl')) { $ssl = 1; } // Create article link $item->link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->slug, $item->catid) . $tmpl); $item->fullLink = JRoute::_(TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->slug, $item->catid), true, $ssl); // Create author link $item->author_link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getUserRoute($item->created_by, $params->get('user_menu_active', 'auto'))); // Compute the asset access permissions. // Technically guest could edit an article, but lets not check that to improve performance a little. if (!$guest) { $asset = 'com_tz_portfolio_plus.article.' . $item->id; // Check general edit permission first. if ($user->authorise('core.edit', $asset)) { $item->params->set('access-edit', true); } elseif (!empty($userId) && $user->authorise('core.edit.own', $asset)) { // Check for a valid user and that they are the owner. if ($userId == $item->created_by) { $item->params->set('access-edit', true); } } } // Old plugins: Ensure that text property is available if (!isset($item->text)) { $item->text = $item->introtext; } if (version_compare(COM_TZ_PORTFOLIO_PLUS_VERSION, '3.1.7', '<')) { $item->text = null; if ($params->get('show_intro', 1)) { $item->text = $item->introtext; } } $item->event = new stdClass(); //Call trigger in group content $results = $dispatcher->trigger('onContentPrepare', array('com_tz_portfolio_plus.users', &$item, &$params, $state->get('offset'))); $item->introtext = $item->text; $results = $dispatcher->trigger('onContentAfterTitle', array('com_tz_portfolio_plus.users', &$item, &$params, $state->get('offset'))); $item->event->afterDisplayTitle = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_tz_portfolio_plus.users', &$item, &$params, $state->get('offset'))); $item->event->beforeDisplayContent = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentAfterDisplay', array('com_tz_portfolio_plus.users', &$item, &$params, $state->get('offset'))); $item->event->afterDisplayContent = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentTZPortfolioVote', array('com_tz_portfolio_plus.users', &$item, &$params, $state->get('offset'))); $item->event->TZPortfolioVote = trim(implode("\n", $results)); // Process the tz portfolio's content plugins. $results = $dispatcher->trigger('onContentDisplayVote', array('com_tz_portfolio_plus.users', &$item, &$params, $state->get('offset'))); $item->event->contentDisplayVote = trim(implode("\n", $results)); $results = $dispatcher->trigger('onBeforeDisplayAdditionInfo', array('com_tz_portfolio_plus.users', &$item, &$params, $state->get('offset'))); $item->event->beforeDisplayAdditionInfo = trim(implode("\n", $results)); $results = $dispatcher->trigger('onAfterDisplayAdditionInfo', array('com_tz_portfolio_plus.users', &$item, &$params, $state->get('offset'))); $item->event->afterDisplayAdditionInfo = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentDisplayListView', array('com_tz_portfolio_plus.users', &$item, &$params, $state->get('offset'))); $item->event->contentDisplayListView = trim(implode("\n", $results)); //Call trigger in group tz_portfolio_plus_mediatype $results = $dispatcher->trigger('onContentDisplayMediaType', array('com_tz_portfolio_plus.users', &$item, &$params, $state->get('offset'))); if ($item) { $item->event->onContentDisplayMediaType = trim(implode("\n", $results)); if ($results = $dispatcher->trigger('onAddMediaType')) { $mediatypes = array(); foreach ($results as $result) { if (isset($result->special) && $result->special) { $mediatypes[] = $result->value; } } $item->mediatypes = $mediatypes; } } else { unset($items[$i]); } } } //Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); if ($active) { $params->def('page_heading', $params->get('page_title', $active->title)); } else { $params->def('page_heading', JText::_('JGLOBAL_ARTICLES')); } $this->items = $items; $this->params = $params; $this->assign('mediaParams', $params); $this->assign('pagination', $this->get('Pagination')); if ($author = JFactory::getUser($state->get('users.id'))) { $author_registry = $author->getParameters(); $author_info = new stdClass(); $author_info->id = $author->id; $author_info->url = $author_registry->get('tz_portfolio_plus_user_url'); $author_info->email = $author->email; $author_info->gender = $author_registry->get('tz_portfolio_plus_user_gender'); $author_info->avatar = $author_registry->get('tz_portfolio_plus_user_avatar'); $author_info->social_links = null; if ($social_links = $author_registry->get('tz_portfolio_plus_user_social_link')) { foreach ($social_links as &$social_link) { $social_link = json_decode($social_link); } $author_info->social_links = $social_links; } $author_info->description = $author_registry->get('tz_portfolio_plus_user_description'); $author_info->author = $author->name; $author_info->author_link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getUserRoute($state->get('users.id'), $params->get('user_menu_active', 'auto'))); $this->item_author = $author_info; } $params = $state->params; JModelLegacy::addIncludePath(COM_TZ_PORTFOLIO_PLUS_PATH_SITE . DIRECTORY_SEPARATOR . 'models'); $model = JModelLegacy::getInstance('Portfolio', 'TZ_Portfolio_PlusModel', array('ignore_request' => true)); $model->setState('params', $params); $model->setState('filter.userId', $state->get('users.id')); $this->char = $state->get('filter.char'); $this->availLetter = $model->getAvailableLetter(); if ($params->get('tz_use_lightbox', 0) == 1) { $doc->addCustomTag('<script type="text/javascript" src="components/com_tz_portfolio_plus/js' . '/jquery.fancybox.pack.js"></script>'); $doc->addStyleSheet('components/com_tz_portfolio_plus/css/fancybox.min.css'); $width = null; $height = null; $autosize = null; if ($params->get('tz_lightbox_width')) { if (preg_match('/%|px/', $params->get('tz_lightbox_width'))) { $width = 'width:\'' . $params->get('tz_lightbox_width') . '\','; } else { $width = 'width:' . $params->get('tz_lightbox_width') . ','; } } if ($params->get('tz_lightbox_height')) { if (preg_match('/%|px/', $params->get('tz_lightbox_height'))) { $height = 'height:\'' . $params->get('tz_lightbox_height') . '\','; } else { $height = 'height:' . $params->get('tz_lightbox_height') . ','; } } if ($width || $height) { $autosize = 'fitToView: false,autoSize: false,'; } $scrollHidden = null; if ($params->get('use_custom_scrollbar', 1)) { $scrollHidden = ',scrolling: "no" ,iframe: { scrolling : "no", }'; } $doc->addCustomTag('<script type="text/javascript"> jQuery(\'.fancybox\').fancybox({ type:\'iframe\', openSpeed:' . $params->get('tz_lightbox_speed', 350) . ', openEffect: "' . $params->get('tz_lightbox_transition', 'elastic') . '", ' . $width . $height . $autosize . ' helpers: { title : { type : "inside" }, overlay : { css : {background: "rgba(0,0,0,' . $params->get('tz_lightbox_opacity', 0.75) . ')"} } }' . $scrollHidden . ' }); </script> '); } $doc->addStyleSheet('components/com_tz_portfolio_plus/css/tzportfolioplus.min.css'); $this->_prepareDocument(); // Add feed links if ($params->get('show_feed_link', 1)) { $link = '&format=feed&limitstart='; $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); $doc->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs); $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'); $doc->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs); } parent::display($tpl); }
/** * Prepares the document */ protected function _prepareDocument() { $app = JFactory::getApplication(); $menus = $app->getMenu(); $pathway = $app->getPathway(); $title = null; // Because the application sets a default page title, // we need to get it from the menu item itself $menu = $menus->getActive(); if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } else { $this->params->def('page_heading', JText::_('JGLOBAL_ARTICLES')); } $title = $this->params->get('page_title', ''); $id = null; if ($menu && isset($menu->query) && isset($menu->query['id'])) { $id = (int) @$menu->query['id']; } // if the menu item does not concern this article if ($menu && ($menu->query['option'] != 'com_tz_portfolio_plus' || $menu->query['view'] != 'article' || $id != $this->item->id)) { // If this is not a single article menu item, set the page title to the article title if ($this->item->title) { $title = $this->item->title; } $path = array(array('title' => $this->item->title, 'link' => '')); $category = JCategories::getInstance('Content')->get($this->item->catid); while ($category && ($menu->query['option'] != 'com_tz_portfolio_plus' || $menu->query['view'] == 'article' || $id != $category->id) && $category->id > 1) { $path[] = array('title' => $category->title, 'link' => TZ_Portfolio_PlusHelperRoute::getCategoryRoute($category->id)); $category = $category->getParent(); } $path = array_reverse($path); foreach ($path as $item) { $pathway->addItem($item['title'], $item['link']); } } // Check for empty title and add site name if param is set if (empty($title)) { $title = $app->getCfg('sitename'); } elseif ($app->getCfg('sitename_pagetitles', 0) == 1) { $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename')); } if (empty($title)) { $title = $this->item->title; } if (!empty($title)) { $title = htmlspecialchars($title); } $this->document->setTitle($title); $description = null; if ($this->item->metadesc) { $description = $this->item->metadesc; } elseif (!empty($this->item->introtext)) { $description = strip_tags($this->item->introtext); $description = explode(' ', $description); $description = array_splice($description, 0, 25); $description = trim(implode(' ', $description)); if (!strpos($description, '...')) { $description .= '...'; } } elseif (!$this->item->metadesc && $this->params->get('menu-meta_description')) { $description = $this->params->get('menu-meta_description'); } if ($description) { $description = htmlspecialchars($description); $this->document->setDescription($description); } $tags = null; if ($this->item->metakey) { $tags = $this->item->metakey; } elseif ($this->listTags) { foreach ($this->listTags as $tag) { $tags[] = $tag->alias; } $tags = implode(',', $tags); } elseif (!$this->item->metakey && $this->params->get('menu-meta_keywords')) { $tags = $this->params->get('menu-meta_keywords'); } if ($this->params->get('robots')) { $this->document->setMetadata('robots', $this->params->get('robots')); } if ($app->getCfg('MetaAuthor') == '1') { $this->document->setMetaData('author', $this->item->author); } // Set metadata tags with prefix property "og:" $this->document->addCustomTag('<meta property="og:title" content="' . $title . '"/>'); $this->document->addCustomTag('<meta property="og:url" content="' . $this->item->fullLink . '"/>'); $this->document->addCustomTag('<meta property="og:type" content="article"/>'); if ($description) { $this->document->addCustomTag('<meta property="og:description" content="' . $description . '"/>'); } //// End set meta tags with prefix property "og:" //// // Set meta tags with prefix property "article:" $this->document->addCustomTag('<meta property="article:author" content="' . $this->item->author . '"/>'); $this->document->addCustomTag('<meta property="article:published_time" content="' . $this->item->created . '"/>'); $this->document->addCustomTag('<meta property="article:modified_time" content="' . $this->item->modified . '"/>'); $this->document->addCustomTag('<meta property="article:section" content="' . $this->escape($this->item->category_title) . '"/>'); if ($tags) { $tags = htmlspecialchars($tags); $this->document->setMetaData('keywords', $tags); $this->document->addCustomTag('<meta property="article:tag" content="' . $tags . '"/>'); } ///// End set meta tags with prefix property "article:" //// $mdata = $this->item->metadata->toArray(); foreach ($mdata as $k => $v) { if ($v) { $this->document->setMetadata($k, $v); } } // If there is a pagebreak heading or title, add it to the page title if (!empty($this->item->page_title)) { $this->item->title = $this->item->title . ' - ' . $this->item->page_title; $this->document->setTitle($this->item->page_title . ' - ' . JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $this->state->get('list.offset') + 1)); } if ($this->print) { $this->document->setMetaData('robots', 'noindex, nofollow'); } }
?> <?php $letter = trim($letter); $disabledClass = null; $activeClass = null; if ($availLetter[$i] != true) { $disabledClass = ' disabled'; } if ($this->char == $letter) { $activeClass = ' active'; } ?> <li> <a<?php if ($availLetter[$i] != false && $this->char != $letter) { echo ' href="' . JRoute::_(TZ_Portfolio_PlusHelperRoute::getLetterRoute('portfolio', $letter)) . '"'; } ?> class="btn-sm<?php echo $disabledClass . $activeClass; ?> "><?php echo mb_strtoupper(trim($letter)); ?> </a> </li> <?php } } ?> </ul>
?> <?php } ?> </div> <?php } ?> <?php if ($params->get('show_cat_parent_category', 0) && $item->parent_id != 1) { ?> <div class="TzParentCategoryName"> <?php $title = $this->escape($item->parent_title); $url = '<a href="' . JRoute::_(TZ_Portfolio_PlusHelperRoute::getCategoryRoute($item->parent_id)) . '" itemprop="genre">' . $title . '</a>'; ?> <?php if ($params->get('cat_link_parent_category', 1)) { ?> <?php echo JText::sprintf('COM_TZ_PORTFOLIO_PLUS_PARENT', $url); ?> <?php } else { ?> <?php echo JText::sprintf('COM_TZ_PORTFOLIO_PLUS_PARENT', '<span itemprop="genre">' . $title . '</span>'); ?> <?php }
// no direct access defined('_JEXEC') or die; ?> <div class="TzItemsMore"> <h3 class="TzItemsMoreTitle"><?php echo JText::_('COM_TZ_PORTFOLIO_PLUS_MORE_ARTICLES'); ?> </h3> <ol> <?php foreach ($this->link_items as &$item) { ?> <li> <a href="<?php echo JRoute::_(TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->slug, $item->catid)); ?> "> <?php echo $item->title; ?> </a> </li> <?php } ?> </ol> </div>
public static function getCategoriesById($id, $options = array('second_by_article' => false, 'orderby' => null)) { if ($id) { if (is_array($id)) { $storeId = md5(__METHOD__ . '::' . implode(',', $id)); } else { $storeId = md5(__METHOD__ . '::' . $id); } if (!isset(self::$cache[$storeId])) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $subquery = $db->getQuery(true); $query->select('c.*'); $query->from('#__tz_portfolio_plus_categories AS c'); $query->where('c.published = 1'); if (count($options) && isset($options['second_by_article']) && $options['second_by_article']) { $query->join('INNER', '#__tz_portfolio_plus_content_category_map AS m ON m.catid = c.id'); $query->join('INNER', '#__tz_portfolio_plus_content AS cc ON cc.id = m.contentid'); $subquery->select('DISTINCT c2.id'); $subquery->from('#__tz_portfolio_plus_content AS c2'); $subquery->join('INNER', '#__tz_portfolio_plus_content_category_map AS m2 ON m2.contentid = c2.id'); $subquery->join('INNER', '#__tz_portfolio_plus_categories AS cc2 ON cc2.id = m2.catid'); if (is_array($id)) { $subquery->where('cc2.id IN(' . implode(',', $id) . ')'); } else { $subquery->where('cc2.id = ' . $id); } $query->where('cc.id IN(' . $subquery . ')'); $query->group('c.id'); } else { if (is_array($id)) { $query->where('c.id IN(' . implode(',', $id) . ')'); } else { $query->where('c.id = ' . $id); } } if (count($options) && isset($options['orderby']) && $options['orderby']) { $query->order($options['orderby']); } $query->group('c.id'); $db->setQuery($query); $categories = null; if (is_array($id)) { $categories = $db->loadObjectList(); foreach ($categories as &$category) { $category->link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getCategoryRoute($category->id)); } } else { $categories = $db->loadObject(); $categories->link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getCategoryRoute($categories->id)); } if ($categories) { self::$cache[$storeId] = $categories; return $categories; } self::$cache[$storeId] = false; } return self::$cache[$storeId]; } return false; }
protected function _prepareDocument() { $app = JFactory::getApplication(); $menus = $app->getMenu(); $pathway = $app->getPathway(); $title = null; // Because the application sets a default page title, // we need to get it from the menu item itself $menu = $menus->getActive(); if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } else { $this->params->def('page_heading', JText::_('JGLOBAL_ARTICLES')); } $id = (int) @$menu->query['id']; if ($menu && ($menu->query['option'] != 'com_tz_portfolio_plus' || $menu->query['view'] == 'article' || $id != $this->category->id)) { $path = array(array('title' => $this->category->title, 'link' => '')); $category = $this->category->getParent(); while (($menu->query['option'] != 'com_tz_portfolio_plus' || $menu->query['view'] == 'article' || $id != $category->id) && $category->id > 1) { $path[] = array('title' => $category->title, 'link' => TZ_Portfolio_PlusHelperRoute::getCategoryRoute($category->id)); $category = $category->getParent(); } $path = array_reverse($path); foreach ($path as $item) { $pathway->addItem($item['title'], $item['link']); } } $title = $this->params->get('page_title', ''); if (empty($title)) { $title = $app->getCfg('sitename'); } elseif ($app->getCfg('sitename_pagetitles', 0) == 1) { $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename')); } $this->document->setTitle($title); if ($this->category->metadesc) { $this->document->setDescription($this->category->metadesc); } elseif (!$this->category->metadesc && $this->params->get('menu-meta_description')) { $this->document->setDescription($this->params->get('menu-meta_description')); } if ($this->category->metakey) { $this->document->setMetadata('keywords', $this->category->metakey); } elseif (!$this->category->metakey && $this->params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); } if ($this->params->get('robots')) { $this->document->setMetadata('robots', $this->params->get('robots')); } if ($app->getCfg('MetaAuthor') == '1') { $this->document->setMetaData('author', $this->category->getMetadata()->get('author')); } $mdata = $this->category->getMetadata()->toArray(); foreach ($mdata as $k => $v) { if ($v) { $this->document->setMetadata($k, $v); } } // Add feed links if ($this->params->get('show_feed_link', 1)) { $link = '&format=feed&limitstart='; $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); $this->document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs); $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'); $this->document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs); } }
public static function getList(&$params) { // Get the dbo $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('c.*, c.id as content_id, u.name as user_name, u.id as user_id'); $query->select('CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as slug'); $query->select('CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug'); $query->select('CASE WHEN CHAR_LENGTH(c.fulltext) THEN c.fulltext ELSE null END as readmore'); $query->from('#__tz_portfolio_plus_content AS c'); $query->join('INNER', $db->quoteName('#__tz_portfolio_plus_content_category_map') . ' AS m ON m.contentid=c.id'); $query->join('LEFT', $db->quoteName('#__tz_portfolio_plus_categories') . ' AS cc ON cc.id=m.catid'); $query->join('LEFT', $db->quoteName('#__tz_portfolio_plus_tag_content_map') . ' AS x ON x.contentid=c.id'); $query->join('LEFT', $db->quoteName('#__tz_portfolio_plus_tags') . ' AS t ON t.id=x.tagsid'); $query->join('LEFT', $db->quoteName('#__users') . ' AS u ON u.id=c.created_by'); $query->where('c.state= 1'); if ($params->get('category_filter', 2) == 2) { $query->where('(m.main = 0 OR m.main = 1)'); } elseif ($params->get('category_filter', 2) == 1) { $query->where('m.main = 1'); } else { $query->where('m.main = 0'); } $nullDate = $db->Quote($db->getNullDate()); $nowDate = $db->Quote(JFactory::getDate()->toSQL()); $query->where('(c.publish_up = ' . $nullDate . ' OR c.publish_up <= ' . $nowDate . ')'); $query->where('(c.publish_down = ' . $nullDate . ' OR c.publish_down >= ' . $nowDate . ')'); if ($types = $params->get('media_types', array())) { $types = array_filter($types); if (count($types)) { $media_conditions = array(); foreach ($types as $type) { $media_conditions[] = 'c.type=' . $db->quote($type); } if (count($media_conditions)) { $query->where('(' . implode(' OR ', $media_conditions) . ')'); } } } if (!$params->get('show_featured', 1)) { $query->where('c.featured = 0'); } elseif ($params->get('show_featured', 1) == 2) { $query->where('c.featured = 1'); } $catids = $params->get('catid'); if (is_array($catids)) { $catids = array_filter($catids); if (count($catids)) { $query->where('m.catid IN(' . implode(',', $catids) . ')'); } } else { $query->where('m.catid IN(' . $catids . ')'); } switch ($params->get('orderby_sec', 'rdate')) { default: $orderby = 'c.id DESC'; break; case 'rdate': $orderby = 'c.created DESC'; break; case 'date': $orderby = 'c.created ASC'; break; case 'alpha': $orderby = 'c.title ASC'; break; case 'ralpha': $orderby = 'c.title DESC'; break; case 'author': $orderby = 'u.name ASC'; break; case 'rauthor': $orderby = 'u.name DESC'; break; case 'hits': $orderby = 'c.hits DESC'; break; case 'rhits': $orderby = 'c.hits ASC'; break; case 'order': $orderby = 'c.ordering ASC'; break; } if ($params->get('random_article', 0)) { $query->order('RAND()'); } $query->order($orderby); $query->group('c.id'); $db->setQuery($query, 0, $params->get('article_limit', 5)); $items = $db->loadObjectList(); if ($items) { $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); TZ_Portfolio_PlusPluginHelper::importPlugin('content'); TZ_Portfolio_PlusPluginHelper::importPlugin('mediatype'); $dispatcher->trigger('onAlwaysLoadDocument', array('modules.mod_tz_portfolio_plus_articles')); $dispatcher->trigger('onLoadData', array('modules.mod_tz_portfolio_plus_articles', $items, $params)); foreach ($items as $i => &$item) { $item->link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->slug, $item->catslug)); $item->fullLink = JRoute::_(TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->slug, $item->catslug), true, -1); $item->author_link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getUserRoute($item->user_id, $params->get('usermenuitem', 'auto'))); $media = $item->media; if (!empty($media)) { $registry = new Registry($media); $media = $registry->toObject(); $item->media = $media; } $item->mediatypes = array(); // Old plugins: Ensure that text property is available if (!isset($item->text)) { $item->text = $item->introtext; } $item->event = new stdClass(); //Call trigger in group content $results = $dispatcher->trigger('onContentPrepare', array('modules.mod_tz_portfolio_plus_articles', &$item, &$params, 0)); $item->introtext = $item->text; if ($introtext_limit = $params->get('introtext_limit')) { $item->introtext = '<p>' . JHtml::_('string.truncate', $item->introtext, $introtext_limit, true, false) . '</p>'; } // $results = $dispatcher->trigger('onContentAfterTitle', array('modules.mod_tz_portfolio_plus_articles', &$item, &$params, 0)); // $item->event->afterDisplayTitle = trim(implode("\n", $results)); // $results = $dispatcher->trigger('onContentBeforeDisplay', array('modules.mod_tz_portfolio_plus_articles', &$item, &$params, 0, $params->get('layout', 'default'))); $item->event->beforeDisplayContent = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentAfterDisplay', array('modules.mod_tz_portfolio_plus_articles', &$item, &$params, 0, $params->get('layout', 'default'))); $item->event->afterDisplayContent = trim(implode("\n", $results)); // Process the tz portfolio's content plugins. $results = $dispatcher->trigger('onBeforeDisplayAdditionInfo', array('modules.mod_tz_portfolio_plus_articles', &$item, &$params, 0, $params->get('layout', 'default'))); $item->event->beforeDisplayAdditionInfo = trim(implode("\n", $results)); $results = $dispatcher->trigger('onAfterDisplayAdditionInfo', array('modules.mod_tz_portfolio_plus_articles', &$item, &$params, 0, $params->get('layout', 'default'))); $item->event->afterDisplayAdditionInfo = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentDisplayListView', array('modules.mod_tz_portfolio_plus_articles', &$item, &$params, 0, $params->get('layout', 'default'))); $item->event->contentDisplayListView = trim(implode("\n", $results)); //Call trigger in group tz_portfolio_plus_mediatype $results = $dispatcher->trigger('onContentDisplayMediaType', array('modules.mod_tz_portfolio_plus_articles', &$item, &$params, 0, $params->get('layout', 'default'))); if (isset($item) && $item) { $item->event->onContentDisplayMediaType = trim(implode("\n", $results)); if ($results = $dispatcher->trigger('onAddMediaType')) { $mediatypes = array(); foreach ($results as $result) { if (isset($result->special) && $result->special) { $mediatypes[] = $result->value; } } $item->mediatypes = $mediatypes; } } else { unset($items[$i]); } } return $items; } return false; }
public function getItems() { if ($items = parent::getItems()) { $user = JFactory::getUser(); $userId = $user->get('id'); $guest = $user->get('guest'); $params = $this->getState('params'); JLoader::import('category', COM_TZ_PORTFOLIO_PLUS_PATH_SITE . DIRECTORY_SEPARATOR . 'helpers'); $_params = null; $threadLink = null; $comments = null; if (count($items) > 0) { $content_ids = JArrayHelper::getColumn($items, 'id'); $mainCategories = TZ_Portfolio_PlusFrontHelperCategories::getCategoriesByArticleId($content_ids, array('main' => true)); $second_categories = TZ_Portfolio_PlusFrontHelperCategories::getCategoriesByArticleId($content_ids, array('main' => false)); $tags = null; if (count($content_ids) && $params->get('show_tags', 1)) { $tags = TZ_Portfolio_PlusFrontHelperTags::getTagsByArticleId($content_ids, array('orderby' => 'm.contentid', 'menuActive' => $params->get('menu_active', 'auto'), 'reverse_contentid' => true)); } $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); TZ_Portfolio_PlusPluginHelper::importPlugin('mediatype'); TZ_Portfolio_PlusPluginHelper::importPlugin('content'); $dispatcher->trigger('onAlwaysLoadDocument', array('com_tz_portfolio_plus.portfolio')); $dispatcher->trigger('onLoadData', array('com_tz_portfolio_plus.portfolio', $items, $params)); // Get the global params $globalParams = JComponentHelper::getParams('com_tz_portfolio_plus', true); foreach ($items as $i => &$item) { $_params = clone $params; $item->params = clone $_params; $articleParams = new JRegistry(); $articleParams->loadString($item->attribs); if ($mainCategories && isset($mainCategories[$item->id])) { $mainCategory = $mainCategories[$item->id]; if ($mainCategory) { $item->catid = $mainCategory->id; $item->category_title = $mainCategory->title; $item->catslug = $mainCategory->id . ':' . $mainCategory->alias; $item->category_link = $mainCategory->link; // Merge main category's params to article $catParams = new JRegistry($mainCategory->params); if ($inheritFrom = $catParams->get('inheritFrom', 0)) { if ($inheritCategory = TZ_Portfolio_PlusFrontHelperCategories::getCategoriesById($inheritFrom)) { $inheritCatParams = new JRegistry($inheritCategory->params); $catParams = clone $inheritCatParams; } } $item->params->merge($catParams); } } else { // Create main category's link $item->category_link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getCategoryRoute($item->catid)); // Merge main category's params to article if ($mainCategory = TZ_Portfolio_PlusFrontHelperCategories::getCategoriesById($item->catid)) { $catParams = new JRegistry($mainCategory->params); if ($inheritFrom = $catParams->get('inheritFrom', 0)) { if ($inheritCategory = TZ_Portfolio_PlusFrontHelperCategories::getCategoriesById($inheritFrom)) { $inheritCatParams = new JRegistry($inheritCategory->params); $catParams = clone $inheritCatParams; } } $item->params->merge($catParams); } } // Merge with article params $item->params->merge($articleParams); // Get all second categories $item->second_categories = null; if (isset($second_categories[$item->id])) { $item->second_categories = $second_categories[$item->id]; } // Get article's tags $item->tags = null; if ($tags && count($tags) && isset($tags[$item->id])) { $item->tags = $tags[$item->id]; } /*** Start New Source ***/ $tmpl = null; if ($item->params->get('tz_use_lightbox', 0)) { $tmpl = '&tmpl=component'; } $config = JFactory::getConfig(); $ssl = -1; if ($config->get('force_ssl')) { $ssl = 1; } // Create Article Link $item->link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->slug, $item->catid) . $tmpl); $item->fullLink = JRoute::_(TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->slug, $item->catid), true, $ssl); // Create author Link $item->author_link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getUserRoute($item->created_by, $params->get('user_menu_active', 'auto'))); // Compute the asset access permissions. // Technically guest could edit an article, but lets not check that to improve performance a little. if (!$guest) { $asset = 'com_tz_portfolio_plus.article.' . $item->id; // Check general edit permission first. if ($user->authorise('core.edit', $asset)) { $item->params->set('access-edit', true); } elseif (!empty($userId) && $user->authorise('core.edit.own', $asset)) { // Check for a valid user and that they are the owner. if ($userId == $item->created_by) { $item->params->set('access-edit', true); } } } $media = $item->media; if ($item->media && !empty($item->media)) { $registry = new JRegistry($item->media); $obj = $registry->toObject(); $item->media = clone $obj; } $item->mediatypes = array(); // Add feed links if (JFactory::getApplication()->input->getCmd('format', null) != 'feed') { // Old plugins: Ensure that text property is available if (!isset($item->text)) { $item->text = $item->introtext; } // // Process the content plugins. // $dispatcher->trigger('onContentPrepare', array('com_tz_portfolio_plus.portfolio', &$item, &$item->params, $this->getState('list.start'))); $item->introtext = $item->text; $item->event = new stdClass(); $results = $dispatcher->trigger('onContentAfterTitle', array('com_tz_portfolio_plus.portfolio', &$item, &$item->params, $this->getState('list.start'))); $item->event->afterDisplayTitle = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_tz_portfolio_plus.portfolio', &$item, &$item->params, $this->getState('list.start'))); $item->event->beforeDisplayContent = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentAfterDisplay', array('com_tz_portfolio_plus.portfolio', &$item, &$item->params, $this->getState('list.start'))); $item->event->afterDisplayContent = trim(implode("\n", $results)); // Process the tz portfolio's content plugins. $results = $dispatcher->trigger('onContentDisplayVote', array('com_tz_portfolio_plus.portfolio', &$item, &$item->params, $this->getState('list.start'))); $item->event->contentDisplayVote = trim(implode("\n", $results)); $results = $dispatcher->trigger('onBeforeDisplayAdditionInfo', array('com_tz_portfolio_plus.portfolio', &$item, &$item->params, $this->getState('list.start'))); $item->event->beforeDisplayAdditionInfo = trim(implode("\n", $results)); $results = $dispatcher->trigger('onAfterDisplayAdditionInfo', array('com_tz_portfolio_plus.portfolio', &$item, &$item->params, $this->getState('list.start'))); $item->event->afterDisplayAdditionInfo = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentDisplayListView', array('com_tz_portfolio_plus.portfolio', &$item, &$item->params, $this->getState('list.start'))); $item->event->contentDisplayListView = trim(implode("\n", $results)); // Process the tz portfolio's mediatype plugins. $results = $dispatcher->trigger('onContentDisplayMediaType', array('com_tz_portfolio_plus.portfolio', &$item, &$item->params, $this->getState('list.start'))); if ($item) { $item->event->onContentDisplayMediaType = trim(implode("\n", $results)); if ($results = $dispatcher->trigger('onAddMediaType')) { $mediatypes = array(); foreach ($results as $result) { if (isset($result->special) && $result->special) { $mediatypes[] = $result->value; } } $item->mediatypes = $mediatypes; } } else { unset($items[$i]); } } if ($item && strlen(trim($item->introtext)) && ($introLimit = $params->get('tz_article_intro_limit'))) { $item->introtext = '<p>' . JHtml::_('string.truncate', $item->introtext, $introLimit, true, false) . '</p>'; } } return $items; } } return false; }
public function getItems() { if ($items = parent::getItems()) { $categories = new TZ_Portfolio_PlusCategories(); foreach ($items as &$item) { $params = clone $this->getState('params'); $temp = clone $this->getState('params'); // Get the global params $globalParams = JComponentHelper::getParams('com_tz_portfolio_plus', true); /*** New source ***/ $category = $categories->get($item->catid); $catParams = new JRegistry($category->params); $articleParams = new JRegistry(); $articleParams->loadString($item->attribs); // if($temp -> get('menuInheritFrom', 'none') == 'articles'){ // // if($inheritCatid = $catParams -> get('inheritFrom')){ // if($inheritCategory = $categories -> get($inheritCatid)){ // $inheritCatParams = new JRegistry($inheritCategory -> params); // $item -> params = clone($inheritCatParams); // } // }else{ // $item -> params = clone($catParams); // } // $item -> params -> merge($articleParams); // }else{ $item->params = clone $params; // } // Create new options "link" and "fullLink" for article $tmpl = null; if ($item->params->get('tz_use_lightbox', 0)) { $tmpl = '&tmpl=component'; } $config = JFactory::getConfig(); $ssl = -1; if ($config->get('force_ssl')) { $ssl = 1; } $item->link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->slug, $item->catid) . $tmpl); $item->fullLink = JRoute::_(TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->slug, $item->catid), true, $ssl); /** End Create new options **/ $media = $item->media; $registry = new JRegistry(); $registry->loadString($media); $media = $registry->toObject(); $item->media = $media; $item->mediatypes = array(); } return $items; } return false; }
?> <?php if ($this->params->get('show_empty_categories_cat', 0) || $item->numitems || count($item->getChildren())) { if (!isset($this->items[$this->parent->id][$id + 1])) { $class = ' class="last"'; } ?> <div<?php echo $class; ?> > <?php $class = ''; ?> <h3 class="page-header item-title"><a href="<?php echo JRoute::_(TZ_Portfolio_PlusHelperRoute::getCategoryRoute($item->id)); ?> "> <?php echo $this->escape($item->title); ?> </a> <?php if ($this->params->get('show_cat_num_articles_cat', 1) == 1) { ?> <span class="badge badge-info hasTooltip" title="<?php echo JText::_('COM_TZ_PORTFOLIO_PLUS_NUM_ITEMS'); ?> "> <?php echo $item->numitems;
<td> <a style="cursor: pointer;" class="pointer" onclick="if (window.parent) window.parent.<?php echo $this->escape($function); ?> ('<?php echo $item->id; ?> ', '<?php echo $this->escape(addslashes($item->title)); ?> ', '<?php echo $this->escape($item->catid); ?> ', null, '<?php echo $this->escape(TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->id)); ?> ');"> <?php echo $this->escape($item->title); ?> </a> </td> <td class="small hidden-phone"> <?php echo $item->type; ?> </td> <td class="center small"> <?php echo $this->escape($item->access_level);
public static function print_popup($article, $params, $attribs = array()) { $app = JFactory::getApplication(); $input = $app->input; $request = $input->request; $url = TZ_Portfolio_PlusHelperRoute::getArticleRoute($article->slug, $article->catid); $url .= '&tmpl=component&print=1&layout=default&page=' . @$request->limitstart; $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no'; // checks template image directory for image, if non found default are loaded if ($params->get('show_cat_icons', 1)) { $icon = 'icon-print'; if (count($attribs) && isset($attribs['icon'])) { $icon = $attribs['icon']; unset($attribs['icon']); } $text = '<i class="' . $icon . '"></i> ' . JText::_('JGLOBAL_PRINT'); } else { $text = JText::_('JGLOBAL_PRINT'); } $attribs['title'] = JText::_('JGLOBAL_PRINT'); $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;"; $attribs['rel'] = 'nofollow'; return JHtml::_('link', JRoute::_($url), $text, $attribs); }
public function getItems() { if ($items = parent::getItems()) { foreach ($items as &$item) { $params = clone $this->getState('params'); $item->params = clone $params; // Create new options "link" and "fullLink" for article $tmpl = null; if ($item->params->get('tz_use_lightbox', 0)) { $tmpl = '&tmpl=component'; } $config = JFactory::getConfig(); $ssl = -1; if ($config->get('force_ssl')) { $ssl = 1; } //Check redirect to view article $item->link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->slug, $item->catid) . $tmpl); $item->fullLink = JRoute::_(TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->slug, $item->catid), true, $ssl); /** End Create new options **/ // Create author Link $item->author_link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getUserRoute($item->created_by, $params->get('user_menu_active', 'auto'))); $media = $item->media; $registry = new JRegistry(); $registry->loadString($media); $obj = $registry->toObject(); $item->media = clone $obj; $item->mediatypes = array(); } return $items; } return false; }
<?php $letter = trim($letter); $disabledClass = null; $activeClass = null; $date = null; if ($availLetter[$i] != true) { $disabledClass = ' disabled'; } if ($this->char == $letter) { $activeClass = ' active'; } ?> <li> <a<?php if ($availLetter[$i] != false && $this->char != $letter) { echo ' href="' . JRoute::_(TZ_Portfolio_PlusHelperRoute::getDateRoute($this->state->get('filter.year'), $this->state->get('filter.month')) . '&char=' . mb_strtolower(trim($letter))) . '"'; } ?> class="btn-sm<?php echo $disabledClass . $activeClass; ?> "><?php echo mb_strtoupper(trim($letter)); ?> </a> </li> <?php } } ?> </ul>
public static function getTagsByArticleId($contentId, $options = array('orderby' => null, 'condition' => null, 'reverse_contentid' => true, 'menuActive' => null)) { if ($contentId) { if (is_array($contentId)) { $storeId = md5(__METHOD__ . '::' . implode(',', $contentId)); } else { $storeId = md5(__METHOD__ . '::' . $contentId); } if (!isset(self::$cache[$storeId])) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('t.*, c.id AS contentid'); $query->select('CASE WHEN CHAR_LENGTH(t.alias) THEN CONCAT_WS(":", t.id, t.alias) ELSE t.id END as slug'); $query->from('#__tz_portfolio_plus_tags AS t'); $query->join('INNER', '#__tz_portfolio_plus_tag_content_map AS m ON m.tagsid = t.id'); $query->join('INNER', '#__tz_portfolio_plus_content AS c ON c.id = m.contentid'); $query->where('t.published = 1'); if (is_array($contentId)) { $query->where('c.id IN(' . implode(',', $contentId) . ')'); } else { $query->where('c.id = ' . $contentId); } if (count($options)) { if (isset($options['condition']) && $options['condition']) { $query->where($options['condition']); } if (isset($options['orderby']) && $options['orderby']) { $query->order($options['orderby']); } } $db->setQuery($query); if ($data = $db->loadObjectList()) { $tags = array(); $tagIds = array(); $menuActive = null; if (isset($options['menuActive']) && !empty($options['menuActive'])) { $menuActive = $options['menuActive']; } foreach ($data as &$tag) { // Create Tag Link $tag->link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getTagRoute($tag->slug, 0, $menuActive)); // Create article's id is array's key with value are tags if (count($options) && isset($options['reverse_contentid']) && $options['reverse_contentid']) { if (!isset($tags[$tag->contentid])) { $tags[$tag->contentid] = array(); } if (!isset($tagIds[$tag->contentid])) { $tagIds[$tag->contentid] = array(); } if (!in_array($tag->id, $tagIds[$tag->contentid])) { $tags[$tag->contentid][] = $tag; $tagIds[$tag->contentid][] = $tag->id; } } } if (!count($tags)) { $tags = $data; } self::$cache[$storeId] = $tags; return $tags; } self::$cache[$storeId] = false; } return self::$cache[$storeId]; } return false; }