tableName = DB_PREFIX_SERVICE.'FormMail'; $this->DBObj($id); } function baseUrl2Tag($content) { return str_replace(BASE_URL, $this->_base_url_tag, $content); } function tag2BaseUrl($content) { return str_replace($this->_base_url_tag, BASE_URL, $content); } function insert($data = null) { parent::insert($data); $this->_initThankMsg(); $this->_data['thank_msg'] = $this->baseUrl2Tag($this->_data['thank_msg']); $this->_data['frm_tpl'] = $this->baseUrl2Tag($this->_data['frm_tpl']); $this->thankMsg->save($this->_data); } function getFromDB($id, $field = false) { $res = parent::getFromDB($id); $this->_initThankMsg($id); $res = (array)$res + $this->thankMsg->get(); $res['thank_msg'] = $this->tag2BaseUrl($res['thank_msg']); $res['frm_tpl'] = $this->tag2BaseUrl($res['frm_tpl']); return $this->getSubElem($res, $field); } function update($data = null) { parent::update($data); $this->_initThankMsg(); $this->_data['thank_msg'] = $this->baseUrl2Tag($this->_data['thank_msg']); $this->_data['frm_tpl'] = $this->baseUrl2Tag($this->_data['frm_tpl']); $this->thankMsg->save($this->_data); } function _initThankMsg($id = null) { if (is_null($id)){ $id = $this->id; } require_once('class/DB/Lang/Content.php'); $qr = "SHOW FIELDS FROM {$this->tableNameDB}ThankMsg"; $fields = $this->db->queryAll($qr, null, MDB2_FETCHMODE_ASSOC, true); unset($fields['id_parent']); unset($fields['lang']); $this->thankMsg = new LangContent($this->tableName.'ThankMsg', $id, array_keys($fields) ); } function _getGroup4Grid() { return "GROUP BY {$this->tableName}.id"; } function _getJoin4Grid() { return "LEFT JOIN {$this->tableNameDB}Req AS {$this->tableName}Req ON {$this->tableName}Req.id_fm = {$this->tableName}.id AND {$this->tableName}Req.deleted='n' "; } function _getWhat4Grid($opt = array()) { return parent::_getWhat4Grid($opt).", COUNT({$this->tableName}Req.id) AS req_cnt "; } }