This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/application/classes/Model/Module.php

56 lines
1.3 KiB
PHP
Raw Normal View History

2013-10-10 02:44:53 +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
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_Module extends ORM {
2013-10-10 02:44:53 +00:00
// Relationships
protected $_has_one = array(
'record_id'=>array('model'=>'Record_ID','far_key'=>'id'),
);
2013-05-10 10:48:10 +00:00
protected $_has_many = array(
'module_method'=>array('far_key'=>'id'),
);
2013-10-10 02:44:53 +00:00
protected $_sorting = array(
'name'=>'ASC',
);
protected $_display_filters = array(
2013-05-29 11:43:59 +00:00
'external'=>array(
2013-11-08 11:02:32 +00:00
array('StaticList_YesNo::get',array(':value',TRUE)),
2013-05-29 11:43:59 +00:00
),
2013-10-10 02:44:53 +00:00
'name'=>array(
array('strtoupper',array(':value')),
),
'status'=>array(
2013-11-08 11:02:32 +00:00
array('StaticList_YesNo::get',array(':value',TRUE)),
2013-10-10 02:44:53 +00:00
),
);
/**
* 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);
2013-10-10 02:44:53 +00:00
}
public function list_external() {
return $this->_where_active()->where('external','=',TRUE)->find_all();
}
}
?>