Moved functions from OSB and lnAuth
This commit is contained in:
@@ -16,22 +16,22 @@ abstract class lnApp_Model_Account extends Model_Auth_UserDefault {
|
||||
'group'=>array('through'=>'account_group'),
|
||||
);
|
||||
|
||||
protected $_has_one = array(
|
||||
'country'=>array('foreign_key'=>'id'),
|
||||
'currency'=>array('foreign_key'=>'id'),
|
||||
'language'=>array('foreign_key'=>'id'),
|
||||
protected $_belongs_to = array(
|
||||
'country'=>array(),
|
||||
'currency'=>array(),
|
||||
'language'=>array(),
|
||||
);
|
||||
|
||||
protected $_display_filters = array(
|
||||
'active'=>array(
|
||||
array('StaticList_YesNo::get',array(':value',TRUE)),
|
||||
),
|
||||
'date_orig'=>array(
|
||||
array('Site::Date',array(':value')),
|
||||
),
|
||||
'date_last'=>array(
|
||||
array('Site::Date',array(':value')),
|
||||
),
|
||||
'active'=>array(
|
||||
array('StaticList_YesNo::get',array(':value',TRUE)),
|
||||
),
|
||||
);
|
||||
|
||||
protected $_form = array('id'=>'id','value'=>'name()');
|
||||
@@ -40,17 +40,6 @@ abstract class lnApp_Model_Account extends Model_Auth_UserDefault {
|
||||
|
||||
/** REQUIRED ABSTRACT METHODS **/
|
||||
|
||||
/**
|
||||
* Return an account name
|
||||
*/
|
||||
public function name($variable=NULL) {
|
||||
return trim(sprintf('%s %s',$this->first_name,$this->last_name));
|
||||
}
|
||||
|
||||
public function refnum($short=FALSE) {
|
||||
return ($short ? '' : sprintf('%02s-',Site::id())).sprintf('%04s',$this->id);
|
||||
}
|
||||
|
||||
/** LOCAL METHODS **/
|
||||
|
||||
/**
|
||||
@@ -97,24 +86,14 @@ abstract class lnApp_Model_Account extends Model_Auth_UserDefault {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will extract the available methods for this account
|
||||
* This is used both for menu options and method security
|
||||
* Return an account name
|
||||
*/
|
||||
public function methods() {
|
||||
static $result = array();
|
||||
public function name($variable=NULL) {
|
||||
return trim(sprintf('%s %s',$this->first_name,$this->last_name));
|
||||
}
|
||||
|
||||
// @todo We may want to optimise this with some session caching.
|
||||
if ($result)
|
||||
return $result;
|
||||
|
||||
foreach ($this->groups() as $go)
|
||||
foreach ($go->module_method->find_all() as $mmo)
|
||||
if (empty($result[$mmo->id]))
|
||||
$result[$mmo->id] = $mmo;
|
||||
|
||||
Sort::MAsort($result,array('module->name','menu_display'));
|
||||
|
||||
return $result;
|
||||
public function refnum($short=FALSE) {
|
||||
return ($short ? '' : sprintf('%02s-',Site::id())).sprintf('%04s',$this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user