當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Forms\IControl類代碼示例

本文整理匯總了PHP中Nette\Forms\IControl的典型用法代碼示例。如果您正苦於以下問題:PHP IControl類的具體用法?PHP IControl怎麽用?PHP IControl使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了IControl類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: validateDate

 /**
  * @return bool
  */
 public static function validateDate(IControl $control)
 {
     $year = $control->year;
     $month = $control->month;
     $day = $control->day;
     if (!$control->isRequired() && $year === $month && $month === $day && $day === '') {
         return TRUE;
     } elseif ($year > 0 && $month > 0 && $day > 0) {
         return checkdate($month, $day, $year);
     } else {
         return FALSE;
     }
 }
開發者ID:jirinapravnik,項目名稱:common,代碼行數:16,代碼來源:DateInput.php

示例2: 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;
 }
開發者ID:newPOPE,項目名稱:web-addons.nette.org,代碼行數:17,代碼來源:FormValidators.php

示例3: validateData

 public static function validateData(Nette\Forms\IControl $control)
 {
     return strlen($control->code) && !is_int($control->code) && $control->isIcoValid($control->ico);
 }
開發者ID:zaxxx,項目名稱:zaxcms,代碼行數:4,代碼來源:ICO.php

示例4: 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]);
 }
開發者ID:soundake,項目名稱:pd,代碼行數:12,代碼來源:DatePicker.php

示例5: validateFilled

 /**
  * Filled validator: is control filled?
  * @param  Nette\Forms\IControl
  * @return bool
  */
 public static function validateFilled(IControl $control)
 {
     return $control->isFilled();
 }
開發者ID:exesek,項目名稱:nette20login,代碼行數:9,代碼來源:BaseControl.php

示例6: 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;
 }
開發者ID:radekdostal,項目名稱:nette-datetimepicker,代碼行數:23,代碼來源:AbstractDateTimePicker.php

示例7: 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);
 }
開發者ID:radeksimko,項目名稱:nette,代碼行數:10,代碼來源:BaseControl.php

示例8: setDependOn

 /**
  * @param \Nette\Forms\IControl $control
  * @param $name
  * @return ManyToOne
  */
 public function setDependOn(\Nette\Forms\IControl $control, $name = NULL)
 {
     $_this = $this;
     $this->dependOn = array($control, $name ?: $control->name);
     $this->criteria = array($name => -1);
     $this->form->addSubmit($this->name . '_reload', 'reload')->setValidationScope(FALSE);
     $control->form->onBeforeRender[] = function ($form) use($_this, $control) {
         $control->getControlPrototype()->onChange = "\$('#frm{$form->name}-{$_this->name}_reload').click();";
     };
     $f = function ($form) use($_this, $control, $name) {
         $_this->setCriteria(array($name => $control->value));
     };
     $control->form->onAttached[] = $f;
     $control->form->onLoad[] = $f;
     return $this;
 }
開發者ID:svobodni,項目名稱:web,代碼行數:21,代碼來源:ManyToOne.php

示例9: validateData

 public static function validateData(Nette\Forms\IControl $control)
 {
     return checkdate((int) $control->month, (int) $control->day, (int) $control->year) && $control->validTime($control->hour, $control->minute);
 }
開發者ID:zaxxx,項目名稱:zaxcms,代碼行數:4,代碼來源:OldDateTime.php

示例10: validateFilled

 /**
  * Filled validator: is control filled?
  * @param  IControl
  * @return bool
  */
 public static function validateFilled(IControl $control)
 {
     return count($control->getValue()) !== 0;
 }
開發者ID:svobodni,項目名稱:web,代碼行數:9,代碼來源:TagsInput.php

示例11: negativeNumber

 public static function negativeNumber(IControl $control)
 {
     return (int) $control->getValue() < 0;
 }
開發者ID:zaxcms,項目名稱:forms,代碼行數:4,代碼來源:TestValidator.php

示例12: renderControl

 /**
  * Renders 'control' part of visual row of controls.
  * @param \Nette\Forms\IControl $control
  * @return string
  */
 public function renderControl(\Nette\Forms\IControl $control)
 {
     if ($control instanceof \Nette\Forms\Controls\Checkbox) {
         $html = $control->getLabelPrototype();
         $caption = $html->getText();
         $html->setHtml((string) $control->getControl() . " " . $caption);
         return (string) $html;
     }
     return parent::renderControl($control);
 }
開發者ID:r-st,項目名稱:foundation-form-renderer,代碼行數:15,代碼來源:Renderer.php

示例13: validatePhoneNumber

 /**
  * @param \Nette\Forms\IControl
  * @return bool
  */
 public function validatePhoneNumber(\Nette\Forms\IControl $control)
 {
     $value = $control->getHttpData(Form::DATA_LINE, '[' . static::NAME_PREFIX . ']');
     $value .= $control->getHttpData(Form::DATA_LINE, '[' . static::NAME_NUMBER . ']');
     return $this->validatePhoneNumberString($value);
 }
開發者ID:nella,項目名稱:forms-phone,代碼行數:10,代碼來源:PhoneNumberInput.php

示例14: validateValid

 /**
  * @param  Forms\IControl $control
  * @return bool
  */
 public static function validateValid(Forms\IControl $control)
 {
     $httpRequest = $control->getHttpRequest();
     return $control->getReCaptcha()->validate($httpRequest->getRemoteAddress(), $httpRequest->getPost());
 }
開發者ID:pavelplzak,項目名稱:ReCaptchaControl,代碼行數:9,代碼來源:ReCaptchaControl.php

示例15: 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;
 }
開發者ID:jurasm2,項目名稱:multiplefileupload,代碼行數:10,代碼來源:MultipleFileUpload.php


注:本文中的Nette\Forms\IControl類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。