function editShopbranch($id) { if ($this->input->post('title')) { // var_dump($_POST); $keys = array('title', 'openTime', 'phone', 'address'); foreach ($keys as $key) { $data[$key] = $this->input->post($key); } $data['district'] = avosPointer('District', $this->input->post('districtId')); $data['subDistrict'] = avosPointer('District', $this->input->post('subDistrictId')); $latitude = doubleval($this->input->post('latitude')); $longitude = doubleval($this->input->post('longitude')); $data['location'] = avosGeoPoint($latitude, $longitude); $result = $this->model->update($id, $data); if ($result < 0) { echo $result; } else { $this->session->set_flashdata('msg', '创建成功'); redirect('admin/shops/index', 'refresh'); } return; } $headDistricts = $this->district_m->get_all_headDistrict(); $subDistricts = array(); foreach ($headDistricts as $district) { $subDistricts = array_merge($subDistricts, $district['subDistricts']); } $data['title'] = '子商户'; $data['main'] = 'admin_shops_editshopbranch'; $data['model'] = $this->model->get($id); $data['headDistricts'] = $headDistricts; $data['subDistricts'] = $subDistricts; $this->load->view($this->config->item('admin_template'), $data); }
function index($offset = 0) { $models = $this->model->get_all_headDistrict(); $this->load->library('pagination'); // $config['base_url'] = site_url('admin/districts/index/'); $config['total_rows'] = count($models); $config['per_page'] = 20; $config['uri_segment'] = 4; $config['full_tag_open'] = '<p>'; $config['full_tag_close'] = '</p>'; $this->pagination->initialize($config); $data['title'] = '区域管理'; $data['main'] = 'admin_districts_home'; $data['models'] = $models; $this->load->view($this->config->item('admin_template'), $data); }
public function headDistricts_get() { $results = $this->district_m->get_all_headDistrict(); return $this->output_results($results); }