Added Account list, DB changes for account

This commit is contained in:
Deon George
2012-07-30 17:47:28 +10:00
parent 84145ac24f
commit 8f56da789e
6 changed files with 158 additions and 32 deletions

View File

@@ -13,31 +13,10 @@
class Controller_Admin_Account extends Controller_TemplateDefault_Admin {
protected $secure_actions = array(
'autocomplete'=>FALSE, // @todo To Change
'list'=>TRUE,
'listlog'=>TRUE,
);
/**
* Show a list of account logins
*/
public function action_listlog() {
Block::add(array(
'title'=>_('Account Login Log'),
'body'=>Table::display(
ORM::factory('account_log')->order_by('id','DESC')->find_all(),
25,
array(
'id'=>array('label'=>'ID'),
'date_orig'=>array('label'=>'Date'),
'account->name()'=>array('label'=>'Account'),
'ip'=>array('label'=>'IP Address'),
'details'=>array('label'=>'Details'),
),
array(
'page'=>TRUE,
)),
));
}
public function action_autocomplete() {
$return = array();
@@ -61,7 +40,7 @@ class Controller_Admin_Account extends Controller_TemplateDefault_Admin {
}
// @todo The results should be limited so that users dont see what they shouldnt.
foreach ($a->find_all() as $ao)
foreach ($a->find_all() as $ao)
array_push($return,array(
'id'=>$ao->id,
'label'=>sprintf('%s (%s)',$ao->name(),$ao->email),
@@ -69,8 +48,55 @@ class Controller_Admin_Account extends Controller_TemplateDefault_Admin {
));
$this->auto_render = FALSE;
$this->response->headers('Content-Type','application/json');
$this->response->body(json_encode($return));
$this->response->headers('Content-Type','application/json');
$this->response->body(json_encode($return));
}
/**
* Show a list of account logins
*/
public function action_listlog() {
Block::add(array(
'title'=>_('Account Login Log'),
'body'=>Table::display(
ORM::factory('account_log')->order_by('id','DESC')->find_all(),
25,
array(
'id'=>array('label'=>'ID'),
'date_orig'=>array('label'=>'Date'),
'account->name()'=>array('label'=>'Account'),
'ip'=>array('label'=>'IP Address'),
'details'=>array('label'=>'Details'),
),
array(
'page'=>TRUE,
)),
));
}
/**
* Show a list of accounts
*/
public function action_list() {
Block::add(array(
'title'=>_('Customer List'),
'body'=>Table::display(
ORM::factory('account')->list_active(),
25,
array(
'id'=>array('label'=>'ID','url'=>'user/account/view/'),
'accnum()'=>array('label'=>'Num'),
'name(TRUE)'=>array('label'=>'Account'),
'email'=>array('label'=>'Email'),
'invoices_due_total(NULL,TRUE)'=>array('label'=>'Invoices','class'=>'right'),
'count_services(TRUE,NULL)'=>array('label'=>'Services','class'=>'right'),
),
array(
'page'=>TRUE,
'type'=>'select',
'form'=>'user/account/view',
)),
));
}
}
?>