Language ID rework

This commit is contained in:
Deon George
2012-07-30 15:10:58 +10:00
parent 5697e7985b
commit 7b0e87d28c
12 changed files with 51 additions and 13 deletions

View File

@@ -22,6 +22,9 @@ abstract class ORMOSB extends ORM {
// Our attribute values that need to be stored as serialized
protected $_serialize_column = array();
// Our attributes used in forms.
protected $_form = array();
public function rules() {
return array(
'id'=>array(
@@ -60,6 +63,10 @@ abstract class ORMOSB extends ORM {
}
}
final public static function form($table,$blank=FALSE) {
return ORM::factory($table)->formselect($blank);
}
/**
* Get Next record id
*
@@ -146,6 +153,18 @@ abstract class ORMOSB extends ORM {
return parent::__get($column);
}
public function formselect($blank) {
$result = array();
if ($blank)
$result[] = '';
foreach ($this->find_all() as $o)
$result[$o->{$this->_form['id']}] = $o->{$this->_form['value']};
return $result;
}
public function keyget($column,$key=NULL) {
if (is_null($key) OR ! is_array($this->$column))
return $this->$column;