Beispiel #1
0
 public function handle_request_internal()
 {
     $req = APF::get_instance()->get_request();
     //echo 'x';die();
     $params = $req->get_parameters();
     if ($params['changerole_user_id'] && $params['new_role']) {
         //echo 'x';die();
         $changerole_user_id = $params['changerole_user_id'];
         $new_role = $params['new_role'];
         //echo 'cao';die();
         $suc = Bll_UserRoleBiz::get_instance()->change_role($changerole_user_id, $new_role);
         if ($suc) {
             $req->set_attribute('suc', 'change succeed!');
         } else {
             $req->set_attribute('suc', 'change failed!');
         }
     }
     //$dev=Bll_UserBiz::get_instance()->get_dev_users();var_dump($dev);die();
     $admins = Bll_UserBiz::get_instance()->get_admins();
     //var_dump($admins);die();
     $qas = Bll_UserBiz::get_instance()->get_qa_users();
     //var_dump($qas);die();
     $devs = Bll_UserBiz::get_instance()->get_dev_users();
     //var_dump($dev);die();
     $qa_dev = array_merge($qas, $devs);
     $req->set_attribute('admins', $admins);
     $req->set_attribute('qa_dev', $qa_dev);
     return 'Home_Root';
 }
Beispiel #2
0
 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';
     }
 }
Beispiel #3
0
 public static function &get_instance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Beispiel #4
0
 public function handle_request_internal()
 {
     $req = APF::get_instance()->get_request();
     $res = APF::get_instance()->get_response();
     $oauth_config = APF::get_instance()->get_config('oauth', 'ldap');
     $client_id = $oauth_config['client_id'];
     $client_secret = $oauth_config['client_secret'];
     $oauth_url = $oauth_config['oauth_url'];
     $user = $this->login_with_oauth($client_id, $client_secret, $oauth_url);
     if ($user) {
         $user = json_decode($user, true);
         $username = $user['username'];
         $token = $user['access_token'];
         $user_info = Bll_UserBiz::get_instance()->get_userinfo_by_username($username);
         //get userinfo from ibug
         if ($user_info) {
             $user_info = Util_ArrayUtils::obj_to_arr($user_info);
             $location = Home_IndexController::build_uri();
             $this->login_success($user_info[0]['user_id'], $user_info[0]['user_name'], $location);
         } else {
             $ldap_info = $this->get_info_from_oauth($token, $oauth_url);
             $ldap_info = json_decode($ldap_info, true);
             $new_user = array('user_name' => $username, 'chinese_name' => $ldap_info['chinese_name'], 'english_name' => $ldap_info['english_name'], 'email' => $ldap_info['email']);
             $new_user_id = Bll_UserBiz::get_instance()->insert_newuser($new_user);
             $user_role_id = Bll_UserRoleBiz::get_instance()->default_role($new_user_id, 'dev');
             $location = Home_IndexController::build_uri();
             $this->login_success($new_user_id, $new_user['user_name'], $location);
         }
     }
 }
Beispiel #5
0
 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;
     if (isset($params['edit_submit'])) {
         $person_id = $params['person_id'];
         $input_arr = array('english_name' => $params['english_name'], 'chinese_name' => $params['chinese_name'], 'whole_name' => $params['whole_name'], 'email' => $params['email'], 'is_disabled' => $params['disable']);
         $ret = Bll_UserBiz::get_instance()->modify_user($person_id, $input_arr);
         $role_id = $params['role'];
         if (in_array($role_id, array('1', '2', '3', '4'))) {
             $ret = Bll_UserRoleBiz::get_instance()->change_role_by_userid($person_id, $role_id);
         }
         $url = Admin_PersonViewController::build_uri();
         $res->redirect($url);
     } else {
         if ($id != 0) {
             $person = Bll_UserBiz::get_instance()->get_userinfo_by_user_id($id);
             $role = Bll_UserRoleBiz::get_instance()->get_role_by_user($id);
         }
         $req->set_attribute('person', $person);
         $req->set_attribute('role', $role);
         return 'Admin_PersonEdit';
     }
 }
Beispiel #6
0
 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';
     }
 }
Beispiel #7
0
 public function handle_request_internal()
 {
     $req = APF::get_instance()->get_request();
     $params = $req->get_parameters();
     $name_str = $params['name_str'];
     $users = Bll_UserBiz::get_instance()->get_ajax_users_by_name_str($name_str);
     return $users;
 }
Beispiel #8
0
 /**
  * 修改ticket的cc
  * @param int $ticket_id
  * @param string $cc_users
  * @return boolean
  */
 public function modify_ticket_cc($ticket_id, $cc_users)
 {
     $cc_arr_whole = explode(';', $cc_users);
     $cc_arr_user = Bll_UserBiz::get_instance()->process_cc_users($cc_arr_whole);
     $del = $this->delete_ticket_cc($ticket_id);
     $add = $this->cc_user_add($ticket_id, $cc_arr_user);
     if ($add) {
         return true;
     } else {
         return false;
     }
 }
Beispiel #9
0
 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'] : 1;
     $tab_info = array(1 => array('name' => 'Anjuke', 'click' => false, 'id' => 2), 2 => array('name' => 'Aifang', 'click' => false, 'id' => 3), 3 => array('name' => 'Haozu', 'click' => false, 'id' => 4), 4 => array('name' => 'Jinpu', 'click' => false, 'id' => 5), 5 => array('name' => 'Mobile', 'click' => false, 'id' => 6), 6 => array('name' => 'Inc', 'click' => false, 'id' => 1));
     $tab_info[$product]['click'] = true;
     $depart = $tab_info[$product]['id'];
     $month_query = $params['form_month'] ? $params['form_month'] : date("Y-m", strtotime('now'));
     $begin = date("Y-m-01 00:00:00", strtotime($month_query));
     $end = date("Y-m-t 23:59:59", strtotime($month_query));
     $bugs_online = Bll_TicketBiz::get_instance()->get_count_online_by_month($begin, $end, 'all');
     $online_sec = array();
     foreach ($bugs_online as $row) {
         $online_sec[$row->owner][$row->priority][] = $row;
     }
     $persons = Bll_UserBiz::get_instance()->get_dev_staffs($depart);
     $table_all_on = array('P1' => 0, 'P2' => 0, 'P3' => 0, 'P4' => 0, 'P5' => 0, 'all' => 0);
     $table_on_tmp = array();
     $online_p_c = array();
     foreach ($persons as $row) {
         $tmp_on = array();
         if (!empty($online_sec[$row->user_name])) {
             $tmp_on['person'] = $row->chinese_name;
             $tmp_on['P1'] = isset($online_sec[$row->user_name]['7']) ? count($online_sec[$row->user_name]['7']) : 0;
             $tmp_on['P2'] = isset($online_sec[$row->user_name]['8']) ? count($online_sec[$row->user_name]['8']) : 0;
             $tmp_on['P3'] = isset($online_sec[$row->user_name]['6']) ? count($online_sec[$row->user_name]['6']) : 0;
             $tmp_on['P4'] = isset($online_sec[$row->user_name]['9']) ? count($online_sec[$row->user_name]['9']) : 0;
             $tmp_on['P5'] = isset($online_sec[$row->user_name]['10']) ? count($online_sec[$row->user_name]['10']) : 0;
             $tmp_on['all'] = $tmp_on['P1'] + $tmp_on['P2'] + $tmp_on['P3'] + $tmp_on['P4'] + $tmp_on['P5'];
             $table_on_tmp[$row->user_name] = $tmp_on;
             $table_all_on['P1'] += $tmp_on['P1'];
             $table_all_on['P2'] += $tmp_on['P2'];
             $table_all_on['P3'] += $tmp_on['P3'];
             $table_all_on['P4'] += $tmp_on['P4'];
             $table_all_on['P5'] += $tmp_on['P5'];
             $table_all_on['all'] += $tmp_on['all'];
             $online_p_c[$row->user_name] = $tmp_on['all'];
         }
     }
     arsort($online_p_c);
     $table_on = array();
     foreach ($online_p_c as $key => $row) {
         $table_on[] = $table_on_tmp[$key];
     }
     $req->set_attribute('month_query', $month_query);
     $req->set_attribute('table_on', $table_on);
     $req->set_attribute('table_all_on', $table_all_on);
     $req->set_attribute('tab_info', $tab_info);
     return 'Report_DevStatis';
 }
Beispiel #10
0
 public function handle_request_internal()
 {
     $req = APF::get_instance()->get_request();
     $res = APF::get_instance()->get_response();
     $params = $req->get_parameters();
     $persons = Bll_UserBiz::get_instance()->get_all_users();
     $user_roles = Bll_UserRoleBiz::get_instance()->get_all_user_role();
     $roles = array();
     foreach ($user_roles as $row) {
         $roles[$row->user_id] = $row;
     }
     $req->set_attribute('persons', $persons);
     $req->set_attribute('roles', $roles);
     return 'Admin_PersonView';
 }
Beispiel #11
0
 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';
     }
 }
Beispiel #12
0
 public function handle_request_internal()
 {
     $req = APF::get_instance()->get_request();
     $res = APF::get_instance()->get_response();
     $params = $req->get_parameters();
     $groups = Bll_UserGroupCustomBiz::get_instance()->get_all_groups();
     $groups_arr = array();
     $group_arr = array();
     foreach ($groups as $group) {
         $group_arr['id'] = $group->id;
         $group_arr['group_name'] = $group->group_name;
         $group_arr['department'] = Bll_DdCommonBiz::get_instance()->get_department_name_by_value($group->department)->name;
         $group_members = explode(",", $group->group_members);
         $group_members = array_filter($group_members);
         $members_arr = Bll_UserBiz::get_instance()->get_chinesenames_by_ids($group_members);
         $group_arr['group_members'] = implode(',', $members_arr);
         $groups_arr[] = $group_arr;
     }
     $req->set_attribute('groups_arr', $groups_arr);
     if (isset($params['id'])) {
         $ret = Bll_UserGroupCustomBiz::get_instance()->group_delete($params['id']);
     }
     return 'Admin_GroupView';
 }
Beispiel #13
0
 public function handle_request_internal()
 {
     $req = APF::get_instance()->get_request();
     $res = APF::get_instance()->get_response();
     $ticket_id = $req->get_parameter('ticket_id');
     $error = $req->get_parameter('error');
     $user_id = $req->get_user_id();
     $user_role = Bll_RoleBiz::get_instance()->get_user_role($user_id);
     $ticket = Bll_TicketBiz::get_instance()->get_detail($ticket_id);
     if (empty($ticket)) {
         $location = Home_IndexController::build_uri();
         $res->redirect($location);
     }
     //custom_detail
     $custom_detail = Bll_TicketColumnDetailBiz::get_instance()->get_ticket_custom($ticket_id);
     $custom_all = Bll_TicketColumnDetailBiz::get_instance()->get_all_custom($ticket_id);
     $ticket_before_md5 = md5(json_encode($ticket));
     $ticket->reporter = Bll_UserBiz::get_instance()->get_wholename_by_username($ticket->reporter);
     $ticket->owner = Bll_UserBiz::get_instance()->get_wholename_by_username($ticket->owner);
     $ticket->assigned_qa = Bll_UserBiz::get_instance()->get_wholename_by_username($ticket->assigned_qa);
     $ticket_log = Bll_TicketLogBiz::get_instance()->get_log($ticket_id);
     $ticket_cc_arr = Bll_TicketCcBiz::get_instance()->get_ticket_cc($ticket_id);
     $cc_tmp = array();
     foreach ($ticket_cc_arr as $key => $ticket_cc) {
         if (Util_StringUtils::is_email($ticket_cc->cc_to)) {
             $cc_tmp[] = $ticket_cc->cc_to;
         } else {
             $cc_tmp[] = Bll_UserBiz::get_instance()->get_wholename_by_username($ticket_cc->cc_to);
         }
     }
     $ticket_cc_str = implode(";", $cc_tmp);
     $current_time = date("Y-m-d H:i:s");
     $ticket_log_process = array();
     foreach ($ticket_log as $key => $log) {
         if ($ticket_log[$key]->field == "component") {
             if (ctype_digit($ticket_log[$key]->oldvalue)) {
                 $ticket_log[$key]->oldvalue = Bll_TicketBiz::get_instance()->get_component_name($ticket_log[$key]->oldvalue);
             }
             if (ctype_digit($ticket_log[$key]->newvalue)) {
                 $ticket_log[$key]->newvalue = Bll_TicketBiz::get_instance()->get_component_name($ticket_log[$key]->newvalue);
             }
         } else {
             if ($ticket_log[$key]->field == "department") {
                 if (ctype_digit($ticket_log[$key]->oldvalue)) {
                     $ticket_log[$key]->oldvalue = Bll_TicketBiz::get_instance()->get_common_name($ticket_log[$key]->oldvalue);
                 }
                 if (ctype_digit($ticket_log[$key]->newvalue)) {
                     $ticket_log[$key]->newvalue = Bll_TicketBiz::get_instance()->get_common_name($ticket_log[$key]->newvalue);
                 }
             } else {
                 if ($ticket_log[$key]->field == "ticket" && $ticket_log[$key]->oldvalue == "null") {
                     $ticket_log[$key]->newvalue = "new";
                 }
             }
         }
         $ticket_log_process[$log->created_at][] = $log;
     }
     $log_time = array();
     foreach ($ticket_log_process as $key => $log) {
         /*
          * within 24h show xxx hours ago
          * mt 24h lt 7days show xx days ago
          * mt 7days lt 30days show xx weeks ago
          * mt 30days show xx months ago
          * floor((strtotime($current_time)-strtotime($log->created_at))/86400)
          */
         $second = floor(strtotime($current_time) - strtotime($key));
         $minute = floor((strtotime($current_time) - strtotime($key)) / 60);
         $hour = floor((strtotime($current_time) - strtotime($key)) / 3600);
         $day = floor((strtotime($current_time) - strtotime($key)) / 86400);
         $week = floor((strtotime($current_time) - strtotime($key)) / 604800);
         $month = floor((strtotime($current_time) - strtotime($key)) / 2592000);
         if ($second < 60) {
             $log_time[$key] = $second . ' seconds ago ';
         } else {
             if ($minute < 60) {
                 $log_time[$key] = $minute . ' minutes ago ';
             } else {
                 if ($hour < 24) {
                     $log_time[$key] = $hour . ' hours ago ';
                 } else {
                     if ($hour >= 24 && $hour < 168) {
                         $log_time[$key] = $day . ' days ago ';
                     } else {
                         if ($hour >= 168 && $hour < 720) {
                             $log_time[$key] = $week . ' weeks ago ';
                         } else {
                             if ($hour >= 720) {
                                 $log_time[$key] = $month . ' months ago ';
                             }
                         }
                     }
                 }
             }
         }
     }
     $parent = Bll_TicketRelationBiz::get_instance()->find_root_by_parent($ticket_id);
     if ($parent) {
         $parent_id = $parent->parent_ticket_id;
     } else {
         $parent_id = "0";
     }
     $son = Bll_TicketRelationBiz::get_instance()->find_son_bugs_of_parent($ticket_id);
     if (empty($son)) {
         $son_id = "0";
     } else {
         $son_id = $son[0]->ticket_id;
     }
     $ticket_status = Ticket_Status::get_status($ticket);
     $actions = $ticket_status->get_available_actions($user_role, $ticket->environment);
     $resolutions = Bll_DdCommonBiz::get_instance()->get_resolutions();
     //start.....
     $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);
     $dev_users = Bll_UserBiz::get_instance()->get_dev_users();
     $tmp_dev = array();
     foreach ($dev_users as $key => $value) {
         $tmp_dev[$key] = $value->whole_name;
     }
     $dev_users = json_encode($tmp_dev);
     $qa_users = Bll_UserBiz::get_instance()->get_qa_users();
     $admin_users = Bll_UserBiz::get_instance()->get_admins();
     $qa_admin_users = array_merge($qa_users, $admin_users);
     $tmp_qa = array();
     foreach ($qa_admin_users as $key => $value) {
         $tmp_qa[$key] = $value->whole_name;
     }
     $qa_admin_users = json_encode($tmp_qa);
     //end.....
     $reasons = Bll_DdCommonBiz::get_instance()->get_reasons();
     $files = Bll_AttachmentBiz::get_instance()->get_file_by_ticket_id($ticket_id);
     if ($files) {
         foreach ($files as $file) {
             $file_link = Bll_AttachmentBiz::get_instance()->get_file_link_by_hash($file->fetch_hash);
             $file->fetch_hash = $file_link;
         }
     }
     $prioritys = Bll_DdCommonBiz::get_instance()->get_prioritys();
     $emergencies = Bll_DdCommonBiz::get_instance()->get_emergencies();
     $environments = Bll_DdCommonBiz::get_instance()->get_environments();
     $departments = Bll_DdCommonBiz::get_instance()->get_departments_new();
     $department_id = Bll_DdCommonBiz::get_instance()->get_department_id_by_name($ticket->department);
     $rel_components = Bll_DdComponentBiz::get_instance()->get_components($department_id->id);
     $req->set_attribute('user_id', $user_id);
     $req->set_attribute('files', $files);
     $req->set_attribute('prioritys', $prioritys);
     $req->set_attribute('emergencies', $emergencies);
     $req->set_attribute('departments', $departments);
     $req->set_attribute('rel_components', $rel_components);
     $req->set_attribute('environments', $environments);
     $req->set_attribute('reasons', $reasons);
     $req->set_attribute('resolutions', $resolutions);
     $req->set_attribute('ticket', $ticket);
     $req->set_attribute('ticket_cc_str', $ticket_cc_str);
     $req->set_attribute('ticket_logs', $ticket_log_process);
     $req->set_attribute('log_time', $log_time);
     $req->set_attribute('actions', $actions);
     $req->set_attribute('all_users', $all_users);
     $req->set_attribute('dev_users', $dev_users);
     $req->set_attribute('qa_admin_users', $qa_admin_users);
     $req->set_attribute('ticket_before_md5', $ticket_before_md5);
     $req->set_attribute('parent_id', $parent_id);
     $req->set_attribute('son_id', $son_id);
     $req->set_attribute('custom_detail', $custom_detail);
     $req->set_attribute('custom_all', $custom_all);
     if ($error) {
         $req->set_attribute('error', $error);
     }
     return 'Ticket_Detail';
 }
Beispiel #14
0
 public function group_quality(array $table_project, $group_id, $begin, $end, $total_pmt, $delay_projects)
 {
     $res = array();
     $group_quality = array();
     $delay_pmt_ids = array();
     for ($v = 0; $v < count($delay_projects); $v++) {
         $delay_pmt_ids[] = $delay_projects[$v]->pmt_id;
     }
     $group_info = $this->get_group_info($group_id);
     foreach ($table_project as $pmt_id => $value) {
         $dev_persons = explode("<br />", $value['dev_person']);
         for ($i = 0; $i < count($dev_persons); $i++) {
             foreach ($group_info as $group_name => $members) {
                 foreach ($members[0] as $mem_id => $mem_name) {
                     if ($dev_persons[$i] == $mem_name) {
                         if (!isset($res[$group_name][1][$pmt_id]['bug_rate'])) {
                             $res[$group_name][1][$pmt_id]['bug_rate'] = $value['bug_devload'];
                             if (in_array($pmt_id, $delay_pmt_ids)) {
                                 $res[$group_name][1][$pmt_id]['delay'] = 1;
                             } else {
                                 $res[$group_name][1][$pmt_id]['delay'] = 0;
                             }
                         }
                     }
                 }
                 $res[$group_name][0]['members'] = $members[1];
             }
         }
     }
     foreach ($res as $group_name => $pmt_info) {
         $pmt_count = count($pmt_info);
         $less = 0;
         $delay = 0;
         $count_rate = 0;
         foreach ($pmt_info[1] as $value) {
             if ($value['bug_rate'] > 0.15) {
                 $less++;
             }
             if ($value['delay'] == 1) {
                 $delay++;
             }
             $count_rate += $value['bug_rate'];
         }
         $group_quality[$group_name]['less_rate'] = round($less / $pmt_count, 4) * 100;
         $group_quality[$group_name]['delay'] = $delay;
         $group_quality[$group_name]['pmt_count'] = $pmt_count;
         $group_quality[$group_name]['bug_rate'] = round($count_rate / $pmt_count, 2);
         $user_names = Bll_UserBiz::get_instance()->get_usernames_by_userids($pmt_info[0]['members']);
         $bugs = Bll_TicketBiz::get_instance()->get_count_production_by_groups($begin, $end, $user_names);
         $group_quality[$group_name]['bugs'] = count($bugs);
     }
     $return = '<table class="data_table" id="table_project_2_3_month">
                     <thead>
                     <tr>
                         <th class="table_sort" style="vertical-align:middle;"><span>开发组</span></th>
                         <th class="table_sort" style="vertical-align:middle;"><span>每工时Bug数量未达标项目比例</span></th>
                         <th class="table_sort" style="vertical-align:middle;"><span>线上Bug</span></th>
                         <th class="table_sort" style="vertical-align:middle;"><span>项目总数</span></th>
                         <th class="table_sort" style="vertical-align:middle;"><span>延期项目</span></th>
                         <th class="table_sort" style="vertical-align:middle;"><span>Bug工时比</span></th>
                     </tr>
                     </thead><tbody>';
     $total_bug = 0;
     if (count($group_quality) > 0) {
         foreach ($group_quality as $group_name => $value) {
             $total_bug += $value['bugs'];
             $return .= '<tr>' . '<td>' . $group_name . '</td>' . '<td>' . $value['less_rate'] . '%' . '</td>' . '<td>' . $value['bugs'] . '</td>' . '<td>' . $value['pmt_count'] . '</td>' . '<td>' . $value['delay'] . '</td>' . '<td>' . $value['bug_rate'] . '</td></tr>';
         }
         $return .= '<tr>' . '<td>' . "统计" . '</td>' . '<td>' . "" . '</td>' . '<td>' . $total_bug . '</td>' . '<td>' . $total_pmt . '</td>' . '<td>' . count($delay_pmt_ids) . '</td>' . '<td>' . "" . '</td></tr>';
         $return .= "</tbody></table>";
     }
     return $return;
 }
Beispiel #15
0
 protected function get_results()
 {
     $q = $this->request->get_parameter('q');
     $sort_by = @$this->request->get_parameter('sort_by');
     $sort_by = empty($sort_by) ? 'id' : $sort_by;
     $this->sort = $sort_by;
     $sort_order = @$this->request->get_parameter('sort_order');
     $sort_order = empty($sort_order) ? 'desc' : $sort_order;
     $this->group_order = $sort_order;
     $sort_c = @$this->request->get_parameter('sort_c');
     $sort_c = empty($sort_c) ? 'id' : $sort_c;
     $this->sort_c = $sort_c;
     $sort_o = @$this->request->get_parameter('sort_o');
     $sort_o = empty($sort_o) ? 'desc' : $sort_o;
     $this->sort_o = $sort_o;
     if ($sort_by != 'id') {
         if (!empty($sort_c)) {
             $sort = "{$sort_by} {$sort_order}, {$sort_c} {$sort_o}";
         } else {
             $sort = "{$sort_by} {$sort_order}, id desc";
         }
     } else {
         $sort = "{$sort_c} {$sort_o}";
     }
     $rows = @intval($this->request->get_parameter('rows'));
     $rows = empty($rows) ? 100 : $rows;
     $current = $this->page_current;
     $start = @intval($rows * ($current - 1));
     $params = $this->request->get_parameters();
     $user_querys = array();
     $fields = array_keys($this->fields);
     $user_inputs = array();
     foreach ($fields as $field) {
         if (empty($params[$field])) {
             continue;
         }
         if (empty($params[$field]['v'])) {
             continue;
         }
         if ($field != 'component' && $field != 'created_at' && $field != 'closed_at' && $field != 'updated_at' && $params[$field]['v'][0] == '') {
             $user_inputs[$field]['t'] = $this->fields[$field]['type'];
             $user_inputs[$field]['o'] = $params[$field]['o'];
             $user_inputs[$field]['v'] = array('');
             continue;
         }
         $user_inputs[$field]['t'] = $this->fields[$field]['type'];
         $user_inputs[$field]['o'] = $params[$field]['o'];
         $user_inputs[$field]['v'] = array();
         $sub_querys = array();
         foreach ($params[$field]['v'] as $v) {
             if (!is_array($v)) {
                 $v = trim($v);
             }
             if ($v === '') {
                 continue;
             }
             if ($this->fields[$field]['type'] == 'dateinput') {
                 $v['b'] = trim($v['b']);
                 $v['e'] = trim($v['e']);
                 $_user_input = array();
                 $date_begin = '*';
                 $date_end = '*';
                 if ($v['b']) {
                     $date_begin = strtotime($v['b']);
                     if ($date_begin <= 0) {
                         $date_begin = '*';
                     }
                     $_user_input['b'] = $v['b'];
                 }
                 if ($v['e']) {
                     $date_end = strtotime($v['e'] . ' 23:59:59');
                     if ($date_end <= 0) {
                         $date_end = '*';
                     }
                     $_user_input['e'] = $v['e'];
                 }
                 if ($date_begin == '*' && $date_end == '*') {
                     continue;
                 }
                 $sub_querys[] = "{$field}:[{$date_begin} TO {$date_end}]";
                 $user_inputs[$field]['v'][] = $_user_input;
             } else {
                 $user_inputs[$field]['v'][] = $v;
                 if ($field == 'owner' || $field == 'assigned_qa' || $field == 'reporter') {
                     $v_tmp = $v;
                     $v = Bll_UserBiz::get_instance()->get_username_by_wholename($v);
                     if (!$v) {
                         $v = $v_tmp;
                     }
                 } else {
                     if ($field == 'priority' || $field == 'environment' || $field == 'department' || $field == 'resolution' || $field == 'reason') {
                         $v_tmp = $v;
                         if ($v_tmp == '0') {
                             $v = "";
                         } else {
                             $v = Bll_DdCommonBiz::get_instance()->get_name_by_id($v_tmp);
                         }
                     } else {
                         if ($field == 'component') {
                             $v1 = Bll_DdComponentBiz::get_instance()->get_name_by_id($v['c']);
                             $v2 = Bll_DdCommonBiz::get_instance()->get_name_by_id($v['d']);
                             $sub_querys[] = "(department:\"{$v2}\" AND component:\"{$v1}\")";
                             continue;
                         } else {
                             if ($field == 'keyword') {
                                 if ($user_inputs[$field]['o'] == 'ticket title') {
                                     $sub_querys[] = "summary:({$v})";
                                 }
                                 if ($user_inputs[$field]['o'] == 'ticket description') {
                                     $sub_querys[] = "description:({$v})";
                                 }
                                 continue;
                             }
                         }
                     }
                 }
                 $sub_querys[] = "{$field}:\"{$v}\"";
             }
         }
         if (empty($sub_querys)) {
             continue;
         }
         $sub_querys_str = "(" . join(' OR ', $sub_querys) . ")";
         if ($params[$field]['o'] == 'is not') {
             $sub_querys_str = '-' . $sub_querys_str;
         }
         $user_querys[] = $sub_querys_str;
     }
     $q = join(" AND ", $user_querys);
     try {
         $solr = Util_SolrFactory::get_instance()->get_solr();
         $results = $solr->search($q, array('wt' => 'json', 'sort' => $sort), $start, $rows);
         //处理新字段
         if ($results) {
             $results['csv'] = $solr->search($q, array('wt' => 'json', 'sort' => $sort), 0, $results['numFound']);
         }
     } catch (Exception $e) {
         $this->page_status = 'solrexception';
         $this->request->set_attribute('solrexception', $e->getMessage());
     }
     $this->request->set_attribute('user_inputs', $user_inputs);
     $this->request->set_attribute('sort_by', $sort_by);
     $this->request->set_attribute('sort_order', $sort_order);
     $this->request->set_attribute('sort_c', $sort_c);
     $this->request->set_attribute('sort_o', $sort_o);
     return $results;
 }
Beispiel #16
0
 public function process_tickets_field($tickets)
 {
     $common_ids = array();
     $component_ids = array();
     $usernames = array();
     foreach ($tickets as $ticket) {
         $common_ids[] = $ticket->priority;
         $common_ids[] = $ticket->emergency;
         $common_ids[] = $ticket->environment;
         $common_ids[] = $ticket->department;
         $common_ids[] = $ticket->resolution;
         $common_ids[] = $ticket->reason;
         $component_ids[] = $ticket->component;
         $usernames[] = $ticket->owner;
         $usernames[] = $ticket->assigned_qa;
         $usernames[] = $ticket->reporter;
     }
     $common_names = Bll_DdCommonBiz::get_instance()->get_names_by_ids($common_ids);
     $component_names = Bll_DdComponentBiz::get_instance()->get_names_by_ids($component_ids);
     $wholenames = Bll_UserBiz::get_instance()->get_wholenames_by_usernames($usernames);
     foreach ($tickets as $ticket) {
         $ticket->priority = $common_names[$ticket->priority];
         $ticket->emergency = $common_names[$ticket->emergency];
         $ticket->environment = $common_names[$ticket->environment];
         $ticket->department = $common_names[$ticket->department];
         $ticket->component = $component_names[$ticket->component];
         $ticket->owner = $wholenames[$ticket->owner];
         $ticket->assigned_qa = $wholenames[$ticket->assigned_qa];
         $ticket->reporter = $wholenames[$ticket->reporter];
         if ($ticket->resolution == 'Fixed') {
             $ticket->resolution = $ticket->resolution;
         } else {
             $ticket->resolution = $common_names[$ticket->resolution];
         }
         if ($ticket->is_regression == '1') {
             $ticket->is_regression = 'yes';
         } else {
             $ticket->is_regression = 'no';
         }
         if ($ticket->is_occasional == '1') {
             $ticket->is_occasional = 'yes';
         } else {
             $ticket->is_occasional = 'no';
         }
         $ticket->reason = $common_names[$ticket->reason];
     }
     return $tickets;
 }
Beispiel #17
0
 public function handle_request_internal()
 {
     /*
      * owner is me
      * assign_qa is me
      * tickets which I create
      * tickets which are cc to me
      */
     $req = APF::get_instance()->get_request();
     $username = $req->get_username();
     $userid = $req->get_user_id();
     $params = $req->get_parameters();
     $wholename = Bll_UserBiz::get_instance()->get_wholename_by_username($username);
     if ($params['view'] == 'all') {
         $tickets_opened = array();
         $i = 0;
         $tickets_accepted = array();
         $j = 0;
         $tickets_verified = array();
         $k = 0;
         $tickets_released = array();
         $m = 0;
         $tickets_closed = array();
         $n = 0;
         $type = $params['type'];
         if ($type == 'ownerd') {
             $owner_tickets = Bll_TicketBiz::get_instance()->get_owner_tickets($username);
             foreach ($owner_tickets as $ticket) {
                 if ($ticket->status == 'opened') {
                     $tickets_opened[$i] = $ticket;
                     $i = $i + 1;
                 } else {
                     if ($ticket->status == 'accepted') {
                         $tickets_accepted[$j] = $ticket;
                         $j = $j + 1;
                     } else {
                         if ($ticket->status == 'verified') {
                             $tickets_verified[$k] = $ticket;
                             $k = $k + 1;
                         } else {
                             if ($ticket->status == 'released') {
                                 $tickets_released[$m] = $ticket;
                                 $m = $m + 1;
                             } else {
                                 if ($ticket->status == 'closed') {
                                     $tickets_closed[$n] = $ticket;
                                     $n = $n + 1;
                                 }
                             }
                         }
                     }
                 }
             }
             $name = "My tickets(ownerd)";
         } else {
             if ($type == 'assign') {
                 $assign_qa_tickets = Bll_TicketBiz::get_instance()->get_assign_qa_tickets($username);
                 foreach ($assign_qa_tickets as $ticket) {
                     if ($ticket->status == 'opened') {
                         $tickets_opened[$i] = $ticket;
                         $i = $i + 1;
                     } else {
                         if ($ticket->status == 'accepted') {
                             $tickets_accepted[$j] = $ticket;
                             $j = $j + 1;
                         } else {
                             if ($ticket->status == 'verified') {
                                 $tickets_verified[$k] = $ticket;
                                 $k = $k + 1;
                             } else {
                                 if ($ticket->status == 'released') {
                                     $tickets_released[$m] = $ticket;
                                     $m = $m + 1;
                                 } else {
                                     if ($ticket->status == 'closed') {
                                         $tickets_closed[$n] = $ticket;
                                         $n = $n + 1;
                                     }
                                 }
                             }
                         }
                     }
                 }
                 $name = "Assigned QA tickets";
             } else {
                 if ($type == 'create') {
                     $create_tickets = Bll_TicketBiz::get_instance()->get_create_tickets($username);
                     foreach ($create_tickets as $ticket) {
                         if ($ticket->status == 'opened') {
                             $tickets_opened[$i] = $ticket;
                             $i = $i + 1;
                         } else {
                             if ($ticket->status == 'accepted') {
                                 $tickets_accepted[$j] = $ticket;
                                 $j = $j + 1;
                             } else {
                                 if ($ticket->status == 'verified') {
                                     $tickets_verified[$k] = $ticket;
                                     $k = $k + 1;
                                 } else {
                                     if ($ticket->status == 'released') {
                                         $tickets_released[$m] = $ticket;
                                         $m = $m + 1;
                                     } else {
                                         if ($ticket->status == 'closed') {
                                             $tickets_closed[$n] = $ticket;
                                             $n = $n + 1;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     $name = "My tickets(create by me)";
                 } else {
                     if ($type == 'cc') {
                         $cc_tickets = Bll_TicketBiz::get_instance()->get_cc_tickets($username);
                         foreach ($cc_tickets as $ticket) {
                             if ($ticket->status == 'opened') {
                                 $tickets_opened[$i] = $ticket;
                                 $i = $i + 1;
                             } else {
                                 if ($ticket->status == 'accepted') {
                                     $tickets_accepted[$j] = $ticket;
                                     $j = $j + 1;
                                 } else {
                                     if ($ticket->status == 'verified') {
                                         $tickets_verified[$k] = $ticket;
                                         $k = $k + 1;
                                     } else {
                                         if ($ticket->status == 'released') {
                                             $tickets_released[$m] = $ticket;
                                             $m = $m + 1;
                                         } else {
                                             if ($ticket->status == 'closed') {
                                                 $tickets_closed[$n] = $ticket;
                                                 $n = $n + 1;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         $name = "My tickets(cc to me)";
                     }
                 }
             }
         }
         $tickets = array();
         $tickets['opened'] = $tickets_opened;
         $tickets['accepted'] = $tickets_accepted;
         $tickets['verified'] = $tickets_verified;
         $tickets['released'] = $tickets_released;
         $tickets['closed'] = $tickets_closed;
         $req->set_attribute('tickets', $tickets);
         $req->set_attribute('name', $name);
         return 'Home_IndexAll';
     }
     $owner_tickets = Bll_TicketBiz::get_instance()->get_owner_tickets($username);
     $owner_tickets_opened = array();
     $i = 0;
     $owner_tickets_accepted = array();
     $j = 0;
     $owner_tickets_verified = array();
     $k = 0;
     $owner_tickets_released = array();
     $m = 0;
     $owner_tickets_closed = array();
     if ($owner_tickets) {
         foreach ($owner_tickets as $ticket) {
             if ($ticket->status == 'opened') {
                 $owner_tickets_opened[$i] = $ticket;
                 $i = $i + 1;
             } elseif ($ticket->status == 'accepted') {
                 $owner_tickets_accepted[$j] = $ticket;
                 $j = $j + 1;
             } elseif ($ticket->status == 'verified') {
                 $owner_tickets_verified[$k] = $ticket;
                 $k = $k + 1;
             } elseif ($ticket->status == 'released') {
                 $owner_tickets_released[$m] = $ticket;
                 $m = $m + 1;
             }
         }
     }
     $assign_qa_tickets = Bll_TicketBiz::get_instance()->get_assign_qa_tickets($username);
     $assign_qa_tickets_opened = array();
     $i = 0;
     $assign_qa_tickets_accepted = array();
     $j = 0;
     $assign_qa_tickets_verified = array();
     $k = 0;
     $assign_qa_tickets_released = array();
     $m = 0;
     $assign_qa_tickets_closed = array();
     if ($assign_qa_tickets) {
         foreach ($assign_qa_tickets as $ticket) {
             if ($ticket->status == 'opened') {
                 $assign_qa_tickets_opened[$i] = $ticket;
                 $i = $i + 1;
             } elseif ($ticket->status == 'accepted') {
                 $assign_qa_tickets_accepted[$j] = $ticket;
                 $j = $j + 1;
             } elseif ($ticket->status == 'verified') {
                 $assign_qa_tickets_verified[$k] = $ticket;
                 $k = $k + 1;
             } elseif ($ticket->status == 'released') {
                 $assign_qa_tickets_released[$m] = $ticket;
                 $m = $m + 1;
             }
         }
     }
     $create_tickets = Bll_TicketBiz::get_instance()->get_create_tickets($username);
     $create_tickets_opened = array();
     $i = 0;
     $create_tickets_accepted = array();
     $j = 0;
     $create_tickets_verified = array();
     $k = 0;
     $create_tickets_released = array();
     $m = 0;
     $create_tickets_closed = array();
     if ($create_tickets) {
         foreach ($create_tickets as $ticket) {
             if ($ticket->status == 'opened') {
                 $create_tickets_opened[$i] = $ticket;
                 $i = $i + 1;
             } elseif ($ticket->status == 'accepted') {
                 $create_tickets_accepted[$j] = $ticket;
                 $j = $j + 1;
             } elseif ($ticket->status == 'verified') {
                 $create_tickets_verified[$k] = $ticket;
                 $k = $k + 1;
             } elseif ($ticket->status == 'released') {
                 $create_tickets_released[$m] = $ticket;
                 $m = $m + 1;
             }
         }
     }
     $cc_tickets = Bll_TicketBiz::get_instance()->get_cc_tickets($username);
     $cc_tickets_opened = array();
     $i = 0;
     $cc_tickets_accepted = array();
     $j = 0;
     $cc_tickets_verified = array();
     $k = 0;
     $cc_tickets_released = array();
     $m = 0;
     $cc_tickets_closed = array();
     if ($cc_tickets) {
         foreach ($cc_tickets as $ticket) {
             if ($ticket->status == 'opened') {
                 $cc_tickets_opened[$i] = $ticket;
                 $i = $i + 1;
             } elseif ($ticket->status == 'accepted') {
                 $cc_tickets_accepted[$j] = $ticket;
                 $j = $j + 1;
             } elseif ($ticket->status == 'verified') {
                 $cc_tickets_verified[$m] = $ticket;
                 $m = $m + 1;
             } elseif ($ticket->status == 'released') {
                 $cc_tickets_released[$n] = $ticket;
                 $n = $n + 1;
             }
         }
     }
     $tickets = array();
     $tickets['ownerd']['opened'] = $owner_tickets_opened;
     $tickets['ownerd']['accepted'] = $owner_tickets_accepted;
     $tickets['ownerd']['verified'] = $owner_tickets_verified;
     $tickets['ownerd']['released'] = $owner_tickets_released;
     $tickets['ownerd']['closed'] = $owner_tickets_closed;
     $tickets['assign']['opened'] = $assign_qa_tickets_opened;
     $tickets['assign']['accepted'] = $assign_qa_tickets_accepted;
     $tickets['assign']['verified'] = $assign_qa_tickets_verified;
     $tickets['assign']['released'] = $assign_qa_tickets_released;
     $tickets['assign']['closed'] = $assign_qa_tickets_closed;
     $tickets['create']['opened'] = $create_tickets_opened;
     $tickets['create']['accepted'] = $create_tickets_accepted;
     $tickets['create']['verified'] = $create_tickets_verified;
     $tickets['create']['released'] = $create_tickets_released;
     $tickets['create']['closed'] = $create_tickets_closed;
     $tickets['cc']['opened'] = $cc_tickets_opened;
     $tickets['cc']['accepted'] = $cc_tickets_accepted;
     $tickets['cc']['verified'] = $cc_tickets_verified;
     $tickets['cc']['released'] = $cc_tickets_released;
     $tickets['cc']['closed'] = $cc_tickets_closed;
     $role = Bll_RoleBiz::get_instance()->get_user_role($userid);
     $counts = array();
     $counts['ownerd'] = count($tickets['ownerd']['opened']) + count($tickets['ownerd']['accepted']) + count($tickets['ownerd']['verified']) + count($tickets['ownerd']['released']);
     $counts['assign'] = count($tickets['assign']['opened']) + count($tickets['assign']['accepted']) + count($tickets['assign']['verified']) + count($tickets['assign']['released']);
     $counts['create'] = count($tickets['create']['opened']) + count($tickets['create']['accepted']) + count($tickets['create']['verified']) + count($tickets['create']['released']);
     $counts['cc'] = count($tickets['cc']['opened']) + count($tickets['cc']['accepted']) + count($tickets['cc']['verified']) + count($tickets['cc']['released']);
     foreach ($counts as $key => $count) {
         if ($count == 0) {
             $counts[$key] = '';
         }
     }
     foreach ($tickets as $key => $ticket) {
         foreach ($ticket as $key_row => $ticket_row) {
             if (empty($ticket_row)) {
                 unset($tickets[$key][$key_row]);
             }
         }
     }
     $tickets = array_filter($tickets);
     $time = array();
     foreach ($tickets as $key => $ticket) {
         foreach ($ticket as $key_row => $ticket_row) {
             foreach ($ticket_row as $k => $r) {
                 $time[$key][$key_row][$k]['create'] = Bll_TicketBiz::get_instance()->process_time_field($r->created_at);
                 $time[$key][$key_row][$k]['update'] = Bll_TicketBiz::get_instance()->process_time_field($r->updated_at);
             }
         }
     }
     $req->set_attribute('tickets', $tickets);
     $req->set_attribute('role', $role);
     $req->set_attribute('counts', $counts);
     $req->set_attribute('time', $time);
     $req->set_attribute('wholename', $wholename);
     return 'Home_Index';
 }
<?php

apf_require_class('Bll_TicketBiz');
apf_require_class('Bll_ReportDayOnlineOwnerBiz');
apf_require_class('Bll_DdCommonBiz');
apf_require_class('Bll_UserBiz');
$owner = Bll_DdComponentBiz::get_instance()->get_all_blong('blongto');
$oneday = 86400 * 0;
$whichday = strtotime('now') - $oneday;
$begin = date('Y-m-d 00:00:00', $whichday);
$end = date('Y-m-d 23:59:59', $whichday);
$day = date('Y-m-d', $whichday);
foreach ($owner as $key => $value) {
    $count = Bll_TicketBiz::get_instance()->get_count_by_function($begin, $end, $value);
    $owner[$key] = $count;
}
$user = array_keys($owner);
$userName = Bll_UserBiz::get_instance()->get_chinesenames_by_ids($user);
$input_arr = array();
foreach ($userName as $userid => $username) {
    $input_arr['day'] = $day;
    $input_arr['owner'] = $username;
    $input_arr['count'] = $owner[$userid] ? $owner[$userid] : 0;
    Bll_ReportDayOnlineOwnerBiz::get_instance()->insert_count_data($input_arr);
}
Beispiel #19
0
 protected function set_filter_fields()
 {
     $_rows = Bll_DdCommonBiz::get_instance()->get_departments_new();
     $departments = array();
     foreach ($_rows as $_row) {
         $departments[$_row->id] = $_row->name;
     }
     $this->request->set_attribute('departments', $departments);
     $_rows = Bll_DdCommonBiz::get_instance()->get_environments();
     $environments = array();
     foreach ($_rows as $_row) {
         $environments[$_row->id] = $_row->name;
     }
     $_rows = Bll_DdCommonBiz::get_instance()->get_reasons();
     $reasons = array();
     foreach ($_rows as $_row) {
         $reasons[$_row->id] = $_row->name;
     }
     $_rows = Bll_DdCommonBiz::get_instance()->get_resolutions();
     $resolutions = array('0' => 'None');
     foreach ($_rows as $_row) {
         $resolutions[$_row->id] = $_row->name;
     }
     $_rows = Bll_DdCommonBiz::get_instance()->get_prioritys();
     $prioritys = array();
     foreach ($_rows as $_row) {
         $prioritys[$_row->id] = $_row->name;
     }
     $_rows = Bll_DdComponentBiz::get_instance()->get_all_components();
     $components = array();
     foreach ($_rows as $_row) {
         $components[$_row->int] = $_row->name;
     }
     $_rows = Ticket_Status::get_all_status();
     $statuses = array();
     foreach ($_rows as $_row) {
         $statuses[$_row] = $_row;
     }
     $fields = array('assigned_qa' => array('type' => 'input', 'operates' => array('is', 'is not')), 'component' => array('type' => 'input', 'operates' => array('is', 'is not')), 'created_at' => array('type' => 'dateinput'), 'closed_at' => array('type' => 'dateinput'), 'department' => array('type' => 'checkbox', 'options' => $departments), 'environment' => array('type' => 'checkbox', 'options' => $environments), 'is_occasional' => array('type' => 'checkbox', 'options' => array('1' => 'Yes', '0' => 'No')), 'is_regression' => array('type' => 'checkbox', 'options' => array('1' => 'Yes', '0' => 'No')), 'keyword' => array('type' => 'input', 'operates' => array('ticket title', 'ticket description')), 'owner' => array('type' => 'input', 'operates' => array('is', 'is not')), 'person_liable' => array('type' => 'input', 'operates' => array('is', 'is not')), 'pmt_id' => array('type' => 'input', 'operates' => array('is', 'is not')), 'priority' => array('type' => 'checkbox', 'options' => $prioritys), 'reason' => array('type' => 'checkbox', 'options' => $reasons), 'reporter' => array('type' => 'input', 'operates' => array('is', 'is not')), 'resolution' => array('type' => 'checkbox', 'options' => $resolutions), 'status' => array('type' => 'checkbox', 'options' => $statuses), 'updated_at' => array('type' => 'dateinput'), 'reject' => array('type' => 'checkbox', 'options' => array('1' => 'Yes', '0' => 'No')), 'reopen' => array('type' => 'checkbox', 'options' => array('1' => 'Yes', '0' => 'No')));
     $column = array('1' => array('id' => 'owner', 'value' => 'Owner', 'check' => '1'), '2' => array('id' => 'priority', 'value' => 'Priority', 'check' => '1'), '3' => array('id' => 'component', 'value' => 'Component', 'check' => '1'), '4' => array('id' => 'pmt_id', 'value' => 'PMT ID', 'check' => '1'), '5' => array('id' => 'environment', 'value' => 'Environment', 'check' => '1'), '6' => array('id' => 'created_at', 'value' => 'Created Time', 'check' => '1'), '7' => array('id' => 'updated_at', 'value' => 'Last Updated', 'check' => '1'), '8' => array('id' => 'status', 'value' => 'Status', 'check' => '1'), '9' => array('id' => 'assigned_qa', 'value' => 'Assigned QA', 'check' => '0'), '10' => array('id' => 'reporter', 'value' => 'Reporter', 'check' => '0'), '11' => array('id' => 'resolution', 'value' => 'Resolution', 'check' => '0'), '12' => array('id' => 'reason', 'value' => 'Reason', 'check' => '0'), '13' => array('id' => 'person_liable', 'value' => 'Person Liable', 'check' => '0'), '14' => array('id' => 'is_regression', 'value' => 'Is Regression', 'check' => '0'), '15' => array('id' => 'is_occasional', 'value' => 'Is Occasional', 'check' => '0'), '16' => array('id' => 'reason_detail', 'value' => 'Reason Detail', 'check' => '0'), '17' => array('id' => 'description', 'value' => 'Description', 'check' => '0'));
     $all_users = Bll_UserBiz::get_instance()->get_all_users();
     $tmp_all = array();
     foreach ($all_users as $key => $value) {
         $tmp_all[$key] = $value->whole_name;
     }
     $all_users = json_encode($tmp_all);
     $this->fields = $fields;
     $this->request->set_attribute('users', $all_users);
     $this->request->set_attribute('fields', $fields);
     $this->request->set_attribute('column', $column);
 }
Beispiel #20
0
<?php

apf_require_class('Bll_UserBiz');
apf_require_class('Bll_ReportPersonCountBiz');
$depart_staff = array('1' => 'Inc', '2' => 'Anjuke', '3' => 'Aifang', '4' => 'Haozu', '5' => 'Jinpu', '6' => 'Mobile');
$tech_persons = Bll_UserBiz::get_instance()->get_tech_users();
$tech_p_depart = array();
foreach ($tech_persons as $row) {
    $tech_p_depart[$depart_staff[$row->department_id]][] = $row;
}
$tech_count = array();
foreach ($tech_p_depart as $key => $row) {
    $tech_count[$key] = count($row);
}
$tech_all = 0;
foreach ($tech_count as $row) {
    $tech_all += $row;
}
$tech_count['all'] = $tech_all;
$time = strtotime('now');
$month = date('Y-m', $time);
$input_arr = array();
foreach ($tech_count as $key => $c) {
    $input_arr[] = array('month' => $month, 'department' => $key, 'person_count' => $c);
}
foreach ($input_arr as $input) {
    $re = Bll_ReportPersonCountBiz::get_instance()->insert_count_data($input);
}
echo date('c ') . " Count persons ok \n";
}
$departments = Bll_DdCommonBiz::get_instance()->get_departments_new();
//get the department,eg:用户端,客户端
$tickets_all = array();
foreach ($departments as $depart) {
    $list = Bll_ReportGroupSelectedBiz::get_instance()->get_all_groups_by_department($depart->value);
    $inserted_group = array();
    foreach ($list as $value) {
        if (in_array($value->group_id, $inserted_group)) {
            //防止重复插入相同group id的数据
            continue;
        }
        $inserted_group[] = $value->group_id;
        $item = array();
        $item['department'] = $depart->value;
        $item['type_key'] = "group";
        $item['week'] = $week;
        $item['type_value'] = $value->group_id;
        $item['updated_time'] = date("Y-m-d H:i:s");
        //获取group下所有人的tickets数量
        $user_id_arr = Bll_UserGroupCustomBiz::get_instance()->get_group_members_by_id($value->group_id);
        if (!$user_id_arr) {
            continue;
        }
        $group_usernames = Bll_UserBiz::get_instance()->get_usernames_by_userids($user_id_arr);
        $tickets = Bll_TicketBiz::get_instance()->get_count_online_by_groups($begin, $end, $group_usernames, $depart->id);
        $item['count'] = count($tickets);
        Bll_ReportWeekOnlineNewBiz::get_instance()->insert_count_data($item);
    }
}
echo date('c ') . " Count week online bugs by group ok \n";
Beispiel #22
0
 public function handle_request_internal()
 {
     $req = APF::get_instance()->get_request();
     $res = APF::get_instance()->get_response();
     $params = $req->get_parameters();
     if ($params['delete']) {
         $suc = Bll_BookmarkBiz::get_instance()->delete_bookmark_by_id($params['delete']);
         $location = Home_PersonalQueryController::build_uri();
         $res->redirect($location);
     }
     if ($params['type'] && ($params['id'] || $params['owner'])) {
         $tickets_opened = array();
         $i = 0;
         $tickets_accepted = array();
         $j = 0;
         $tickets_verified = array();
         $k = 0;
         $tickets_released = array();
         $m = 0;
         $tickets_closed = array();
         $n = 0;
         $type = $params['type'];
         if ($type == 'pmtid') {
             $pmt_id = trim($params['id']);
             $name = 'Tickets of pmt id is ' . $pmt_id;
             if (preg_match('/^\\d*$/', $pmt_id)) {
                 $pmt_tickets = Bll_TicketBiz::get_instance()->get_tickets_by_pmtid($pmt_id);
                 foreach ($pmt_tickets as $ticket) {
                     if ($ticket->status == 'opened') {
                         $tickets_opened[$i] = $ticket;
                         $i = $i + 1;
                     } elseif ($ticket->status == 'accepted') {
                         $tickets_accepted[$j] = $ticket;
                         $j = $j + 1;
                     } elseif ($ticket->status == 'verified') {
                         $tickets_verified[$k] = $ticket;
                         $k = $k + 1;
                     } elseif ($ticket->status == 'released') {
                         $tickets_released[$m] = $ticket;
                         $m = $m + 1;
                     } elseif ($ticket->status == 'closed') {
                         $tickets_closed[$n] = $ticket;
                         $n = $n + 1;
                     }
                 }
             } else {
                 $tickets_opened = array();
                 $tickets_accepted = array();
                 $tickets_verified = array();
                 $tickets_released = array();
                 $tickets_closed = array();
             }
             if ($params['bc'] == 'yes') {
                 $input_arr = array();
                 $input_arr['user'] = $req->get_username();
                 $input_arr['name'] = $params['name'];
                 $input_arr['type'] = "1";
                 $input_arr['value'] = "type=" . $type . '&id=' . $pmt_id;
                 $id = Bll_BookmarkBiz::get_instance()->insert_condition($input_arr);
                 $url_again = Home_PersonalQueryController::build_uri() . '?' . $bookmark_value . '&bced=yes';
                 $res->redirect($url_again);
             } else {
                 if ($params['bced'] == 'yes') {
                 } else {
                     $value = "type=" . $type . '&id=' . $pmt_id;
                 }
             }
         } else {
             if ($type == 'owner') {
                 $owner = $params['owner'];
                 $tmp_owner = explode(';', $owner);
                 $owner_whole = $tmp_owner[0];
                 $owner_user = Bll_UserBiz::get_instance()->get_username_by_wholename($owner_whole);
                 if (!$owner_user) {
                     $owner_user = $owner_whole;
                 }
                 $name = 'Tickets of owner is ' . $owner_whole;
                 //if($params['time_begin']&&$params['time_end']){  2012-1-1
                 if ($params['time_begin'] && preg_match('/^\\d{4}\\-\\d{1,2}\\-\\d{1,2}$/', $params['time_begin'])) {
                     $time_begin = $params['time_begin'];
                 }
                 if ($params['time_end'] && preg_match('/^\\d{4}\\-\\d{1,2}\\-\\d{1,2}$/', $params['time_end'])) {
                     $time_end = $params['time_end'] . ' 23:59:59';
                 }
                 $owner_tickets = Bll_TicketBiz::get_instance()->get_tickets_by_query_owner($owner_user, $time_begin, $time_end);
                 foreach ($owner_tickets as $ticket) {
                     if ($ticket->status == 'opened') {
                         $tickets_opened[$i] = $ticket;
                         $i = $i + 1;
                     } else {
                         if ($ticket->status == 'accepted') {
                             $tickets_accepted[$j] = $ticket;
                             $j = $j + 1;
                         } else {
                             if ($ticket->status == 'verified') {
                                 $tickets_verified[$k] = $ticket;
                                 $k = $k + 1;
                             } else {
                                 if ($ticket->status == 'released') {
                                     $tickets_released[$m] = $ticket;
                                     $m = $m + 1;
                                 } else {
                                     if ($ticket->status == 'closed') {
                                         $tickets_closed[$n] = $ticket;
                                         $n = $n + 1;
                                     }
                                 }
                             }
                         }
                     }
                 }
                 if ($params['bc'] == 'yes') {
                     $input_arr = array();
                     $input_arr['user'] = $req->get_username();
                     $input_arr['name'] = $params['name'];
                     $input_arr['type'] = "1";
                     $input_arr['value'] = "type=" . $type . "&owner=" . $owner_user;
                     $id = Bll_BookmarkBiz::get_instance()->insert_condition($input_arr);
                     $url_again = Home_PersonalQueryController::build_uri() . '?' . $bookmark_value . '&bced=yes';
                     $res->redirect($url_again);
                 } else {
                     if ($params['bced'] == 'yes') {
                     } else {
                         $value = 'type=' . $type . '&owner=' . $owner_user;
                     }
                 }
             }
         }
         $tickets = array();
         $tickets['opened'] = $tickets_opened;
         $tickets['accepted'] = $tickets_accepted;
         $tickets['verified'] = $tickets_verified;
         $tickets['released'] = $tickets_released;
         $tickets['closed'] = $tickets_closed;
         $req->set_attribute('name', $name);
         $req->set_attribute('tickets', $tickets);
         $req->set_attribute('value', $value);
         return 'Home_IndexAllMyQ';
     }
     $personal_conditions = Bll_BookmarkBiz::get_instance()->get_personal_conditions($req->get_username());
     $all_users = Bll_UserBiz::get_instance()->get_all_users();
     $tmp_all = array();
     foreach ($all_users as $key => $value) {
         $tmp_all[$key] = $value->whole_name;
     }
     $all_users = json_encode($tmp_all);
     $req->set_attribute('all_users', $all_users);
     $req->set_attribute('personal_conditions', $personal_conditions);
     return 'Home_PersonalQuery';
 }
Beispiel #23
0
 public function handle_request_internal()
 {
     $req = APF::get_instance()->get_request();
     $params = $req->get_parameters();
     //var_dump($params);die();
     //var_dump($params['description']);die();
     if ($params && $params['summary'] && $params['editor1'] && $params['owner'] && $params['reporter']) {
         $input_arr = array('summary' => $params['summary'], 'reporter' => $params['reporter'], 'description' => Ticket_AttachAddController::convert_imageurl($params['editor1']), 'priority' => $params['priority'], 'emergency' => $params['emergency'], 'environment' => $params['environment'], 'department' => $params['department'], 'component' => $params['component'], 'owner' => $params['owner'], 'cc_user' => $params['cc_user'], 'assigned_qa' => $params['assigned_qa'], 'pmt_id' => $params['pmt_id'], 'version' => $params['version'], 'is_regression' => $params['is_regression'], 'status' => 'opened', 'version' => $params['version'], 'is_occasional' => $params['is_occasional'], 'person_liable' => $params['person_liable']);
         if (in_array($input_arr['department'], array('47', '48'))) {
             $input_arr['pmt_id'] = 0;
         }
         $input_arr['owner'] = strpos($input_arr['owner'], ";") ? substr($input_arr['owner'], 0, strpos($input_arr['owner'], ";")) : $input_arr['owner'];
         $input_arr['owner'] = Bll_UserBiz::get_instance()->get_username_by_wholename($input_arr['owner']);
         $input_arr['assigned_qa'] = strpos($input_arr['assigned_qa'], ";") ? substr($input_arr['assigned_qa'], 0, strpos($input_arr['assigned_qa'], ";")) : $input_arr['assigned_qa'];
         $input_arr['assigned_qa'] = Bll_UserBiz::get_instance()->get_username_by_wholename($input_arr['assigned_qa']);
         //$input_arr['person_liable'] = strpos($input_arr['person_liable'],";")?substr($input_arr['person_liable'], 0, strpos($input_arr['person_liable'],";")):$input_arr['person_liable'];
         //$input_arr['person_liable'] = Bll_UserBiz::get_instance()->get_username_by_wholename($input_arr['person_liable']);
         $ticket_id = Bll_TicketBiz::get_instance()->ticket_add($input_arr);
         //request icase api
         if (isset($params['case_id'])) {
             $cycle = 3;
             $url = "http://icase.corp.anjuke.com/api/save/case2bug?";
             $p = array();
             $p['bug_id'] = $ticket_id;
             $p['case_id'] = $params['case_id'];
             $url = $url . "bug_id=" . $p['bug_id'] . "&case_id=" . $p['case_id'] . "&key=nmzszxsl";
             $culr = curl_init();
             curl_setopt($culr, CURLOPT_URL, $url);
             curl_setopt($culr, CURLOPT_RETURNTRANSFER, 1);
             curl_setopt($culr, CURLOPT_FOLLOWLOCATION, 1);
             $data = curl_exec($culr);
             $data = json_decode($data, true);
             while ($cycle > 0) {
                 if ($data['status'] == "ok") {
                     break;
                 }
                 $data = curl_exec($culr);
                 $cycle--;
             }
             curl_close($culr);
         }
         //request imonitor api
         if (isset($params['task_fail_id']) && $params['task_fail_id'] != "") {
             $cycle = 3;
             $url = "10.10.9.53:8888/api/ibug/";
             $p = array();
             $p['bug_id'] = $ticket_id;
             $p['task_fail_id'] = $params['task_fail_id'];
             $culr = curl_init();
             curl_setopt($culr, CURLOPT_URL, $url);
             curl_setopt($culr, CURLOPT_RETURNTRANSFER, 1);
             curl_setopt($culr, CURLOPT_HEADER, 0);
             curl_setopt($culr, CURLOPT_POST, 1);
             curl_setopt($culr, CURLOPT_POSTFIELDS, $p);
             $data = curl_exec($culr);
             while ($cycle > 0) {
                 if ($data == "ok") {
                     break;
                 }
                 $data = curl_exec($culr);
                 $cycle--;
             }
             curl_close($culr);
         }
         //custom column
         $custom_columns = Bll_TicketCustomColumnBiz::get_instance()->get_custom_columns();
         foreach ($custom_columns as $column) {
             if (!empty($params[$column->column_name])) {
                 $custom_arr[$column->column_name] = $params[$column->column_name];
             }
         }
         if (!empty($custom_arr)) {
             $res = Bll_TicketColumnDetailBiz::get_instance()->ticket_custom_add($ticket_id, $custom_arr);
         }
         //save files using curl
         $file_hidden = $params['file_hidden'];
         if (!empty($file_hidden)) {
             foreach ($file_hidden as $file_id) {
                 $file_info = Bll_AttachmentBiz::get_instance()->get_file_info_by_id($file_id);
                 $local_filepath = $file_info->local_filepath;
                 $finfo = finfo_open(FILEINFO_MIME_TYPE);
                 $file_type = finfo_file($finfo, $local_filepath);
                 $post_params = array("file" => "@" . $local_filepath . ";type=" . $file_type);
                 $request_url = APF::get_instance()->get_config('file_upload_url');
                 $ch = curl_init();
                 curl_setopt($ch, CURLOPT_URL, $request_url);
                 curl_setopt($ch, CURLOPT_POST, 1);
                 curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);
                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                 $ret = curl_exec($ch);
                 $info = curl_getinfo($ch);
                 $ret_value = json_decode($ret);
                 if (!$ret_value->error) {
                     $fetch_hash = $ret_value->saved_file[0]->hash;
                 }
                 //更新数据库
                 $res = Bll_AttachmentBiz::get_instance()->modify_file_info($file_id, $ticket_id, $fetch_hash);
             }
         }
         $current_time = date("Y-m-d H:i:s");
         if ($ticket_id) {
             //mail add
             $id = Bll_MailBiz::get_instance()->mail_add($ticket_id, $current_time);
         }
         if ($ticket_id) {
             //new ticket log add
             $input_arr = array('ticket_id' => $ticket_id, 'created_by' => $req->get_username(), 'field' => 'ticket', 'oldvalue' => 'null', 'newvalue' => $input_arr['description'], 'created_at' => $current_time);
             $log_id = Bll_TicketLogBiz::get_instance()->log_add($input_arr);
         }
         $location = Ticket_DetailController::build_uri() . '?ticket_id=' . $ticket_id;
         APF::get_instance()->get_response()->redirect($location);
     } else {
         if ($params['post'] == 'posted') {
             $req->set_attribute('error', '请检查,summary,description,owner为必填项!');
         }
     }
     $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);
     $dev_users = Bll_UserBiz::get_instance()->get_dev_users();
     $tmp_dev = array();
     foreach ($dev_users as $key => $value) {
         $tmp_dev[$key] = $value->whole_name;
     }
     $dev_users = json_encode($tmp_dev);
     $qa_users = Bll_UserBiz::get_instance()->get_qa_users();
     $admin_users = Bll_UserBiz::get_instance()->get_admins();
     $qa_admin_users = array_merge($qa_users, $admin_users);
     $tmp_qa = array();
     foreach ($qa_admin_users as $key => $value) {
         $tmp_qa[$key] = $value->whole_name;
     }
     $qa_admin_users = json_encode($tmp_qa);
     $prioritys = Bll_DdCommonBiz::get_instance()->get_prioritys();
     $emergencies = Bll_DdCommonBiz::get_instance()->get_emergencies();
     $reasons = Bll_DdCommonBiz::get_instance()->get_reasons();
     $environments = Bll_DdCommonBiz::get_instance()->get_environments();
     $departments = Bll_DdCommonBiz::get_instance()->get_departments_new();
     $custom_columns = Bll_TicketCustomColumnBiz::get_instance()->get_custom_columns();
     $req->set_attribute('prioritys', $prioritys);
     $req->set_attribute('emergencies', $emergencies);
     $req->set_attribute('reasons', $reasons);
     $req->set_attribute('environments', $environments);
     $req->set_attribute('departments', $departments);
     $req->set_attribute('reporter', $req->get_username());
     $req->set_attribute('all_users', $all_users);
     $req->set_attribute('dev_users', $dev_users);
     $req->set_attribute('qa_admin_users', $qa_admin_users);
     $req->set_attribute('custom_columns', $custom_columns);
     $req->set_attribute('paramas', $params);
     return 'Ticket_Add';
 }
Beispiel #24
0
 $owner_address = Bll_UserBiz::get_instance()->get_mail_address_by_username($mail_to_owner);
 $mail_to_qa = Bll_TicketBiz::get_instance()->get_assign_qa_for_mail($ticket_id);
 $tmp = explode(';', $mail_to_qa);
 $mail_to_qa = $tmp[0];
 $qa_address = Bll_UserBiz::get_instance()->get_mail_address_by_username($mail_to_qa);
 $mail_to_cc_str = Bll_TicketCcBiz::get_instance()->get_cc_for_mail($ticket_id);
 //string such as bai;jian;
 $mail_to_ccs = explode(';', $mail_to_cc_str);
 //cc users array
 $ccs_address = array();
 foreach ($mail_to_ccs as $key => $mail_to_cc) {
     if ($mail_to_cc) {
         if (Util_StringUtils::is_email($mail_to_cc)) {
             $ccs_address[$key] = $mail_to_cc;
         } else {
             $cc_tmp = Bll_UserBiz::get_instance()->get_mail_address_by_username($mail_to_cc);
             if ($cc_tmp) {
                 $ccs_address[$key] = $cc_tmp;
             }
         }
     }
 }
 $cc_to = implode(',', $ccs_address);
 $smtp_server = APF::get_instance()->get_config('smtp_server');
 $smtp_port = APF::get_instance()->get_config('smtp_port');
 $smtp_user = APF::get_instance()->get_config('smtp_user');
 $smtp_pass = APF::get_instance()->get_config('smtp_pass');
 $smtp_usermail = APF::get_instance()->get_config('smtp_usermail');
 $smtp_to_arr = array();
 if ($reporter_address) {
     $smtp_to_arr[] = $reporter_address;
Beispiel #25
0
 protected function set_filter_fields()
 {
     $_rows = Bll_DdCommonBiz::get_instance()->get_departments_new();
     $departments = array();
     foreach ($_rows as $_row) {
         $departments[$_row->id] = $_row->name;
     }
     $_rows = Bll_DdCommonBiz::get_instance()->get_environments();
     $environments = array();
     foreach ($_rows as $_row) {
         $environments[$_row->id] = $_row->name;
     }
     $_rows = Bll_DdCommonBiz::get_instance()->get_reasons();
     $reasons = array();
     foreach ($_rows as $_row) {
         $reasons[$_row->id] = $_row->name;
     }
     $_rows = Bll_DdCommonBiz::get_instance()->get_resolutions();
     $resolutions = array('0' => 'None');
     foreach ($_rows as $_row) {
         $resolutions[$_row->id] = $_row->name;
     }
     $_rows = Bll_DdCommonBiz::get_instance()->get_prioritys();
     $prioritys = array();
     foreach ($_rows as $_row) {
         $prioritys[$_row->id] = $_row->name;
     }
     $_rows = Bll_DdComponentBiz::get_instance()->get_all_components();
     $components = array();
     foreach ($_rows as $_row) {
         $components[$_row->int] = $_row->name;
     }
     $_rows = Ticket_Status::get_all_status();
     $statuses = array();
     foreach ($_rows as $_row) {
         $statuses[$_row] = $_row;
     }
     $fields = array('assigned_qa' => array('type' => 'input', 'operates' => array('is', 'is not')), 'component' => array('type' => 'input', 'operates' => array('is', 'is not')), 'created_at' => array('type' => 'dateinput'), 'closed_at' => array('type' => 'dateinput'), 'department' => array('type' => 'checkbox', 'options' => $departments), 'environment' => array('type' => 'checkbox', 'options' => $environments), 'is_occasional' => array('type' => 'checkbox', 'options' => array('1' => 'Yes', '0' => 'No')), 'is_regression' => array('type' => 'checkbox', 'options' => array('1' => 'Yes', '0' => 'No')), 'keyword' => array('type' => 'input', 'operates' => array('ticket title', 'ticket description')), 'owner' => array('type' => 'input', 'operates' => array('is', 'is not')), 'person_liable' => array('type' => 'input', 'operates' => array('is', 'is not')), 'pmt_id' => array('type' => 'input', 'operates' => array('is', 'is not')), 'priority' => array('type' => 'checkbox', 'options' => $prioritys), 'reason' => array('type' => 'checkbox', 'options' => $reasons), 'reporter' => array('type' => 'input', 'operates' => array('is', 'is not')), 'resolution' => array('type' => 'checkbox', 'options' => $resolutions), 'status' => array('type' => 'checkbox', 'options' => $statuses), 'updated_at' => array('type' => 'dateinput'), 'reject' => array('type' => 'checkbox', 'options' => array('1' => 'Yes', '0' => 'No')), 'reopen' => array('type' => 'checkbox', 'options' => array('1' => 'Yes', '0' => 'No')));
     $all_users = Bll_UserBiz::get_instance()->get_all_users();
     $tmp_all = array();
     foreach ($all_users as $key => $value) {
         $tmp_all[$key] = $value->whole_name;
     }
     $this->fields = $fields;
 }
Beispiel #26
0
 public function handle_request_internal()
 {
     $req = APF::get_instance()->get_request();
     $res = APF::get_instance()->get_response();
     $params = $req->get_parameters();
     $login_page = 'Login';
     //cookie start for 自动跳转!
     $cookiename = APF::get_instance()->get_config('AuthCookieName');
     $cookie = @$req->get_cookie($cookiename);
     if ($cookie) {
         $id_name_array = $this->is_auth($cookie);
         if ($id_name_array) {
             $uid = $id_name_array[0];
             $uname = $id_name_array[1];
             $url = Home_IndexController::build_uri();
             $this->login_success($uid, $uname, $url);
         }
     }
     //cookie end
     if (!$params) {
         return $login_page;
     }
     if (empty($params['username']) || empty($params['password'])) {
         $req->set_attribute('err_msg', '请输入用户名和密码!');
         return $login_page;
     } else {
         $username = strtolower($params['username']);
         $password = $params['password'];
         $ldap_auth = Bll_LdapBiz::get_instance()->auth($username, $password);
         //ldap_auth return true or false
         if (!$ldap_auth) {
             //root login:
             if ($username == 'root') {
                 $root_id = Bll_UserBiz::get_instance()->root_auth($password);
                 if ($root_id) {
                     $location = Home_IndexController::build_uri();
                     $this->login_success($root_id, 'root', $location);
                 } else {
                     $req->set_attribute('err_msg', 'root密码错误!');
                     return $login_page;
                 }
             }
             $req->set_attribute('err_msg', '域验证失败,请检查域账户名和密码是否正确,域账户名不包含@anjuke.com<br/>或者请检查域密码是否过期<a href="https://192.168.1.98/iisadmpwd/">密码重置</a>');
             return $login_page;
         } else {
             $user_info = Bll_UserBiz::get_instance()->get_userinfo_by_username($username);
             //get userinfo from ibug
             if ($user_info) {
                 $user_info = Util_ArrayUtils::obj_to_arr($user_info);
                 $location = Home_IndexController::build_uri();
                 $this->login_success($user_info[0]['user_id'], $user_info[0]['user_name'], $location);
             } else {
                 $ldap_info = Bll_LdapBiz::get_instance()->get_userinfo_from_ldap($username, $password);
                 if (!$ldap_info) {
                     $req->set_attribute('err_msg', '域账户信息获取失败,请联系系统开发iBug(pidgin:柏健)');
                     return $login_page;
                 } else {
                     $new_user = array('user_name' => $username, 'chinese_name' => $ldap_info->chinese_name, 'english_name' => $ldap_info->english_name, 'email' => $ldap_info->email);
                     $new_user_id = Bll_UserBiz::get_instance()->insert_newuser($new_user);
                     if ($new_user_id) {
                         $user_role_id = Bll_UserRoleBiz::get_instance()->default_role($new_user_id, 'dev');
                         if ($user_role_id) {
                             $location = Home_IndexController::build_uri();
                             $this->login_success($new_user_id, $new_user['user_name'], $location);
                         } else {
                             $req->set_attribute('err_msg', '账户权限初始化失败,请联系系统开发iBug(pidgin:柏健)');
                             return $login_page;
                         }
                     } else {
                         //insert new failed!
                         $req->set_attribute('err_msg', '账户初始化失败,请联系系统开发iBug(pidgin:柏健)');
                         return $login_page;
                     }
                 }
             }
         }
     }
 }
Beispiel #27
0
 public function get_rank_bug_resolved_by_group($type, $group_id)
 {
     $count_by_group = array();
     $count_by_group['less_87'] = 0;
     $count_by_group['more_87'] = 0;
     $count_by_group['less_88'] = 0;
     $count_by_group['more_88'] = 0;
     $count_by_group['less_89'] = 0;
     $count_by_group['more_89'] = 0;
     $count_by_group['less_90'] = 0;
     $count_by_group['more_90'] = 0;
     $one_day = 86400;
     $result = $this->get_time($type);
     $emergency = Bll_DdCommonBiz::get_instance()->get_emergencies();
     $group = Bll_UserGroupCustomBiz::get_instance()->get_group_by_id($group_id);
     if ($group) {
         $user_id_arr = explode(',', $group->group_members);
         $user_id_arr = array_filter($user_id_arr);
         $depart_id = Bll_DdCommonBiz::get_instance()->get_department_id_by_value($group->department);
         $group_usernames = Bll_UserBiz::get_instance()->get_usernames_by_userids($user_id_arr);
         $tickets = Bll_TicketBiz::get_instance()->get_count_online_by_groups($result[0], $result[1], $group_usernames, $depart_id);
         $tickets = $this->distinct_emergency($tickets, $emergency);
         $count_by_group['group_name'] = $group->group_name;
         foreach ($emergency as $eme) {
             $id = $eme->id;
             $c = count($tickets[$id]);
             if ($c > 0) {
                 $t = count($tickets[$id]);
                 for ($i = 0; $i < $t; $i++) {
                     $created_time = strtotime($tickets[$id][$i]['created_at']);
                     $closed_time = strtotime($tickets[$id][$i]['closed_at']);
                     $created_time_date = strtotime(substr($tickets[$id][$i]['created_at'], 0, 10));
                     $closed_time_date = strtotime(substr($tickets[$id][$i]['closed_at'], 0, 10));
                     $gap = $this->get_work_days($created_time_date, $closed_time_date, $created_time, $closed_time);
                     if ($id == '87') {
                         if ($gap <= $one_day) {
                             $count_by_group['less_87']++;
                         } else {
                             $count_by_group['more_87']++;
                         }
                     } elseif ($id == '88') {
                         if ($gap <= $one_day * 2) {
                             $count_by_group['less_88']++;
                         } else {
                             $count_by_group['more_88']++;
                         }
                     } elseif ($id == '89') {
                         if ($gap <= $one_day * 3) {
                             $count_by_group['less_89']++;
                         } else {
                             $count_by_group['more_89']++;
                         }
                     } elseif ($id == '90') {
                         if ($gap <= $one_day * 22) {
                             $count_by_group['less_90']++;
                         } else {
                             $count_by_group['more_90']++;
                         }
                     }
                 }
             }
         }
     }
     $l = $count_by_group['less_87'] * 5 + $count_by_group['less_88'] * 3 + $count_by_group['less_89'] * 1 + $count_by_group['less_90'] * 0.5;
     $cou = ($count_by_group['less_87'] + $count_by_group['more_87']) * 5 + ($count_by_group['less_88'] + $count_by_group['more_88']) * 3 + ($count_by_group['less_89'] + $count_by_group['more_89']) * 1 + ($count_by_group['less_90'] + $count_by_group['more_90']) * 0.5;
     if ($l == 0 && $cou == 0) {
         $count_by_group['rate'] = 0;
     } else {
         $count_by_group['rate'] = $l / $cou;
     }
     return $count_by_group;
 }
Beispiel #28
0
 private function group_users_add($group_members)
 {
     $group_members_id = null;
     foreach ($group_members as $members) {
         $group_member_id = Bll_UserBiz::get_instance()->get_userId_by_wholename($members);
         $temp_arr[$group_member_id] = $group_member_id;
     }
     if ($temp_arr) {
         $group_members_id = implode(',', $temp_arr);
     }
     return $group_members_id;
 }
Beispiel #29
0
 private function get_group_member_name($group_id)
 {
     $group = Bll_UserGroupCustomBiz::get_instance()->get_group_by_id($group_id);
     $group_user_names = array();
     $user_id_arr = explode(',', $group->group_members);
     $user_id_arr = array_filter($user_id_arr);
     $group_user_names = Bll_UserBiz::get_instance()->get_usernames_by_userids($user_id_arr);
     return $group_user_names;
 }
Beispiel #30
0
 public function handle_request_internal()
 {
     $req = APF::get_instance()->get_request();
     $res = APF::get_instance()->get_response();
     $params = $req->get_parameters();
     $sub = $params['form_sub'] ? trim($params['form_sub']) : 'Update';
     $product_array = array(0, 12, 13, 14, 7, 6, 4);
     $pro_v = $params['pro'] ? $params['pro'] : 0;
     $pmt_id_q = $params['pmt_id'] ? trim($params['pmt_id']) : 0;
     /*$tab_info = array(
       1 => array('name' => 'Anjuke', 'click' => false),
       2 => array('name' => 'Aifang', 'click' => false),
       3 => array('name' => 'Haozu', 'click' => false),
       4 => array('name' => 'Jinpu', 'click' => false),
       5 => array('name' => 'Mobile', 'click' => false),
       6 => array('name' => 'Inc', 'click' => false)
       );*/
     $tab_info = array(0 => array('name' => '全部', 'click' => false), 1 => array('name' => '用户端', 'click' => false), 2 => array('name' => '客户端', 'click' => false), 3 => array('name' => '开发商', 'click' => false), 4 => array('name' => 'CRM', 'click' => false), 5 => array('name' => '移动', 'click' => false), 6 => array('name' => 'Inc.', 'click' => false));
     $tab_info[$pro_v]['click'] = true;
     $product = $product_array[$pro_v];
     $from = $params['from'] ? date("Y-m-d 00:00:00", strtotime($params['from'])) : date("Y-m-01 00:00:00");
     $to = $params['to'] ? date("Y-m-d 23:59:59", strtotime($params['to'])) : date("Y-m-t 23:59:59");
     $input_from = date("Y-m-d", strtotime($from));
     $input_to = date("Y-m-d", strtotime($to));
     $mode = $params['select_mode'] ? $params['select_mode'] : '1';
     if ($sub == 'OK' && $pmt_id_q != 0) {
         $projects = Bll_PMTProjectBiz::get_instance()->get_project_detail_by_ids(array($pmt_id_q));
     } else {
         $projects = Bll_PMTProjectBiz::get_instance()->get_projects_by_release_date_new($product, $from, $to);
     }
     //shirlyhu
     $groups = Bll_UserGroupCustomBiz::get_instance()->get_all_groups();
     foreach ($groups as $value) {
         $group[$value->department][] = array('name' => $value->group_name, 'id' => $value->id);
     }
     if ($group != null) {
         $req->set_attribute('group', $group);
     }
     $groups_users = Bll_UserGroupCustomBiz::get_instance()->get_groups_by_department(10);
     //属于用户端的组
     $member_group = array();
     foreach ($groups as $groups_user) {
         $group_members = explode(',', $groups_user->group_members);
         $member_chinesename = Bll_UserBiz::get_instance()->get_chinesenames_by_ids($group_members);
         foreach ($member_chinesename as $group_member) {
             if ($group_member) {
                 $member_group[$group_member] .= $groups_user->id . ",";
             }
         }
     }
     //shirlyhu
     if (empty($projects)) {
         $req->set_attribute('product', $product);
         $req->set_attribute('tab_info', $tab_info);
         $req->set_attribute('table_person', array());
         $req->set_attribute('table_project', array());
         $req->set_attribute('input_from', $input_from);
         $req->set_attribute('input_to', $input_to);
         $req->set_attribute('mode', $mode);
         $req->set_attribute('pmt_id_q', $pmt_id_q);
         return 'NewReport_Workload';
     }
     $pmt_ids_init = array();
     $projects_pmtid = array();
     foreach ($projects as $project) {
         $projects_pmtid[$project['id']] = $project;
         $pmt_ids_init[] = $project['id'];
     }
     $tasks = Bll_PMTProjectBiz::get_instance()->get_tasks_by_pmt_ids($pmt_ids_init);
     $tasks_pmtid = array();
     $tasks_pmtid_person = array();
     if ($tasks) {
         foreach ($tasks as $task) {
             if (in_array($task['task_type_id'], array(2, 3, 33))) {
                 $tasks_pmtid[$task['project_id']]['dev'][] = $task;
                 $tasks_pmtid_person[$task['project_id']]['dev'][$task['chinese_name']][] = $task['workload'];
             } elseif (in_array($task['task_type_id'], array(4))) {
                 $tasks_pmtid[$task['project_id']]['test'][] = $task;
                 $tasks_pmtid_person[$task['project_id']]['test'][$task['chinese_name']][] = $task['workload'];
             }
         }
     }
     $pmt_ids = array();
     foreach ($pmt_ids_init as $pmt_id) {
         if (!empty($tasks_pmtid[$pmt_id]['dev']) && !empty($tasks_pmtid[$pmt_id]['test'])) {
             $pmt_ids[] = $pmt_id;
         }
     }
     if (empty($pmt_ids)) {
         $req->set_attribute('product', $product);
         $req->set_attribute('tab_info', $tab_info);
         $req->set_attribute('table_person', array());
         $req->set_attribute('table_project', array());
         $req->set_attribute('input_from', $input_from);
         $req->set_attribute('input_to', $input_to);
         $req->set_attribute('mode', $mode);
         $req->set_attribute('pmt_id_q', $pmt_id_q);
         return 'NewReport_Workload';
     }
     $tasks_person = array();
     $tasks_qa = array();
     $persons = array();
     $qa_users = array();
     foreach ($tasks as $task) {
         if (in_array($task['project_id'], $pmt_ids)) {
             if (in_array($task['task_type_id'], array(2, 3, 33))) {
                 $tasks_person[$task['chinese_name']][] = $task['workload'];
                 $persons[] = $task['chinese_name'];
             } elseif (in_array($task['task_type_id'], array(4))) {
                 $tasks_qa[$task['chinese_name']][] = $task['workload'];
                 $qa_users[] = $task['chinese_name'];
             }
         }
     }
     $persons_pro = array_unique($persons);
     $persons = array();
     foreach ($persons_pro as $row) {
         $persons[] = $row;
     }
     $qa_pro = array_unique($qa_users);
     $qa_users = array();
     foreach ($qa_pro as $row) {
         $qa_users[] = $row;
     }
     $rates = Bll_ReportPmtInfoBiz::get_instance()->get_through_rate_by_pmtids($pmt_ids);
     $rates_pmtid = array();
     foreach ($rates as $rate) {
         $rates_pmtid[$rate->project_id][$rate->chinese_name] = $rate->rate;
     }
     $delay_infos = Bll_ReportPmtInfoBiz::get_instance()->get_project_delay_info_by_pmtids($pmt_ids);
     $delay_infos_pmtid = array();
     foreach ($delay_infos as $delay_info) {
         $delay_infos_pmtid[$delay_info->project_id] = $delay_info;
     }
     $bugs = Bll_TicketBiz::get_instance()->get_bugs_by_pmtids($pmt_ids);
     $bugs_pmtid = array();
     foreach ($bugs as $bug) {
         $bugs_pmtid[$bug['pmt_id']] = $bug['BugCount'];
     }
     $bug_detail = Bll_TicketBiz::get_instance()->get_bugs_detail_by_pmtids($pmt_ids);
     $users = Bll_UserBiz::get_instance()->get_all_users();
     $user_wc = array();
     foreach ($users as $row) {
         $user_wc[$row->whole_name] = $row->chinese_name;
     }
     $bug_detail_dev = array();
     $bug_detail_qa = array();
     foreach ($bug_detail as $row) {
         $bug_detail_dev[$row->pmt_id][$user_wc[$row->owner]][] = $row;
         $bug_detail_qa[$row->pmt_id][$user_wc[$row->reporter]][] = $row;
     }
     $table_work_person = array();
     foreach ($pmt_ids as $pmt_id) {
         $dev_p = array();
         $dev_t = array();
         $test_p = array();
         $test_t = array();
         $dev_bug = array();
         $test_bug = array();
         $dev_bug_workload = array();
         $test_bug_workload = array();
         foreach ($tasks_pmtid_person[$pmt_id]['dev'] as $d_p => $task_dev) {
             $dev_p[$d_p] = $d_p;
             $dev_t[$d_p] = 0;
             $dev_bug[$d_p] = isset($bug_detail_dev[$pmt_id][$d_p]) ? count($bug_detail_dev[$pmt_id][$d_p]) : 0;
             foreach ($task_dev as $t) {
                 $dev_t[$d_p] += intval($t);
             }
             $dev_bug_workload[$d_p] = $dev_t[$d_p] == 0 ? 0 : round(intval($dev_bug[$d_p]) / $dev_t[$d_p], 2);
         }
         foreach ($tasks_pmtid_person[$pmt_id]['test'] as $t_p => $task_test) {
             $test_p[$t_p] = $t_p;
             $test_t[$t_p] = 0;
             $test_bug[$t_p] = isset($bug_detail_qa[$pmt_id][$t_p]) ? count($bug_detail_qa[$pmt_id][$t_p]) : 0;
             foreach ($task_test as $t) {
                 $test_t[$t_p] += intval($t);
             }
             $test_bug_workload[$t_p] = $test_t[$t_p] == 0 ? 0 : round(intval($test_bug[$t_p]) / $test_t[$t_p], 2);
         }
         $table_work_person[$pmt_id]['dev_p'] = implode("<br />", $dev_p);
         $table_work_person[$pmt_id]['dev_t'] = implode("<br />", $dev_t);
         $table_work_person[$pmt_id]['test_p'] = implode("<br />", $test_p);
         $table_work_person[$pmt_id]['test_t'] = implode("<br />", $test_t);
         $table_work_person[$pmt_id]['dev_bug'] = implode("<br />", $dev_bug);
         $table_work_person[$pmt_id]['test_bug'] = implode("<br />", $test_bug);
         $table_work_person[$pmt_id]['dev_bug_workload'] = implode("<br />", $dev_bug_workload);
         $table_work_person[$pmt_id]['test_bug_workload'] = implode("<br />", $test_bug_workload);
     }
     //stage: 5-dev 6-test
     $table_workload = array();
     $table_through = array();
     foreach ($pmt_ids as $pmt_id) {
         if (empty($tasks_pmtid[$pmt_id]['dev'])) {
             $table_workload[$pmt_id]['dev_person'] = '';
             $table_workload[$pmt_id]['dev_workload'] = 0;
         } else {
             $person = array();
             $time = 0;
             foreach ($tasks_pmtid[$pmt_id]['dev'] as $row) {
                 $person[] = $row['chinese_name'];
                 $time += intval($row['workload']);
             }
             $person = array_unique($person);
             $person_str = implode("/", $person);
             $table_workload[$pmt_id]['dev_person'] = $person_str;
             $table_workload[$pmt_id]['dev_workload'] = $time;
             $through_arr = array();
             $through_str = "";
             foreach ($person as $person_row) {
                 $str = isset($rates_pmtid[$pmt_id][$person_row]) ? $rates_pmtid[$pmt_id][$person_row] : "-";
                 if ($str == "-") {
                     $through_arr[] = $person_row . ": " . $str;
                 } else {
                     if ($str < 100) {
                         $through_arr[] = '<span style="color:red;">' . $person_row . ": " . $str . '%</span>';
                     } else {
                         $through_arr[] = $person_row . ": " . $str . '%';
                     }
                 }
             }
             $str = isset($rates_pmtid[$pmt_id]['all']) ? $rates_pmtid[$pmt_id]['all'] : "-";
             if ($str == "-") {
                 $through_arr[] = '整个项目' . ": " . $str;
             } else {
                 if ($str < 100) {
                     $through_arr[] = '<span style="color:red;">' . '整个项目' . ": " . $str . '%</span>';
                 } else {
                     $through_arr[] = '整个项目' . ": " . $str . '%';
                 }
             }
             $through_str = implode("<br />", $through_arr);
             $table_through[$pmt_id] = $through_str;
         }
         if (empty($tasks_pmtid[$pmt_id]['test'])) {
             $table_workload[$pmt_id]['test_person'] = '';
             $table_workload[$pmt_id]['test_workload'] = 0;
         } else {
             $person = array();
             $time = 0;
             foreach ($tasks_pmtid[$pmt_id]['test'] as $row) {
                 $person[] = $row['chinese_name'];
                 $time += intval($row['workload']);
             }
             $person = array_unique($person);
             $person_str = implode("/", $person);
             $table_workload[$pmt_id]['test_person'] = $person_str;
             $table_workload[$pmt_id]['test_workload'] = $time;
         }
     }
     $table_project = array();
     foreach ($pmt_ids as $pmt_id) {
         $table_project[$pmt_id]['release_date'] = date("Y-m-d", strtotime($projects_pmtid[$pmt_id]['date_release']));
         $table_project[$pmt_id]['pmt_id'] = $pmt_id;
         $table_project[$pmt_id]['summary'] = $projects_pmtid[$pmt_id]['summary'];
         $table_project[$pmt_id]['owner'] = $projects_pmtid[$pmt_id]['chinese_name'];
         //$table_project[$pmt_id]['dev_person'] = $table_workload[$pmt_id]['dev_person'];
         $table_project[$pmt_id]['dev_workload_all'] = $table_workload[$pmt_id]['dev_workload'];
         //$table_project[$pmt_id]['test_person'] = $table_workload[$pmt_id]['test_person'];
         $table_project[$pmt_id]['test_workload_all'] = $table_workload[$pmt_id]['test_workload'];
         $table_project[$pmt_id]['dev_person'] = $table_work_person[$pmt_id]['dev_p'];
         $table_project[$pmt_id]['dev_workload'] = $table_work_person[$pmt_id]['dev_t'];
         $table_project[$pmt_id]['dev_bug'] = $table_work_person[$pmt_id]['dev_bug'];
         $table_project[$pmt_id]['dev_bug_workload'] = $table_work_person[$pmt_id]['dev_bug_workload'];
         $table_project[$pmt_id]['test_person'] = $table_work_person[$pmt_id]['test_p'];
         $table_project[$pmt_id]['test_workload'] = $table_work_person[$pmt_id]['test_t'];
         $table_project[$pmt_id]['test_bug'] = $table_work_person[$pmt_id]['test_bug'];
         $table_project[$pmt_id]['test_bug_workload'] = $table_work_person[$pmt_id]['test_bug_workload'];
         $table_project[$pmt_id]['self_test'] = $table_through[$pmt_id];
         $table_project[$pmt_id]['bugs_count'] = isset($bugs_pmtid[$pmt_id]) ? $bugs_pmtid[$pmt_id] : 0;
         $table_project[$pmt_id]['bug_devload'] = $table_project[$pmt_id]['dev_workload_all'] == 0 ? 0 : round($table_project[$pmt_id]['bugs_count'] / $table_project[$pmt_id]['dev_workload_all'], 2);
         $table_project[$pmt_id]['bug_testload'] = $table_project[$pmt_id]['test_workload_all'] == 0 ? 0 : round($table_project[$pmt_id]['bugs_count'] / $table_project[$pmt_id]['test_workload_all'], 2);
         $table_project[$pmt_id]['devload_testload'] = $table_project[$pmt_id]['test_workload_all'] == 0 ? 0 : round($table_project[$pmt_id]['dev_workload_all'] / $table_project[$pmt_id]['test_workload_all'], 2);
         //shirlyhu
         //            $person_groups=explode("<br />",$table_project[$pmt_id]['dev_person']);
         //
         //            foreach($person_groups as $person_group){
         //               if($member_group[$person_group]){
         //                   $table_project[$pmt_id]['group_id'].=$member_group[$person_group].",";
         //               }
         //            }
         //shirlyhu
         if (isset($delay_infos_pmtid[$pmt_id])) {
             $table_project[$pmt_id]['is_delay'] = $delay_infos_pmtid[$pmt_id]->self_test_delayed == 1 ? 'Yes' . '<br />' . '原因:' . $delay_infos_pmtid[$pmt_id]->delay_detail : 'No';
         } else {
             $table_project[$pmt_id]['is_delay'] = '-';
         }
     }
     //by person
     $bugs = Bll_TicketBiz::get_instance()->get_bugs_by_persons($persons, $pmt_ids);
     $bugs_person = array();
     foreach ($bugs as $bug) {
         $bugs_person[$bug['chinese_name']] = $bug['BugCount'];
     }
     $bugs_qa_user = Bll_TicketBiz::get_instance()->get_bugs_by_qas($qa_users, $pmt_ids);
     $bugs_qa = array();
     foreach ($bugs_qa_user as $bug) {
         $bugs_qa[$bug['chinese_name']] = $bug['BugCount'];
     }
     $table_qa = array();
     $table_qa['total'] = array('person' => 'Total', 'bugs_count' => 0, 'workload' => 0, 'bugs_load' => 0);
     foreach ($qa_users as $qa) {
         $table_qa[$qa]['person'] = $qa;
         if ($member_group[$qa]) {
             $table_qa[$qa]['group_id'] = $member_group[$qa];
         }
         $table_qa[$qa]['bugs_count'] = isset($bugs_qa[$qa]) ? $bugs_qa[$qa] : 0;
         $table_qa[$qa]['workload'] = 0;
         foreach ($tasks_qa[$qa] as $row) {
             $table_qa[$qa]['workload'] += intval($row);
         }
         $table_qa[$qa]['bugs_load'] = $table_qa[$qa]['workload'] == 0 ? 0 : round($table_qa[$qa]['bugs_count'] / $table_qa[$qa]['workload'], 2);
         $table_qa['total']['bugs_count'] += $table_qa[$qa]['bugs_count'];
         $table_qa['total']['workload'] += $table_qa[$qa]['workload'];
     }
     $table_qa['total']['bugs_load'] = $table_qa['total']['workload'] == 0 ? 0 : round($table_qa['total']['bugs_count'] / $table_qa['total']['workload'], 2);
     $table_person = array();
     $table_person['total'] = array('person' => 'Total', 'bugs_count' => 0, 'workload' => 0, 'bugs_load' => 0);
     foreach ($persons as $person) {
         $table_person[$person]['person'] = $person;
         if ($member_group[$person]) {
             $table_person[$person]['group_id'] = $member_group[$person];
         }
         $table_person[$person]['bugs_count'] = isset($bugs_person[$person]) ? $bugs_person[$person] : 0;
         $table_person[$person]['workload'] = 0;
         foreach ($tasks_person[$person] as $row) {
             $table_person[$person]['workload'] += intval($row);
         }
         $table_person[$person]['bugs_load'] = $table_person[$person]['workload'] == 0 ? 0 : round($table_person[$person]['bugs_count'] / $table_person[$person]['workload'], 2);
         $table_person['total']['bugs_count'] += $table_person[$person]['bugs_count'];
         $table_person['total']['workload'] += $table_person[$person]['workload'];
     }
     $table_person['total']['bugs_load'] = $table_person['total']['workload'] == 0 ? 0 : round($table_person['total']['bugs_count'] / $table_person['total']['workload'], 2);
     $req->set_attribute('product', $product);
     $req->set_attribute('tab_info', $tab_info);
     $req->set_attribute('table_person', $table_person);
     $req->set_attribute('table_qa', $table_qa);
     $req->set_attribute('table_project', $table_project);
     $req->set_attribute('input_from', $input_from);
     $req->set_attribute('input_to', $input_to);
     $req->set_attribute('mode', $mode);
     $req->set_attribute('pmt_id_q', $pmt_id_q);
     return 'NewReport_Workload';
 }