| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /inetpub/wwwroot/icd/components/com_sectionex/views/category/ |
Upload File : |
<?php
/**
* @package SectionEx
* @copyright Copyright (C) 2008 Robert Kuster. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* @link http://www.stackideas.com
*
* SectionEx is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined('_JEXEC') or die('Restricted access');
jimport( 'joomla.application.component.view');
// Component Helper
require_once(JPATH_COMPONENT_SITE.DS.'helpers'.DS.'misc.php');
require_once(JPATH_COMPONENT_SITE.DS.'helpers'.DS.'route.php');
require_once(JPATH_ROOT.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
/**
* HTML View class for the HelloWorld Component
*
* @package Joomla.Tutorials
* @subpackage Components
*/
class SectionExViewCategory extends JView
{
function display($tpl = null)
{
$cid = JRequest::getVar( 'cid' , 0 , 'GET' );
if($this->get( 'IdSection') == 0 && $cid == 0 )
{ // No section was selected for our menu item.. Show an error message and return.
echo "<b>".JText::_("ALERT_SECTION_NOT_SELECTED")."</b>";
return;
}
// Get page/component configuration
$mainframe =& JFactory::getApplication();
$params = &$mainframe->getParams();
$uri =& JFactory::getURI();
// Get some data from the model
$articles =& $this->get( 'Articles');
$section =& $this->get( 'Section' );
$category =& $this->get( 'Category' );
// ARTICLES -> create URL for each article
// CATEGORIES -> get start index into articles verctor && active articles per category
$this->_init_Additional_Category_And_Article_Data( $categories, $articles );
// parameters
$db =& JFactory::getDBO();
$document =& JFactory::getDocument();
$params =& $mainframe->getParams();
$document->setTitle( $section->title . ' - ' . $category->title );
$document->link = JRoute::_('index.php?option=com_sectionex&view=category&id=' . $this->get('IdSection') . '&cid=' . $cid . '&format=feed&type=rss');
foreach ( $articles as $row )
{
// strip html from feed item title
$title = $this->escape( $row->title );
$title = html_entity_decode( $title );
// url link to article
$link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));
// strip html from feed item description text
$description = ($params->get('feed_summary', 0) ? $row->introtext.$row->fulltext : $row->introtext);
$author = $row->created_by_alias ? $row->created_by_alias : $row->author;
// load individual item creator class
$item = new JFeedItem();
$item->title = $title;
$item->link = $link;
$item->description = $description;
$item->date = $row->created;
$item->category = 'frontpage';
// loads item info into rss array
$document->addItem( $item );
}
// -> asign refs so we can use the 'variables' in our tmpl files
}
// ARTICLES -> create URL for each article
// CATEGORIES -> get start index into articles verctor and active articles per category
function _init_Additional_Category_And_Article_Data(&$categories, &$articles)
{
// for CATEGORIES:
// a) retrieve start index into the article array for each category
// (note that articles have been "ordered" by categories in our SQL statement, thus
// all articles of one categroy are "bundled" together one after the other)
// b) calculate the number of active articles( #actually displayed articles -> this will be a number
// between "0 < activeItems < numitems", depending on the filtering criteriums)
// values needed for generating URLs
$isSefEnabled = $this->_isSef();
$newItemId = "Itemid=" . RkHelper::getIdOfActiveMenu();
// LOOP over all articles
for ($i=0; $i < sizeof($articles); $i++)
{
$article = & $articles[$i];
// skip uncategorized articles for now
if ($article->catid == 0)
continue;
// -> get article's URL
$article->link = $this->_getArticleURL($article, $isSefEnabled, $newItemId);
}
}
function _getArticleURL(&$article, &$isSefEnabled, &$newItemId)
{
global $mainframe;
$params = &$mainframe->getParams();
$link = '';
// -> Fron Page like links?
if ($params->get('se_menu_behavior') == 1)
{
// -> create a link with the functionality provided by Joomla! core
$link = JRoute::_(ContentHelperRouteX::getArticleRoute($article->slug, $article->catslug, $article->sectionid));
return $link;
}
// -> SectionEx like links?
if ($isSefEnabled == true)
{ // -> SEO urls enabled
// manually create a link that links to our component;
// sectionexBuildRoute is called implicitly (by JRoute)
$link = JRoute::_('index.php?view=article&catid='.$article->catslug.'&id='.$article->slug);
return $link;
}
else
{ // -> RAW urls enabled
$link = JRoute::_(ContentHelperRouteX::getArticleRoute($article->slug, $article->catslug, $article->sectionid));
// Is there an Itemid somewhere in the link?
if (preg_match("/Item[Ii]d=[0-9]+/", $link, $oldItemId))
{
// -> replace the existing Itemid with Itdemid="OurMenu".
// This way our menu stays highlihte even though we are displaying content from another component.
$link = str_replace( $oldItemId[0], $newItemId, $link );
return $link;
}
else
{ // If there is no Itemid (no other menu which links to the displayed article) append it.
$link = $link . "&" .$newItemId;
return $link;
}
} // else -> RAW links
// Oops. Should never get here..
return $link;
}
function _isSef()
{
$mainframe =& JFactory::getApplication();
$sef = $mainframe->getCfg('sef');
if ($sef == JROUTER_MODE_SEF)
return true;
return false;
}
function _buildSortLists()
{
global $mainframe;
$params = &$mainframe->getParams();
// Table ordering values -> Get filter data from Reuqest or session
$keyPrefix = RkHelper::getPrefixFoxStateVariables($params->get('se_sort_propagate'));
$filter_order = $mainframe->getUserStateFromRequest($keyPrefix . 'filter_order', 'filter_order', '');
$filter_order_Dir = $mainframe->getUserStateFromRequest($keyPrefix . 'filter_order_Dir', 'filter_order_Dir', '');
$filter_title = JRequest::getString('filter_title', '', 'request');
$filter_author = JRequest::getString('filter_author', '', 'request');
$filter_content = JRequest::getString('filter_content', '', 'request');
$lists['order'] = $filter_order;
$lists['order_Dir'] = $filter_order_Dir;
$lists['title'] = $filter_title;
$lists['author'] = $filter_author;
$lists['content'] = $filter_content;
return $lists;
}
function _getHtmlTocEntry($c)
{
$row = &$this->categories[$c];
$juri = JURI::getInstance();
$str_numitems_active = $this->_is_a_FilterActive() ? ($row->numitems_active . "/") : null;
if ($this->_is_a_FilterActive() && ($row->numitems_active == 0))
{
$strRet = "";
//$strRet .= "<li><span class=\"small\">";
$strRet .= $row->title;
if ($this->params->get('se_toc_show_numitems') == 1)
{
$strRet .= " ( ". $str_numitems_active . $row->numitems ." ". JText::_('ITEMS') ." )";
}
//$strRet .= "</span></li>";
}
else
{
$strRet = "";
$strRet .= "<a href='" . $juri->toString() . "#catid" . $row->id . "'>";
$strRet .= $row->title;
if ($this->params->get('se_toc_show_numitems') == 1)
{
$strRet .= "</a> <span class=\"small\">( ". $str_numitems_active . $row->numitems ." ". JText::_('ITEMS') ." )</span>";
}
else
{
$strRet .= "</a>";
}
}
return $strRet;
}
function _is_a_FilterActive()
{
global $mainframe;
$params = &$mainframe->getParams();
if ($params->get('se_filters'))
{
$filter_title = JRequest::getString('filter_title', '', 'request');
if ($filter_title)
{
return true;
}
$filter_author = JRequest::getString('filter_author', '', 'request');
if ($filter_author)
{
return true;
}
$filter_content = JRequest::getString('filter_content', '', 'request');
if ($filter_content)
{
return true;
}
}
return false;
}
function _writeInlineStyle($style)
{
if ($this->params->get('use_inline_css') == 1)
{
echo "style='" . $style . "'";
}
}
function _formatAndConvertIntroText(&$introtext)
{
if (($this->params->get('se_show_intro_text_short')==1) ||
($this->params->get('se_show_intro_text_short')==2))
{ // show only a short variant of our intro-text (if it is defined in a special hidden <span> tag)
// Look for a string which is defined with the following span (only exact machtes):
// <span class="SectionExDescription" style="display: none;">....</span>
$regex_pattern = "/<span style=\"display: none\" class=\"ShortDescription\">(.*)<\/span>/";
if (preg_match($regex_pattern, $introtext, $matches))
{
$introtext = $matches[1];
return;
}
if ($this->params->get('se_show_intro_text_short')==2)
{ // se_show_intro_text_short == 2 == SHORT_ONLY
// We wanted only short introduction textes. If they are not specified then nothing is displayed.
$introtext = "";
return;
}
}
// If we got here then we didn't change the introduction text in any way. The full introduction text will be displayed
// (this is the same text as displayed on the front-page). This applies for one of the following scenarios:
// a) se_show_intro_text_short == 0 (NO)
// b) se_show_intro_text_short == 1 (SHORT_IF_IT_EXISTS), but no short-intro was defined for our article
}
}
?>