2014-09-29 05:15:49 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Application Module Model
|
|
|
|
*
|
|
|
|
* This module must remain in applications/ as it is used very early in the
|
|
|
|
* MDB initialisation.
|
|
|
|
*
|
|
|
|
* @package lnAuth
|
|
|
|
* @category Models
|
|
|
|
* @author Deon George
|
|
|
|
* @copyright (c) 2014 Deon George
|
|
|
|
* @license http://dev.leenooks.net/license.html
|
|
|
|
*/
|
|
|
|
abstract class lnAuth_Model_Module extends ORM {
|
|
|
|
// Relationships
|
|
|
|
protected $_has_one = array(
|
|
|
|
'record_id'=>array('model'=>'Record_ID','far_key'=>'id'),
|
|
|
|
);
|
|
|
|
protected $_has_many = array(
|
|
|
|
'module_method'=>array('far_key'=>'id'),
|
|
|
|
);
|
|
|
|
protected $_sorting = array(
|
|
|
|
'name'=>'ASC',
|
|
|
|
);
|
|
|
|
|
|
|
|
protected $_display_filters = array(
|
|
|
|
'external'=>array(
|
|
|
|
array('StaticList_YesNo::get',array(':value',TRUE)),
|
|
|
|
),
|
|
|
|
'name'=>array(
|
|
|
|
array('strtoupper',array(':value')),
|
|
|
|
),
|
|
|
|
'active'=>array(
|
|
|
|
array('StaticList_YesNo::get',array(':value',TRUE)),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return an instance of this Module's Model
|
|
|
|
*
|
|
|
|
* @param $id PK of Model
|
|
|
|
*/
|
|
|
|
public function instance($id=NULL) {
|
|
|
|
if (! $this->loaded())
|
|
|
|
throw new Kohana_Exception('Cant call an instance of a model when it is not loaded');
|
|
|
|
|
|
|
|
return ORM::factory(Kohana::classname($this->name),$id);
|
|
|
|
}
|
|
|
|
|
2016-08-31 05:01:59 +00:00
|
|
|
public function name($variable=NULL) {
|
2016-08-25 13:23:25 +00:00
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
2014-09-29 05:15:49 +00:00
|
|
|
public function list_external() {
|
|
|
|
return $this->where_active()->where('external','=',TRUE)->find_all();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|