/**
  * @AjaxCallable
  * @AjaxMethod=POST
  * @AjaxAsync=TRUE
  */
 function compile_scenario()
 {
     $this->load->library('DecimillClient');
     $this->load->model('ScenarioModel');
     $id = filter_input(INPUT_POST, 'id');
     $text = filter_input(INPUT_POST, 'text');
     $scenario = ScenarioModel::loadById($id);
     $scenario->setText($text);
     $scenario->update();
     $res = DecimillClient::call('-a', 'compileScenario', '-s', $id);
     if (!$res->isError) {
         $scenario->setCompiled($res->body);
         $scenario->update();
     } else {
         $scenario->setCompiled('<div class="compile-error">Scenario was compiled with errors, please re-compile.</div>');
         $scenario->update();
     }
     return $res;
 }
 /**
  * @AjaxCallable
  * @AjaxMethod=POST
  * @AjaxAsync=TRUE
  */
 function compile_model()
 {
     $this->load->library('DecimillClient');
     $this->load->model('ModelModel');
     $id = filter_input(INPUT_POST, 'id');
     $text = filter_input(INPUT_POST, 'text');
     // Update model in database
     $model = ModelModel::loadById($id);
     $model->setText($text);
     $model->update();
     // Parse model using DeciMill
     $res = DecimillClient::call('-a', 'compileModel', '-m', $id);
     if (!$res->isError) {
         $model->setCompiled($res->body);
         $model->update();
     } else {
         $model->setCompiled('<div class="compile-error">Model was compiled with errors, please re-compile.</div>');
         $model->update();
     }
     return $res;
 }
Esempio n. 3
0
 public function client()
 {
     $this->load->library('DecimillClient');
     $client = new DecimillClient();
     $client->compileModel(2, 'UCL', 'This model `Goal 1 <- Goal 3, Goal 5` is nice.');
 }
Esempio n. 4
0
 public static function getScenarioInfo($id, $caseId)
 {
     CL_Loader::get_instance()->library('DecimillClient');
     $res = DecimillClient::call("-t", $id, "-c", $caseId, "-a", "getTempScenarioInfo");
     return json_decode($res, TRUE);
 }