Ejemplo n.º 1
0
 private function show_reports($status)
 {
     global $request, $phpbb_root_path, $phpEx;
     global $template, $db, $user, $config, $action;
     $start = $request->variable('start', 0);
     switch ($action) {
         case 'close':
         case 'delete':
             $report_id_list = $request->variable('report_id_list', array(0));
             if (!sizeof($report_id_list)) {
                 trigger_error('NO_REPORT_SELECTED');
             }
             $this->manager->close_reports($report_id_list, $action);
             break;
     }
     $reports = $this->manager->get_reported_feedbacks($start, self::NUM_PER_PAGE, $status);
     $report_count = $this->manager->get_reports_count($status);
     if ($user->data['user_timezone']) {
         $timezone = new \DateTimeZone($user->data['user_timezone']);
     } else {
         $timezone = new \DateTimeZone($config['board_timezone']);
     }
     foreach ($reports as $key => $report) {
         $comments = $this->manager->getLatestFeedbackComment($report['feedback_id']);
         $report['short_comment'] = $comments['short_comment'];
         $report['long_comment'] = $comments['long_comment'];
         $report['to_username'] = $this->get_username_full($db, $report['to_user_id']);
         $report['from_username'] = $this->get_username_full($db, $report['from_user_id']);
         $report['f_date_created'] = new \DateTime('@' . $report['f_date_created']);
         $report['f_date_created']->setTimezone($timezone);
         $report['r_date_created'] = new \DateTime('@' . $report['r_date_created']);
         $report['r_date_created']->setTimezone($timezone);
         $report['U_VIEW_DETAILS'] = append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=' . $this->id . '&mode=trader_report_details&report_id=' . $report['report_id']);
         $reports[$key] = $report;
     }
     $template->assign_vars(array('REPORTS' => $reports, 'OPEN' => $status, 'S_CLOSED' => $status ? false : true));
     $base_url = append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i={$this->id}&mode=open_trader_reports");
     $this->pagination->generate_template_pagination($base_url, 'pagination', 'start', $report_count, self::NUM_PER_PAGE, $start);
     add_form_key('mcp_trader');
     $this->tpl_name = 'mcp_trader_reports';
 }