protected function _getValueFromPostData($postData) { $ret = parent::_getValueFromPostData($postData); if ($ret == '' || $ret == 'null') { $ret = null; } return $ret; }
public function getTemplateVars($values, $fieldNamePostfix = '', $idPrefix = '') { $ret = parent::getTemplateVars($values, $fieldNamePostfix, $idPrefix); $name = $this->getFieldName(); $valueYear = 0; $valueMonth = 0; $valueDay = 0; $value = isset($values[$name]) ? $values[$name] : $this->getDefaultValue(); if ($value) { $value = strtotime($value); if ($value) { $valueYear = (int) date('Y', $value); $valueMonth = (int) date('m', $value); $valueDay = (int) date('d', $value); } } $kwfTrl = Kwf_Trl::getInstance(); $ret['id'] = $idPrefix . str_replace(array('[', ']'), array('_', '_'), $name . $fieldNamePostfix); $ret['html'] = "<select name=\"{$name}_day\">"; $ret['html'] .= "<option value=\"\">{$kwfTrl->trlKwf('Day', array(), $this->_language)}</option>"; for ($i = 1; $i <= 31; $i++) { $v = str_pad($i, 2, '0', STR_PAD_LEFT); $ret['html'] .= "<option value=\"{$v}\""; if ($i == $valueDay) { $ret['html'] .= ' selected="selected"'; } $ret['html'] .= ">{$i}</option>"; } $ret['html'] .= "</select>"; $ret['html'] = '<div class="outerSelect day">' . $ret['html'] . '</div><div class="outerSelect month">'; $months = array($kwfTrl->trlKwf('January', array(), $this->_language), $kwfTrl->trlKwf('February', array(), $this->_language), $kwfTrl->trlKwf('March', array(), $this->_language), $kwfTrl->trlKwf('April', array(), $this->_language), $kwfTrl->trlKwf('May', array(), $this->_language), $kwfTrl->trlKwf('June', array(), $this->_language), $kwfTrl->trlKwf('July', array(), $this->_language), $kwfTrl->trlKwf('August', array(), $this->_language), $kwfTrl->trlKwf('September', array(), $this->_language), $kwfTrl->trlKwf('October', array(), $this->_language), $kwfTrl->trlKwf('November', array(), $this->_language), $kwfTrl->trlKwf('December', array(), $this->_language)); $ret['html'] .= "<select name=\"{$name}_month\">"; $ret['html'] .= "<option value=\"\">{$kwfTrl->trlKwf('Month', array(), $this->_language)}</option>"; for ($i = 1; $i <= 12; $i++) { $v = str_pad($i, 2, '0', STR_PAD_LEFT); $ret['html'] .= "<option value=\"{$v}\""; if ($i == $valueMonth) { $ret['html'] .= ' selected="selected"'; } $ret['html'] .= ">{$months[$i - 1]}</option>"; } $ret['html'] .= "</select>"; $ret['html'] = $ret['html'] . '</div><div class="outerSelect year">'; $ret['html'] .= "<select name=\"{$name}_year\">"; $ret['html'] .= "<option value=\"\">{$kwfTrl->trlKwf('Year', array(), $this->_language)}</option>"; for ($i = date('Y'); $i >= 1900; $i--) { $ret['html'] .= "<option value=\"{$i}\""; if ($i == $valueYear) { $ret['html'] .= ' selected="selected"'; } $ret['html'] .= ">{$i}</option>"; } $ret['html'] .= "</select>"; $ret['html'] = $ret['html'] . '</div>'; return $ret; }
public function getTemplateVars($values, $fieldNamePostfix = '', $idPrefix = '') { $name = $this->getFieldName(); $value = (string) $values[$name]; $ret = parent::getTemplateVars($values, $fieldNamePostfix, $idPrefix); $value = htmlspecialchars($value); $name = htmlspecialchars($name); $ret['html'] = "<input type=\"hidden\" " . "name=\"{$name}{$fieldNamePostfix}\" value=\"{$value}\" />"; return $ret; }
public function getTemplateVars($values, $fieldNamePostfix = '', $idPrefix = '') { $name = $this->getFieldName(); $value = $values[$name]; if (!$value) { $value = trlKwf('hh:mm'); } $ret = parent::getTemplateVars($values, $fieldNamePostfix, $idPrefix); $value = htmlspecialchars($value); $name = htmlspecialchars($name); $ret['id'] = $idPrefix . str_replace(array('[', ']'), array('_', '_'), $name . $fieldNamePostfix); $ret['html'] = "<input type=\"text\" id=\"{$ret['id']}\" name=\"{$name}{$fieldNamePostfix}\" value=\"{$value}\" style=\"width: {$this->getWidth()}px\" maxlength=\"{$this->getMaxLength()}\"/>"; return $ret; }
public function getTemplateVars($values, $fieldNamePostfix = '', $idPrefix = '') { $name = $this->getFieldName(); $value = $this->_getOutputValueFromValues($values); $ret = parent::getTemplateVars($values, $fieldNamePostfix, $idPrefix); $class = ''; $v = strtotime($value); if ($v) { $value = date(trlKwf('Y-m-d'), $v); } $value = htmlspecialchars($value); $name = htmlspecialchars($name); $ret['id'] = $idPrefix . str_replace(array('[', ']'), array('_', '_'), $name . $fieldNamePostfix); $ret['html'] = "<input class=\"{$class}\" type=\"text\" id=\"{$ret['id']}\" name=\"{$name}{$fieldNamePostfix}\" value=\"{$value}\" " . "style=\"width: {$this->getWidth()}px\" maxlength=\"{$this->getMaxLength()}\" " . "placeholder=\"" . $this->getPlaceholderText() . "\" />"; return $ret; }
public function getTemplateVars($values, $fieldNamePostfix = '', $idPrefix = '') { $name = $this->getFieldName(); $value = isset($values[$name]) ? $values[$name] : $this->getDefaultValue(); $ret = parent::getTemplateVars($values, $fieldNamePostfix, $idPrefix); //todo: escapen $ret['id'] = $idPrefix . str_replace(array('[', ']'), array('_', '_'), $name . $fieldNamePostfix); $ret['html'] = "<input type=\"checkbox\" id=\"{$ret['id']}\" name=\"{$name}{$fieldNamePostfix}\" "; if ($value) { $ret['html'] .= 'checked="checked" '; } $ret['html'] .= "/>"; if ($this->getBoxLabel()) { $ret['html'] .= ' <label class="boxLabel" for="' . $ret['id'] . '">' . $this->getBoxLabel() . '</label>'; } $ret['html'] .= "<input type=\"hidden\" name=\"{$name}{$fieldNamePostfix}-post\" value=\"1\" />"; return $ret; }
public function getTemplateVars($values, $fieldNamePostfix = '', $idPrefix = '') { $name = $this->getFieldName(); $value = isset($values[$name]) ? (string) $values[$name] : $this->getDefaultValue(); $ret = Kwf_Form_Field_SimpleAbstract::getTemplateVars($values, $fieldNamePostfix, $idPrefix); //todo: escapen $ret['id'] = $idPrefix . str_replace(array('[', ']'), array('_', '_'), $name . $fieldNamePostfix); $ret['html'] = "<textarea id=\"{$ret['id']}\" name=\"{$name}{$fieldNamePostfix}\" "; $width = $this->getWidth(); if (is_numeric($width)) { $width .= 'px'; } $style = ''; if ($width) { $style .= 'width: ' . $width . ';'; } if ($this->getHeight()) { $style .= 'height: ' . $this->getHeight() . 'px;'; } if ($style !== '') { $ret['html'] .= "style=\"{$style}\""; } $cls = $this->getCls(); if ($this->getClearOnFocus() && $value == $this->getDefaultValue()) { $cls .= ' kwfUp-kwfClearOnFocus'; } if ($cls) { $ret['html'] .= ' class="' . trim($cls) . '"'; } if ($this->getEmptyText()) { $ret['html'] .= ' placeholder="' . htmlspecialchars($this->getEmptyText()) . '"'; } $ret['html'] .= '>'; $ret['html'] .= htmlspecialchars($value); $ret['html'] .= "</textarea>"; return $ret; }
public function __construct($field_name = null, $field_label = null) { parent::__construct($field_name, $field_label); $this->setXtype('colorpickerfield'); }
public function getTemplateVars($values, $fieldNamePostfix = '', $idPrefix = '') { $ret = parent::getTemplateVars($values, $fieldNamePostfix, $idPrefix); $prop = $this->_getInputProperties($values, $fieldNamePostfix, $idPrefix); if (isset($prop['id'])) { $ret['id'] = $prop['id']; } $ret['html'] = "<input"; foreach ($prop as $k => $i) { $ret['html'] .= ' ' . htmlspecialchars($k) . '="' . htmlspecialchars($i) . '"'; } $ret['html'] .= " />"; return $ret; }
protected function _addValidators() { parent::_addValidators(); $this->addValidator(new Zend_Validate_Regex("#^(()|(-?[0-9]+\\.[0-9]*;-?[0-9]+\\.[0-9]*))\$#")); }
/** * can be used to set a specific renderer * * e.g '{value:date}' * to use the date renderer * * @param string template */ public function setTpl($tpl) { $ret = parent::setTpl($tpl); return $ret; }
public function getTemplateVars($values, $namePostfix = '', $idPrefix = '') { $name = $this->getFieldName(); $value = isset($values[$name]) ? $values[$name] : null; $ret = parent::getTemplateVars($values, $namePostfix, $idPrefix); $fileSizeLimit = $this->getFileSizeLimit(); $name = htmlspecialchars($name); $ret['id'] = $idPrefix . str_replace(array('[', ']'), array('_', '_'), $name . $namePostfix); $ret['html'] = "<div class=\"kwfFormFieldFileInnerImg\">\n"; if ($value) { $ret['html'] .= "<input type=\"hidden\" name=\"{$name}_upload_id{$namePostfix}\" " . " value=\"{$value['uploadId']}_{$value['hashKey']}\" />"; if ($value['image']) { //todo: width und height von image $ret['html'] .= " <img src=\"/kwf/media/upload/preview?uploadId={$value['uploadId']}&hashKey={$value['hashKey']}&size=frontend\" alt=\"\" width=\"100\" height=\"100\" />"; } } $ret['html'] .= '</div>'; $ret['html'] .= "<div class=\"kwfFormFieldFileInnerContent\">\n"; $ret['html'] .= '<div class="kwfFormFieldFieldDropText">' . $this->getDropText() . '</div>'; $ret['html'] .= "<div class=\"imagePath kwfFormFieldFileUploadWrapper\">\n"; $ret['html'] .= "<input class=\"fileSelector\" type=\"file\" id=\"{$ret['id']}\" name=\"{$name}{$namePostfix}\" " . " data-file-size-limit=\"{$fileSizeLimit}\" " . " style=\"width: {$this->getWidth()}px\" onchange=\"document.getElementById(this.id+'_underlayText').value = this.value;\" />"; $ret['html'] .= '<div class="underlayFileSelector">'; $ret['html'] .= '<input type="text" id="' . $ret['id'] . '_underlayText" class="kwfFormFieldFileUnderlayText" style="width: ' . $this->getWidth() . 'px;" />'; $ret['html'] .= ' <a href="#" class="kwfFormFieldFileUploadButton" onclick="return false;">' . $this->getFrontendButtonText() . '</a>'; $ret['html'] .= '</div>'; $ret['html'] .= '</div>'; if ($value) { $ret['html'] .= "<div class=\"imageTitle\">\n"; $ret['html'] .= '' . $value['filename'] . '.' . $value['extension']; $helper = new Kwf_View_Helper_FileSize(); $ret['html'] .= ' (' . $helper->fileSize($value['fileSize']) . ')'; $ret['html'] .= '</div>'; $ret['html'] .= '<div class="deleteImage"><button class="deleteImage" type="submit" name="' . $name . '_del' . $namePostfix . '" value="1">' . trlKwf("Delete") . '</button></div>'; $uploadId = $value['uploadId']; $hashKey = '_' . $value['hashKey']; } else { $uploadId = '0'; $hashKey = ''; } $ret['html'] .= "<input type=\"hidden\" class=\"kwfUploadIdField\" name=\"{$name}_upload_id{$namePostfix}\" " . " value=\"{$uploadId}{$hashKey}\" />"; $ret['html'] .= '</div>'; return $ret; }
protected function _addValidators() { parent::_addValidators(); //TODO: $this->addValidator(new Zend_Validate_Date()); }
protected function _addValidators() { parent::_addValidators(); $this->addValidator(new Zend_Validate_Int()); }
protected function _addValidators() { parent::_addValidators(); unset($this->_validators['noNewline']); unset($this->_validators['noTags']); }
protected function _addValidators() { Kwf_Form_Field_SimpleAbstract::_addValidators(); }