Ejemplo n.º 1
0
 private function getUpdateActionResponse($criteriaAnalyze, $decision_id, $revert = false, $response = array())
 {
     // When user changes the weights of criteria all dependent values
     // should be recalculated automatically in the alternatives chart
     $stackedBarChart = new StackedBarChart();
     $stackedBarChart->setDecisionId($decision_id);
     $stackedBarChart->setSaveGraph(false);
     $stackedBarChart->setCriteriaValues($criteriaAnalyze->getCriteriaValues());
     $stackedBarChart->load();
     $this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8');
     $stacked_bar_chart[] = '"data":' . $stackedBarChart->getJsonData();
     $stacked_bar_chart[] = '"alternatives":' . $stackedBarChart->getAlternativesJson();
     $stacked_bar_chart[] = '"criteria":' . $stackedBarChart->getCriteriaJson();
     if ($revert) {
         $response[] = '"criteriaData":' . $criteriaAnalyze->getJsonData();
     }
     $response[] = '"stackedBarChart":{' . implode(',', $stacked_bar_chart) . '}';
     return $this->renderText('{' . implode(',', $response) . '}');
 }