Example #1
0
 /**
  * (non-PHPdoc)
  * @see \Simplify\Form\Element::onRender()
  */
 public function onRender(\Simplify\Form\Action $action, $data, $index)
 {
     $this->set('minLength', $this->minLength);
     $this->set('maxLength', $this->maxLength);
     $this->set('mask', $this->mask);
     return parent::onRender($action, $data, $index);
 }
Example #2
0
 /**
  * 
  * @param \Simplify\Form\Action $action
  * @param unknown_type $data
  * @param unknown_type $index
  */
 public function onRender(\Simplify\Form\Action $action, $data, $index)
 {
     $this->set('trueLabel', $this->getTrueLabel());
     $this->set('trueValue', $this->trueValue);
     $this->set('falseLabel', $this->getFalseLabel());
     $this->set('falseValue', $this->falseValue);
     return parent::onRender($action, $data, $index);
 }
Example #3
0
 /**
  * (non-PHPdoc)
  * @see \Simplify\Form\Element::onValidate()
  */
 public function onValidate(\Simplify\Form\Action $action, $data)
 {
     parent::onValidate($action, $data);
     $required = $action->show($this->required) ? $this->getError('required', __('Campo obrigatório')) : false;
     $invalid = $this->getError('invalid', __('Email inválido'));
     $rule = new \Simplify\Validation\Email($invalid, $required);
     $rule->validate($this->getValue($data));
 }
Example #4
0
 /**
  * (non-PHPdoc)
  * @see \Simplify\ValidationInterface::validate()
  */
 public function validate($value)
 {
     $field = $this->element->getFieldName();
     $repo = $this->element->form->repository();
     $pk = $repo->pk;
     $params = array();
     $params[\Simplify\Db\QueryParameters::WHERE][] = "{$field} = :{$field}";
     $params[\Simplify\Db\QueryParameters::DATA][$field] = $value;
     if ($this->id) {
         $params[\Simplify\Db\QueryParameters::WHERE][] = "{$pk} != :{$pk}";
         $params[\Simplify\Db\QueryParameters::DATA][$pk] = $this->id;
     }
     $found = $repo->findCount($params);
     if (!empty($found)) {
         $this->fail();
     }
 }
 /**
  * (non-PHPdoc)
  * @see \Simplify\Form\Element::onValidate()
  */
 public function onValidate(\Simplify\Form\Action $action, $data)
 {
     parent::onValidate($action, $data);
     if ($this->required) {
         $rule = new \Simplify\Validation\StrictEqual('Invalid selection', $this->emptyValue);
         $rule->validate($this->getValue($data));
     }
 }
Example #6
0
 /**
  * (non-PHPdoc)
  * 
  * @see \Simplify\Form\Element::onRender()
  */
 public function onRender(Action $action, $data, $index)
 {
     $this->set('prefix', $this->prefix);
     $this->set('suffix', $this->suffix);
     $this->set('decimalSeparator', $this->decimalSeparator);
     $this->set('thousandsSeparator', $this->thousandsSeparator);
     $this->set('precision', $this->precision);
     return parent::onRender($action, $data, $index);
 }
Example #7
0
 /**
  * (non-PHPdoc)
  * @see \Simplify\Form\Element::onRender()
  */
 public function onRender(\Simplify\Form\Action $action, $data, $index)
 {
     $file = $this->getValue($data);
     if (!empty($file)) {
         if ($this->fileExists($file)) {
             $fileUrl = $this->getFileUrl($file);
         } else {
             $fileUrl = false;
         }
         $this->set('fileUrl', $fileUrl);
     }
     $this->set('maxSize', sy_get_max_upload_size());
     return parent::onRender($action, $data, $index);
 }
 /**
  * (non-PHPdoc)
  * @see \Simplify\Form\Element::onRender()
  */
 public function onRender(\Simplify\Form\Action $action, $data, $index)
 {
     $this->set('options', $this->getOptions($data));
     return parent::onRender($action, $data, $index);
 }
Example #9
0
 /**
  *
  * @return void
  */
 public function __construct($name, $label = false)
 {
     parent::__construct($name, $label);
 }
Example #10
0
 /**
  * (non-PHPdoc)
  *
  * @see \Simplify\Form\Element::onRender()
  */
 public function onRender(\Simplify\Form\Action $action, $data, $index)
 {
     $value = $this->getValue($data);
     $this->set('formatedBeginValue', \Simplify\Form\DateTime::datetime($value['begin']));
     $this->set('formatedEndValue', \Simplify\Form\DateTime::datetime($value['end']));
     $this->set('defaultRange', $this->defaultRange);
     return parent::onRender($action, $data, $index);
 }
Example #11
0
 /**
  * (non-PHPdoc)
  * @see \Simplify\Form\Element::onRender()
  */
 public function onRender(\Simplify\Form\Action $action, $data, $index)
 {
     $this->set('formatedValue', $this->getDisplayValue($action, $data, $index));
     return parent::onRender($action, $data, $index);
 }
Example #12
0
 /**
  * (non-PHPdoc)
  * @see \Simplify\Form\Element::onValidate()
  */
 public function onValidate(\Simplify\Form\Action $action, $data)
 {
     parent::onValidate($action, $data);
     $rule = new \Simplify\Validation\Callback(array($this, 'validate'));
     $rule->validate($this->getValue($data));
 }
Example #13
0
 /**
  * (non-PHPdoc)
  * @see \Simplify\Form\Element::onRender()
  */
 public function onRender(\Simplify\Form\Action $action, $data, $index)
 {
     $this->set('checkedValue', $this->checkedValue);
     return parent::onRender($action, $data, $index);
 }
Example #14
0
 /**
  * (non-PHPdoc)
  * @see \Simplify\Form\Element::onLoadData()
  */
 public function onLoadData(\Simplify\Form\Action $action, &$data, $row)
 {
     parent::onLoadData($action, $data, $row);
     if (isset($data[$this->getFieldName()])) {
         $data[$this->getName()] = $this->makeUrlsAbsolute($data[$this->getName()]);
     }
 }
Example #15
0
 /**
  * (non-PHPdoc)
  * @see \Simplify\Form\Element::onRender()
  */
 public function onRender(\Simplify\Form\Action $action, $data, $index)
 {
     $file = $this->getValue($data);
     $thumbUrl = null;
     $imageUrl = null;
     if (!empty($file)) {
         if ($this->fileExists($file)) {
             $thumbUrl = $this->getThumbUrl($file, $this->thumbWidth, is_numeric($this->thumbHeight) ? $this->thumbHeight : $this->thumbWidth);
             $imageUrl = $this->getImageUrl($file);
         } else {
             $thumbUrl = false;
             $imageUrl = false;
         }
     }
     $this->set('thumbUrl', $thumbUrl);
     $this->set('imageUrl', $imageUrl);
     return parent::onRender($action, $data, $index);
 }