public function exportPresentationsCompanyReport(SS_HTTPRequest $request)
 {
     try {
         $query_string = $request->getVars();
         $sort = isset($query_string['sort']) ? Convert::raw2sql($query_string['sort']) : 'name';
         $sort_dir = isset($query_string['sort_dir']) ? Convert::raw2sql($query_string['sort_dir']) : 'ASC';
         $search_term = isset($query_string['term']) ? Convert::raw2sql($query_string['term']) : '';
         $summit_id = intval($request->param('SUMMIT_ID'));
         $summit = $this->summit_repository->getById($summit_id);
         if (is_null($summit)) {
             throw new NotFoundEntityException('Summit', sprintf(' id %s', $summit_id));
         }
         $ext = 'csv';
         $report_data = $this->presentation_repository->searchByCompanyPaged($summit_id, null, null, $sort, $sort_dir, $search_term);
         $filename = "presentations_company_report-" . date('Ymd') . "." . $ext;
         $delimiter = $ext == 'xls' ? "\t" : ",";
         return CSVExporter::getInstance()->export($filename, $report_data['Data'], $delimiter);
     } catch (NotFoundEntityException $ex2) {
         SS_Log::log($ex2->getMessage(), SS_Log::WARN);
         return $this->notFound($ex2->getMessage());
     } catch (Exception $ex) {
         SS_Log::log($ex->getMessage(), SS_Log::ERR);
         return $this->serverError();
     }
 }
 public function getPresentationsCompanyReport(SS_HTTPRequest $request)
 {
     try {
         $query_string = $request->getVars();
         $page = isset($query_string['page']) ? Convert::raw2sql($query_string['page']) : '';
         $page_size = isset($query_string['items']) ? Convert::raw2sql($query_string['items']) : '';
         $sort = isset($query_string['sort']) ? Convert::raw2sql($query_string['sort']) : 'presentation';
         $sort_dir = isset($query_string['sort_dir']) ? Convert::raw2sql($query_string['sort_dir']) : 'ASC';
         $search_term = isset($query_string['term']) ? Convert::raw2sql($query_string['term']) : '';
         $summit_id = intval($request->param('SUMMIT_ID'));
         $summit = $this->summit_repository->getById($summit_id);
         if (is_null($summit)) {
             throw new NotFoundEntityException('Summit', sprintf(' id %s', $summit_id));
         }
         $presentations = $this->presentation_repository->searchByCompanyPaged($summit_id, $page, $page_size, $sort, $sort_dir, $search_term);
         return $this->ok(array('total' => $presentations['Total'], 'data' => $presentations['Data']));
     } catch (NotFoundEntityException $ex2) {
         SS_Log::log($ex2->getMessage(), SS_Log::WARN);
         return $this->notFound($ex2->getMessage());
     } catch (Exception $ex) {
         SS_Log::log($ex->getMessage(), SS_Log::ERR);
         return $this->serverError();
     }
 }