Esempio n. 1
0
 function display($tpl = null)
 {
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     $params = $app->getParams();
     $feedEmail = $app->getCfg('feed_email', 'author');
     $siteEmail = $app->getCfg('mailfrom');
     $fromName = $app->getCfg('fromname');
     JRequest::setVar('limit', $app->getCfg('feed_limit'));
     // Get some data from the models
     $category = $this->get('Category');
     $rows = $this->get('Items');
     $doc->link = JRoute::_(ContactHelperRoute::getCategoryRoute($category->id));
     foreach ($rows as $row) {
         // strip html from feed item title
         $title = $this->escape($row->name);
         $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
         // Compute the contact slug
         $row->slug = $row->alias ? $row->id . ':' . $row->alias : $row->id;
         // url link to article
         $link = JRoute::_(ContactHelperRoute::getContactRoute($row->slug, $row->catid));
         $description = $row->address;
         $author = $row->created_by_alias ? $row->created_by_alias : $row->author;
         @($date = $row->created ? date('r', strtotime($row->created)) : '');
         // load individual item creator class
         $item = new JFeedItem();
         $item->title = $title;
         $item->link = $link;
         $item->description = $description;
         $item->date = $date;
         $item->category = $category->title;
         $item->author = $author;
         // We don't have the author email so we have to use site in both cases.
         if ($feedEmail == 'site') {
             $item->authorEmail = $siteEmail;
         } elseif ($feedEmail == 'author') {
             $item->authorEmail = $row->author_email;
         }
         // loads item info into rss array
         $doc->addItem($item);
     }
 }
 /**
  * Prepares the document
  *
  * @return  void
  */
 protected function prepareDocument()
 {
     parent::prepareDocument();
     $menu = $this->menu;
     $id = (int) @$menu->query['id'];
     if ($menu && ($menu->query['option'] != $this->extension || $menu->query['view'] == $this->viewName || $id != $this->category->id)) {
         $path = array(array('title' => $this->category->title, 'link' => ''));
         $category = $this->category->getParent();
         while (($menu->query['option'] != 'com_contact' || $menu->query['view'] == 'contact' || $id != $category->id) && $category->id > 1) {
             $path[] = array('title' => $category->title, 'link' => ContactHelperRoute::getCategoryRoute($category->id));
             $category = $category->getParent();
         }
         $path = array_reverse($path);
         foreach ($path as $item) {
             $this->pathway->addItem($item['title'], $item['link']);
         }
     }
     parent::addFeed();
 }
Esempio n. 3
0
 function display()
 {
     // Get some data from the models
     $category = $this->get('Category');
     $rows = $this->get('Items');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     $params = $app->getParams();
     $doc->link = JRoute::_(ContactHelperRoute::getCategoryRoute($category->id));
     foreach ($rows as $row) {
         // strip html from feed item title
         $title = $this->escape($row->name);
         $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
         // Compute the contact slug
         $row->slug = $row->alias ? $row->id . ':' . $row->alias : $row->id;
         // url link to article
         // & used instead of & as this is converted by feed creator
         $link = JRoute::_(ContactHelperRoute::getContactRoute($row->slug, $row->catid), false);
         // strip html from feed item description text
         // TODO: Only pull fulltext if necessary (actually, just get the necessary fields).
         $description = $params->get('feed_summary', 0) ? $row->introtext : $row->introtext;
         $author = $row->created_by_alias ? $row->created_by_alias : $row->author;
         @($date = $row->created ? date('r', strtotime($row->created)) : '');
         // load individual item creator class
         $item = new JFeedItem();
         $item->title = $title;
         $item->link = $link;
         $item->description = $description;
         $item->date = $date;
         $item->category = $row->category;
         // loads item info into rss array
         $doc->addItem($item);
     }
 }
Esempio n. 4
0
defined('_JEXEC') or die;
?>

<?php 
if (count($this->children[$this->category->id]) > 0 && $this->maxLevel != 0) {
    ?>
<ul class="uk-list">
	<?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::_(ContactHelperRoute::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 
            }
Esempio n. 5
0
if ($this->params->get('show_contact_category') == 'show_no_link') {
    ?>
		<h3>
			<span class="contact-category"><?php 
    echo $this->contact->category_title;
    ?>
</span>
		</h3>
	<?php 
}
?>
	<?php 
if ($this->params->get('show_contact_category') == 'show_with_link') {
    ?>
		<?php 
    $contactLink = ContactHelperRoute::getCategoryRoute($this->contact->catid);
    ?>
		<h3>
			<span class="contact-category"><a href="<?php 
    echo $contactLink;
    ?>
">
				<?php 
    echo $this->escape($this->contact->category_title);
    ?>
</a>
			</span>
		</h3>
	<?php 
}
?>
Esempio n. 6
0
 /**
  * Prepares the document
  *
  * @return  void
  *
  * @since   1.6
  */
 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_CONTACT_DEFAULT_PAGE_TITLE'));
     }
     $title = $this->params->get('page_title', '');
     $id = (int) @$menu->query['id'];
     // If the menu item does not concern this contact
     if ($menu && ($menu->query['option'] !== 'com_contact' || $menu->query['view'] !== 'contact' || $id != $this->item->id)) {
         // If this is not a single contact menu item, set the page title to the contact title
         if ($this->item->name) {
             $title = $this->item->name;
         }
         $path = array(array('title' => $this->contact->name, 'link' => ''));
         $category = JCategories::getInstance('Contact')->get($this->contact->catid);
         while ($category && ($menu->query['option'] !== 'com_contact' || $menu->query['view'] === 'contact' || $id != $category->id) && $category->id > 1) {
             $path[] = array('title' => $category->title, 'link' => ContactHelperRoute::getCategoryRoute($this->contact->catid));
             $category = $category->getParent();
         }
         $path = array_reverse($path);
         foreach ($path as $item) {
             $pathway->addItem($item['title'], $item['link']);
         }
     }
     if (empty($title)) {
         $title = $app->get('sitename');
     } elseif ($app->get('sitename_pagetitles', 0) == 1) {
         $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
     } elseif ($app->get('sitename_pagetitles', 0) == 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
     }
     if (empty($title)) {
         $title = $this->item->name;
     }
     $this->document->setTitle($title);
     if ($this->item->metadesc) {
         $this->document->setDescription($this->item->metadesc);
     } elseif ($this->params->get('menu-meta_description')) {
         $this->document->setDescription($this->params->get('menu-meta_description'));
     }
     if ($this->item->metakey) {
         $this->document->setMetadata('keywords', $this->item->metakey);
     } elseif ($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'));
     }
     $mdata = $this->item->metadata->toArray();
     foreach ($mdata as $k => $v) {
         if ($v) {
             $this->document->setMetadata($k, $v);
         }
     }
 }
	<?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 = '';
            ?>
		<h4 class="item-title">
			<a href="<?php 
            echo JRoute::_(ContactHelperRoute::getCategoryRoute($item->id));
            ?>
">
			<?php 
            echo $this->escape($item->title);
            ?>
			</a>

			<?php 
            if ($this->params->get('show_cat_items_cat') == 1) {
                ?>
				<span class="badge badge-info pull-right" title="<?php 
                echo JText::_('COM_CONTACT_COUNT');
                ?>
"><?php 
                echo $item->numitems;
Esempio n. 8
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"';
            }
            ?>
			<div <?php 
            echo $class;
            ?>
 >
			<?php 
            $class = '';
            ?>
				<h3 class="page-header item-title">
					<a href="<?php 
            echo JRoute::_(ContactHelperRoute::getCategoryRoute($item->id, $item->language));
            ?>
">
					<?php 
            echo $this->escape($item->title);
            ?>
</a>
					<?php 
            if ($this->params->get('show_cat_items_cat') == 1) {
                ?>
						<span class="badge badge-info tip hasTooltip" title="<?php 
                echo JHtml::tooltipText('COM_CONTACT_NUM_ITEMS');
                ?>
">
							<?php 
                echo JText::_('COM_CONTACT_NUM_ITEMS');
Esempio n. 9
0
 public function getLinks($args)
 {
     $items = array();
     $view = isset($args->view) ? $args->view : '';
     $language = '';
     if (defined('JPATH_PLATFORM')) {
         require_once JPATH_SITE . '/components/com_contact/helpers/route.php';
     }
     switch ($view) {
         default:
             if (defined('JPATH_PLATFORM')) {
                 $categories = WFLinkBrowser::getCategory('com_contact');
             } else {
                 $categories = WFLinkBrowser::getCategory('com_contact_details');
             }
             foreach ($categories as $category) {
                 if (defined('JPATH_PLATFORM')) {
                     // language
                     if (isset($category->language)) {
                         $language = $category->language;
                     }
                     $url = ContactHelperRoute::getCategoryRoute($category->id, $language);
                 } else {
                     $itemid = WFLinkBrowser::getItemId('com_contact', array('category' => $category->id));
                     $url = 'index.php?option=com_contact&view=category&catid=' . $category->slug . $itemid;
                 }
                 // convert to SEF
                 $url = self::route($url);
                 $items[] = array('id' => 'index.php?option=com_contact&view=category&id=' . $category->id, 'url' => $url, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder contact');
             }
             break;
         case 'category':
             if (defined('JPATH_PLATFORM')) {
                 $categories = WFLinkBrowser::getCategory('com_contact', $args->id);
                 foreach ($categories as $category) {
                     $children = WFLinkBrowser::getCategory('com_contact', $category->id);
                     // language
                     if (isset($category->language)) {
                         $language = $category->language;
                     }
                     if ($children) {
                         $id = ContactHelperRoute::getCategoryRoute($category->id, $language);
                     } else {
                         $id = ContactHelperRoute::getCategoryRoute($category->slug, $language);
                     }
                     // convert to SEF
                     $url = self::route($id);
                     $items[] = array('url' => $url, 'id' => $id, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder content');
                 }
             }
             $contacts = self::_contacts($args->id);
             foreach ($contacts as $contact) {
                 // language
                 if (isset($contact->language)) {
                     $language = $contact->language;
                 }
                 if (defined('JPATH_PLATFORM')) {
                     $id = ContactHelperRoute::getContactRoute($contact->id, $args->id, $language);
                 } else {
                     $catid = $args->id ? '&catid=' . $args->id : '';
                     $itemid = WFLinkBrowser::getItemId('com_contact', array('contact' => $contact->id));
                     if (!$itemid && isset($args->Itemid)) {
                         // fall back to the parent item's Itemid
                         $itemid = '&Itemid=' . $args->Itemid;
                     }
                     $id = 'index.php?option=com_contact&view=contact' . $catid . '&id=' . $contact->id . '-' . $contact->alias . $itemid;
                 }
                 $id = self::route($id);
                 $items[] = array('id' => $id, 'name' => $contact->name . ' / ' . $contact->alias, 'class' => 'file');
             }
             break;
     }
     return $items;
 }
Esempio n. 10
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_CONTACT_DEFAULT_PAGE_TITLE'));
     }
     $id = (int) @$menu->query['id'];
     if ($menu && ($menu->query['option'] != 'com_contact' || $menu->query['view'] == 'contact' || $id != $this->category->id)) {
         $path = array(array('title' => $this->category->title, 'link' => ''));
         $category = $this->category->getParent();
         while (($menu->query['option'] != 'com_contact' || $menu->query['view'] == 'contact' || $id != $category->id) && $category->id > 1) {
             $path[] = array('title' => $category->title, 'link' => ContactHelperRoute::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)) {
         $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
     }
     $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 ($app->getCfg('MetaTitle') == '1') {
         $this->document->setMetaData('title', $this->category->getMetadata()->get('page_title'));
     }
     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);
     }
 }
Esempio n. 11
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::_(ContactHelperRoute::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_contact.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>