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.
66 lines
2.1 KiB
PHP
66 lines
2.1 KiB
PHP
<?php
|
|
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
class Province 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('InfoContents_model');
|
|
$this->load->model('InfoStructures_model');
|
|
}
|
|
|
|
public function index($province_id=0)
|
|
{
|
|
$this->load->library('Accesscheck');
|
|
$this->accesscheck->check_access();
|
|
//查询不到省份信息则显示错误
|
|
$data['province'] = $this->Area_model->get_province($province_id);
|
|
if ($data['province'] == FALSE)
|
|
{
|
|
show_404();
|
|
}
|
|
|
|
$data['countryList'] = $this->Area_model->get_country_list();
|
|
$data['cityList'] = $this->Area_model->get_city_list($province_id);
|
|
$data['city_list'] = $this->Area_model->get_municipalities_list();
|
|
$data['provinceList'] = $this->Area_model->get_province_list();
|
|
$this->load->view('bootstrap/header', $data);
|
|
$this->load->view('bootstrap/welcome');
|
|
$this->load->view('bootstrap/footer');
|
|
}
|
|
|
|
public function edit($province_id=0)
|
|
{
|
|
//查询不到省份信息则显示错误
|
|
$data['province'] = $this->Area_model->get_province($province_id);
|
|
if ($data['province'] == FALSE)
|
|
{
|
|
show_404();
|
|
}
|
|
//查询结构根节点,当为空则建立
|
|
$rootStructure = $this->Information_model->GetRoot('p', $province_id);
|
|
if ($rootStructure == FALSE)
|
|
{
|
|
$this->InfoContents_model->Add('', $data['province']->PRI2_Name, 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $province_id, 'p', 0,
|
|
'','');
|
|
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
|
|
$is_id = $this->InfoStructures_model->insert_id;
|
|
}
|
|
else
|
|
{
|
|
$is_id = $rootStructure->is_id;
|
|
}
|
|
redirect(site_url('information/edit/' . $is_id));
|
|
}
|
|
|
|
}
|
|
|