Esempio n. 1
0
 function model($studyId, $modelId, $action = "")
 {
     $model = ModelModel::loadById($modelId);
     if ($action !== 'edit' && $model->getCompiled() === NULL) {
         $this->location('/model/' . $studyId . '/' . $modelId . '/edit');
     }
     $this->load->library('Parsedown');
     $parser = new Parsedown();
     $this->assign('parser', $parser);
     $this->assign('model', $model);
     $this->assign('title', $model->getNamespace() . ": " . $model->getTitle());
     $this->assign('study', StudyModel::loadById($studyId));
     $this->assign('models', ModelModel::loadByStudy($studyId));
     $this->assign('scenarios', ScenarioModel::loadByStudy($studyId));
     $this->assign('queries', QueryModel::loadByStudy($studyId));
     if ($action === "edit" || $model->getCompiled() === NULL) {
         $this->load->view('header');
         $this->load->view('model_edit');
         $this->load->view('footer');
     } else {
         $this->load->view('header');
         $this->load->view('model');
         $this->load->view('footer');
     }
 }
 /**
  * @AjaxCallable
  * @AjaxMethod=POST
  * @AjaxAsync=TRUE
  */
 function update_model_title()
 {
     $id = filter_input(INPUT_POST, 'id');
     $title = filter_input(INPUT_POST, 'title');
     $namespace = filter_input(INPUT_POST, 'namespace');
     $this->load->model('ModelModel');
     $model = ModelModel::loadById($id);
     $model->setTitle($title);
     $model->setNamespace($namespace);
     $model->update();
     return ['id' => $id, 'title' => $title, 'namespace' => $namespace];
 }