More use of list_active(), setup ajax actions that are check to be ajax

This commit is contained in:
Deon George
2012-10-07 15:15:34 +11:00
parent 4220ade8ac
commit 878c159e3a
19 changed files with 137 additions and 130 deletions

View File

@@ -25,13 +25,14 @@ abstract class ORMOSB extends ORM {
// Our attributes used in forms.
protected $_form = array();
// Rules to assist with site ID and getting next record ID for inserts.
public function rules() {
return array(
'id'=>array(
array('ORMOSB::get_next_id',array(':validation',':model',':field')),
array('ORMOSB::get_next_id',array(':model',':field')),
),
'site_id'=>array(
array('ORMOSB::set_site_id',array(':validation',':model',':field')),
array('ORMOSB::set_site_id',array(':model',':field')),
),
);
}
@@ -73,8 +74,7 @@ abstract class ORMOSB extends ORM {
* @param array Validate object
* @param string Primary Key
*/
// @todo Do we need the $array?
public static function get_next_id(Validation $array,$model,$field) {
public static function get_next_id($model,$field) {
if (! is_null($model->$field))
return TRUE;
@@ -92,8 +92,10 @@ abstract class ORMOSB extends ORM {
return TRUE;
}
// @todo Do we need the $array?
public static function set_site_id(Validation $array,$model,$field) {
/**
* Set the site ID attribute for each row update
*/
public static function set_site_id($model,$field) {
if (! is_null($model->$field))
return TRUE;
@@ -209,14 +211,6 @@ abstract class ORMOSB extends ORM {
return empty($mc[$key]) ? '' : $mc[$key];
}
protected function _where_active() {
return $this->where('status','=',TRUE);
}
public function where_active() {
return $this->_where_active();
}
public function list_active() {
return $this->_where_active()->find_all();
}