2013-05-08 09:00:47 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class provides System Search capabilities
|
|
|
|
*
|
|
|
|
* @package OSB
|
|
|
|
* @category Controllers/User
|
|
|
|
* @author Deon George
|
|
|
|
* @copyright (c) 2009-2013 Open Source Billing
|
|
|
|
* @license http://dev.osbill.net/license.html
|
|
|
|
*/
|
|
|
|
class Controller_User_Search extends Controller_Search {
|
|
|
|
protected $secure_actions = array(
|
|
|
|
'ajaxlist'=>TRUE,
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Used by AJAX calls to find accounts, invoices, services and payments
|
|
|
|
*/
|
|
|
|
public function action_ajaxlist() {
|
|
|
|
$result = array();
|
|
|
|
|
|
|
|
if (isset($_REQUEST['term']) AND trim($_REQUEST['term'])) {
|
2013-05-28 13:10:12 +00:00
|
|
|
$result = Arr::merge($result,ORM::factory('Account')->list_autocomplete($_REQUEST['term'],'url','id',array('ACC %s: %s'=>array('id','name(TRUE)')),array(),array('urlprefix'=>'r/account/view/')));
|
2013-05-09 14:42:54 +00:00
|
|
|
$result = Arr::merge($result,ORM::factory('Service')->list_autocomplete($_REQUEST['term'],'url','id',array('SVC %s: %s'=>array('id','service_name()')),array(),array('urlprefix'=>'u/service/view/')));
|
2013-07-05 06:11:37 +00:00
|
|
|
$result = Arr::merge($result,ORM::factory('Invoice')->list_autocomplete($_REQUEST['term'],'url','id',array('INV %s: %s'=>array('id','account->name(TRUE)')),array(),array('urlprefix'=>'u/invoice/view/')));
|
2013-05-08 09:00:47 +00:00
|
|
|
|
|
|
|
foreach (array('Service_Plugin_Adsl','Service_Plugin_Domain','Service_Plugin_Host') as $o)
|
2013-05-09 14:42:54 +00:00
|
|
|
$result = Arr::merge($result,ORM::factory($o)->list_autocomplete($_REQUEST['term'],'url','service_id',array('SVC %s: %s'=>array('service_id','service_name()')),array(),array('urlprefix'=>'u/service/view/')));
|
2013-05-08 09:00:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->response->headers('Content-Type','application/json');
|
|
|
|
$this->response->body(json_encode(array_values($result)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|