/** * Creates the model * * @return \MUtil_Model_ModelAbstract */ protected function createModel() { if (!$this->model instanceof LogModel) { $this->model = $this->loader->getModels()->createLogModel(); $this->model->applyDetailSettings(); } return $this->model; }
/** * Creates a model for getModel(). Called only for each new $action. * * The parameters allow you to easily adapt the model to the current action. The $detailed * parameter was added, because the most common use of action is a split between detailed * and summarized actions. * * @param boolean $detailed True when the current action is not in $summarizedActions. * @param string $action The current action. * @return \MUtil_Model_ModelAbstract */ protected function createModel($detailed, $action) { $model = $this->loader->getModels()->createLogModel(); if ($detailed) { $model->applyDetailSettings(); } else { $model->applyBrowseSettings(); } return $model; }
/** * Creates the model * * @return \MUtil_Model_ModelAbstract */ protected function createModel() { if ($this->model instanceof \Gems_Model_StaffModel) { $model = $this->model; } else { $model = $this->loader->getModels()->getStaffModel(); $model->applyBrowseSettings(); } return $model; }
/** * The model to use with a controller * * @param string $controller Name of controller (or other id) * @return \MUtil_Model_ModelAbstract or null when not found */ protected function getControllerTargetModel($controller) { switch ($controller) { case 'respondent': $model = $this->loader->getModels()->getRespondentModel(true); $model->applyEditSettings(); return $model; case 'calendar': $model = $this->loader->getModels()->createAppointmentModel(); $this->applySource($model); $model->applyEditSettings(null); return $model; default: return null; } }
protected function _scanForms() { $messages = array(); $formCnt = 0; $addCnt = 0; $eDir = $this->_checkDir($this->formDir); if ($eDir !== false) { $model = $this->loader->getModels()->getOpenRosaFormModel(); while (false !== ($filename = $eDir->read())) { if (substr($filename, -4) == '.xml') { $formCnt++; $form = new \OpenRosa_Tracker_Source_OpenRosa_Form($this->formDir . $filename); $filter['gof_form_id'] = $form->getFormID(); $filter['gof_form_version'] = $form->getFormVersion(); $forms = $model->load($filter); if (!$forms) { $newValues = array(); $newValues['gof_id'] = null; $newValues['gof_form_id'] = $form->getFormID(); $newValues['gof_form_version'] = $form->getFormVersion(); $newValues['gof_form_title'] = $form->getTitle(); $newValues['gof_form_xml'] = $filename; $newValues = $model->save($newValues); if (\Gems_Tracker::$verbose) { \MUtil_Echo::r($newValues, 'added form'); } $addCnt++; } } } } $cache = GemsEscort::getInstance()->cache; $cache->clean(); $messages[] = sprintf('Checked %s forms and added %s forms', $formCnt, $addCnt); }
/** * Creates the model * * @return \MUtil_Model_ModelAbstract */ protected function createModel() { if (!$this->model instanceof \Gems_Model_StaffModel) { $this->model = $this->loader->getModels()->getStaffModel(false); $this->model->applyOwnAccountEdit(); } return $this->model; }
/** * Creates the model * * @return \MUtil_Model_ModelAbstract */ protected function createModel() { if (!$this->model instanceof \Gems_Model_RespondentModel) { $this->model = $this->loader->getModels()->createRespondentModel(); $this->model->applyBrowseSettings(); } return $this->model; }
/** * Called after the check that all required registry values * have been set correctly has run. * * @return void */ public function afterRegistry() { parent::afterRegistry(); $this->model = $this->loader->getModels()->getRespondentModel(true); if ($this->addLoginCheck) { $this->model->addLoginCheck(); } // Load the data $this->refresh(); }
/** * Creates the model * * @return \MUtil_Model_ModelAbstract */ protected function createModel() { if (!$this->model instanceof \Gems_Model_AppointmentModel) { $this->model = $this->loader->getModels()->createAppointmentModel(); $this->model->applyBrowseSettings(); } $this->model->addColumn(new \Zend_Db_Expr("CONVERT(gap_admission_time, DATE)"), 'date_only'); $this->model->set('date_only', 'dateFormat', \Zend_Date::WEEKDAY . ' ' . \Zend_Date::DAY_SHORT . ' ' . \Zend_Date::MONTH_NAME . ' ' . \Zend_Date::YEAR); $this->model->set('gap_admission_time', 'label', $this->_('Time'), 'dateFormat', 'HH:mm'); $this->model->set('gr2o_patient_nr', 'label', $this->_('Respondent nr')); \Gems_Model_RespondentModel::addNameToModel($this->model, $this->_('Name')); // \MUtil_Model::$verbose = true; return $this->model; }
/** * Creates a model for getModel(). Called only for each new $action. * * The parameters allow you to easily adapt the model to the current action. The $detailed * parameter was added, because the most common use of action is a split between detailed * and summarized actions. * * @param boolean $detailed True when the current action is not in $summarizedActions. * @param string $action The current action. * @return \MUtil_Model_ModelAbstract */ public function createModel($detailed, $action) { if ($this->escort instanceof \Gems_Project_Layout_MultiLayoutInterface) { $styles = \MUtil_Lazy::call(array($this->escort, 'getStyles')); } else { $styles = array(); } $model = $this->loader->getModels()->getOrganizationModel($styles); if ($detailed) { if ('create' == $action || 'edit' == $action) { $model->applyEditSettings(); } else { $model->applyDetailSettings(); } } else { $model->applyBrowseSettings(); } return $model; }
/** * Exports a single respondent * * @param string $respondentId */ protected function _exportRespondent($respondentId) { $respondentModel = $this->loader->getModels()->getRespondentModel(false); //Insert orgId when set if (is_array($respondentId) && isset($respondentId['gr2o_id_organization'])) { $filter['gr2o_id_organization'] = $respondentId['gr2o_id_organization']; $respondentId = $respondentId['gr2o_patient_nr']; } else { // Or accept to find in current organization // $filter['gr2o_id_organization'] = $this->currentUser->getCurrentOrganizationId(); // Or use any allowed organization? $filter['gr2o_id_organization'] = array_keys($this->currentUser->getAllowedOrganizations()); } $filter['gr2o_patient_nr'] = $respondentId; $respondentModel->setFilter($filter); $respondentData = $respondentModel->loadFirst(); $this->html->snippet($this->_respondentSnippet, 'model', $respondentModel, 'data', $respondentData, 'respondentId', $respondentId); $tracker = $this->loader->getTracker(); $tracks = $tracker->getRespondentTracks($respondentData['gr2o_id_user'], $respondentData['gr2o_id_organization']); foreach ($tracks as $trackId => $track) { $this->_exportTrack($track); } }
/** * Creates a model for getModel(). Called only for each new $action. * * The parameters allow you to easily adapt the model to the current action. The $detailed * parameter was added, because the most common use of action is a split between detailed * and summarized actions. * * @param boolean $detailed True when the current action is not in $summarizedActions. * @param string $action The current action. * @return \MUtil_Model_ModelAbstract */ protected function createModel($detailed, $action) { $model = $this->loader->getModels()->createRespondentModel(); if (!$detailed) { return $model->applyBrowseSettings(); } switch ($action) { case 'create': case 'edit': case 'import': return $model->applyEditSettings(); case 'delete': default: return $model->applyDetailSettings(); } }
/** * Get the relation object if any * * @return Gems_Model_RespondentRelationInstance */ public function getRelation() { if (is_null($this->_relation) || $this->_relation->getRelationId() !== $this->getRelationId()) { $model = $this->loader->getModels()->getRespondentRelationModel(); $relationObject = $model->getRelation($this->getRespondentId(), $this->getRelationId()); $this->_relation = $relationObject; } return $this->_relation; }
/** * Get the comm Model */ public function createModel() { return $this->loader->getModels()->getCommTemplateModel(); }