Working on HOST SERVER and improvements to ORMOSB

This commit is contained in:
Deon George
2012-06-27 00:28:18 +10:00
parent f50bea38a3
commit a0e1714358
24 changed files with 1007 additions and 645 deletions

View File

@@ -24,6 +24,10 @@ class lnApp_Block extends HTMLRender {
* @param array Block attributes
*/
public static function add($block,$prepend=FALSE) {
// Any body objects should be converted to a string, so that any calls to Style/Script are processed
if (isset($block['body']))
$block['body'] = (string)$block['body'];
parent::add($block);
// Detect any style sheets.

View File

@@ -15,6 +15,7 @@ class lnApp_Script extends HTMLRender {
protected static $_spacer = "\n";
protected static $_required_keys = array('type','data');
protected static $_unique_vals = array('file'=>'type');
protected static $_rendered = FALSE;
/**
* Return an instance of this class
@@ -47,7 +48,15 @@ class lnApp_Script extends HTMLRender {
}
}
static::$_rendered = TRUE;
return $foutput.static::$_spacer.$soutput;
}
public static function add($item,$prepend=FALSE,$x='') {
if (static::$_rendered)
throw new Kohana_Exception('Already rendered?');
return parent::add($item,$prepend);
}
}
?>

View File

@@ -96,18 +96,6 @@ abstract class ORMOSB extends ORM {
return TRUE;
}
// @todo Change this to be called by array_blob functions
public static function serialize_array(ORM $model,$field,$value) {
if (is_null($value))
return TRUE;
if (! is_array($value))
return FALSE;
$model->_changed[$field] = $field;
$model->$field = serialize($value);
}
public function __get($column) {
if (array_key_exists($column,$this->_table_columns)) {
@@ -166,15 +154,20 @@ abstract class ORMOSB extends ORM {
}
public function save(Validation $validation = NULL) {
// Find any fields that have changed, and that are blobs, and encode them.
// Find any fields that have changed, and process them.
if ($this->_changed)
foreach ($this->_changed as $c)
// Any fields that are blobs, and encode them.
if ($this->_table_columns[$c]['data_type'] == 'blob') {
$this->_object[$c] = $this->blob($this->_object[$c],TRUE);
// We need to reset our auto_convert flag
if (isset($this->_table_columns[$c]['auto_convert']))
$this->_table_columns[$c]['auto_convert'] = FALSE;
// Any fields that should be seriailzed, we'll do that.
} elseif (is_array($this->_object[$c]) AND in_array($c,$this->_serialize_column)) {
$this->_object[$c] = serialize($this->_object[$c]);
}
return parent::save($validation);