Added site_id to ORM::add() and Module/Method updates
This commit is contained in:
parent
4b432d2eb4
commit
ceb8159826
3
classes/Database/Query/Builder/Insert.php
Normal file
3
classes/Database/Query/Builder/Insert.php
Normal 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 {}
|
23
classes/lnAuth/Database/Query/Builder/Insert.php
Normal file
23
classes/lnAuth/Database/Query/Builder/Insert.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
@ -48,6 +48,10 @@ abstract class lnAuth_Model_Module extends ORM {
|
|||||||
return ORM::factory(Kohana::classname($this->name),$id);
|
return ORM::factory(Kohana::classname($this->name),$id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function name() {
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
public function list_external() {
|
public function list_external() {
|
||||||
return $this->where_active()->where('external','=',TRUE)->find_all();
|
return $this->where_active()->where('external','=',TRUE)->find_all();
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,13 @@ abstract class lnAuth_Model_Module_Method extends ORM {
|
|||||||
return substr($this->name,strpos($this->name,':')+1);
|
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
|
* Get our Module_Method object for this request
|
||||||
*/
|
*/
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
<legend>Method Details</legend>
|
<legend>Method Details</legend>
|
||||||
|
|
||||||
<?php
|
<?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'=>'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','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','classlabelnum'=>'3']);
|
||||||
?>
|
?>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user