本文整理汇总了PHP中Nette\Forms\IControl::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP IControl::getValue方法的具体用法?PHP IControl::getValue怎么用?PHP IControl::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Forms\IControl
的用法示例。
在下文中一共展示了IControl::getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isLicenseValid
/**
* @param \Nette\Forms\IControl
* @return bool
*/
public function isLicenseValid(IControl $control)
{
$licenses = $control->getValue();
if (is_string($licenses)) {
$licenses = array_map('trim', explode(',', $licenses));
}
foreach ($licenses as $license) {
if (!$this->validators->isLicenseValid($license)) {
return FALSE;
}
}
return TRUE;
}
示例2: validateFloat
/**
* Is a control's value float number?
* @return bool
*/
public static function validateFloat(IControl $control)
{
$value = str_replace(array(' ', ','), array('', '.'), $control->getValue());
if (Validators::isNumeric($value)) {
$control->setValue((double) $value);
return TRUE;
}
return FALSE;
}
示例3: validateLength
/**
* Count/length validator. Range is array, min and max length pair.
* @return bool
* @internal
*/
public static function validateLength(IControl $control, $range)
{
if (!is_array($range)) {
$range = array($range, $range);
}
$value = $control->getValue();
return Nette\Utils\Validators::isInRange(is_array($value) ? count($value) : Nette\Utils\Strings::length($value), $range);
}
示例4: validateEqual
/**
* Equal validator: are control's value and second parameter equal?
* @param Nette\Forms\IControl
* @param mixed
* @return bool
*/
public static function validateEqual(IControl $control, $arg)
{
$value = $control->getValue();
foreach (is_array($value) ? $value : array($value) as $val) {
foreach (is_array($arg) ? $arg : array($arg) as $item) {
if ((string) $val === (string) ($item instanceof IControl ? $item->value : $item)) {
return TRUE;
}
}
}
return FALSE;
}
示例5: validateRange
/**
* Rangle validator: is a control's value number in specified range?
* @param Nette\Forms\IControl
* @param array min and max value pair
* @return bool
*/
public static function validateRange(IControl $control, $range)
{
return Nette\Utils\Validators::isInRange($control->getValue(), $range);
}
示例6: validateChecked
/**
* Filled validator: has been any checkbox checked?
*
* @param \Nette\Forms\IControl $control
* @return bool
*/
public static function validateChecked(Nette\Forms\IControl $control)
{
return $control->getValue() !== NULL;
}
示例7: validateFilled
/**
* Filled validator: is control filled?
* @param IControl
* @return bool
*/
public static function validateFilled(IControl $control)
{
return count($control->getValue()) !== 0;
}
示例8: validateRange
/**
* Is entered values within allowed range?
*
* @author Jan Tvrdík
* @param DatePicker
* @param array 0 => minDate, 1 => maxDate
* @return bool
*/
public static function validateRange(Nette\Forms\IControl $control, $range)
{
return ($range[0] === NULL || $control->getValue() >= $range[0]) && ($range[1] === NULL || $control->getValue() <= $range[1]);
}
示例9: validateValid
/**
* @param BaseDateTime
* @return bool
*/
public static function validateValid(\Nette\Forms\IControl $control)
{
$value = $control->getValue();
return is_null($value) || $value instanceof DateTime;
}
示例10: negativeNumber
public static function negativeNumber(IControl $control)
{
return (int) $control->getValue() < 0;
}
示例11:
IControl?(object)array('control'=>$rule->arg->getHtmlName()):$rule->arg;}$payload[]=$item;}return$payload;}static
function
validateEqual(IControl$control,$arg){$value=$control->getValue();foreach((is_array($value)?$value:array($value))as$val){foreach((is_array($arg)?$arg:array($arg))as$item){if((string)$val===(string)($item
instanceof
IControl?$item->value:$item)){return
TRUE;}}}return
FALSE;}static
示例12: validateFilled
/**
* Filled validator: has been any file uploaded?
* @param Forms\IControl
* @return bool
*/
public static function validateFilled(Forms\IControl $control)
{
$files = $control->getValue();
return count($files) > 0;
}
示例13: validateRange
/**
* Validates range
*
* @param \Nette\Forms\IControl $control control
* @param array $range minimum and maximum dates and times
* @return bool
*/
public static function validateRange(IControl $control, $range)
{
if ($control->getValue() !== '') {
if ($control->range['min'] !== NULL) {
if ($control->getValue() < $control->range['min']) {
return FALSE;
}
}
if ($control->range['max'] !== NULL) {
if ($control->getValue() > $control->range['max']) {
return FALSE;
}
}
}
return TRUE;
}
示例14: validateFilled
/**
* Filled validator: has been any filed?
*
* @param \Nette\Forms\IControl
* @return bool
*/
public static function validateFilled(\Nette\Forms\IControl $control)
{
return (bool) count(array_filter(
$control->getValue(), function($file) {
return $file instanceof FileUpload && $file->isOK();
}
));
}
示例15: validateMinDistanceFrom
public static function validateMinDistanceFrom(IControl $control, array $args)
{
list($distance, $point) = $args;
return $control->getValue()->getDistanceTo(new GpsPoint($point)) >= $distance;
}