Enabled Search, Improved Navbar, Fixed Application Authorisation and some other minor fixes

This commit is contained in:
Deon George
2013-05-08 19:00:47 +10:00
parent 364cb58b7b
commit ce17247db6
27 changed files with 877 additions and 67 deletions

View File

@@ -166,13 +166,11 @@ class Model_Account extends Model_Auth_UserDefault {
/**
* Search for accounts matching a term
*/
public function list_autocomplete($term,$index='id',array $limit=array()) {
$result = array();
public function list_autocomplete($term,$index,$value,array $label,array $limit=array(),array $options=NULL) {
$ao = Auth::instance()->get_user();
$this->clear();
$this->where_active();
$value = 'name(TRUE)';
// Build our where clause
// First Name, Last name
@@ -190,7 +188,6 @@ class Model_Account extends Model_Auth_UserDefault {
} elseif (preg_match('/\@/',$term)) {
$this->where('email','like','%'.$term.'%');
$value = 'email';
} else {
$this->where_open()
@@ -201,22 +198,10 @@ class Model_Account extends Model_Auth_UserDefault {
->where_close();
}
foreach ($limit as $w) {
list($k,$s,$v) = $w;
$this->and_where($k,$s,$v);
}
// Restrict results to authorised accounts
$this->and_where('id','IN',$ao->RTM->customers($ao->RTM));
array_push($limit,array('id','IN',$ao->RTM->customers($ao->RTM)));
foreach ($this->find_all() as $o)
$result[$o->$index] = array(
'value'=>$o->$index,
'label'=>sprintf('ACC %s: %s',$o->id,Table::resolve($o,$value)),
);
return $result;
return parent::list_autocomplete($term,$index,$value,$label,$limit,$options);
}
}
?>