Some cleanup, setup improvements and other misc items
This commit is contained in:
@@ -70,6 +70,14 @@ class Model_Account extends Model_Auth_UserDefault {
|
||||
return $processed ? $o->find_all() : $o->where_unprocessed()->find_all();
|
||||
}
|
||||
|
||||
public function isAdmin() {
|
||||
return ($this->RTM->loaded() AND is_null($this->RTM->parent_id));
|
||||
}
|
||||
|
||||
public function isReseller() {
|
||||
return $this->RTM->loaded();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of due invoices for this account
|
||||
*
|
||||
|
@@ -42,7 +42,7 @@ class Model_Setup extends ORM_OSB {
|
||||
if (! $this->loaded() OR (is_null($value) AND ! $this->module_config))
|
||||
return array();
|
||||
|
||||
$mo = ORM::factory('Module')->where('name','=',$key)->find();
|
||||
$mo = ORM::factory('Module',array('name'=>$key));
|
||||
|
||||
if (! $mo->loaded())
|
||||
throw new Kohana_Exception('Unknown module :name',array(':name'=>$key));
|
||||
@@ -60,6 +60,25 @@ class Model_Setup extends ORM_OSB {
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function module_config_id($key=NULL) {
|
||||
$result = array();
|
||||
|
||||
foreach (array_keys($this->module_config) as $mid) {
|
||||
if (is_null($key) OR $key == $mid) {
|
||||
$result[$mid] = array(
|
||||
'object'=>ORM::factory('Module',$mid),
|
||||
'data'=>$this->module_config[$mid],
|
||||
);
|
||||
|
||||
// If we are just after our key, we can continue here
|
||||
if ($key AND $key==$mid)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get/Set our Site Configuration from the DB
|
||||
*
|
||||
@@ -67,7 +86,7 @@ class Model_Setup extends ORM_OSB {
|
||||
* @param $value Values to store. If NULL, retrieves the value stored, otherwise stores value.
|
||||
*/
|
||||
public function site_details($key,array $value=NULL) {
|
||||
if (! in_array($key,array('name','address1','address2','city','state','pcode','phone','fax','email')))
|
||||
if (! in_array($key,array('name','address1','address2','city','state','pcode','phone','fax','email','faqurl')))
|
||||
throw new Kohana_Exception('Unknown Site Configuration Key :key',array(':key'=>$key));
|
||||
|
||||
// If $value is NULL, we are a getter
|
||||
|
Reference in New Issue
Block a user