2011-09-27 11:22:13 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class provides Admin Account management
|
|
|
|
*
|
|
|
|
* @package lnApp
|
|
|
|
* @subpackage Page/Account
|
|
|
|
* @category Controllers
|
|
|
|
* @author Deon George
|
|
|
|
* @copyright (c) 2010 Deon George
|
|
|
|
* @license http://dev.leenooks.net/license.html
|
|
|
|
*/
|
|
|
|
class Controller_Admin_Account extends Controller_TemplateDefault_Admin {
|
|
|
|
protected $secure_actions = array(
|
2012-10-07 04:15:34 +00:00
|
|
|
'ajaxlist'=>FALSE, // @todo To Change
|
2012-07-30 07:47:28 +00:00
|
|
|
'list'=>TRUE,
|
2011-09-27 11:22:13 +00:00
|
|
|
'listlog'=>TRUE,
|
|
|
|
);
|
|
|
|
|
2012-10-07 04:15:34 +00:00
|
|
|
public function action_ajaxlist() {
|
2011-10-14 05:44:12 +00:00
|
|
|
$return = array();
|
|
|
|
|
2012-10-07 04:15:34 +00:00
|
|
|
if (isset($_REQUEST['term']) AND trim($_REQUEST['term']))
|
2012-11-09 23:13:57 +00:00
|
|
|
$return += ORM::factory('Account')->list_autocomplete($_REQUEST['term']);
|
2011-10-14 05:44:12 +00:00
|
|
|
|
|
|
|
$this->auto_render = FALSE;
|
2012-07-30 07:47:28 +00:00
|
|
|
$this->response->headers('Content-Type','application/json');
|
2012-10-07 04:15:34 +00:00
|
|
|
$this->response->body(json_encode(array_values($return)));
|
2012-07-30 07:47:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show a list of account logins
|
|
|
|
*/
|
|
|
|
public function action_listlog() {
|
|
|
|
Block::add(array(
|
|
|
|
'title'=>_('Account Login Log'),
|
|
|
|
'body'=>Table::display(
|
2012-11-09 23:13:57 +00:00
|
|
|
ORM::factory('Account_Log')->order_by('id','DESC')->find_all(),
|
2012-07-30 07:47:28 +00:00
|
|
|
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(
|
2012-11-09 23:13:57 +00:00
|
|
|
ORM::factory('Account')->list_active(),
|
2012-07-30 07:47:28 +00:00
|
|
|
25,
|
|
|
|
array(
|
2013-02-12 11:14:59 +00:00
|
|
|
'id'=>array('label'=>'ID','url'=>URL::link('user','account/view/')),
|
2012-07-30 07:47:28 +00:00
|
|
|
'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',
|
2013-02-12 11:14:59 +00:00
|
|
|
'form'=>URL::link('user','account/view'),
|
2012-07-30 07:47:28 +00:00
|
|
|
)),
|
|
|
|
));
|
2011-10-14 05:44:12 +00:00
|
|
|
}
|
2011-09-27 11:22:13 +00:00
|
|
|
}
|
|
|
|
?>
|