/** * @return \Nette\DateTime|NULL */ public function getValue() { $value = parent::getValue(); if ($value == '') { return NULL; } return DateTime::from($value); }
/** * Returns control's value. * * @return string * @override */ public function getValue() { $value = parent::getValue(); foreach ($this->filtersOut as $filter) { $value = $filter($value); } return $value; }
public function valideFormNewSystemName(\Nette\Forms\Controls\TextInput $input) { $privilege = $this->privileges->where('system_name', $input->getValue()); if (!$privilege->fetch()) { return true; } else { return false; } }
/** * @return DateTime|NULL */ public function getValue() { $value = DateTime::createFromFormat($this->format, parent::getValue()); $err = DateTime::getLastErrors(); if ($err['error_count']) { $value = NULL; } return $value; }
/** * @return \DateTime|NULL */ public function getValue() { $value = parent::getValue(); $value = \DateTime::createFromFormat(static::$format, $value); $err = \DateTime::getLastErrors(); if ($err['error_count']) { $value = FALSE; } return $value ?: NULL; }
/** * Returns control's value. * @return string */ public function getValue() { $value = parent::getValue(); // convert to Nette\Utils\DateTime if ($value && is_string($value)) { $format = "d.m.Y"; $value = DateTime::createFromFormat($format, $value); } return $value ? $value : NULL; }
/** * @return array */ public function getValue() { $value = parent::getValue(); if (!$value) { return NULL; } else { if (is_array($value)) { return $value; } } return array_map(function ($value) { return trim($value); }, explode(",", $value)); }
/** * @return array */ public function getValue() { $value = parent::getValue(); if (!$value) { return NULL; } else { if (is_array($value)) { return $value; } } $value = array_map(function ($value) { return trim($value); }, explode(',', $value)); return array_values(array_unique($value)); }
public function getValue() { $value = parent::getValue(); if ($this->multiple) { $images = array(); foreach (explode(',', $value) as $img) { if ($img != '') { $images[] = $img; } } return $images; } else { return $value; } }
/** * @return array */ public function getValue() { // temporarily disable filters $filters = $this->filters; $this->filters = array(); $res = Strings::split(parent::getValue(), "" . $this->delimiter . ""); $this->filters = $filters; foreach ($res as &$tag) { foreach ($this->filters as $filter) { $tag = $filter($tag); } if (!$tag) { unset($tag); } } return $res; }
public function validate() { if ($this->isDisabled()) { return; } $this->cleanErrors(); $this->rules->validate(); $emails = preg_split('~\\s*,\\s*~', parent::getValue()); foreach ($emails as $email) { $email = trim($email); if (!$email) { continue; } $user = $this->orm->users->getByEmail($email); if (!$user) { $this->addError("Email '{$email}' not registered."); } } }
/** * @return \DateTime|NULL */ public function getValue() { return $this->dateConverter->parse(parent::getValue()); }
/** * @return \DateTime */ public function getValue() { $value = parent::getValue(); return empty($value) ? NULL : \DateTime::createFromFormat($this->dateFormat, $value); }
/** * @return bool */ public function isValid() { return $this->dateTimeIntervalConverter->isValid(parent::getValue()); }
/** * @return \DateTime|NULL */ public function getValue() { return $this->dateFormatter->parse(parent::getValue()); }
/** * @return mixed */ public function getRawValue() { return parent::getValue(); }
/** * Get Time from ::addTime() field * * @param Nette\Forms\Controls\TextInput $input * * @return mixed */ public static function getTimeValue($input) { if ($input instanceof Nette\Forms\Controls\TextInput) { $value = $input->getValue(); } else { $value = $input; } return empty($value) ? NULL : $value . ':00'; }