コード例 #1
0
 /**
  * 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)
 {
     $rcLib = $this->util->getReceptionCodeLibrary();
     $yesNo = $this->util->getTranslated()->getYesNo();
     $model = new \MUtil_Model_TableModel('gems__reception_codes');
     $model->copyKeys();
     // The user can edit the keys.
     $model->set('grc_id_reception_code', 'label', $this->_('Code'), 'size', '10');
     $model->set('grc_description', 'label', $this->_('Description'), 'size', '30');
     $model->set('grc_success', 'label', $this->_('Is success code'), 'multiOptions', $yesNo, 'elementClass', 'CheckBox', 'description', $this->_('This reception code is a success code.'));
     $model->set('grc_active', 'label', $this->_('Active'), 'multiOptions', $yesNo, 'elementClass', 'CheckBox', 'description', $this->_('Only active codes can be selected.'));
     if ($detailed) {
         $model->set('desc1', 'elementClass', 'Html', 'label', ' ', 'value', \MUtil_Html::create('h4', $this->_('Can be assigned to')));
     }
     $model->set('grc_for_respondents', 'label', $this->_('Respondents'), 'multiOptions', $yesNo, 'elementClass', 'CheckBox', 'description', $this->_('This reception code can be assigned to a respondent.'));
     $model->set('grc_for_tracks', 'label', $this->_('Tracks'), 'multiOptions', $yesNo, 'elementClass', 'CheckBox', 'description', $this->_('This reception code can be assigned to a track.'));
     $model->set('grc_for_surveys', 'label', $this->_('Tokens'), 'multiOptions', $rcLib->getSurveyApplicationValues(), 'description', $this->_('This reception code can be assigned to a token.'));
     if ($detailed) {
         $model->set('desc2', 'elementClass', 'Html', 'label', ' ', 'value', \MUtil_Html::create('h4', $this->_('Additional actions')));
     }
     $model->set('grc_redo_survey', 'label', $this->_('Redo survey'), 'multiOptions', $rcLib->getRedoValues(), 'description', $this->_('Redo a survey on this reception code.'));
     $model->set('grc_overwrite_answers', 'label', $this->_('Overwrite existing consents'), 'multiOptions', $yesNo, 'elementClass', 'CheckBox', 'description', $this->_('Remove the consent from already answered surveys.'));
     if ($detailed) {
         $model->set('grc_id_reception_code', 'validator', $model->createUniqueValidator('grc_id_reception_code'));
         $model->set('grc_description', 'validator', $model->createUniqueValidator('grc_description'));
     }
     if ($this->project->multiLocale) {
         $model->set('grc_description', 'description', 'ENGLISH please! Use translation file to translate.');
     }
     \Gems_Model::setChangeFieldsByPrefix($model, 'grc');
     return $model;
 }
コード例 #2
0
 /**
  * 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)
 {
     $model = new \MUtil_Model_TableModel('gems__consents');
     $model->copyKeys();
     // The user can edit the keys.
     $model->set('gco_description', 'label', $this->_('Description'), 'size', '10');
     $model->set('gco_order', 'label', $this->_('Order'), 'size', '10', 'description', $this->_('Determines order of presentation in interface.'), 'validator', 'Digits');
     $model->set('gco_code', 'label', $this->_('Consent code'), 'multiOptions', $this->util->getConsentTypes(), 'description', $this->_('Internal code, not visible to users, copied with the token information to the source.'));
     if ($detailed) {
         $model->set('gco_description', 'validator', $model->createUniqueValidator('gco_description'));
         $model->set('gco_order', 'validator', $model->createUniqueValidator('gco_order'));
     }
     if ($this->project->multiLocale) {
         $model->set('gco_description', 'description', 'ENGLISH please! Use translation file to translate.');
     }
     \Gems_Model::setChangeFieldsByPrefix($model, 'gco');
     return $model;
 }