Source for file contacts.php
Documentation is available at contacts.php
* @subpackage Search.contacts
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @subpackage Search.contacts
* Load the language file on instantiation.
* @return array An array of search areas
'contacts' =>
'PLG_SEARCH_CONTACTS_CONTACTS'
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
* @param string Target search string
* @param string matching option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
public function onContentSearch($text, $phrase =
'', $ordering =
'', $areas =
null)
$groups =
implode(',', $user->getAuthorisedViewLevels());
$sContent =
$this->params->get('search_content', 1);
$sArchived =
$this->params->get('search_archived', 1);
$limit =
$this->params->def('search_limit', 50);
$section =
JText::_('PLG_SEARCH_CONTACTS_CONTACTS');
$order =
'c.title ASC, a.name ASC';
$text =
$db->quote('%' .
$db->escape($text, true) .
'%', false);
$query =
$db->getQuery(true);
$case_when =
' CASE WHEN ';
$case_when .=
$query->charLength('a.alias', '!=', '0');
$a_id =
$query->castAsChar('a.id');
$case_when .=
$query->concatenate(array($a_id, 'a.alias'), ':');
$case_when .=
$a_id .
' END as slug';
$case_when1 =
' CASE WHEN ';
$case_when1 .=
$query->charLength('c.alias', '!=', '0');
$c_id =
$query->castAsChar('c.id');
$case_when1 .=
$query->concatenate(array($c_id, 'c.alias'), ':');
$case_when1 .=
$c_id .
' END as catslug';
'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,'
$query->from('#__contact_details AS a')
->join('INNER', '#__categories AS c ON c.id = a.catid')
'(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 .
')'
->group('a.id, a.con_position, a.misc, c.alias, c.id')
$query->where('a.language in (' .
$db->quote($tag) .
',' .
$db->quote('*') .
')')
->where('c.language in (' .
$db->quote($tag) .
',' .
$db->quote('*') .
')');
$db->setQuery($query, 0, $limit);
$rows =
$db->loadObjectList();
foreach ($rows as $key =>
$row)
$rows[$key]->href =
'index.php?option=com_contact&view=contact&id=' .
$row->slug .
'&catid=' .
$row->catslug;
$rows[$key]->text =
$row->title;
$rows[$key]->text .=
($row->con_position) ?
', ' .
$row->con_position :
'';
$rows[$key]->text .=
($row->misc) ?
', ' .
$row->misc :
'';
Documentation generated on Tue, 19 Nov 2013 14:56:43 +0100 by phpDocumentor 1.4.3