コード例 #1
0
 /**
  * Overrule to implement snippet specific filtering and sorting.
  *
  * @param \MUtil_Model_ModelAbstract $model
  */
 protected function processFilterAndSort(\MUtil_Model_ModelAbstract $model)
 {
     parent::processFilterAndSort($model);
     $appId = $this->request->getParam(\Gems_Model::APPOINTMENT_ID);
     if ($appId) {
         $appKeyPrefix = $this->db->quote(FieldsDefinition::makeKey(FieldMaintenanceModel::APPOINTMENTS_NAME, ''));
         $appSource = $this->db->quote(\Gems_Tracker_Engine_StepEngineAbstract::APPOINTMENT_TABLE);
         $or[] = $this->db->quoteInto("gro_valid_after_source = {$appSource} AND\n                        (gto_id_respondent_track, gro_valid_after_field) IN\n                            (SELECT gr2t2a_id_respondent_track, CONCAT({$appKeyPrefix}, gr2t2a_id_app_field)\n                                FROM gems__respondent2track2appointment\n                                WHERE gr2t2a_id_appointment = ?)", $appId);
         $or[] = $this->db->quoteInto("gro_valid_for_source = {$appSource} AND\n                        (gto_id_respondent_track, gro_valid_for_field) IN\n                            (SELECT gr2t2a_id_respondent_track, CONCAT({$appKeyPrefix}, gr2t2a_id_app_field)\n                                FROM gems__respondent2track2appointment\n                                WHERE gr2t2a_id_appointment = ?)", $appId);
     }
     $model->addFilter(array('(' . implode(') OR (', $or) . ')'));
 }
コード例 #2
0
 /**
  * The place to check if the data set in the snippet is valid
  * to generate the snippet.
  *
  * When invalid data should result in an error, you can throw it
  * here but you can also perform the check in the
  * checkRegistryRequestsAnswers() function from the
  * {@see \MUtil_Registry_TargetInterface}.
  *
  * @return boolean
  */
 public function hasHtmlOutput()
 {
     if ($this->menu) {
         $default = $this->project->getDefaultTrackId();
         if ($default) {
             if ($this->respondent->getReceptionCode()->isSuccess()) {
                 $track = $this->loader->getTracker()->getTrackEngine($default);
                 if ($track->isUserCreatable()) {
                     $list = $this->menu->getMenuList()->addByController('track', 'create', sprintf($this->_('Add %s track to this respondent'), $track->getTrackName()))->addParameterSources(array(\Gems_Model::TRACK_ID => $default, 'gtr_id_track' => $default, 'track_can_be_created' => 1), $this->request);
                     $this->onEmpty = $list->getActionLink('track', 'create');
                 }
             }
         }
         if (!$this->onEmpty) {
             if ($this->respondent->getReceptionCode()->isSuccess()) {
                 $list = $this->menu->getMenuList()->addByController('track', 'show-track', $this->_('Add a track to this respondent'))->addParameterSources($this->request);
                 $this->onEmpty = $list->getActionLink('track', 'show-track');
             } else {
                 $this->onEmpty = \MUtil_Html::create('em', $this->_('No valid tokens found'));
             }
         }
     }
     return parent::hasHtmlOutput();
 }
コード例 #3
0
 public function createModel()
 {
     $model = parent::createModel();
     if (!$model->has('forgroup')) {
         $model->addColumn('gems__groups.ggp_name', 'forgroup');
     }
     return $model;
 }