Пример #1
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $document->link = JRoute::_(WeblinksHelperRoute::getCategoryRoute(JRequest::getVar('id', null, '', 'int')));
     JRequest::setVar('limit', $app->getCfg('feed_limit'));
     $siteEmail = $app->getCfg('mailfrom');
     $fromName = $app->getCfg('fromname');
     $document->editor = $fromName;
     $document->editorEmail = $siteEmail;
     // Get some data from the model
     $items = $this->get('Items');
     $category = $this->get('Category');
     foreach ($items as $item) {
         // strip html from feed item title
         $title = $this->escape($item->title);
         $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
         // url link to article
         $link = JRoute::_(WeblinksHelperRoute::getWeblinkRoute($item->slug, $item->catid));
         // strip html from feed item description text
         $description = $item->description;
         $date = $item->date ? date('r', strtotime($item->date)) : '';
         // load individual item creator class
         $feeditem = new JFeedItem();
         $feeditem->title = $title;
         $feeditem->link = $link;
         $feeditem->description = $description;
         $feeditem->date = $date;
         $feeditem->category = 'Weblinks';
         // loads item info into rss array
         $document->addItem($feeditem);
     }
 }
Пример #2
0
 /**
  * Prepares the document
  *
  * @return  void
  */
 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::_('COM_WEBLINKS_DEFAULT_PAGE_TITLE'));
     }
     $id = (int) @$menu->query['id'];
     if ($menu && ($menu->query['option'] != 'com_weblinks' || $id != $this->category->id)) {
         $this->params->set('page_subheading', $this->category->title);
         $path = array(array('title' => $this->category->title, 'link' => ''));
         $category = $this->category->getParent();
         while (($menu->query['option'] != 'com_weblinks' || $id != $category->id) && $category->id > 1) {
             $path[] = array('title' => $category->title, 'link' => WeblinksHelperRoute::getCategoryRoute($category->id));
             $category = $category->getParent();
         }
         $path = array_reverse($path);
         foreach ($path as $item) {
             $pathway->addItem($item['title'], $item['link']);
         }
     }
     parent::addFeed();
 }
Пример #3
0
 public function getLinks($args)
 {
     $wf = WFEditorPlugin::getInstance();
     $items = array();
     switch ($args->view) {
         // Get all WebLink categories
         default:
         case 'categories':
             $categories = WFLinkBrowser::getCategory('com_weblinks');
             foreach ($categories as $category) {
                 if (method_exists('WeblinksHelperRoute', 'getCategoryRoute')) {
                     $id = WeblinksHelperRoute::getCategoryRoute($category->id);
                 } else {
                     $itemid = WFLinkBrowser::getItemId('com_weblinks', array('categories' => null, 'category' => $category->id));
                     $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id . $itemid;
                 }
                 $items[] = array('id' => $id, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder weblink');
             }
             break;
             // Get all links in the category
         // Get all links in the category
         case 'category':
             require_once JPATH_SITE . DS . 'includes' . DS . 'application.php';
             require_once JPATH_SITE . DS . 'components' . DS . 'com_weblinks' . DS . 'helpers' . DS . 'route.php';
             if (!WF_JOOMLA15) {
                 $categories = WFLinkBrowser::getCategory('com_weblinks', $args->id);
                 if (count($categories)) {
                     foreach ($categories as $category) {
                         $children = WFLinkBrowser::getCategory('com_weblinks', $category->id);
                         if ($children) {
                             $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id;
                         } else {
                             if (method_exists('WeblinksHelperRoute', 'getCategoryRoute')) {
                                 $id = WeblinksHelperRoute::getCategoryRoute($category->id);
                             } else {
                                 $itemid = WFLinkBrowser::getItemId('com_weblinks', array('categories' => null, 'category' => $category->id));
                                 $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id . $itemid;
                             }
                         }
                         $items[] = array('id' => $id, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder weblink');
                     }
                 }
             }
             $weblinks = self::_weblinks($args->id);
             foreach ($weblinks as $weblink) {
                 $items[] = array('id' => WeblinksHelperRoute::getWeblinkRoute($weblink->slug, $weblink->catslug), 'name' => $weblink->title . ' / ' . $weblink->alias, 'class' => 'file');
             }
             break;
     }
     return $items;
 }
Пример #4
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $document->link = JRoute::_(WeblinksHelperRoute::getCategoryRoute(JRequest::getVar('id', null, '', 'int')));
     JRequest::setVar('limit', $app->getCfg('feed_limit'));
     $params = $app->getParams();
     $siteEmail = $app->getCfg('mailfrom');
     $fromName = $app->getCfg('fromname');
     $feedEmail = $app->getCfg('feed_email', 'author');
     $document->editor = $fromName;
     if ($feedEmail != "none") {
         $document->editorEmail = $siteEmail;
     }
     // Get some data from the model
     $items = $this->get('Items');
     $category = $this->get('Category');
     foreach ($items as $item) {
         // strip html from feed item title
         $title = $this->escape($item->title);
         $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
         // url link to article
         $link = JRoute::_(WeblinksHelperRoute::getWeblinkRoute($item->id, $item->catid));
         // strip html from feed item description text
         $description = $item->description;
         $author = $item->created_by_alias ? $item->created_by_alias : $item->author;
         $date = $item->date ? date('r', strtotime($item->date)) : '';
         // load individual item creator class
         $feeditem = new JFeedItem();
         $feeditem->title = $title;
         $feeditem->link = $link;
         $feeditem->description = $description;
         $feeditem->date = $date;
         $feeditem->category = $category->title;
         $feeditem->author = $author;
         // We don't have the author email so we have to use site in both cases.
         if ($feedEmail == 'site') {
             $feeditem->authorEmail = $siteEmail;
         } elseif ($feedEmail === 'author') {
             $feeditem->authorEmail = $item->author_email;
         }
         // loads item info into rss array
         $document->addItem($feeditem);
     }
 }
		<?php 
        if ($this->params->get('show_empty_categories_cat') || $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::_(WeblinksHelperRoute::getCategoryRoute($item->id));
            ?>
">
					<?php 
            echo $this->escape($item->title);
            ?>
</a>
					<?php 
            if ($this->params->get('show_cat_num_articles_cat') == 1) {
                ?>
						<span class="badge badge-info tip hasTooltip" title="<?php 
                echo JHtml::tooltipText('COM_WEBLINKS_NUM_ITEMS');
                ?>
">
							<?php 
                echo $item->numitems;
Пример #6
0
 /**
  * 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::_('COM_WEBLINKS_DEFAULT_PAGE_TITLE'));
     }
     $id = (int) @$menu->query['id'];
     if ($menu && ($menu->query['option'] != 'com_weblinks' || $id != $this->category->id)) {
         $this->params->set('page_subheading', $this->category->title);
         $path = array(array('title' => $this->category->title, 'link' => ''));
         $category = $this->category->getParent();
         while (($menu->query['option'] != 'com_weblinks' || $id != $category->id) && $category->id > 1) {
             $path[] = array('title' => $category->title, 'link' => WeblinksHelperRoute::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 alternative feed link
     if ($this->params->get('show_feed_link', 1) == 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);
     }
 }
Пример #7
0
defined('_JEXEC') or die;
?>

<?php 
if (count($this->children[$this->category->id]) > 0 && $this->maxLevel != 0) {
    ?>
<ul>
	<?php 
    foreach ($this->children[$this->category->id] as $id => $child) {
        ?>
		<?php 
        if ($this->params->get('show_empty_categories') || $child->numitems || count($child->getChildren())) {
            ?>
			<li>
				<a href="<?php 
            echo JRoute::_(WeblinksHelperRoute::getCategoryRoute($child->id));
            ?>
"><?php 
            echo $this->escape($child->title);
            ?>
</a>
	
				<?php 
            if ($this->params->get('show_cat_items') == 1) {
                ?>
				<small>(<?php 
                echo $child->numitems;
                ?>
)</small>
				<?php 
            }
Пример #8
0
<?php
defined('_JEXEC') or die;

?>

<?php if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) : ?>
<ul>
	<?php foreach($this->items[$this->parent->id] as $id => $item) : ?>
		<?php if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) : ?>
		<li>
			<a href="<?php echo JRoute::_(WeblinksHelperRoute::getCategoryRoute($item->id));?>"><?php echo $this->escape($item->title); ?></a>
			
			<?php if ($this->params->get('show_cat_items_cat') == 1) : ?>
			<small>(<?php echo $item->numitems; ?>)</small>
			<?php endif; ?>

			<?php if (($this->params->get('show_subcat_desc_cat') == 1) && $item->description) : ?>
			<div><?php echo JHtml::_('content.prepare', $item->description, '', 'com_weblinks.categories'); ?></div>
			<?php endif; ?>

			<?php
				if (count($item->getChildren()) > 0) {
					$this->items[$item->id] = $item->getChildren();
					$this->parent = $item;
					$this->maxLevelcat--;
					echo $this->loadTemplate('items');
					$this->parent = $item->getParent();
					$this->maxLevelcat++;
				}
			?>
		</li>
Пример #9
0
 public function getLinks($args)
 {
     $wf = WFEditorPlugin::getInstance();
     $items = array();
     require_once JPATH_SITE . '/includes/application.php';
     require_once JPATH_SITE . '/components/com_weblinks/helpers/route.php';
     switch ($args->view) {
         // Get all WebLink categories
         default:
         case 'categories':
             $categories = WFLinkBrowser::getCategory('com_weblinks');
             foreach ($categories as $category) {
                 $url = '';
                 $itemid = WFLinkBrowser::getItemId('com_weblinks', array('categories' => null, 'category' => $category->id));
                 if (method_exists('WeblinksHelperRoute', 'getCategoryRoute')) {
                     $id = WeblinksHelperRoute::getCategoryRoute($category->id);
                     if (strpos($id, 'index.php?Itemid=') !== false) {
                         $url = $id;
                         $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id;
                     }
                 } else {
                     $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id . $itemid;
                 }
                 $items[] = array('url' => $url, 'id' => $id, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder weblink');
             }
             break;
             // Get all links in the category
         // Get all links in the category
         case 'category':
             if (defined('JPATH_PLATFORM')) {
                 $categories = WFLinkBrowser::getCategory('com_weblinks', $args->id);
                 if (count($categories)) {
                     foreach ($categories as $category) {
                         $children = WFLinkBrowser::getCategory('com_weblinks', $category->id);
                         $url = '';
                         if ($children) {
                             $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id;
                         } else {
                             $itemid = WFLinkBrowser::getItemId('com_weblinks', array('categories' => null, 'category' => $category->id));
                             if (method_exists('WeblinksHelperRoute', 'getCategoryRoute')) {
                                 $id = WeblinksHelperRoute::getCategoryRoute($category->id);
                                 if (strpos($id, 'index.php?Itemid=') !== false) {
                                     $url = $id;
                                     $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id;
                                 }
                             } else {
                                 $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id . $itemid;
                             }
                         }
                         $items[] = array('url' => $url, 'id' => $id, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder weblink');
                     }
                 }
             }
             $weblinks = self::_weblinks($args->id);
             foreach ($weblinks as $weblink) {
                 $id = WeblinksHelperRoute::getWeblinkRoute($weblink->slug, $weblink->catslug);
                 if (defined('JPATH_PLATFORM')) {
                     $id .= '&task=weblink.go';
                 }
                 $items[] = array('id' => $id, 'name' => $weblink->title . ' / ' . $weblink->alias, 'class' => 'file');
             }
             break;
     }
     return $items;
 }
Пример #10
0
 static function getCategoryTree($xmap, $parent, &$params, $category)
 {
     $db = JFactory::getDBO();
     $children = $category->getChildren();
     $xmap->changeLevel(1);
     foreach ($children as $cat) {
         $node = new stdclass();
         $node->id = $parent->id;
         $node->uid = $parent->uid . 'c' . $cat->id;
         $node->name = $cat->title;
         $node->link = WeblinksHelperRoute::getCategoryRoute($cat);
         $node->priority = $params['cat_priority'];
         $node->changefreq = $params['cat_changefreq'];
         $node->expandible = true;
         if ($xmap->printNode($node) !== FALSE) {
             xmap_com_weblinks::getCategoryTree($xmap, $parent, $params, $cat);
         }
     }
     $xmap->changeLevel(-1);
     if ($params['include_links']) {
         //view=category&catid=...
         $linksModel = new WeblinksModelCategory();
         $linksModel->getState();
         // To force the populate state
         $linksModel->setState('list.limit', JArrayHelper::getValue($params, 'max_links', NULL));
         $linksModel->setState('list.start', 0);
         $linksModel->setState('list.ordering', 'ordering');
         $linksModel->setState('list.direction', 'ASC');
         $linksModel->setState('category.id', $category->id);
         $links = $linksModel->getItems();
         $xmap->changeLevel(1);
         foreach ($links as $link) {
             $node = new stdclass();
             $node->id = $parent->id;
             $node->uid = $parent->uid . 'i' . $link->id;
             $node->name = $link->title;
             $node->link = WeblinksHelperRoute::getWeblinkRoute($link->id, $category->id);
             $node->priority = $params['link_priority'];
             $node->changefreq = $params['link_changefreq'];
             $node->expandible = false;
             $xmap->printNode($node);
         }
         $xmap->changeLevel(-1);
     }
 }
Пример #11
0
JHtml::_('bootstrap.tooltip');

if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) :
?>
	<?php foreach($this->items[$this->parent->id] as $id => $item) : ?>
		<?php
		if ($this->params->get('show_empty_categories_cat') || $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::_(WeblinksHelperRoute::getCategoryRoute($item->id));?>">
					<?php echo $this->escape($item->title); ?></a>
					<?php if ($this->params->get('show_cat_num_articles_cat') == 1) :?>
						<span class="badge badge-info tip hasTooltip" title="<?php echo JText::_('COM_WEBLINKS_NUM_ITEMS'); ?>">
							<?php echo $item->numitems; ?>
						</span>
					<?php endif; ?>
					<?php if (count($item->getChildren()) > 0) : ?>
						<a href="#category-<?php echo $item->id;?>" data-toggle="collapse" data-toggle="button" class="btn btn-mini pull-right"><span class="icon-plus"></span></a>
					<?php endif;?>
				</h3>
				<?php if ($this->params->get('show_subcat_desc_cat') == 1) :?>
					<?php if ($item->description) : ?>
						<div class="category-desc">
				<?php echo JHtml::_('content.prepare', $item->description, '', 'com_weblinks.categories'); ?>
						</div>
 /**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  * @param int $parent_id
  */
 private static function getCategoryTree($xmap, stdClass $parent, array &$params, $parent_id)
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select(array('c.id', 'c.alias', 'c.title', 'c.parent_id'))->from('#__categories AS c')->where('c.parent_id = ' . $db->quote($parent_id ? $parent_id : 1))->where('c.extension = ' . $db->quote('com_weblinks'))->where('c.published = 1')->order('c.lft');
     if (!$params['show_unauth']) {
         $query->where('c.access IN(' . $params['groups'] . ')');
     }
     if ($params['language_filter']) {
         $query->where('c.language IN(' . $db->quote(JFactory::getLanguage()->getTag()) . ', ' . $db->quote('*') . ')');
     }
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     if (empty($rows)) {
         return;
     }
     $xmap->changeLevel(1);
     foreach ($rows as $row) {
         $node = new stdclass();
         $node->id = $parent->id;
         $node->name = $row->title;
         $node->uid = $parent->uid . '_cid_' . $row->id;
         $node->browserNav = $parent->browserNav;
         $node->priority = $params['category_priority'];
         $node->changefreq = $params['category_changefreq'];
         $node->pid = $row->parent_id;
         $node->link = WeblinksHelperRoute::getCategoryRoute($row->id);
         if ($xmap->printNode($node) !== false) {
             self::getlinks($xmap, $parent, $params, $row->id);
         }
     }
     $xmap->changeLevel(-1);
 }
Пример #13
0
 static function getCategoryTree($xmap, $parent, &$params, $category)
 {
     $db = JFactory::getDBO();
     $children = $category->getChildren();
     $xmap->changeLevel(1);
     foreach ($children as $cat) {
         $node = new stdclass();
         $node->id = $parent->id;
         $node->uid = $parent->uid . 'c' . $cat->id;
         $node->name = $cat->title;
         $node->link = WeblinksHelperRoute::getCategoryRoute($cat);
         $node->priority = $params['cat_priority'];
         $node->changefreq = $params['cat_changefreq'];
         $node->expandible = true;
         if ($xmap->printNode($node) !== FALSE) {
             xmap_com_weblinks::getCategoryTree($xmap, $parent, $params, $cat);
         }
     }
     $xmap->changeLevel(-1);
     if ($params['include_links']) {
         //view=category&catid=...
         $linksModel = new WeblinksModelCategory();
         $linksModel->getState();
         // To force the populate state
         $linksModel->setState('list.limit', JArrayHelper::getValue($params, 'max_links', NULL));
         $linksModel->setState('list.start', 0);
         $linksModel->setState('list.ordering', 'ordering');
         $linksModel->setState('list.direction', 'ASC');
         $linksModel->setState('category.id', $category->id);
         $links = $linksModel->getItems();
         $xmap->changeLevel(1);
         foreach ($links as $link) {
             $item_params = new JRegistry();
             $item_params->loadString($link->params);
             $node = new stdclass();
             $node->id = $parent->id;
             $node->uid = $parent->uid . 'i' . $link->id;
             $node->name = $link->title;
             // Find the Itemid
             $Itemid = intval(preg_replace('/.*Itemid=([0-9]+).*/', '$1', WeblinksHelperRoute::getWeblinkRoute($link->id, $category->id)));
             if ($item_params->get('count_clicks', $params['count_clicks']) == 1) {
                 $node->link = 'index.php?option=com_weblinks&task=weblink.go&id=' . $link->id . '&Itemid=' . ($Itemid ? $Itemid : $parent->id);
             } else {
                 $node->link = $link->url;
             }
             $node->priority = $params['link_priority'];
             $node->changefreq = $params['link_changefreq'];
             $node->expandible = false;
             $xmap->printNode($node);
         }
         $xmap->changeLevel(-1);
     }
 }