/** * 分配管理员站点 */ public function site($id) { //zhu add $this->_check_manager($id); if ($_POST) { $manager = Mymanager::instance($id)->get(); $target_select = $this->input->post('target_select'); if ($manager['site_num'] < count($target_select)) { remind::set(Kohana::lang('o_manage.self_account') . $manager['site_num'] . Kohana::lang('o_manage.num_site'), 'manage/manager/site/' . $id); } if (!$target_select) { remind::set(Kohana::lang('o_manage.select_site'), 'manage/manager/site/' . $id); } if (Mymanager::instance()->set_sites($id, $_POST)) { remind::set(Kohana::lang('o_global.add_success'), 'manage/manager', 'success'); } else { remind::set(Kohana::lang('o_global.add_error'), 'manage/manager/site/' . $id); } } /* 得到当前所有的站点类型 */ $site_types = Mysite_type::instance()->site_types(); /* 验证是超级管理员就列出所有站点 */ if (role::is_root($this->manager_name)) { $sites = Mysite::instance()->get_sites(); } else { /* 超级管理员外自己不能调整自己的站点 */ if ($this->manager_id == $id) { remind::set(Kohana::lang('o_manage.self_can_not_set_self_site'), 'manage/manager'); } $sites = Mymanager::instance($this->manager_id)->sites(); } $target_sites = Mymanager::instance($id)->sites(); $optional_sites = tool::my_array_diff($sites, $target_sites); $this->template->content = new View("manage/assign_site"); $this->template->content->sites = $optional_sites; $this->template->content->site_types = $site_types; $this->template->content->target_sites = $target_sites; $this->template->content->access_url = url::base() . 'manage/site/ajax_search_site'; $this->template->content->title = '管理员站点分组管理'; }
/** * 订单导出查看 */ public function view($id = 0) { //初始化返回数据 $return_data = array(); //请求结构体 $request_data = array(); try { /* 权限验证 订单导出配置*/ role::check('order_edit'); if ($id < 1) { /* 添加导出配置 */ $data = Myorder_export::instance(1)->get(); if ($data['id'] > 0) { $export_select_ids = unserialize($data['export_ids']); $export_name = null; $export_id = 0; } else { throw new MyRuntimeException(Kohana::lang('o_order.default_config_error'), 403); } } else { /* 修改导出配置 */ $data = Myorder_export::instance($id)->get(); $export_select_ids = unserialize($data['export_ids']); $export_name = $data['name']; $export_id = $data['id']; } /* 导出配置详情 */ $xls = export::instance(); $export_list = $xls->config(); $export_select_list = array(); foreach ($export_select_ids as $value) { foreach ($export_list as $key => $rs) { $export_list[$key]['id'] = $key; if ($key == $value) { $rs['id'] = $key; $export_select_list[$key] = $rs; } } } $export_spare_list = tool::my_array_diff($export_list, $export_select_list); $this->template->content = new View("order/order_export"); $this->template->content->export_select_list = $export_select_list; $this->template->content->export_spare_list = $export_spare_list; $this->template->content->export_name = $export_name; $this->template->content->export_id = $export_id; } catch (MyRuntimeException $ex) { $return_struct['status'] = 0; $return_struct['code'] = $ex->getCode(); $return_struct['msg'] = $ex->getMessage(); //TODO 异常处理 //throw $ex; if ($this->is_ajax_request()) { $this->template = new View('layout/empty_html'); $this->template->content = $return_struct['msg']; } else { $this->template->return_struct = $return_struct; $content = new View('info'); $this->template->content = $content; /* 请求结构数据绑定 */ $this->template->content->request_data = $request_data; /* 返回结构体绑定 */ $this->template->content->return_struct = $return_struct; } } }