Internal overhaul
This commit is contained in:
@@ -188,6 +188,10 @@ class Auth_OSB extends Auth_ORM {
|
||||
return $uo;
|
||||
}
|
||||
|
||||
public function get_groups() {
|
||||
return is_null($x=$this->get_user()) ? ORM::factory('Group')->where('id','=',0)->find_all() : $x->groups();
|
||||
}
|
||||
|
||||
/**
|
||||
* OSB authentication is controlled via database queries.
|
||||
*
|
||||
|
@@ -171,13 +171,11 @@ class Controller_Admin_Module extends Controller_Module {
|
||||
* List our installed modules
|
||||
*/
|
||||
public function action_list() {
|
||||
$mo = ORM::factory('Module');
|
||||
|
||||
Block::factory()
|
||||
->title('Defined Modules')
|
||||
->title_icon('icon-cog')
|
||||
->body(Table::factory()
|
||||
->data($mo->find_all())
|
||||
->data(ORM::factory('Module')->where('parent_id','is',NULL)->find_all())
|
||||
->jssort(TRUE)
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
|
@@ -33,7 +33,7 @@ class Controller_Reseller_Account extends Controller_Account {
|
||||
'name(TRUE)'=>'Account',
|
||||
'email'=>'Email',
|
||||
'invoices_due_total(NULL,TRUE)'=>'Invoices',
|
||||
'services_count(TRUE)'=>'Services',
|
||||
'service->list_count()'=>'Services',
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('reseller','account/view/')),
|
||||
|
@@ -22,13 +22,13 @@ class Controller_User_Welcome extends Controller_Welcome {
|
||||
->span(6)
|
||||
->body(Table::factory()
|
||||
->data($this->ao->service->list_active())
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'service_name()'=>'Service',
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('user','service/view/')),
|
||||
))
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'service_name()'=>'Service',
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('user','service/view/')),
|
||||
))
|
||||
);
|
||||
|
||||
Block::factory()
|
||||
@@ -43,15 +43,15 @@ class Controller_User_Welcome extends Controller_Welcome {
|
||||
->span(6)
|
||||
->body(Table::factory()
|
||||
->data($this->ao->invoice->list_due())
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'due_date'=>'Date Due',
|
||||
'total(TRUE)'=>'Invoice Total',
|
||||
'due(TRUE)'=>'Amount Due',
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('user','invoice/view/')),
|
||||
))
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'due_date'=>'Date Due',
|
||||
'total(TRUE)'=>'Invoice Total',
|
||||
'due(TRUE)'=>'Amount Due',
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('user','invoice/view/')),
|
||||
))
|
||||
);
|
||||
|
||||
Block::factory()
|
||||
@@ -60,14 +60,14 @@ class Controller_User_Welcome extends Controller_Welcome {
|
||||
->span(6)
|
||||
->body(Table::factory()
|
||||
->data($this->ao->service->list_expiring())
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'service_name()'=>'Service',
|
||||
'expire(TRUE)'=>'Date',
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('user','service/view/')),
|
||||
))
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'service_name()'=>'Service',
|
||||
'expire(TRUE)'=>'Date',
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('user','service/view/')),
|
||||
))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -146,19 +146,6 @@ class Model_Account extends Model_Auth_UserDefault {
|
||||
return trim(sprintf('%s %s',$this->first_name,$this->last_name).(($withcompany AND $this->company) ? sprintf(' (%s)',$this->company) : ''));
|
||||
}
|
||||
|
||||
/**
|
||||
* List all the services for this account
|
||||
*/
|
||||
public function services($active=TRUE) {
|
||||
$o = $this->service;
|
||||
|
||||
return $active ? $o->where_active()->find_all() : $o->find_all();
|
||||
}
|
||||
|
||||
public function services_count($active=TRUE) {
|
||||
return $this->services($active)->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* The key we use to sort entries of this model type
|
||||
*/
|
||||
|
@@ -67,5 +67,12 @@ class Model_Group extends Model_Auth_Role {
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of groups that have their own pricing
|
||||
*/
|
||||
public function list_pricegroups() {
|
||||
return $this->where_active()->where('pricing','=',TRUE)->find_all();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -261,8 +261,10 @@ abstract class ORM_OSB extends ORM {
|
||||
/**
|
||||
* Function help to find records that are active
|
||||
*/
|
||||
public function list_active() {
|
||||
return $this->_where_active()->find_all();
|
||||
public function list_active($active=TRUE) {
|
||||
$x=($active ? $this->_where_active() : $this);
|
||||
|
||||
return $x->find_all();
|
||||
}
|
||||
|
||||
public function list_count($active=TRUE) {
|
||||
|
Reference in New Issue
Block a user