コード例 #1
0
 public static function &get_instance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: UserOnlineBug.php プロジェクト: emilymwang8/ibug
 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'] : 'all';
     $user_id = $req->get_user_id();
     $departments = Bll_DdCommonBiz::get_instance()->get_departments_for_user_group();
     $groups = Bll_UserGroupCustomBiz::get_instance()->get_all_groups();
     $input_arr = array('type_key' => 'page', 'type_value' => $pro);
     $page_bind_groups = Bll_ReportGroupSelectedBiz::get_instance()->get_group_ids_arr($input_arr);
     foreach ($departments as $value) {
         if (intval($value->value) < 17 || intval($value->value) > 26) {
             $department[$value->value] = $value->name;
         }
     }
     foreach ($groups as $value) {
         $group[$value->department][] = array('name' => $value->group_name, 'id' => $value->id);
     }
     $tab_info = array('all' => array('name' => 'ALL', 'click' => false), 'mobile' => array('name' => 'Mobile', 'click' => false), 'pc' => array('name' => 'Pc', 'click' => false));
     $tab_info[$pro]['click'] = true;
     $req->set_attribute('tab_info', $tab_info);
     $req->set_attribute('department', $department);
     if ($group != null) {
         $req->set_attribute('group', $group);
     }
     $req->set_attribute('user_id', $user_id);
     if (!empty($page_bind_groups) || strlen($page_bind_groups[0]) > 0) {
         $req->set_attribute('page_bind_groups', $page_bind_groups);
     }
     $req->set_attribute('department_id', $department_id);
     return 'NewReport_UserOnlineBug';
 }
コード例 #3
0
ファイル: GroupAdd.php プロジェクト: emilymwang8/ibug
 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';
     }
 }
コード例 #4
0
 public function get_group_names_by_ids($input_arr)
 {
     $group_names_arr = array();
     $group_ids = $this->get_group_ids_arr($input_arr);
     foreach ($group_ids as $group_id) {
         $group = Bll_UserGroupCustomBiz::get_instance()->get_group_by_id($group_id);
         if ($group) {
             $group_name = $group->group_name;
             $group_names_arr[$group->id] = $group_name;
         }
     }
     return $group_names_arr;
 }
コード例 #5
0
ファイル: GroupEdit.php プロジェクト: emilymwang8/ibug
 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';
     }
 }
コード例 #6
0
ファイル: GroupView.php プロジェクト: emilymwang8/ibug
 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';
 }
コード例 #7
0
ファイル: OnlineNew.php プロジェクト: emilymwang8/ibug
 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;
 }
コード例 #8
0
ファイル: Tables.php プロジェクト: emilymwang8/ibug
 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;
 }
コード例 #9
0
ファイル: ProjectQuality.php プロジェクト: emilymwang8/ibug
 public function process_group_info($group_ids, array $dev_bug_rate)
 {
     $groups = explode("|", $group_ids);
     $result = array();
     for ($i = 0; $i < count($groups); $i++) {
         $total_bug = 0;
         $total_time = 0;
         $group_info = Bll_UserGroupCustomBiz::get_instance()->get_group_by_id(intval($groups[$i]));
         $members_id = Bll_UserGroupCustomBiz::get_instance()->get_group_members_by_id(intval($groups[$i]));
         $members_chinese_name = Bll_UserBiz::get_instance()->get_chinesenames_by_ids($members_id);
         foreach ($members_chinese_name as $value) {
             if (isset($dev_bug_rate[$value])) {
                 $total_bug += $dev_bug_rate[$value][1];
                 $total_time += $dev_bug_rate[$value][2];
             }
         }
         if ($total_time != 0) {
             $result[$group_info->group_name] = array($members_chinese_name, $total_bug, $total_time, round($total_bug / $total_time, 2));
         }
     }
     return $result;
 }
コード例 #10
0
ファイル: Workload.php プロジェクト: emilymwang8/ibug
 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';
 }
コード例 #11
0
}
$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";