tableName = DB_PREFIX_SERVICE.'HTMLBlock';
return $this->DBObj($id);
}
function getBaseUrlTag()
{
return '{BASE_URL}';
}
function baseUrl2Tag($content)
{
return str_replace(Constant::get('BASE_URL'), HTMLBlock::getBaseUrlTag(), $content );
}
function tag2BaseUrl($content)
{
return str_replace(HTMLBlock::getBaseUrlTag(), Constant::get('BASE_URL'), $content );
}
function _initTable()
{
if (!is_object($this->table)) {
require_once('class/DB/DBTable.php');
$this->table = new DBTable($this->tableName);
$this->HTMLBlockContent = new DBTable($this->tableName.'Content');
}
return true;
}
function initFromArray($data, $files = null)
{
foreach ($data['content'] as $leng => $value) {
$data['content'][$leng] = $this->baseUrl2Tag($data['content'][$leng]);
}
return parent::initFromArray($data, $files);
}
function insert($data = null)
{
parent::insert($data);
$this->_initContent();
$this->content->save($this->_data);
return $this->id;
}
function delete()
{
parent::delete();
$this->_initContent();
$this->content->delete();
}
function update($data = null, $files = null)
{
parent::update($data);
$this->_initContent();
$this->content->save($this->_data);
return true;
}
function getFromDB($id, $field = false)
{
$res = parent::getFromDB($id);
$this->_initContent($id);
$res = $res + $this->content->get();
foreach ($res['content'] as $leng => $value) {
$res['content'][$leng] = $this->tag2BaseUrl($res['content'][$leng]);
}
return $this->getSubElem($res, $field);
}
function _initContent($id = null)
{
if (is_null($id)){
$id = $this->id;
}
require_once('class/DB/Lang/Content.php');
$this->content = new LangContent($this->tableName.'Content', $id);
}
}
?>