function getContactRoute($id, $catid) { $needles = array('category' => (int) $catid, 'categories' => null); //Find the itemid $itemid = ContactHelperRoute::_findItem($needles); $itemid = $itemid ? '&Itemid=' . $itemid : ''; //Create the link $link = 'index.php?option=com_contact&view=contact&id=' . $id . '&catid=' . $catid . $itemid; return $link; }
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(); }
/** * 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) { $jinput = JFactory::getApplication()->input; $view = $view === null ? $jinput->get('view') : $view; $id = empty($id) ? $jinput->getInt('id') : $id; if ($view === 'contact') { if ($id) { $associations = JLanguageAssociations::getAssociations('com_contact', '#__contact_details', 'com_contact.item', $id); $return = array(); foreach ($associations as $tag => $item) { $return[$tag] = ContactHelperRoute::getContactRoute($item->id, (int) $item->catid, $item->language); } return $return; } } if ($view === 'category' || $view === 'categories') { return self::getCategoryAssociations($id, 'com_contact'); } return array(); }
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); } }
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_contact'); $items = $menus->getItems('component_id', $component->id); 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]; } } } } } else { $active = $menus->getActive(); if ($active) { return $active->id; } } return null; }
/** * 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 == 'contact') { if ($id) { $associations = ContactHelper::getAssociations($id); $return = array(); foreach ($associations as $tag => $item) { $return[$tag] = ContactHelperRoute::getContactRoute($item->id, $item->catid, $item->language); } return $return; } } if ($view == 'category' || $view == 'categories') { return self::getCategoryAssociations($id, 'com_contact'); } return array(); }
/** * Search content (contacts). * * The SQL must return the following fields that are used in a common display * routine: href, title, section, created, text, browsernav. * * @param string $text Target search string. * @param string $phrase Matching option (possible values: exact|any|all). Default is "any". * @param string $ordering Ordering option (possible values: newest|oldest|popular|alpha|category). Default is "newest". * @param string $areas An array if the search is to be restricted to areas or null to search all areas. * * @return array Search results. * * @since 1.6 */ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null) { require_once JPATH_SITE . '/components/com_contact/helpers/route.php'; $db = JFactory::getDbo(); $app = JFactory::getApplication(); $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); if (is_array($areas)) { if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) { return array(); } } $sContent = $this->params->get('search_content', 1); $sArchived = $this->params->get('search_archived', 1); $limit = $this->params->def('search_limit', 50); $state = array(); if ($sContent) { $state[] = 1; } if ($sArchived) { $state[] = 2; } if (empty($state)) { return array(); } $text = trim($text); if ($text == '') { return array(); } $section = JText::_('PLG_SEARCH_CONTACTS_CONTACTS'); switch ($ordering) { case 'alpha': $order = 'a.name ASC'; break; case 'category': $order = 'c.title ASC, a.name ASC'; break; case 'popular': case 'newest': case 'oldest': default: $order = 'a.name DESC'; } $text = $db->quote('%' . $db->escape($text, true) . '%', false); $query = $db->getQuery(true); // SQLSRV changes. $case_when = ' CASE WHEN '; $case_when .= $query->charLength('a.alias', '!=', '0'); $case_when .= ' THEN '; $a_id = $query->castAsChar('a.id'); $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':'); $case_when .= ' ELSE '; $case_when .= $a_id . ' END as slug'; $case_when1 = ' CASE WHEN '; $case_when1 .= $query->charLength('c.alias', '!=', '0'); $case_when1 .= ' THEN '; $c_id = $query->castAsChar('c.id'); $case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':'); $case_when1 .= ' ELSE '; $case_when1 .= $c_id . ' END as catslug'; $query->select('a.name AS title, \'\' AS created, a.con_position, a.misc, ' . $case_when . ',' . $case_when1 . ', ' . $query->concatenate(array("a.name", "a.con_position", "a.misc"), ",") . ' AS text,' . $query->concatenate(array($db->quote($section), "c.title"), " / ") . ' AS section,' . '\'2\' AS browsernav'); $query->from('#__contact_details AS a')->join('INNER', '#__categories AS c ON c.id = a.catid')->where('(a.name LIKE ' . $text . ' OR a.misc LIKE ' . $text . ' OR a.con_position LIKE ' . $text . ' OR a.address LIKE ' . $text . ' OR a.suburb LIKE ' . $text . ' OR a.state LIKE ' . $text . ' OR a.country LIKE ' . $text . ' OR a.postcode LIKE ' . $text . ' OR a.telephone LIKE ' . $text . ' OR a.fax LIKE ' . $text . ') AND a.published IN (' . implode(',', $state) . ') AND c.published=1 ' . ' AND a.access IN (' . $groups . ') AND c.access IN (' . $groups . ')')->order($order); // Filter by language. if ($app->isSite() && JLanguageMultilang::isEnabled()) { $tag = JFactory::getLanguage()->getTag(); $query->where('a.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')')->where('c.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')'); } $db->setQuery($query, 0, $limit); try { $rows = $db->loadObjectList(); } catch (RuntimeException $e) { $rows = array(); JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); } if ($rows) { foreach ($rows as $key => $row) { $rows[$key]->href = ContactHelperRoute::getContactRoute($row->slug, $row->catslug); $rows[$key]->text = $row->title; $rows[$key]->text .= $row->con_position ? ', ' . $row->con_position : ''; $rows[$key]->text .= $row->misc ? ', ' . $row->misc : ''; } } return $rows; }
<?php if ($this->params->get('show_fax_headings') and !empty($item->fax)) { ?> <?php echo JTEXT::sprintf('COM_CONTACT_FAX_NUMBER', $item->fax); ?> <br /> <?php } ?> </span> <p> <div class="list-title"> <a href="<?php echo JRoute::_(ContactHelperRoute::getContactRoute($item->slug, $item->catid)); ?> "> <?php echo $item->name; ?> </a> <?php if ($this->items[$i]->published == 0) { ?> <span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?> </span> <?php }
if ($params->get('separate_code', '') == "hr") { $separate_code = "<hr class=\"contact_sep\" />"; } else { $separate_code = ""; } } } include $sitepath . 'components/com_contact/helpers/route.php'; echo '<div class="custom module doctors">'; echo '<h3 class="page-header"><a href="/specialist"><span>Наши специалисты</span></a></h3>'; echo '<ul>'; $separate_num = sizeof($contacts); for ($i = 0; $i < sizeof($contacts); $i++) { echo '<li>'; $slug = $contacts[$i]->id . ":" . $contacts[$i]->alias; $url = ContactHelperRoute::getContactRoute($slug, $contacts[$i]->catid); $telephone_array = explode(",", $contacts[$i]->telephone); if ($params->get('show_image', '') == 1 && $contacts[$i]->name != '') { if ($params->get('link_image', '') == 1) { echo "<a href=\"" . $url . "\" class=\"thumb\">" . contactImage($contacts[$i], $params->get('thumb_size', 100)) . "</a>{$newspace}\n"; } else { echo "<span class=\"info_image\">" . contactImage($contacts[$i], $params->get('thumb_size', 100)) . "</span>{$newspace}\n"; } } list($lastname, $firstname, $middlename) = split(' ', $contacts[$i]->name); if ($params->get('show_name', '') == 1 && $contacts[$i]->name != '') { if ($params->get('link_to', '') == 1) { echo "<h4><a href=\"" . $url . "\"><strong>" . $lastname . "</strong><br/>" . $firstname . " " . $middlename . "</a></h4>{$newspace}\n"; } else { echo "<h4><strong>" . $lastname . "</strong><br/>" . $firstname . " " . $middlename . "</h4>{$newspace}\n"; }
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 } ?>
/** * Method to index an item. The item must be a FinderIndexerResult object. * * @param FinderIndexerResult $item The item to index as an FinderIndexerResult object. * @param string $format The item format * * @return void * * @since 2.5 * @throws Exception on database error. */ protected function index(FinderIndexerResult $item, $format = 'html') { // Check if the extension is enabled if (JComponentHelper::isEnabled($this->extension) == false) { return; } $item->setLanguage(); // Initialize the item parameters. $registry = new Registry(); $registry->loadString($item->params); $item->params = $registry; // Build the necessary route and path information. $item->url = $this->getURL($item->id, $this->extension, $this->layout); $item->route = ContactHelperRoute::getContactRoute($item->slug, $item->catslug, $item->language); $item->path = FinderIndexerHelper::getContentPath($item->route); // Get the menu title if it exists. $title = $this->getItemMenuTitle($item->url); // Adjust the title if necessary. if (!empty($title) && $this->params->get('use_menu_title', true)) { $item->title = $title; } /* * Add the meta-data processing instructions based on the contact * configuration parameters. */ // Handle the contact position. if ($item->params->get('show_position', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'position'); } // Handle the contact street address. if ($item->params->get('show_street_address', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'address'); } // Handle the contact city. if ($item->params->get('show_suburb', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'city'); } // Handle the contact region. if ($item->params->get('show_state', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'region'); } // Handle the contact country. if ($item->params->get('show_country', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'country'); } // Handle the contact zip code. if ($item->params->get('show_postcode', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'zip'); } // Handle the contact telephone number. if ($item->params->get('show_telephone', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'telephone'); } // Handle the contact fax number. if ($item->params->get('show_fax', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'fax'); } // Handle the contact e-mail address. if ($item->params->get('show_email', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'email'); } // Handle the contact mobile number. if ($item->params->get('show_mobile', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'mobile'); } // Handle the contact webpage. if ($item->params->get('show_webpage', true)) { $item->addInstruction(FinderIndexer::META_CONTEXT, 'webpage'); } // Handle the contact user name. $item->addInstruction(FinderIndexer::META_CONTEXT, 'user'); // Add the type taxonomy data. $item->addTaxonomy('Type', 'Contact'); // Add the category taxonomy data. $item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access); // Add the language taxonomy data. $item->addTaxonomy('Language', $item->language); // Add the region taxonomy data. if (!empty($item->region) && $this->params->get('tax_add_region', true)) { $item->addTaxonomy('Region', $item->region); } // Add the country taxonomy data. if (!empty($item->country) && $this->params->get('tax_add_country', true)) { $item->addTaxonomy('Country', $item->country); } // Get content extras. FinderIndexerHelper::getContentExtras($item); // Index the item. $this->indexer->index($item); }
/** * 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); } }
<?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>
/** * Convert an row to an elastica document */ private function rowToDocument($row) { $id = $row->id; //Create a date object $date = new DateTime($row->created); //Get the names of the categories $category = JCategories::getInstance('Contact')->get($row->catid); $categories = array(); while ($category && $category->id > 1) { $categories[] = $category->title; $category = $category->getParent(); } // Create a document $entity = array('id' => $id, 'name' => html_entity_decode(strip_tags($row->name), ENT_COMPAT | ENT_HTML401, 'UTF-8'), 'alias' => $row->alias, 'misc' => html_entity_decode(strip_tags($row->misc), ENT_COMPAT | ENT_HTML401, 'UTF-8'), 'categories' => implode(';', $categories), 'language' => $row->language, 'created_at' => $date->format('Y-m-d\\Th:i:s'), 'href' => ContactHelperRoute::getContactRoute($row->id, implode(';', $categories), $row->language)); $document = new \Elastica\Document($id, $entity); return $document; }
<?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;
</td> <td> <a href="javascript:void(0);" onclick="if (window.parent) window.parent.<?php echo $this->escape($function); ?> ('<?php echo $item->id; ?> ', '<?php echo $this->escape(addslashes($item->name)); ?> ', '<?php echo $this->escape($item->catid); ?> ', null, '<?php echo $this->escape(ContactHelperRoute::getContactRoute($item->id, $item->catid, $item->language)); ?> ', '<?php echo $this->escape($lang); ?> ', null);"> <?php echo $this->escape($item->name); ?> </a> <div class="small"> <?php echo JText::_('JCATEGORY') . ": " . $this->escape($item->category_title); ?> </div> </td>
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; }
/** * 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"'; } ?> <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');
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 }
</th> <?php endif; ?> </tr> </thead> <?php endif; ?> <tbody> <?php foreach($this->items as $i => $item) : ?> <tr class="<?php echo ($i % 2) ? "odd" : "even"; ?>"> <td class="item-num"> <?php echo $i; ?> </td> <td class="item-title"> <a href="<?php echo JRoute::_(ContactHelperRoute::getContactRoute($item->slug, $item->catid)); ?>"> <?php echo $item->name; ?></a> </td> <?php if ($this->params->get('show_position_headings')) : ?> <td class="item-position"> <?php echo $item->con_position; ?> </td> <?php endif; ?> <?php if ($this->params->get('show_email_headings')) : ?> <td class="item-email"> <?php echo $item->email_to; ?> </td> <?php endif; ?>