コード例 #1
0
ファイル: TbDatePicker.php プロジェクト: bombush/NatsuCon
 /**
  * Sets date
  *
  * @param string $value date
  * @return void
  */
 public function setValue($value)
 {
     if ($value instanceof \DateTime) {
         $value = $value->format($this->format);
     }
     parent::setValue($value);
 }
コード例 #2
0
 /**
  * @param \DateTime|string $value
  * @return static
  */
 public function setValue($value)
 {
     if ($value instanceof DateTimeInterval) {
         $value = $this->dateTimeIntervalConverter->format($value);
     }
     return parent::setValue($value);
 }
コード例 #3
0
ファイル: MoneyControl.php プロジェクト: f3l1x/nette-plugins
 /**
  * Sets control's value.
  *
  * @param $value
  * @return MoneyControl
  * @override
  */
 public function setValue($value)
 {
     foreach ($this->filtersIn as $filter) {
         $value = $filter($value);
     }
     return parent::setValue($value);
 }
コード例 #4
0
ファイル: DatePicker.php プロジェクト: brosland/framework
 /**
  * @param string|DateTime $value
  * @return self
  */
 public function setValue($value = NULL)
 {
     if ($value instanceof DateTime) {
         $value = $value->format($this->format);
     }
     return parent::setValue($value);
 }
コード例 #5
0
 /**
  * Sets control's value.
  * @param  string
  * @return self
  */
 public function setValue($value = null)
 {
     if ($value instanceof \DateTime) {
         $value = $value->format("d.m.Y");
     }
     parent::setValue($value);
     return $this;
 }
コード例 #6
0
 /**
  * @param \DateTime|string $value
  * @return static
  */
 public function setValue($value)
 {
     if ($value instanceof \DateTime) {
         $value = $this->dateConverter->format($value);
     }
     $this->rawValue = trim($value);
     return parent::setValue($value);
 }
コード例 #7
0
ファイル: DateTimeControl.php プロジェクト: mike227/n-forms
 /**
  * @param \DateTime|NULL $date
  * @return self
  */
 public function setValue($date)
 {
     if ($date !== NULL && !$date instanceof \DateTime) {
         throw new Nette\InvalidArgumentException("Expected DateTime. Given:" . gettype($date));
     }
     $value = $date === NULL ? NULL : $date->format($this->dateFormat);
     return parent::setValue($value);
 }
コード例 #8
0
ファイル: BaseDateTime.php プロジェクト: norbe/framework
	/**
	 * @param \DateTime
	 * @return BaseDateTime
	 */
	public function setValue($value = NULL)
	{
		try {
			if ($value instanceof \DateTime) {
				return parent::setValue($value->format(static::$format));
			} else {
				return parent::setValue($value);
			}
		} catch (\Exception $e) {
			return parent::setValue(NULL);
		}
	}
コード例 #9
0
 /**
  * @param \DateTime
  * @return BaseDateTime
  */
 public function setValue($value)
 {
     try {
         if ($value instanceof DateTime || $value instanceof \DibiDateTime) {
             parent::setValue($value->format($this->format));
         } elseif ($value != '') {
             $date = DateTime::from($value);
             parent::setValue($date->format($this->format));
         }
     } catch (\Exception $e) {
         return parent::setValue(NULL);
     }
 }
コード例 #10
0
 /**
  * Sets date and time
  *
  * @param string $value date and time
  * @return void
  */
 public function setValue($value)
 {
     if ($value instanceof \DateTime) {
         $value = $value->format($this->format);
     }
     if ($this->message !== NULL && $this->value !== NULL) {
         if ($this->range['min'] !== NULL && $this->range['max'] !== NULL) {
             $this->addRule(Form::RANGE, $this->message, array($this->range['min'], $this->range['max']));
         } elseif ($this->range['min'] !== NULL) {
             $this->addRule(Form::MIN, $this->message, $this->range['min']);
         } else {
             $this->addRule(Form::MAX, $this->message, $this->range['max']);
         }
     }
     parent::setValue($value);
 }
コード例 #11
0
ファイル: DateTimePicker.php プロジェクト: cujan/vcelyweb
 /**
  * Sets date and time
  *
  * @param string $value date and time
  * @return void
  */
 public function setValue($value)
 {
     $value = preg_replace('~([0-9]{4})-([0-9]{2})-([0-9]{2})~', '$3.$2.$1', $value);
     parent::setValue($value);
 }
コード例 #12
0
ファイル: TagsInput.php プロジェクト: svobodni/web
 /**
  * Sets control's value.
  * @param  string
  * @return TextBase  provides a fluent interface
  */
 public function setValue($value)
 {
     if (!is_array($value)) {
         $value = explode(trim($this->joiner), $value);
     }
     parent::setValue(implode($this->joiner, $value));
     return $this;
 }
コード例 #13
0
 public function setValue($editors)
 {
     $emails = [];
     if (is_array($editors)) {
         foreach ($editors as $editor) {
             $emails[] = $editor->email;
         }
         $editors = implode(', ', $emails);
     }
     return parent::setValue($editors);
 }