/** * @param stdClass $o * @return \ModelModel */ public static function fromObject($o) { $model = new ModelModel(); $model->setId($o->id); $model->setStudyId($o->studyId); $model->setTitle($o->title); $model->setNamespace($o->namespace); $model->setText($o->text); $model->setCompiled($o->compiled); return $model; }
function add_scenario() { $caseId = $this->session->get('caseId'); $models = ModelModel::loadAll($caseId); $scenarios = ScenarioModel::loadAll($caseId); $case = CaseModel::load($caseId); $this->assign('models', $models); $this->assign('scenarios', $scenarios); $this->assign('case', $case); $this->load->view('scenario_add'); }
/** * @AjaxCallable=TRUE * @AjaxMethod=POST * @AjaxAsync=TRUE */ function update_model_text() { $caseId = $this->session->get('caseId'); $id = filter_input(INPUT_POST, 'id'); $text = filter_input(INPUT_POST, 'text'); ModelModel::updateText($id, $caseId, $text); $info = ModelModel::getInfo($id, $caseId); if (!$info['isError']) { $newId = $info['body']['id']; $name = $info['body']['name']; ModelModel::updateId($id, $caseId, $newId); ModelModel::updateName($newId, $caseId, $name); return $info; } return $info; }
public function testModelModelSavesModelResponses() { $this->auth(); $model = new ModelModel(array('modelID' => 1, 'depth' => 'response')); $page = $model->nextModelPage(); $section = $page->nextModelSection(); $question = $section->nextModelQuestion(); $response = $question->createModelResponse('match', 'test'); $modelResponseID = $response->modelResponseID; $model->save(); $testResponse = new ModelResponseModel(array('modelResponseID' => $modelResponseID)); $this->assertEquals($modelResponseID, $testResponse->modelResponseID); }
/** * Do the work of running a report and assigning the results to the view */ private function runReport() { unset($this->view->menuItems); $instance = new InstanceModel(array('instanceID' => $this->_getParam('instance'), 'depth' => 'response')); $model = new ModelModel(array('modelID' => $this->_getParam('id'), 'depth' => 'response', 'instance' => $instance)); $this->view->failures = $model->compare(array('additional_information' => $this->_getParam('addlInfo') ? true : false, 'model_pass' => $this->_getParam('passing') ? true : false)); }
/** * Get the model (or models) with the given name * * @param string model The name of the model (or models) we are looking for * @return array */ public static function findModelsByName($name) { if (!isset(self::$modelTable)) { self::$modelTable = QFrame_Db_Table::getTable('model'); } $where = self::$modelTable->getAdapter()->quoteInto('name = ?', $name); $rows = self::$modelTable->fetchAll($where); $models = array(); foreach ($rows as $row) { $models[] = new ModelModel(array('modelID' => $row->modelID)); } return $models; }
function delete_model($studyId, $modelId) { $this->load->model('ModelModel'); ModelModel::delete($modelId); $this->location('/study/' . $studyId); }
function add_report($studyId) { $this->assign('study', StudyModel::loadById($studyId)); $this->assign('models', ModelModel::loadByStudy($studyId)); $this->assign('scenarios', ScenarioModel::loadByStudy($studyId)); $this->assign('queries', QueryModel::loadByStudy($studyId)); $this->load->view('header'); $this->load->view('add_report'); $this->load->view('footer'); }
public function logOut() { self::$errorMessage = 6; unset($_SESSION[$this->loggedInSession]); }