Ejemplo n.º 1
0
 /**
  * @param sfWebRequest $request
  */
 public function executeExport(sfWebRequest $request)
 {
     //$this->forward404Unless(in_array($this->getUser()->getGuardUser()->account_type, array('Pro', 'Enterprice')));
     $decision_id = $request->getParameter('decision_id', false);
     $decision = DecisionTable::getInstance()->getDecisionForUser($this->getUser()->getGuardUser(), $decision_id);
     $this->forward404Unless($decision);
     header('Content-type: application/force-download');
     header('Content-Disposition: attachment; filename="' . $decision->name . '.xlsx"');
     $criteriaAnalyze = new CriteriaAnalyze();
     $criteriaAnalyze->setDecisionId($decision_id);
     $criteriaAnalyze->load();
     $logicalFilter = new LogicalFilterView();
     $logicalFilter->setDecisionId($decision_id);
     $logicalFilter->load();
     $roleFilter = new RoleFilterView();
     $roleFilter->setDecisionId($decision_id);
     $roleFilter->load();
     $statusFilter = new StatusFilterView();
     $statusFilter->setDecisionId($decision_id);
     $statusFilter->load();
     $tagFilter = new TagFilterView();
     $tagFilter->setDecisionId($decision_id);
     $tagFilter->load();
     $stackedBarChart = new StackedBarChart();
     $stackedBarChart->setDecisionId($decision_id);
     $stackedBarChart->setCriteriaValues($criteriaAnalyze->getCriteriaValues());
     $stackedBarChart->setRoleFilterData($roleFilter->getData());
     $stackedBarChart->setStatusFilterData($statusFilter->getData());
     $stackedBarChart->setTagFilterData($tagFilter->getDataForSQL());
     $stackedBarChart->setFilteredAlternativesIds($logicalFilter->getFilteredAlternativesIds());
     $stackedBarChart->load();
     $excelExporter = new AlternativesExcelExporter($stackedBarChart);
     $excelExporter->export();
     exit;
 }