function add_scenario()
 {
     $studyId = filter_input(INPUT_POST, 'studyId');
     $title = filter_input(INPUT_POST, 'scenarioTitle');
     $namespace = filter_input(INPUT_POST, 'scenarioNamespace');
     $this->load->model('ScenarioModel');
     $scenario = new ScenarioModel();
     $scenario->setStudyId($studyId);
     $scenario->setTitle($title);
     $scenario->setNamespace($namespace);
     $scenario->setText("");
     $scenario->add();
     $this->location('/scenario/' . $studyId . '/' . $scenario->getId());
 }
 /**
  * @AjaxCallable=TRUE
  * @AjaxMethod=POST
  * @AjaxAsync=TRUE
  */
 function add_scenario()
 {
     $this->load->library('DecimillClient');
     $id = $this->session->getId();
     $caseId = $this->session->get('caseId');
     $text = filter_input(INPUT_POST, 'text');
     TempModel::add($id, $caseId, $text);
     $info = TempModel::getScenarioInfo($id, $caseId);
     if ($info['isError']) {
         return $info;
     }
     ScenarioModel::add($info['body']['id'], $caseId, $info['body']['name'], $text);
     TempModel::remove($id, $caseId);
     return $info;
 }