View of /mambo/branches/4.6/mambots/search/contacts.searchbot.php
Parent Directory
|
Revision Log
Revision 1 -
(download)
(annotate)
Tue Dec 13 03:45:47 2005 UTC (7 years, 5 months ago) by root
Original Path: mambo/trunk/mambots/search/contacts.searchbot.php
File size: 2135 byte(s)
Tue Dec 13 03:45:47 2005 UTC (7 years, 5 months ago) by root
Original Path: mambo/trunk/mambots/search/contacts.searchbot.php
File size: 2135 byte(s)
Initial repository layout
<?php /** * @version $Id: contacts.searchbot.php,v 1.1 2005/07/22 01:58:25 eddieajau Exp $ * @package Mambo * @copyright (C) 2000 - 2005 Miro International Pty Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * Mambo is Free Software */ /** ensure this file is being included by a parent file */ defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); $_MAMBOTS->registerFunction( 'onSearch', 'botSearchContacts' ); /** * Contacts Search method * * 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 mathcing option, exact|any|all * @param string ordering option, newest|oldest|popular|alpha|category */ function botSearchContacts( $text, $phrase='', $ordering='' ) { global $database, $my; $text = trim( $text ); if ($text == '') { return array(); } $section = _CONTACT_TITLE; switch ( $ordering ) { case 'alpha': $order = 'a.name ASC'; break; case 'category': $order = 'b.title ASC, a.name ASC'; break; case 'popular': case 'newest': case 'oldest': default: $order = 'a.name DESC'; } $query = "SELECT a.name AS title," . "\n CONCAT_WS( ', ', a.name, a.con_position, a.misc ) AS text," . "\n '' AS created," . "\n CONCAT_WS( ' / ', '$section', b.title ) AS section," . "\n '2' AS browsernav," . "\n CONCAT( 'index.php?option=com_contact&task=view&&contact_id=', a.id ) AS href" . "\n FROM #__contact_details AS a" . "\n INNER JOIN #__categories AS b ON b.id = a.catid AND b.access <= '$my->gid'" . "\n WHERE ( a.name LIKE '%$text%'" . "\n OR a.misc LIKE '%$text%'" . "\n OR a.con_position LIKE '%$text%'" . "\n OR a.address LIKE '%$text%'" . "\n OR a.suburb LIKE '%$text%'" . "\n OR a.state LIKE '%$text%'" . "\n OR a.country LIKE '%$text%'" . "\n OR a.postcode LIKE '%$text%'" . "\n OR a.telephone LIKE '%$text%'" . "\n OR a.fax LIKE '%$text%' )" . "\n AND a.published = '1'" . "\n ORDER BY $order" ; $database->setQuery( $query ); $rows = $database->loadObjectList(); return $rows; } ?>
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

