Пример #1
0
 static function edit($faq, $params, $attribs = array())
 {
     $user = JFactory::getUser();
     $uri = JFactory::getURI();
     if ($params && $params->get('popup')) {
         return;
     }
     if ($faq->state < 0) {
         return;
     }
     JHtml::_('behavior.tooltip');
     $url = FaqsHelperRoute::getFormRoute($faq->id, base64_encode($uri));
     $icon = $faq->state ? 'edit.png' : 'edit_unpublished.png';
     $text = JHtml::_('image', 'system/' . $icon, JText::_('JGLOBAL_EDIT'), NULL, true);
     if ($faq->state == 0) {
         $overlib = JText::_('JUNPUBLISHED');
     } else {
         $overlib = JText::_('JPUBLISHED');
     }
     $date = JHtml::_('date', $faq->created);
     $author = $faq->created_by_alias ? $faq->created_by_alias : $faq->author;
     $overlib .= '&lt;br /&gt;';
     $overlib .= $date;
     $overlib .= '&lt;br /&gt;';
     $overlib .= htmlspecialchars($author, ENT_COMPAT, 'UTF-8');
     $button = JHtml::_('link', JRoute::_($url), $text);
     $output = '<span class="hasTip" title="' . JText::_('COM_FAQS_EDIT') . ' :: ' . $overlib . '">' . $button . '</span>';
     return $output;
 }
Пример #2
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $document->link = JRoute::_(FaqsHelperRoute::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::_(FaqsHelperRoute::getFaqRoute($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);
     }
 }
Пример #3
0
        ?>
	<?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"';
            }
            ?>
	<li<?php 
            echo $class;
            ?>
>
	<?php 
            $class = '';
            ?>
		<span class="item-title"><a href="<?php 
            echo JRoute::_(FaqsHelperRoute::getCategoryRoute($item->id));
            ?>
">
			<?php 
            echo $this->escape($item->title);
            ?>
</a>
		</span>
		<?php 
            if ($this->params->get('show_subcat_desc_cat') == 1) {
                ?>
		<?php 
                if ($item->description) {
                    ?>
			<div class="category-desc">
				<?php 
Пример #4
0
        ?>
	<?php 
        if ($this->params->get('show_empty_categories') || $child->numitems || count($child->getChildren())) {
            if (!isset($this->children[$this->category->id][$id + 1])) {
                $class = ' class="last"';
            }
            ?>
	<li<?php 
            echo $class;
            ?>
>
		<?php 
            $class = '';
            ?>
			<span class="item-title"><a href="<?php 
            echo JRoute::_(FaqsHelperRoute::getCategoryRoute($child->id));
            ?>
">
				<?php 
            echo $this->escape($child->title);
            ?>
</a>
			</span>

			<?php 
            if ($this->params->get('show_subcat_desc') == 1) {
                ?>
			<?php 
                if ($child->description) {
                    ?>
				<div class="category-desc">
Пример #5
0
 protected static function _findItem($needles = null)
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu('site');
     // Prepare the reverse lookup array.
     if (self::$lookup === null) {
         self::$lookup = array();
         $component = JComponentHelper::getComponent('com_faqs');
         $items = $menus->getItems('component_id', $component->id);
         if ($items) {
             foreach ($items as $item) {
                 if (isset($item->query) && isset($item->query['view'])) {
                     $view = $item->query['view'];
                     if (!isset(self::$lookup[$view])) {
                         self::$lookup[$view] = array();
                     }
                     if (isset($item->query['id'])) {
                         self::$lookup[$view][$item->query['id']] = $item->id;
                     }
                 }
             }
         }
     }
     if ($needles) {
         foreach ($needles as $view => $ids) {
             if (isset(self::$lookup[$view])) {
                 foreach ($ids as $id) {
                     if (isset(self::$lookup[$view][(int) $id])) {
                         return self::$lookup[$view][(int) $id];
                     }
                 }
             }
         }
     }
     $active = $menus->getActive();
     if ($active) {
         return $active->id;
     }
     return null;
 }
Пример #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_FAQS_DEFAULT_PAGE_TITLE'));
     }
     $id = (int) @$menu->query['id'];
     if ($menu && ($menu->query['option'] != 'com_faqs' || $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_faqs' || $id != $category->id) && $category->id > 1) {
             $path[] = array('title' => $category->title, 'link' => FaqsHelperRoute::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);
     }
 }