This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/application/classes/Controller/User/Search.php

37 lines
1.7 KiB
PHP
Raw Normal View History

<?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 ($this->request->query('term')) {
$result = Arr::merge($result,ORM::factory('Account')->list_autocomplete($this->request->query('term'),'url','id',array('ACC %s: %s'=>array('id','name()')),array(),array('urlprefix'=>URL::link('reseller','account/view/'))));
$result = Arr::merge($result,ORM::factory('Service')->list_autocomplete($this->request->query('term'),'url','id',array('SVC %s: %s'=>array('id','name()')),array(),array('urlprefix'=>URL::link('user','service/view/'))));
$result = Arr::merge($result,ORM::factory('Invoice')->list_autocomplete($this->request->query('term'),'url','id',array('INV %s: %s'=>array('id','account->name()')),array(),array('urlprefix'=>URL::link('user','invoice/view/'))));
2019-03-15 02:36:03 +00:00
foreach (array('Service_Plugin_Adsl','Service_Plugin_Domain','Service_Plugin_Host','Service_Plugin_Voip') as $o)
$result = Arr::merge($result,ORM::factory($o)->list_autocomplete($this->request->query('term'),'url','service_id',array('SVC %s: %s'=>array('service_id','service->name()')),array(),array('urlprefix'=>URL::link('user','service/view/'))));
}
$this->response->headers('Content-Type','application/json');
$this->response->body(json_encode(array_values($result)));
}
}
?>