Exemple #1
0
 protected function afterInit()
 {
     parent::afterInit();
     if (!$this->isValid()) {
         $this->cfg->classLine .= ' fileError';
     }
 }
Exemple #2
0
 public function setValue($value, $refill = false)
 {
     parent::setValue($value);
     if ($refill) {
         $this->date->set($value, 'formatDate', 'short2');
     } else {
         $this->date->set($value);
     }
 }
Exemple #3
0
 public function setValue($value, $refill = false)
 {
     return parent::setValue(str_replace(',', '.', $value));
 }
Exemple #4
0
 /**
  * Add a form element in the current section
  *
  * @param string|form_abstract $type Form element type or element form
  * @param array $prm Parameter array for the element
  * @param bool $isI18n
  * @return form_abstract|null Reference to the added element or null if not added or i18n (name exist yet)
  */
 public function add($type, array $prm = array(), $isI18n = false)
 {
     if ($isI18n) {
         $this->i18nElements[] = array('type' => $type, 'prm' => $prm);
         return null;
     }
     $inst = null;
     $name = null;
     if ($type instanceof form_abstract && !$this->has($name = $type->getName())) {
         $inst = $type;
         $inst->renew();
     } else {
         if (is_string($type) && array_key_exists('name', $prm) && !$this->has($name = $prm['name'])) {
             $inst = $this->getNew($type, $prm);
         }
     }
     if ($inst) {
         $this->elements[$this->curSection][$name] = $inst;
         $this->elementsSection[$name] = $this->curSection;
         if ($inst instanceof form_file) {
             $this->hasFiles++;
         }
         return $inst;
     } else {
         return null;
     }
 }
Exemple #5
0
 public function setValue($value, $refill = false)
 {
     if (is_array($value) && $this->cfg->uniqValue) {
         parent::setValue(array_shift($value));
     } else {
         parent::setValue($value);
     }
 }