2013-10-10 02:44:53 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class provides Reseller Account management
|
|
|
|
*
|
|
|
|
* @package OSB
|
|
|
|
* @category Controllers/Reseller
|
|
|
|
* @author Deon George
|
|
|
|
* @copyright (c) 2009-2013 Open Source Billing
|
|
|
|
* @license http://dev.osbill.net/license.html
|
|
|
|
*/
|
|
|
|
class Controller_Reseller_Account extends Controller_Account {
|
|
|
|
protected $secure_actions = array(
|
|
|
|
'list'=>TRUE,
|
|
|
|
'listlog'=>TRUE,
|
2013-05-28 13:10:12 +00:00
|
|
|
'view'=>TRUE,
|
2013-10-10 02:44:53 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show a list of accounts
|
|
|
|
*/
|
|
|
|
public function action_list() {
|
2013-06-10 11:48:06 +00:00
|
|
|
Block::factory()
|
|
|
|
->title(_('Customer List'))
|
2016-07-24 14:44:17 +00:00
|
|
|
->title_icon('fa fa-list')
|
2013-06-10 11:48:06 +00:00
|
|
|
->body(Table::factory()
|
2013-10-09 05:43:41 +00:00
|
|
|
->data(ORM::factory('Account')->where_authorised($this->ao,'id')->find_all())
|
2013-06-10 11:48:06 +00:00
|
|
|
->jssort('customer')
|
|
|
|
->columns(array(
|
|
|
|
'id'=>'ID',
|
2013-11-08 11:02:32 +00:00
|
|
|
'status'=>'Active',
|
2013-06-10 11:48:06 +00:00
|
|
|
'accnum()'=>'Num',
|
|
|
|
'name(TRUE)'=>'Account',
|
|
|
|
'email'=>'Email',
|
|
|
|
'invoices_due_total(NULL,TRUE)'=>'Invoices',
|
2016-07-24 14:44:17 +00:00
|
|
|
'service->find_all()->count()'=>'Services',
|
2013-06-10 11:48:06 +00:00
|
|
|
))
|
|
|
|
->prepend(array(
|
|
|
|
'id'=>array('url'=>URL::link('reseller','account/view/')),
|
|
|
|
))
|
|
|
|
);
|
2013-10-10 02:44:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show a list of account logins
|
|
|
|
*/
|
|
|
|
public function action_listlog() {
|
2016-07-24 14:44:17 +00:00
|
|
|
$this->template->content = View::factory('account/reseller/listlog');
|
2013-10-10 02:44:53 +00:00
|
|
|
}
|
2013-05-28 13:10:12 +00:00
|
|
|
|
|
|
|
public function action_view() {
|
|
|
|
$ao = ORM::factory('Account',$this->request->param('id'));
|
2013-12-04 10:37:09 +00:00
|
|
|
|
|
|
|
if (! $ao->loaded() OR ! $ao->status OR ! Auth::instance()->authorised($ao))
|
|
|
|
throw HTTP_Exception::factory(403,'Account either doesnt exist, or you are not authorised to see it');
|
2013-05-28 13:10:12 +00:00
|
|
|
|
2016-07-24 14:44:17 +00:00
|
|
|
$this->template->content = View::factory('account/reseller/view')->set('o',$ao);
|
2013-05-28 13:10:12 +00:00
|
|
|
}
|
2013-10-10 02:44:53 +00:00
|
|
|
}
|
|
|
|
?>
|