/**
  * Show single report
  *
  * @param void
  * @return null
  */
 function report()
 {
     if ($this->active_report->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->active_report->canView($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     $report_records = TimeReports::executeReport($this->logged_user, $this->active_report);
     $total_time = 0;
     if (is_foreachable($report_records)) {
         if ($this->active_report->getSumByUser()) {
             foreach ($report_records as $report_record) {
                 $total_time += $report_record['total_time'];
             }
             // foreach
         } else {
             foreach ($report_records as $report_record) {
                 $total_time += $report_record->getValue();
             }
             // foreach
         }
         // if
     }
     // if
     $this->smarty->assign(array('grouped_reports' => TimeReports::findGrouped(), 'report_records' => $report_records, 'total_time' => $total_time, 'show_project' => true));
 }
 /**
  * Show a single report
  *
  * @param void
  * @return null
  */
 function report()
 {
     if ($this->active_report->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->active_report->canView($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     $report_records = TimeReports::executeReport($this->logged_user, $this->active_report, $this->active_project);
     $total_time = 0;
     if (is_foreachable($report_records)) {
         if ($this->active_report->getSumByUser()) {
             foreach ($report_records as $report_record) {
                 $total_time += $report_record['total_time'];
             }
             // foreach
         } else {
             foreach ($report_records as $report_record) {
                 $total_time += $report_record->getValue();
             }
             // foreach
         }
         // if
     }
     // if
     $this->smarty->assign(array('grouped_reports' => TimeReports::findGrouped(), 'report_records' => $report_records, 'total_time' => $total_time, 'show_project' => false));
     $this->setTemplate(array('module' => TIMETRACKING_MODULE, 'controller' => 'global_timetracking', 'template' => 'report'));
 }