public function handle_request_internal() { $req = APF::get_instance()->get_request(); $res = APF::get_instance()->get_response(); $params = $req->get_parameters(); $pro = $params['pro'] ? $params['pro'] : 0; $id = $params['cid'] ? $params['cid'] : 0; if (isset($params['edit_submit'])) { $comp_id = $params['comp_id']; $input_arr = array('name' => $params['comp_name'], 'owner' => $params['comp_owner'], 'is_disabled' => $params['disable'], 'is_deleted' => $params['delete']); $ret = Bll_DdComponentBiz::get_instance()->modify_component($comp_id, $input_arr); $url = Admin_CompViewController::build_uri() . "?pro=" . $pro; $res->redirect($url); } else { if ($id != 0 && $pro != 0) { $depart = Bll_DdCommonBiz::get_instance()->get_name_by_id($pro); $component = Bll_DdComponentBiz::get_instance()->get_component_by_id($id); } $all_users = Bll_UserBiz::get_instance()->get_all_valid_users(); $tmp_all = array(); foreach ($all_users as $key => $value) { $tmp_all[$key] = $value->user_name; } $all_users = json_encode($tmp_all); $req->set_attribute('depart', $depart); $req->set_attribute('pro', $pro); $req->set_attribute('component', $component); $req->set_attribute('all_users', $all_users); return 'Admin_CompEdit'; } }
public function handle_request_internal() { $req = APF::get_instance()->get_request(); $res = APF::get_instance()->get_response(); $params = $req->get_parameters(); $pro = $params['pro'] ? $params['pro'] : 0; if (isset($params['add_submit'])) { $input_arr = array('department' => $params['department'], 'name' => $params['comp_name'], 'owner' => $params['comp_owner'], 'is_disabled' => $params['disable'], 'is_deleted' => $params['delete']); $ret = Bll_DdComponentBiz::get_instance()->add_by_admin($input_arr); $url = Admin_CompViewController::build_uri() . "?pro=" . $pro; $res->redirect($url); } else { $depart = Bll_DdCommonBiz::get_instance()->get_departments_new(); $req->set_attribute('depart', $depart); $req->set_attribute('pro', $pro); return 'Admin_CompAdd'; } }
public function handle_request_internal() { $req = APF::get_instance()->get_request(); $res = APF::get_instance()->get_response(); $params = $req->get_parameters(); $product = $params['pro'] ? $params['pro'] : 2; $userid = $req->get_user_id(); $role = Bll_RoleBiz::get_instance()->get_user_role($userid); if ($role != "admin" && $role != "root") { $status = "nopermit"; $this->request->set_attribute('status', $status); return 'Admin_CompView'; } if (isset($params['sort_save'])) { $new_sort = $params['comp_sort']; $components = Bll_DdComponentBiz::get_instance()->get_components($product); foreach ($components as $key => $row) { if ($row->sort != $new_sort[$key]) { $modify_id = $row->int; $input_arr = array('sort' => $new_sort[$key]); $res_id = Bll_DdComponentBiz::get_instance()->modify_component($modify_id, $input_arr); } } $url = Admin_CompViewController::build_uri() . "?pro=" . $product; $res->redirect($url); } else { $departments = Bll_DdCommonBiz::get_instance()->get_departments_new(); $depart_select = array(); foreach ($departments as $row) { $depart_select[$row->id] = array('name' => $row->name, 'click' => false); } $depart_select[$product]['click'] = true; $components = Bll_DdComponentBiz::get_instance()->get_components($product, 1); $req->set_attribute('pro', $product); $req->set_attribute('depart_select', $depart_select); $req->set_attribute('components', $components); return 'Admin_CompView'; } /*$user_id=$req->get_user_id(); $params=$req->get_parameters(); if($params['changerole_user_id']&&$params['new_role']){ $changerole_user_id=$params['changerole_user_id'];$new_role=$params['new_role']; $suc=Bll_UserRoleBiz::get_instance()->change_role($changerole_user_id, $new_role);//old:dev new:qa if($suc){ $req->set_attribute('suc', '修改成功!'); }else{ $req->set_attribute('suc', '修改失败!'); } } $user_info=Bll_UserBiz::get_instance()->get_userinfo_by_user_id($user_id); $role_name=Bll_RoleBiz::get_instance()->get_user_role($user_id); if($role_name=='admin'){ $dev_users=Bll_UserBiz::get_instance()->get_dev_users();//对象数组 $qa_users=Bll_UserBiz::get_instance()->get_qa_users();//对象数组 $req->set_attribute('admin', 'admin'); $req->set_attribute('dev_users', $dev_users);//对象数组 $req->set_attribute('qa_users', $qa_users);//对象数组 } $req->set_attribute('user_info', $user_info);//一个对象 return 'Admin_CompView';*/ }