Exemplo n.º 1
0
 public function setValue($value)
 {
     if (is_array($value)) {
         if (isset($value['value'])) {
             parent::setValue($value['value']);
         }
         if (isset($value['overwrite'])) {
             if ($value['overwrite'] == '1' || $value['overwrite'] === true) {
                 $this->overwrite = true;
             } else {
                 $this->overwrite = false;
             }
         }
     } else {
         parent::setValue($value);
     }
 }
Exemplo n.º 2
0
 /**
  * Set value
  *
  * If value matches checked value, sets to that value, and sets the checked
  * flag to true.
  *
  * Any other value causes the unchecked value to be set as the current
  * value, and the checked flag to be set as false.
  *
  *
  * @param  mixed $value
  * @return Zend_Form_Element_Checkbox
  */
 public function setValue($value)
 {
     if ($value == $this->getCheckedValue()) {
         parent::setValue($value);
         $this->checked = true;
     } else {
         parent::setValue($this->getUncheckedValue());
         $this->checked = false;
     }
     return $this;
 }
Exemplo n.º 3
0
 public function setValue($value)
 {
     if (is_array($value)) {
         $value = $value['year'] . '-' . $value['month'] . '-' . $value['day'];
         if ($value == "0-0-0") {
             return parent::setValue(NULL);
         }
     }
     return parent::setValue($value);
 }
Exemplo n.º 4
0
 public function setValue($value)
 {
     if (is_array($value)) {
         // Process date
         $year = null;
         $month = null;
         $day = null;
         if (isset($value['date']) && preg_match('/^(\\d+)\\/(\\d+)\\/(\\d+)$/', $value['date'], $m)) {
             array_shift($m);
             $year = $m[stripos($this->dateFormat, 'y')];
             $month = $m[stripos($this->dateFormat, 'm')];
             $day = $m[stripos($this->dateFormat, 'd')];
         } else {
             if (isset($value['year']) && is_numeric($value['year'])) {
                 $year = $value['year'];
             }
             if (isset($value['month']) && is_numeric($value['month'])) {
                 $month = $value['month'];
             }
             if (isset($value['day']) && is_numeric($value['day'])) {
                 $day = $value['day'];
             }
         }
         // Process time
         $hour = null;
         $minute = null;
         $second = null;
         if (isset($value['hour']) && is_numeric($value['hour']) && in_array($value['hour'], $this->getHourOptions())) {
             $hour = $value['hour'];
         }
         if (isset($value['minute']) && is_numeric($value['minute']) && in_array($value['minute'], $this->getMinuteOptions())) {
             $minute = $value['minute'];
         }
         if (isset($value['second']) && is_numeric($value['second'])) {
             $second = $value['second'];
         }
         if (isset($value['ampm']) && in_array($value['ampm'], $this->getAMPMOptions())) {
             if ($value['ampm'] == 'PM' && $hour < 12 && null !== $hour) {
                 $hour += 12;
             } else {
                 if ($value['ampm'] == 'AM' && $hour == 12) {
                     $hour = 0;
                 }
             }
         }
         // Get values
         $formatString = '%1$04d-%2$02d-%3$02d';
         if (null !== $hour && null !== $minute) {
             $formatString .= ' %4$02d:%5$02d:%6$02d';
         }
         $valueString = sprintf($formatString, $year, $month, $day, $hour, $minute, $second);
         $value = $valueString;
     }
     return parent::setValue($value);
 }
Exemplo n.º 5
0
 /**
  * Set value
  *
  * If non-null, sets checked flag to true
  * 
  * @param mixed $value 
  * @return void
  */
 public function setValue($value)
 {
     $value = ($value === null) ? 0 : 1;
     $this->checked = ($value === 0) ? false : true;
     return parent::setValue($value);
 }
Exemplo n.º 6
0
 /**
  * Set element value
  *
  * @param  mixed $value
  * @return \MUtil_Form_Element_Table (continuation pattern)
  */
 public function setValue($value)
 {
     // $this->setElementsBelongTo($this->getName());
     if ($this->_subForm && $value) {
         $this->_subForm->setElementsBelongTo($this->getName());
         foreach ($value as $id => $row) {
             if (isset($this->_subForms[$id])) {
                 $this->_subForms[$id]->populate($row);
             } else {
                 $subForm = clone $this->_subForm;
                 $name = $this->getName() . '[' . $id . ']';
                 $subForm->setElementsBelongTo($name);
                 $subForm->setName($name);
                 $subForm->populate($row);
                 $this->_subForms[$id] = $subForm;
             }
         }
     }
     return parent::setValue($value);
 }
Exemplo n.º 7
0
 public function setValue($value)
 {
     if (is_array($value)) {
         // Process date
         $year = null;
         $month = null;
         $day = null;
         $localeObject = Zend_Registry::get('Locale');
         $dateLocaleString = $localeObject->getTranslation('long', 'Date', $localeObject);
         // overwrite date format
         if (isset($value['date']) && preg_match('/^(\\d+)-(\\d+)-(\\d+)$/', $value['date'], $m)) {
             array_shift($m);
             $year = $m[stripos($this->dateFormat, 'y')];
             $month = $m[stripos($this->dateFormat, 'm')];
             $day = $m[stripos($this->dateFormat, 'd')];
         } else {
             if (isset($value['year']) && is_numeric($value['year'])) {
                 $year = $value['year'];
             }
             if (isset($value['month']) && is_numeric($value['month'])) {
                 $month = $value['month'];
             }
             if (isset($value['day']) && is_numeric($value['day'])) {
                 $day = $value['day'];
             }
         }
         // Get values
         $formatString = '%1$04d-%2$02d-%3$02d';
         $valueString = sprintf($formatString, $year, $month, $day);
         $value = $valueString;
     }
     return parent::setValue($value);
 }
Exemplo n.º 8
0
 public function setValue($value)
 {
     parent::setValue($value);
 }