本文整理汇总了PHP中ContactHelperRoute::getContactRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP ContactHelperRoute::getContactRoute方法的具体用法?PHP ContactHelperRoute::getContactRoute怎么用?PHP ContactHelperRoute::getContactRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContactHelperRoute
的用法示例。
在下文中一共展示了ContactHelperRoute::getContactRoute方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
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);
}
}
示例2: getAssociations
/**
* 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();
}
示例3: display
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);
}
}
示例4: getAssociations
/**
* 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();
}
示例5: display
//.........这里部分代码省略.........
$params->set('marker_class', 'jicons-none');
break;
default:
if ($params->get('icon_address')) {
$image1 = JHtml::_('image', $params->get('icon_address', 'con_address.png'), JText::_('COM_CONTACT_ADDRESS') . ': ', null, false);
} else {
$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);
} else {
$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);
} else {
$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);
} else {
$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);
} else {
$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);
} else {
$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');
break;
}
// Add links to contacts
if ($params->get('show_contact_list') && count($contacts) > 1) {
foreach ($contacts as &$contact) {
$contact->link = JRoute::_(ContactHelperRoute::getContactRoute($contact->slug, $contact->catid));
}
$item->link = JRoute::_(ContactHelperRoute::getContactRoute($item->slug, $item->catid));
}
// Process the content plugins.
JPluginHelper::importPlugin('content');
$offset = $state->get('list.offset');
// Fix for where some plugins require a text attribute
!empty($item->misc) ? $item->text = $item->misc : ($item->text = null);
JFactory::getApplication()->triggerEvent('onContentPrepare', array('com_contact.contact', &$item, &$this->params, $offset));
// Store the events for later
$item->event = new stdClass();
$results = JFactory::getApplication()->triggerEvent('onContentAfterTitle', array('com_contact.contact', &$item, &$this->params, $offset));
$item->event->afterDisplayTitle = trim(implode("\n", $results));
$results = JFactory::getApplication()->triggerEvent('onContentBeforeDisplay', array('com_contact.contact', &$item, &$this->params, $offset));
$item->event->beforeDisplayContent = trim(implode("\n", $results));
$results = JFactory::getApplication()->triggerEvent('onContentAfterDisplay', array('com_contact.contact', &$item, &$this->params, $offset));
$item->event->afterDisplayContent = trim(implode("\n", $results));
if ($item->text) {
$item->misc = $item->text;
}
// Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
$this->contact =& $item;
$this->params =& $params;
$this->return =& $return;
$this->state =& $state;
$this->item =& $item;
$this->user =& $user;
$this->contacts =& $contacts;
$item->tags = new JHelperTags();
$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')) {
$this->setLayout($layout);
}
} elseif (isset($active->query['layout'])) {
// We need to set the layout in case this is an alternative menu item (with an alternative layout)
$this->setLayout($active->query['layout']);
}
$model = $this->getModel();
$model->hit();
$captchaSet = $params->get('captcha', JFactory::getApplication()->get('captcha', '0'));
foreach (JPluginHelper::getPlugin('captcha') as $plugin) {
if ($captchaSet === $plugin->name) {
$this->captchaEnabled = true;
break;
}
}
$this->_prepareDocument();
return parent::display($tpl);
}
示例6: index
/**
* 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);
//.........这里部分代码省略.........
示例7:
</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>
示例8: onContentSearch
/**
* 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;
}
示例9:
<?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
}
示例10: foreach
</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; ?>
示例11: getLinks
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;
}
示例12: display
function display($tpl = null)
{
// Initialise variables.
$app = JFactory::getApplication();
$user = JFactory::getUser();
$dispatcher = JDispatcher::getInstance();
$state = $this->get('State');
$item = $this->get('Item');
$this->form = $this->get('Form');
// Get the parameters
$params = JComponentHelper::getParams('com_contact');
if ($item) {
// If we found an item, merge the item parameters
$params->merge($item->params);
// Get Category Model data
$categoryModel = JModel::getInstance('Category', 'ContactModel', array('ignore_request' => true));
$categoryModel->setState('category.id', $item->catid);
$categoryModel->setState('list.ordering', 'a.name');
$categoryModel->setState('list.direction', 'asc');
$contacts = $categoryModel->getItems();
}
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
// check if access is not public
$groups = $user->getAuthorisedViewLevels();
$return = '';
if (!in_array($item->access, $groups) || !in_array($item->category_access, $groups)) {
$uri = JFactory::getURI();
$return = (string) $uri;
JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
return;
}
$options['category_id'] = $item->catid;
$options['order by'] = 'a.default_con DESC, a.ordering ASC';
// Handle email cloaking
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);
}
} else {
$params->set('address_check', 0);
}
// Manage the display mode for contact detail groups
switch ($params->get('contact_icons')) {
case 1:
// text
$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');
break;
case 2:
// none
$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');
break;
default:
// icons
$image1 = JHTML::_('image', 'contacts/' . $params->get('icon_address', 'con_address.png'), JText::_('COM_CONTACT_ADDRESS') . ": ", NULL, true);
$image2 = JHTML::_('image', 'contacts/' . $params->get('icon_email', 'emailButton.png'), JText::_('JGLOBAL_EMAIL') . ": ", NULL, true);
$image3 = JHTML::_('image', 'contacts/' . $params->get('icon_telephone', 'con_tel.png'), JText::_('COM_CONTACT_TELEPHONE') . ": ", NULL, true);
$image4 = JHTML::_('image', 'contacts/' . $params->get('icon_fax', 'con_fax.png'), JText::_('COM_CONTACT_FAX') . ": ", NULL, true);
$image5 = JHTML::_('image', 'contacts/' . $params->get('icon_misc', 'con_info.png'), JText::_('COM_CONTACT_OTHER_INFORMATION') . ": ", NULL, true);
$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');
break;
}
// Add links to contacts
if ($params->get('show_contact_list') && count($contacts) > 1) {
foreach ($contacts as &$contact) {
$contact->link = JRoute::_(ContactHelperRoute::getContactRoute($contact->slug, $contact->catid));
}
$item->link = JRoute::_(ContactHelperRoute::getContactRoute($item->slug, $item->catid));
}
JHtml::_('behavior.formvalidation');
//Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
$this->assignRef('contact', $item);
$this->assignRef('params', $params);
$this->assignRef('return', $return);
//.........这里部分代码省略.........
示例13: rowToDocument
/**
* 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;
}
示例14: sizeof
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";
}