</div> <div class="wrap-row"> <label>Nội dung: </label> <?php if ($mode == MODE_REPLY) { ?> <?php echo form_textarea(array('id' => 'reply_mail', 'name' => 'content', 'rows' => 6, 'cols' => 100, 'placeholder' => 'Tối đa 300 kí tự')); ?> <span id="content_mail"> ********************************** Trả lời cho liên lạc: ********************************<br> Gửi từ <?php echo $form_data['email']; ?> vào ngày <?php echo cnvStringToDate($form_data['create_at'], 'dd-mm-yyyy hh:ii:ss'); ?> <br><br> <?php echo $form_data['content']; ?> </span> <?php echo form_error('content', '<span class="error">', '</span>'); ?> <?php } else { ?> <?php echo form_textarea(array('name' => 'content', 'rows' => 4, 'cols' => 100, 'readonly' => true, 'class' => 'no-input'), $form_data['content']); ?>
/** * getAll * * Get 1 record trong $table voi dieu kien $wheres, sap xep theo $orderBy * * @param type $table * @param type $arrWheres * @param type $arrOrderBy */ public function getOne($arrWheres = array()) { if (count($arrWheres) > 0) { $this->db->where($arrWheres); } $arrOutput = $this->db->get('products')->row_array(); $arrOutput['publish_at'] = cnvStringToDate($arrOutput['publish_at'], 'dd-mm-yyyy'); $files = $this->db->get_where('files', array('owner_id' => $arrWheres['id'], 'table_id' => 'products'))->row_array(); if (count($files) > 0) { $arrOutput['file_url'] = base_url($files['path_thumb'] . $files['file_thumb']); } return $arrOutput; }
/** * confirm * Xử lý add/edit record */ private function confirm($id = '') { $model = $this->uri->segment(2) . '_model'; if ($this->arrCommon['mode'] == MODE_EDIT && is_numeric($id)) { $arrWheres = array('id' => $id); $this->arrCommon['form_data'] = $this->{$model}->search($arrWheres, 'detail'); } else { $this->arrCommon['form_data'] = array('id' => '', 'name' => '', 'status' => 1, 'price' => 0, 'discount' => 0, 'desc' => '', 'brand_id' => '', 'url' => '', 'is_group' => 0, 'publish_at' => cnvStringToDate(getCurrentDt(), 'dd-mm-yyyy'), 'address' => '', 'phone' => '', 'email' => '', 'username' => '', 'role_id' => '', 'content' => '', 'is_published' => 0, 'author' => '', 'content' => '', 'order_by' => -1, 'file_url' => base_url(NO_IMG_URL), 'file_id' => "", 'logo_id' => "", 'ico_id' => "", 'start_at' => cnvStringToDate(getCurrentDt(), 'dd-mm-yyyy'), 'finish_at' => cnvStringToDate(getCurrentDt(), 'dd-mm-yyyy'), 'other_file_url' => "", 'files_id' => "", 'meta_title' => "", 'meta_keywords' => "", 'meta_desc' => ""); } $this->setSelectData(); // Submit form if ($this->input->post() && $this->setValidate($this->arrCommon)) { $arrForm = $this->input->post(); // On form $arrNotSubmit = array('datefrom', 'dateto', 'search', 'search_id', 'confpass', 'count', 'removeList', 'removeDb'); $arrInput = array(); foreach ($arrForm as $key => $vl) { if (strpos($key, 'rules') == 0 && !in_array($key, $arrNotSubmit)) { switch ($key) { case 'publish_at': $arrInput['data'][$key] = cnvDateToString($vl); break; case 'modules': $arrInput['data']['modules'] = $vl; break; default: $arrInput['data'][$key] = $vl; break; } } if (!isset($arrForm['status'])) { $arrInput['data']['status'] = 0; } } if ($this->{$model}->getInsertUpdate($arrInput)) { $this->setMessage(LTV0002, 'success'); } redirect(current_url()); } }