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.
information-system/application/controllers/setting.php

83 lines
3.0 KiB
PHTML

<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Setting extends CI_Controller {
function __construct() {
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoMetas_model');
}
public function index() {
$data = array();
$data['active'] = 'home';
$data['setting_body'] = '各种系统选项的设置,请选择左侧栏目';
$this->load->view('bootstrap3/header', $data);
$this->load->view('bootstrap3/setting');
$this->load->view('bootstrap3/footer');
}
public function website_nav() {
$data = array();
$data['active'] = 'website_nav';
$data['nav_list'] = $this->InfoMetas_model->get_list(0, 'setting_website_nav_' . strtolower($this->config->item('site_code')));
$data['setting_body'] = $this->load->view('bootstrap3/setting_website_nav', $data, true);
$this->load->view('bootstrap3/header', $data);
$this->load->view('bootstrap3/setting');
$this->load->view('bootstrap3/footer');
}
public function add() {
$im_ic_id = $this->input->post('im_ic_id');
$im_key = $this->input->post('im_key');
$im_value = $this->input->post('im_value');
$return_url = $this->input->post('return_url');
if (!empty($im_key) && !empty($im_value)) {
$this->InfoMetas_model->add($im_ic_id, $im_key, $im_value);
if (!empty($return_url)) {
$data[] = array('name' => 'ok_go', 'value' => $return_url);
} else {
$data[] = array('name' => 'ok', 'value' => '添加成功!');
}
} else {
$data[] = array('name' => 'no', 'value' => '添加失败!');
}
echo json_encode($data);
}
public function save() {
$im_id = $this->input->post('im_id');
$im_value = $this->input->post('im_value');
if (!empty($im_id) && !empty($im_value)) {
$this->InfoMetas_model->update_by_id($im_id, $im_value);
$data[] = array('name' => 'ok', 'value' => '保存成功!');
} else {
$data[] = array('name' => 'no', 'value' => '保存失败!');
}
echo json_encode($data);
}
public function delete() {
$im_id = $this->input->post('im_id');
$return_url = $this->input->post('return_url');
if (!empty($im_id)) {
$this->InfoMetas_model->delete_by_id($im_id);
if (!empty($return_url)) {
$data[] = array('name' => 'ok_go', 'value' => $return_url);
} else {
$data[] = array('name' => 'ok', 'value' => '删除成功!');
}
} else {
$data[] = array('name' => 'no', 'value' => '保存失败!');
}
echo json_encode($data);
}
}