/** * @AjaxCallable * @AjaxMethod=POST * @AjaxAsync=TRUE */ function update_query_title() { $id = filter_input(INPUT_POST, 'id'); $title = filter_input(INPUT_POST, 'title'); $this->load->model('QueryModel'); $query = QueryModel::loadById($id); $query->setTitle($title); $query->update(); return ['id' => $id, 'title' => $title]; }
function report($studyId, $queryId, $action = "") { $query = QueryModel::loadById($queryId); if ($action !== 'edit' && $query->getCompiled() === NULL) { $this->location('/report/' . $studyId . '/' . $queryId . '/edit'); } $this->load->library('Parsedown'); $parser = new Parsedown(); $this->assign('parser', $parser); $this->assign('query', $query); $this->assign('title', $query->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" || $query->getCompiled() === NULL) { $this->load->view('header'); $this->load->view('report_edit'); $this->load->view('footer'); } else { $this->load->view('header'); $this->load->view('report'); $this->load->view('footer'); } }