public function handle_request_internal() { $req = APF::get_instance()->get_request(); $res = APF::get_instance()->get_response(); $params = $req->get_parameters(); $all_users = Bll_UserBiz::get_instance()->get_all_valid_users(); $tmp_all = array(); foreach ($all_users as $key => $value) { $tmp_all[$key] = $value->whole_name; } $all_users = json_encode($tmp_all); $departments = Bll_DdCommonBiz::get_instance()->get_departments_new(); $req->set_attribute('all_users', $all_users); $req->set_attribute('departments', $departments); // var_dump($params['group_members']) ; if (isset($params['add_submit'])) { if (!empty($params['group_name']) && !empty($params['department']) && !empty($params['group_members'])) { $department = Bll_DdCommonBiz::get_instance()->get_department_value_by_id($params['department']); $input_arr = array('group_name' => $params['group_name'], 'department' => $department, 'group_members' => $params['group_members']); $ret = Bll_UserGroupCustomBiz::get_instance()->group_add($input_arr); if ($ret) { $url = Admin_GroupViewController::build_uri(); $res->redirect($url); } else { return 'Admin_GroupAdd'; } } else { return 'Admin_GroupAdd'; } } else { return 'Admin_GroupAdd'; } }
public function handle_request_internal() { $req = APF::get_instance()->get_request(); $res = APF::get_instance()->get_response(); $params = $req->get_parameters(); $id = $params['pid'] ? $params['pid'] : 0; $all_users = Bll_UserBiz::get_instance()->get_all_valid_users(); $tmp_all = array(); foreach ($all_users as $key => $value) { $tmp_all[$key] = $value->whole_name; } $all_users = json_encode($tmp_all); $departments = Bll_DdCommonBiz::get_instance()->get_departments_new(); if ($id != 0) { $group = Bll_UserGroupCustomBiz::get_instance()->get_group_by_id($id); $group_members = explode(",", $group->group_members); $group_members = array_filter($group_members); $members = Bll_UserBiz::get_instance()->get_wholenames_by_ids($group_members); $group_members = implode(';', $members); } $req->set_attribute('all_users', $all_users); $req->set_attribute('departments', $departments); $req->set_attribute('group', $group); $req->set_attribute('group_members', $group_members); if (isset($params['edit_submit'])) { if (!empty($params['group_name']) && !empty($params['department']) && !empty($params['group_members'])) { $group_id = $params['group_id']; $department = Bll_DdCommonBiz::get_instance()->get_department_value_by_id($params['department']); $input_arr = array('group_name' => $params['group_name'], 'group_members' => $params['group_members'], 'department' => $department); $ret = Bll_UserGroupCustomBiz::get_instance()->group_edit($group_id, $input_arr); if ($ret) { $url = Admin_GroupViewController::build_uri(); $res->redirect($url); } else { return 'Admin_GroupEdit'; } } else { return 'Admin_GroupEdit'; } } else { return 'Admin_GroupEdit'; } }