Source for file view.html.php
Documentation is available at view.html.php
* @subpackage com_contact
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
require_once JPATH_COMPONENT .
'/models/category.php';
* HTML Contact View class for the Contact component
* @subpackage com_contact
* Execute and display a template script.
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
* @return mixed A string if successful, otherwise a Error object.
public function display($tpl =
null)
$state =
$this->get('State');
$item =
$this->get('Item');
// If we found an item, merge the item parameters
$params->merge($item->params);
// Get Category Model data
$categoryModel->setState('category.id', $item->catid);
$categoryModel->setState('list.ordering', 'a.name');
$categoryModel->setState('list.direction', 'asc');
$categoryModel->setState('filter.published', 1);
$contacts =
$categoryModel->getItems();
if (count($errors =
$this->get('Errors')))
// check if access is not public
$groups =
$user->getAuthorisedViewLevels();
if ((!in_array($item->access, $groups)) ||
(!in_array($item->category_access, $groups)))
$options['category_id'] =
$item->catid;
$options['order by'] =
'a.default_con DESC, a.ordering ASC';
if ($item->email_to &&
$params->get('show_email'))
$item->email_to =
JHtml::_('email.cloak', $item->email_to);
if ($params->get('show_street_address') ||
$params->get('show_suburb') ||
$params->get('show_state') ||
$params->get('show_postcode') ||
$params->get('show_country'))
if (!empty ($item->address) ||
!empty ($item->suburb) ||
!empty ($item->state) ||
!empty ($item->country) ||
!empty ($item->postcode))
$params->set('address_check', 1);
$params->set('address_check', 0);
// Manage the display mode for contact detail groups
switch ($params->get('contact_icons'))
$params->set('marker_address', JText::_('COM_CONTACT_ADDRESS') .
": ");
$params->set('marker_email', JText::_('JGLOBAL_EMAIL') .
": ");
$params->set('marker_telephone', JText::_('COM_CONTACT_TELEPHONE') .
": ");
$params->set('marker_fax', JText::_('COM_CONTACT_FAX') .
": ");
$params->set('marker_mobile', JText::_('COM_CONTACT_MOBILE') .
": ");
$params->set('marker_misc', JText::_('COM_CONTACT_OTHER_INFORMATION') .
": ");
$params->set('marker_class', 'jicons-text');
$params->set('marker_address', '');
$params->set('marker_email', '');
$params->set('marker_telephone', '');
$params->set('marker_mobile', '');
$params->set('marker_fax', '');
$params->set('marker_misc', '');
$params->set('marker_class', 'jicons-none');
if ($params->get('icon_address'))
$image1 =
JHtml::_('image', $params->get('icon_address', 'con_address.png'), JText::_('COM_CONTACT_ADDRESS').
": ", null, false);
$image1 =
JHtml::_('image', 'contacts/'.
$params->get('icon_address', 'con_address.png'), JText::_('COM_CONTACT_ADDRESS').
": ", null, true);
if ($params->get('icon_email'))
$image2 =
JHtml::_('image', $params->get('icon_email', 'emailButton.png'), JText::_('JGLOBAL_EMAIL').
": ", null, false);
$image2 =
JHtml::_('image', 'contacts/'.
$params->get('icon_email', 'emailButton.png'), JText::_('JGLOBAL_EMAIL').
": ", null, true);
if ($params->get('icon_telephone'))
$image3 =
JHtml::_('image', $params->get('icon_telephone', 'con_tel.png'), JText::_('COM_CONTACT_TELEPHONE').
": ", null, false);
$image3 =
JHtml::_('image', 'contacts/'.
$params->get('icon_telephone', 'con_tel.png'), JText::_('COM_CONTACT_TELEPHONE').
": ", null, true);
if ($params->get('icon_fax'))
$image4 =
JHtml::_('image', $params->get('icon_fax', 'con_fax.png'), JText::_('COM_CONTACT_FAX').
": ", null, false);
$image4 =
JHtml::_('image', 'contacts/'.
$params->get('icon_fax', 'con_fax.png'), JText::_('COM_CONTACT_FAX').
": ", null, true);
if ($params->get('icon_misc'))
$image5 =
JHtml::_('image', $params->get('icon_misc', 'con_info.png'), JText::_('COM_CONTACT_OTHER_INFORMATION').
": ", null, false);
$image5 =
JHtml::_('image', 'contacts/'.
$params->get('icon_misc', 'con_info.png'), JText::_('COM_CONTACT_OTHER_INFORMATION').
": ", null, true);
if ($params->get('icon_mobile'))
$image6 =
JHtml::_('image', $params->get('icon_mobile', 'con_mobile.png'), JText::_('COM_CONTACT_MOBILE').
": ", null, false);
$image6 =
JHtml::_('image', 'contacts/'.
$params->get('icon_mobile', 'con_mobile.png'), JText::_('COM_CONTACT_MOBILE').
": ", null, true);
$params->set('marker_address', $image1);
$params->set('marker_email', $image2);
$params->set('marker_telephone', $image3);
$params->set('marker_fax', $image4);
$params->set('marker_misc', $image5);
$params->set('marker_mobile', $image6);
$params->set('marker_class', 'jicons-icons');
if ($params->get('show_contact_list') &&
count($contacts) >
1)
foreach ($contacts as &$contact)
JHtml::_('behavior.formvalidation');
//Escape strings for HTML output
$this->params =
&$params;
$this->return =
&$return;
$this->contacts =
&$contacts;
$item->tags->getItemTags('com_contact.contact', $this->item->id);
// Override the layout only if this is not the active menu item
// If it is the active menu item, then the view and item id will match
$active =
$app->getMenu()->getActive();
if ((!$active) ||
((strpos($active->link, 'view=contact') ===
false) ||
(strpos($active->link, '&id=' . (string)
$this->item->id) ===
false)))
if ($layout =
$params->get('contact_layout'))
elseif (isset
($active->query['layout']))
// We need to set the layout in case this is an alternative menu item (with an alternative layout)
$menus =
$app->getMenu();
$pathway =
$app->getPathway();
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu =
$menus->getActive();
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
$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
$title =
$this->item->name;
$path =
array(array('title' =>
$this->contact->name, 'link' =>
''));
while ($category &&
($menu->query['option'] !=
'com_contact' ||
$menu->query['view'] ==
'contact' ||
$id !=
$category->id) &&
$category->id >
1)
$category =
$category->getParent();
$pathway->addItem($item['title'], $item['link']);
$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'));
$title =
$this->item->name;
$this->document->setTitle($title);
if ($this->item->metadesc)
$this->document->setDescription($this->item->metadesc);
elseif (!$this->item->metadesc &&
$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->item->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'));
$mdata =
$this->item->metadata->toArray();
foreach ($mdata as $k =>
$v)
$this->document->setMetadata($k, $v);
Documentation generated on Tue, 19 Nov 2013 15:17:14 +0100 by phpDocumentor 1.4.3