Language ID rework
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user