public function getTemplateVars($values, $fieldNamePostfix = '', $idPrefix = '')
 {
     $ret = parent::getTemplateVars($values, $fieldNamePostfix, $idPrefix);
     require_once 'vendor/koala-framework/recaptcha-php/recaptchalib.php';
     $ret['html'] = "<div data-fieldname=\"" . $this->getFieldName() . $fieldNamePostfix . "\">" . recaptcha_get_html(Kwf_Config::getValue('recaptcha.publicKey')) . "</div>";
     return $ret;
 }
示例#2
0
 public function getTemplateVars($values, $fieldNamePostfix = '', $idPrefix = '')
 {
     $ret = parent::getTemplateVars($values, $fieldNamePostfix, $idPrefix);
     $ret['id'] = $idPrefix . $this->getFieldName() . $fieldNamePostfix;
     $cls = $this->getCls();
     $ret['html'] = "<div class=\"{$cls}\">" . $this->getText() . "</div>";
     return $ret;
 }
 public function validate($row, $postData)
 {
     $ret = parent::validate($row, $postData);
     if (isset($this->_validators['samePassword'])) {
         $password1 = $postData[$this->_passwordField1->getFieldName()];
         $password2 = $postData[$this->_passwordField2->getFieldName()];
         $validator = $this->_validators['samePassword'];
         if (!$validator->isValid(array($password1, $password2))) {
             $ret[] = array('messages' => $validator->getMessages(), 'field' => $this->_passwordField1);
         }
     }
     return $ret;
 }
 public function validate($row, $postData)
 {
     $ret = parent::validate($row, $postData);
     $data = $this->_getValueFromPostData($postData);
     if (!is_string($data)) {
         return $ret;
     }
     $data = Zend_Json::decode($data);
     $dimensions = $this->getDimensions();
     reset($dimensions);
     if ($this->getAllowBlank() === false || $this->getAllowBlank() === 0 || $this->getAllowBlank() === '0') {
         if (!isset($dimensions[$data['dimension']])) {
             $ret[] = array('message' => trlKwf("Please fill out the field"), 'field' => $this);
         }
     }
     if (!empty($data['dimension'])) {
         $dimension = $dimensions[$data['dimension']];
     } else {
         $dimension = current($dimensions);
     }
     return $ret;
 }
 public function getTemplateVars($values, $fieldNamePostfix = '', $idPrefix = '')
 {
     $ret = parent::getTemplateVars($values, $fieldNamePostfix, $idPrefix);
     $ret['items'] = $this->fields->getTemplateVars($values, $fieldNamePostfix, $idPrefix);
     return $ret;
 }
 public function getTemplateVars($values, $namePostfix = '', $idPrefix = '')
 {
     $ret = parent::getTemplateVars($values, $namePostfix, $idPrefix);
     $name = $this->getFieldName();
     $value = $values[$name];
     $ret['preHtml'] = '<input type="hidden" name="' . $name . '_num' . $namePostfix . '" value="' . count($value) . '" />';
     if (is_null($this->getAllowAdd()) || $this->getAllowAdd()) {
         $ret['postHtml'] = '<div class="addLayer"><div class="submitWrapper"><span class="beforeButton"></span><span class="button"><button class="submit add" type="submit" name="' . $name . '_add' . $namePostfix . '" value="1">' . trlKwf("New Entry") . '</button></span><span class="afterButton"></span></div></div>';
     }
     $ret['items'] = array();
     foreach ($value as $i => $rowValues) {
         $ret['items'][] = array('preHtml' => "<div class=\"kwfFormFieldMultiFieldsRow\">\n", 'item' => null);
         $ret['items'] = array_merge($ret['items'], $this->fields->getTemplateVars($rowValues, $namePostfix . "[{$i}]", $idPrefix));
         if (is_null($this->getAllowDelete()) || $this->getAllowDelete()) {
             $ret['items'][] = array('postHtml' => "</div>\n", 'html' => '<button class="delete" type="submit" name="' . $name . '_del' . $namePostfix . '" value="' . $i . '">' . trlKwf("Delete Entry") . '</button>', 'item' => null);
         }
     }
     return $ret;
 }
 public function prepareSave(Kwf_Model_Row_Interface $row, $postData)
 {
     Kwf_Form_Field_Abstract::prepareSave($row, $postData);
 }
 public function getName()
 {
     $name = parent::getName();
     if (!$name) {
         $name = $this->getTableName();
     }
     return $name;
 }
 public function __construct($field_name = null, $field_label = null, $ruleKey = null)
 {
     parent::__construct($field_name, $field_label);
     $this->setXtype('imageviewer');
     $this->setRuleKey($ruleKey);
 }
 public function getMetaData($model)
 {
     $ret = parent::getMetaData($model);
     $ret['items'] = array($this->getFilterField()->getMetaData($model), $this->getFilteredField()->getMetaData($model));
     return $ret;
 }
 public function getTemplateVars($values, $fieldNamePostfix = '', $idPrefix = '')
 {
     $ret = parent::getTemplateVars($values, $fieldNamePostfix, $idPrefix);
     $helper = new Kwf_View_Helper_FormField();
     $ret['html'] = '<div class="kwfFormFieldMultiCheckbox kwfFormFieldMultiCheckbox' . ucfirst($this->getOutputType()) . '"';
     $ret['html'] .= ' data-fieldname="' . $this->getFieldName() . $fieldNamePostfix . '"';
     $ret['html'] .= '>';
     $fields = $this->_getFields()->getTemplateVars($values, $fieldNamePostfix, $idPrefix);
     $i = 0;
     foreach ($fields as $field) {
         $ret['html'] .= '<div class="checkboxItem' . ($i == 0 ? ' first' : '') . '">' . $helper->returnFormField($field) . '</div>';
         $i++;
     }
     $ret['html'] .= '<div class="checkboxItemEnd"></div>';
     if ($this->getShowCheckAllLinks()) {
         $ret['html'] .= '<div class="checkAllLinksWrapper">' . '<a href="#" class="kwfMultiCheckboxCheckAll">' . $this->getCheckAllText() . '</a>' . ' / ' . '<a href="#" class="kwfMultiCheckboxCheckNone">' . $this->getCheckNoneText() . '</a>' . '</div>';
     }
     $ret['html'] .= '</div>';
     return $ret;
 }
 public function getMetaData($model)
 {
     $ret = parent::getMetaData($model);
     unset($ret['allowTags']);
     return $ret;
 }