Added site_id to ORM::add() and Module/Method updates

This commit is contained in:
Deon George 2016-08-25 23:23:25 +10:00
parent 4b432d2eb4
commit ceb8159826
5 changed files with 39 additions and 2 deletions

View File

@ -0,0 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.');
class Database_Query_Builder_Insert extends lnAuth_Database_Query_Builder_Insert {}

View File

@ -0,0 +1,23 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class extends Kohana's [Database_Query_Builder_Insert] to ensure that we have a site_id included in the values
*
* @package lnAuth
* @category Helpers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnAuth_Database_Query_Builder_Insert extends Kohana_Database_Query_Builder_Insert {
public function compile($db = NULL) {
$this->_columns = Arr::Merge($this->_columns,['site_id']);
foreach ($this->_values as $k=>$v)
$this->_values[$k] = Arr::Merge($this->_values[$k],[Site::id()]);
return parent::compile($db);
}
}
?>

View File

@ -48,6 +48,10 @@ abstract class lnAuth_Model_Module extends ORM {
return ORM::factory(Kohana::classname($this->name),$id);
}
public function name() {
return $this->name;
}
public function list_external() {
return $this->where_active()->where('external','=',TRUE)->find_all();
}

View File

@ -51,6 +51,13 @@ abstract class lnAuth_Model_Module_Method extends ORM {
return substr($this->name,strpos($this->name,':')+1);
}
/**
* Calculate the description for this method on any menu link
*/
public function menu_display() {
return $this->menu_display ? $this->menu_display : sprintf('%s: %s',$this->module->name,$this->name);
}
/**
* Get our Module_Method object for this request
*/

View File

@ -3,8 +3,8 @@
<legend>Method Details</legend>
<?php
echo View::factory('field/text')->set('data',['field'=>'notes','value'=>$o->notes,'text'=>'Description','class'=>'col-md-9','classlabel'=>'col-md-3']);
echo View::factory('field/text')->set('data',['field'=>'menu_display','value'=>$o->menu_display,'text'=>'Menu Title','class'=>'col-md-9','classlabel'=>'col-md-3']);
echo View::factory('field/text')->set('data',['field'=>'notes','value'=>$o->notes,'text'=>'Description','class'=>'col-md-9','classlabelnum'=>'3']);
echo View::factory('field/text')->set('data',['field'=>'menu_display','value'=>$o->menu_display,'text'=>'Menu Title','class'=>'col-md-9','classlabelnum'=>'3']);
?>
</fieldset>