function add_query() { $studyId = filter_input(INPUT_POST, 'studyId'); $title = filter_input(INPUT_POST, 'title'); $this->load->model('QueryModel'); $query = new QueryModel(); $query->setStudyId($studyId); $query->setTitle($title); $query->setText(""); $query->add(); $this->location('/report/' . $studyId . '/' . $query->getId()); }
/** * @AjaxCallable=TRUE * @AjaxMethod=POST * @AjaxAsync=TRUE */ function run_query() { $caseId = $this->session->get('caseId'); $text = filter_input(INPUT_POST, 'text'); QueryModel::add($caseId, $text); $res = QueryModel::run($caseId); return $res; // // Retrieve script path // $path = $this->config->get_item('main', 'decimill_path'); // // $out = NULL; // $res = NULL; // // // Execute query // exec('java -jar ' . $path . 'decimill-client.jar -a runQuery -c ' . $caseId, $out, $res); // // if ($res === 0) { // return [ // 'body' => json_decode($out[0])->body, // 'isError' => false, // 'errCode' => 0 // ]; // } else { // return [ // 'body' => json_decode($out[0])->body, // 'isError' => true, // 'errCode' => $res // ]; // } }