First start at retiring Affiliate in favour of RTM

This commit is contained in:
Deon George
2013-04-05 09:42:29 +11:00
parent 9d4b2f50ff
commit 43dfd88bce
49 changed files with 680 additions and 570 deletions

View File

@@ -9,13 +9,13 @@
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Controller_Admin_Welcome extends Controller_TemplateDefault_Admin {
class Controller_Admin_Welcome extends Controller_Welcome {
protected $auth_required = TRUE;
public $secure_actions = array(
'index'=>TRUE,
);
public function action_index() {
$ao = ORM::factory('Account',Auth::instance()->get_user()->id);
$t = time();
// Show outstanding invoices
@@ -99,11 +99,31 @@ class Controller_Admin_Welcome extends Controller_TemplateDefault_Admin {
));
Block::add(array(
'title'=>sprintf('%s: %s %s',$ao->accnum(),$ao->first_name,$ao->last_name),
'title'=>sprintf('%s: %s %s',$this->ao->accnum(),$this->ao->first_name,$this->ao->last_name),
'subtitle'=>_('Administrator Overview'),
'body'=>(string)Block_Sub::factory(),
));
// We are a site administrator
if ($this->ao->rtm_id == NULL) {
$rtmo = ORM::factory('RTM',array('account_id','=',$this->ao->id))->find();
// Quick validation, if we are an admin, we should have an entry in the RTM table.
if (! $rtmo->loaded())
throw new Kohana_Exception('User :aid not set up properly',array(':aid'=>$this->ao->id));
$output = View::factory('welcome/admin')
->set('o',$rtmo);
} else {
$rtmo = ORM::factory('RTM',$this->ao->rmt_id);
}
if ($output)
Block::add(array(
'title'=>sprintf('Reseller %s',$this->ao->display('company')),
'body'=>$output,
));
}
}
?>