Moved module under application
This commit is contained in:
26
application/classes/model/group/method.php
Normal file
26
application/classes/model/group/method.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* OSB Application Module Method Model
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Modules
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Model_Group_Method extends ORMOSB {
|
||||
// Relationships
|
||||
protected $_has_one = array(
|
||||
'record_id'=>array(),
|
||||
);
|
||||
protected $_belongs_to = array(
|
||||
'group'=>array(),
|
||||
);
|
||||
|
||||
// This module doesnt keep track of column updates automatically
|
||||
protected $_created_column = FALSE;
|
||||
protected $_updated_column = FALSE;
|
||||
}
|
||||
?>
|
39
application/classes/model/module/method.php
Normal file
39
application/classes/model/module/method.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* OSB Application Module Method Model
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Modules
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Model_Module_Method extends ORMOSB {
|
||||
// Relationships
|
||||
protected $_belongs_to = array(
|
||||
'module'=>array(),
|
||||
);
|
||||
protected $_has_one = array(
|
||||
'record_id'=>array(),
|
||||
);
|
||||
protected $_has_many = array(
|
||||
'group'=>array('through'=>'group_method','foreign_key'=>'method_id')
|
||||
);
|
||||
|
||||
protected $_sorting = array(
|
||||
'name'=>'ASC',
|
||||
);
|
||||
|
||||
protected $_display_filters = array(
|
||||
'menu_display'=>array(
|
||||
array('StaticList_YesNo::display',array(':value')),
|
||||
),
|
||||
);
|
||||
|
||||
// This module doesnt keep track of column updates automatically
|
||||
protected $_created_column = FALSE;
|
||||
protected $_updated_column = FALSE;
|
||||
}
|
||||
?>
|
26
application/classes/model/module/method/token.php
Normal file
26
application/classes/model/module/method/token.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* OSB Application Module Method Token Model
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Modules
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Model_Module_Method_Token extends ORMOSB {
|
||||
// Relationships
|
||||
protected $_belongs_to = array(
|
||||
'account'=>array(),
|
||||
'module_method'=>array(),
|
||||
);
|
||||
protected $_has_one = array(
|
||||
'record_id'=>array(),
|
||||
);
|
||||
|
||||
// This module doesnt keep track of column updates automatically
|
||||
protected $_update_column = FALSE;
|
||||
}
|
||||
?>
|
41
application/classes/model/record/id.php
Normal file
41
application/classes/model/record/id.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* @package OSB
|
||||
* @subpackage Modules
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Model_Record_Id extends ORMOSB {
|
||||
protected $_primary_key = 'module_id';
|
||||
|
||||
// This module doesnt keep track of column updates automatically
|
||||
protected $_created_column = FALSE;
|
||||
protected $_updated_column = FALSE;
|
||||
|
||||
// @todo we need $mid here, since if there is no record, we cant figure out the module that called us.
|
||||
public function next_id($mid) {
|
||||
if (is_null($this->id)) {
|
||||
$this->module_id = $mid;
|
||||
|
||||
// We'll get the next ID as the MAX(id) of the table
|
||||
$mo = ORM::factory('module',$mid);
|
||||
|
||||
$max = DB::select(array('MAX(id)','id'))
|
||||
->from($mo->name)
|
||||
->where('site_id','=',Config::siteid());
|
||||
|
||||
$this->id = $max->execute()->get('id');
|
||||
}
|
||||
|
||||
$this->id++;
|
||||
|
||||
if (! $this->save())
|
||||
throw new Koahan_Exception(_('Unable to increase ID for :table'),array(':table'=>$mid));
|
||||
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user