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/Reseller/Account.php
2016-08-18 12:38:00 +10:00

65 lines
1.7 KiB
PHP

<?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,
'view'=>TRUE,
);
/**
* Show a list of accounts
*/
public function action_list() {
$this->meta->title = 'Customer List';
Block::factory()
->title(_('Customer List'))
->title_icon('fa fa-list')
->body(Table::factory()
->data(ORM::factory('Account')->where_authorised($this->ao,'id')->find_all())
->jssort('customer')
->columns(array(
'id'=>'ID',
'status'=>'Active',
'accnum()'=>'Num',
'name(TRUE)'=>'Account',
'email'=>'Email',
'invoices_due_total(NULL,TRUE)'=>'Invoices',
'service->find_all()->count()'=>'Services',
))
->prepend(array(
'id'=>array('url'=>URL::link('reseller','account/view/')),
))
);
}
/**
* Show a list of account logins
*/
public function action_listlog() {
$this->template->content = View::factory('account/reseller/listlog');
}
public function action_view() {
$ao = ORM::factory('Account',$this->request->param('id'));
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');
$this->meta->title = 'Customer: '.$ao->name();
$this->template->content = View::factory('account/reseller/view')->set('o',$ao);
}
}
?>