public function handle_request_internal() { $req = APF::get_instance()->get_request(); $res = APF::get_instance()->get_response(); $params = $req->get_parameters(); $pmt_id = $params['form_pmt'] ? trim($params['form_pmt']) : 0; if ($pmt_id != 0) { //project detail table $project = Bll_PMTProjectBiz::get_instance()->get_project_detail_by_ids(array($pmt_id)); $table_project = array(); if (!empty($project)) { $tasks = Bll_PMTProjectBiz::get_instance()->get_tasks_by_pmt_ids(array($pmt_id)); $rates = Bll_ReportPmtInfoBiz::get_instance()->get_through_rate_by_pmtids(array($pmt_id)); $delay_info = Bll_ReportPmtInfoBiz::get_instance()->get_project_delay_info_by_pmtids(array($pmt_id)); $dev_person = array(); $test_person = array(); foreach ($tasks as $task) { if (in_array($task['task_type_id'], array(2, 3, 33))) { $dev_person[] = $task['chinese_name']; } else { if (in_array($task['task_type_id'], array(4))) { $test_person[] = $task['chinese_name']; } } } $dev_person = array_unique($dev_person); $test_person = array_unique($test_person); $table_project['dev_person'] = implode("/", $dev_person); $table_project['test_person'] = implode("/", $test_person); $rate_person = array(); foreach ($rates as $rate) { $rate_person[$rate->chinese_name] = $rate->rate; } $through_arr = array(); foreach ($dev_person as $person_row) { $str = isset($rate_person[$person_row]) ? $rate_person[$person_row] . "%" : "-"; $through_arr[] = $person_row . ": " . $str; } $str = isset($rate_person['all']) ? $rate_person['all'] . "%" : "-"; $through_arr[] = '整个项目' . ": " . $str; $through_str = implode(" ", $through_arr); $table_project['through_rate'] = $through_str; $table_project['pmt_id'] = $pmt_id; $table_project['summary'] = $project[0]['summary']; $table_project['release_date'] = date("Y-m-d", strtotime($project[0]['date_release'])); $table_project['pro_set'] = empty($project[0]['set_id']) ? '' : $project[0]['set_id'] . ". " . $project[0]['set_name']; $table_project['owner'] = $project[0]['chinese_name']; if (!empty($delay_info)) { $table_project['is_delay'] = $delay_info[0]->self_test_delayed == 1 ? 'Yes' . '<br />' . '原因:' . $delay_info[0]->delay_detail : 'No'; } else { $table_project['is_delay'] = '-'; } } //reopen & reject list $reopen_id = Bll_TicketRelationBiz::get_instance()->find_reopen_id_by_pmtid($pmt_id); $reopen = array(); if (!empty($reopen_id)) { foreach ($reopen_id as $row) { $reopen[] = $row['ticket_id']; } } $reject_id = Bll_TicketCounterBiz::get_instance()->get_reject_id_by_pmtid($pmt_id); $reject = array(); if (!empty($reject_id)) { foreach ($reject_id as $row) { $reject[] = $row["ticket_id"]; } } //prepare $day = date("Y-m-d"); $date_arr = array(); for ($i = 9; $i >= 1; $i--) { $t = "-{$i} day"; $date_arr[] = date("Y-m-d", strtotime($t)); } $date_arr[] = $day; $status = Ticket_Status::get_all_status(); $prioritys = Bll_DdCommonBiz::get_instance()->get_prioritys(); $priority = array(); $p_id_name = array(); foreach ($prioritys as $prioritys_row) { $priority[$prioritys_row->value] = $prioritys_row->name; $p_id_name[$prioritys_row->id] = $prioritys_row->name; } $environments = Bll_DdCommonBiz::get_instance()->get_environments(); $environment = array(); foreach ($environments as $environments_row) { $environment[$environments_row->value] = $environments_row->name; } //daily table $table_data = Bll_ReportProgessPmtBiz::get_instance()->get_counts_by_type_date($pmt_id, '2012-05-01', $day); foreach ($table_data as $key => $data_row) { $table_data[$key]->environment = $environment[$data_row->environment]; } //pmt_day $counts_day = Bll_ReportDayPmtBiz::get_instance()->get_counts_by_pmt_type($pmt_id, 'all'); $pmt_day = array(); if (!empty($counts_day)) { foreach ($counts_day as $key => $row) { $pmt_day[] = array('date' => $this->convert_date($row->day), 'count' => $row->count); } } else { $pmt_day[] = array('date' => $this->convert_date($day), 'count' => 0); } /*$day_pro = array(); foreach($counts_day as $row){ $day_pro[$row->day] = $row->count; } foreach($date_arr as $date_row){ $c = isset($day_pro[$date_row])? $day_pro[$date_row] : 0; $pmt_day[] = array('date' => $date_row, 'count' => $c); }*/ //pmt_priority $counts_prior = Bll_ReportDayPmtBiz::get_instance()->get_counts_by_pmt_type($pmt_id, 'priority'); $prior_pro = array(); foreach ($counts_prior as $row) { $prior_pro[$row->day][$row->type_value] = $row->count; } $pmt_priority = array(); if (!empty($prior_pro)) { foreach ($prior_pro as $key => $row) { $tmp = array(); $tmp['date'] = $this->convert_date($key); foreach ($priority as $p_value => $p_name) { $o = isset($row[$p_value]) ? $row[$p_value] : 0; $tmp[$p_name] = $o; } $pmt_priority[] = $tmp; } } /*else { $tmp = array(); $tmp['date'] = $this->convert_date($day); foreach($priority as $p_value => $p_name){ $tmp[$p_name] = 0; } $pmt_priority[] = $tmp; }*/ //pmt_status $counts_status = Bll_ReportDayPmtBiz::get_instance()->get_counts_by_pmt_type($pmt_id, 'status'); $status_pro = array(); foreach ($counts_status as $row) { $status_pro[$row->day][$row->type_value] = $row->count; } $pmt_status = array(); if (!empty($status_pro)) { foreach ($status_pro as $key => $row) { $tmp = array(); $tmp['date'] = $this->convert_date($key); foreach ($status as $status_row) { $s = isset($row[$status_row]) ? $row[$status_row] : 0; $tmp[$status_row] = $s; } $pmt_status[] = $tmp; } } /*else { $tmp = array(); $tmp['date'] = $this->convert_date($day); foreach($status as $status_row){ $tmp[$status_row] = 0; } $pmt_status[] = $tmp; }*/ //priority and status today $tickets_type = Bll_TicketBiz::get_instance()->get_count_pmt_type($pmt_id); $ticket_priority = array(); $ticket_status = array(); foreach ($tickets_type as $row) { $ticket_priority[$row->priority][] = $row; $ticket_status[$row->status][] = $row; } $tmp_p = array(); $tmp_p['date'] = $this->convert_date($day); foreach ($p_id_name as $id => $p_name) { $tmp_p[$p_name] = isset($ticket_priority[$id]) ? count($ticket_priority[$id]) : 0; } if (!isset($prior_pro[$day])) { $pmt_priority[] = $tmp_p; } $tmp_s = array(); $tmp_s['date'] = $this->convert_date($day); foreach ($status as $status_row) { $tmp_s[$status_row] = isset($ticket_status[$status_row]) ? count($ticket_status[$status_row]) : 0; } if (!isset($status_pro[$day])) { $pmt_status[] = $tmp_s; } $req->set_attribute('pmt_day', $pmt_day); $req->set_attribute('pmt_priority', $pmt_priority); $req->set_attribute('pmt_status', $pmt_status); $req->set_attribute('table_data', $table_data); $req->set_attribute('table_project', $table_project); $req->set_attribute('reopen', $reopen); $req->set_attribute('reject', $reject); } $req->set_attribute('pmt_id', $pmt_id); return 'NewReport_ProjectDaily'; }
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; }
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); }