Rework service, change module_method configuration

This commit is contained in:
Deon George
2013-06-04 21:50:41 +10:00
parent 2ac7389223
commit f4ddea3586
35 changed files with 780 additions and 1022 deletions

View File

@@ -39,13 +39,18 @@ class Request extends Kohana_Request {
$result = NULL;
$mo = ORM::factory('Module',array('name'=>$this->_controller));
list($c,$x) = substr_count($this->_controller,'_') ? explode('_',$this->_controller,2) : array($this->_controller,'');
$mo = ORM::factory('Module',array('name'=>$c));
if ($mo->loaded() AND $mo->status) {
$method = strtolower($this->_directory ? sprintf('%s_%s',$this->_directory,$this->_action) : $this->_action);
$method = strtolower($this->_directory ? sprintf('%s:%s',$this->_directory.($x ? '_'.$x : ''),$this->_action) : $this->_action);
// Get the method number
$mmo = $mo->module_method->where('name','=',$method)->find();
$mmo = $mo->module_method
->where('name','=',$method)
->or_where('name','=',str_replace(':','_',$method)) // @todo This is temporary until all our method names have a colon delimiter
->find();
if ($mmo->loaded())
$result = $mmo;