2010-11-29 22:41:08 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* OSB Application Module Model
|
|
|
|
*
|
|
|
|
* This module must remain in applications/ as it is used very early in the
|
|
|
|
* OSB initialisation.
|
|
|
|
*
|
|
|
|
* @package OSB
|
|
|
|
* @category Models
|
|
|
|
* @author Deon George
|
2013-03-19 22:35:19 +00:00
|
|
|
* @copyright (c) 2009-2013 Open Source Billing
|
|
|
|
* @license http://dev.osbill.net/license.html
|
2010-11-29 22:41:08 +00:00
|
|
|
*/
|
2012-12-10 21:48:30 +00:00
|
|
|
class Model_Module extends ORM_OSB {
|
2010-11-29 22:41:08 +00:00
|
|
|
// Relationships
|
|
|
|
protected $_has_one = array(
|
2013-04-04 22:42:29 +00:00
|
|
|
'record_id'=>array('model'=>'Record_ID','far_key'=>'id'),
|
2010-11-29 22:41:08 +00:00
|
|
|
);
|
2013-05-10 10:48:10 +00:00
|
|
|
protected $_has_many = array(
|
|
|
|
'module_method'=>array('far_key'=>'id'),
|
|
|
|
);
|
2010-11-29 22:41:08 +00:00
|
|
|
protected $_sorting = array(
|
|
|
|
'name'=>'ASC',
|
|
|
|
);
|
|
|
|
|
2011-08-27 06:33:46 +00:00
|
|
|
protected $_display_filters = array(
|
2013-05-29 11:43:59 +00:00
|
|
|
'external'=>array(
|
|
|
|
array('StaticList_YesNo::get',array(':value')),
|
|
|
|
),
|
2011-08-27 06:33:46 +00:00
|
|
|
'name'=>array(
|
|
|
|
array('strtoupper',array(':value')),
|
|
|
|
),
|
|
|
|
'status'=>array(
|
2013-04-26 01:42:09 +00:00
|
|
|
array('StaticList_YesNo::get',array(':value')),
|
2011-08-27 06:33:46 +00:00
|
|
|
),
|
2010-11-29 22:41:08 +00:00
|
|
|
);
|
2012-11-09 23:13:57 +00:00
|
|
|
|
2013-05-29 11:43:59 +00:00
|
|
|
public function external($render=FALSE) {
|
|
|
|
return $this->label_bool('external',$render);
|
|
|
|
}
|
|
|
|
|
2013-01-15 06:07:54 +00:00
|
|
|
/**
|
|
|
|
* Return an instance of this Module's Model
|
|
|
|
*
|
|
|
|
* @param $id PK of Model
|
|
|
|
*/
|
|
|
|
public function instance($id=NULL) {
|
|
|
|
return ORM::factory(ucwords($this->name),$id);
|
|
|
|
}
|
|
|
|
|
2012-11-09 23:13:57 +00:00
|
|
|
public function list_external() {
|
|
|
|
return $this->_where_active()->where('external','=',TRUE)->find_all();
|
|
|
|
}
|
2010-11-29 22:41:08 +00:00
|
|
|
}
|
|
|
|
?>
|