/** * Set those values needed for editing * * @return \Gems\Tracker\Model\FieldMaintenanceModel (continuation pattern) */ public function applyEditSettings() { $this->applyDetailSettings(); $this->set('gtf_id_field', 'elementClass', 'Hidden'); $this->set('gtf_id_track', 'elementClass', 'Exhibitor'); $this->set('gtf_field_type', 'elementClass', 'Exhibitor'); $this->set('gtf_field_name', 'elementClass', 'Text', 'size', '30', 'minlength', 2, 'required', true, 'validator', $this->createUniqueValidator(array('gtf_field_name', 'gtf_id_track'))); $this->set('gtf_id_order', 'elementClass', 'Text', 'validators[int]', 'Int', 'validators[gt]', new \Zend_Validate_GreaterThan(0), 'validators[unique]', $this->createUniqueValidator(array('gtf_id_order', 'gtf_id_track'))); $this->set('gtf_field_code', 'elementClass', 'Text', 'minlength', 4); $this->set('gtf_field_description', 'elementClass', 'Text', 'size', 30); $this->set('gtf_field_values', 'elementClass', 'Hidden'); $this->set('gtf_to_track_info', 'elementClass', 'CheckBox', 'onclick', 'this.form.submit();'); $this->set('gtf_track_info_label', 'elementClass', 'CheckBox', 'required', false); $this->set('gtf_required', 'elementClass', 'CheckBox'); $this->set('gtf_readonly', 'elementClass', 'CheckBox'); $this->set('gtf_filter_id', 'elementClass', 'Hidden'); $this->set('gtf_min_diff_length', 'elementClass', 'Hidden'); $this->set('gtf_min_diff_unit', 'elementClass', 'Hidden'); $this->set('gtf_max_diff_length', 'elementClass', 'Hidden'); $this->set('gtf_max_diff_unit', 'elementClass', 'Hidden'); $this->set('gtf_after_next', 'elementClass', 'None'); // Deprecatedin 1.7.1 $this->set('gtf_uniqueness', 'elementClass', 'Hidden'); $this->set('gtf_create_track', 'elementClass', 'Hidden'); $this->set('gtf_create_wait_days', 'elementClass', 'Hidden'); $class = 'Model\\Dependency\\FieldTypeChangeableDependency'; $dependency = $this->tracker->createTrackClass($class, $this->_modelField); $this->addDependency($dependency); }
/** * Get all the round objects * * @return array of roundId => \Gems\Tracker\Round */ public function getRounds() { $this->_ensureRounds(); foreach ($this->_rounds as $roundId => $roundData) { if (!isset($this->_roundObjects[$roundId])) { $this->_roundObjects[$roundId] = $this->tracker->createTrackClass('Round', $roundData); } } return $this->_roundObjects; }
/** * Get the round object * * @param int $roundId Gems round id * @return \Gems\Tracker\Round */ public function getRound($roundId) { $this->_ensureRounds(); if (!isset($this->_rounds[$roundId])) { return null; } if (!isset($this->_roundObjects[$roundId])) { $this->_roundObjects[$roundId] = $this->tracker->createTrackClass('Round', $this->_rounds[$roundId]); } return $this->_roundObjects[$roundId]; }
/** * Returns a model that can be used to retrieve or save the field definitions for the track editor. * * @param boolean $detailed Create a model for the display of detailed item data or just a browse table * @param string $action The current action * @return \Gems\Tracker\Model\FieldMaintenanceModel */ public function getMaintenanceModel($detailed = false, $action = 'index') { if (isset($this->_maintenanceModels[$action])) { return $this->_maintenanceModels[$action]; } $model = $this->tracker->createTrackClass('Model\\FieldMaintenanceModel'); if ($detailed) { if ('edit' === $action || 'create' === $action) { $model->applyEditSettings(); if ('create' === $action) { $model->set('gtf_id_track', 'default', $this->_trackId); // Set the default round order // Load last row $row = $model->loadFirst(array('gtf_id_track' => $this->_trackId), array('gtf_id_order' => SORT_DESC), false); if ($row && isset($row['gtf_id_order'])) { $newOrder = $row['gtf_id_order'] + 10; $model->set('gtf_id_order', 'default', $newOrder); } } } else { $model->applyDetailSettings(); } } else { $model->applyBrowseSettings(); } $this->_maintenanceModels[$action] = $model; return $model; }