You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.0 KiB
PHTML
63 lines
2.0 KiB
PHTML
8 years ago
|
<?php
|
||
|
|
||
|
if (!defined('BASEPATH'))
|
||
|
exit('No direct script access allowed');
|
||
|
|
||
|
class Amp extends CI_Controller {
|
||
|
|
||
|
function __construct() {
|
||
|
parent::__construct();
|
||
|
$this->permission->is_admin();
|
||
|
//$this->output->enable_profiler(TRUE);
|
||
|
$this->load->model('Information_model');
|
||
|
$this->load->model('InfoMetas_model');
|
||
|
}
|
||
|
|
||
|
public function index() {
|
||
|
$data = array();
|
||
|
$this->load->view('bootstrap3/header', $data);
|
||
|
$this->load->view('amp_editor');
|
||
|
$this->load->view('bootstrap3/footer');
|
||
|
}
|
||
|
|
||
|
public function edit($ic_id) {
|
||
|
$data = array();
|
||
|
$data['information'] = $this->Information_model->detail_by_ic_id($ic_id);
|
||
|
if ($data['information'] == FALSE) {
|
||
|
show_404();
|
||
|
}
|
||
|
$this->load->view('bootstrap3/header', $data);
|
||
|
$this->load->view('amp_editor');
|
||
|
$this->load->view('bootstrap3/footer');
|
||
|
}
|
||
|
|
||
|
public function edit_save() {
|
||
|
$data = array();
|
||
|
$ic_id = $this->input->post('ic_id');
|
||
|
$textarea_htmlcode = $this->input->post('textarea_htmlcode');
|
||
|
$amp_status = $this->input->post('amp_status');
|
||
|
$data['information'] = $this->Information_model->detail_by_ic_id($ic_id);
|
||
|
if ($data['information'] == FALSE) {
|
||
|
show_404();
|
||
|
}
|
||
|
|
||
|
$amp = $this->InfoMetas_model->get($ic_id, 'AMP');
|
||
|
if ($amp === false) {
|
||
|
$this->InfoMetas_model->add($ic_id, 'AMP', $textarea_htmlcode);
|
||
|
} else {
|
||
|
$this->InfoMetas_model->update($ic_id, 'AMP', $textarea_htmlcode);
|
||
|
}
|
||
|
|
||
|
$amp_status_value = $this->InfoMetas_model->get($ic_id, 'AMP_STATUS');
|
||
|
if ($amp_status_value === false) {
|
||
|
$this->InfoMetas_model->add($ic_id, 'AMP_STATUS', $amp_status);
|
||
|
} else {
|
||
|
$this->InfoMetas_model->update($ic_id, 'AMP_STATUS', $amp_status);
|
||
|
}
|
||
|
|
||
|
$data[] = array('name' => 'ok', 'value' => $this->lang->line('form_info_success'));
|
||
|
echo json_encode($data);
|
||
|
}
|
||
|
|
||
|
}
|