/** * @return string * @throws NotSupportedException */ protected function renderValueContent() { $params = array('inputPrefix' => $this->inputPrefixData); $valueElementType = $this->model->getValueElementType(); if ($valueElementType != null) { $valueElementClassName = $valueElementType . 'Element'; $valueElement = new $valueElementClassName($this->model, 'value', $this->form, $params); if ($valueElement instanceof NameIdElement) { $valueElement->setIdAttributeId('value'); $valueElement->setNameAttributeName('stringifiedModelForValue'); } if ($valueElement instanceof MixedDropDownTypesForWorkflowActionAttributeElement) { $valueElement->editableTemplate = '<div class="value-data">{content}{error}</div>'; } elseif ($valueElement instanceof MixedDateTypesForWorkflowActionAttributeElement || $valueElement instanceof MixedDateTimeTypesForWorkflowActionAttributeElement) { $valueElement->editableTemplate = '<div class="value-data has-date-inputs">{content}{error}</div>'; } else { $startingDivStyleFirstValue = null; if ($this->model->type == WorkflowActionAttributeForm::TYPE_STATIC_NULL) { $startingDivStyleFirstValue = "display:none;"; $valueElement->params['disabled'] = 'disabled'; } $valueElement->editableTemplate = '<div class="value-data"><div class="first-value-area" style="' . $startingDivStyleFirstValue . '">{content}{error}</div></div>'; } return $valueElement->render(); } }
public function validateValue() { if (parent::validateValue()) { $validator = CValidator::createValidator('type', $this, 'value', array('type' => 'integer')); $validator->allowEmpty = false; $validator->validate($this); return !$this->hasErrors(); } return false; }
/** * Value can either be date or if dynamic, then it is an integer * @return bool */ public function validateValue() { if (parent::validateValue()) { if ($this->type == self::TYPE_STATIC) { $validator = CValidator::createValidator('type', $this, 'value', array('type' => 'integer')); $validator->allowEmpty = false; $validator->validate($this); return !$this->hasErrors(); } else { if ($this->value != null) { $this->addError('value', Zurmo::t('WorkflowsModule', 'Value cannot be set')); return false; } return true; } } return false; }
/** * @param WorkflowActionProcessingModelAdapter $adapter * @param $attribute */ public function resolveNullAlternativeValueAndSetToModel(WorkflowActionProcessingModelAdapter $adapter, $attribute) { assert('is_string($attribute)'); parent::resolveNullAlternativeValueAndSetToModel($adapter, $attribute); if ($adapter->getModel()->{$attribute} === null) { $adapter->getModel()->{$attribute} = '0000-00-00'; } }
/** * @return array */ public function attributeLabels() { return array_merge(parent::attributeLabels(), array('durationInterval' => Zurmo::t('Core', 'Interval'))); }
/** * Override to make sure the value attribute is set as a url value */ public function rules() { return array_merge(parent::rules(), array(array('value', 'url'))); }
/** * Override to make sure the value attribute is set as an integer value */ public function rules() { return array_merge(parent::rules(), array(array('value', 'type', 'type' => 'integer'))); }
/** * Override to make sure value is a float and adding in additional attribute rules */ public function rules() { return array_merge(parent::rules(), array(array('value', 'type', 'type' => 'float'), array('currencyId', 'type', 'type' => 'integer'), array('currencyIdType', 'validateCurrencyId'), array('currencyIdType', 'type', 'type' => 'string'), array('currencyIdType', 'required'))); }