__construct() public method

public __construct ( $caption = NULL )
Exemplo n.º 1
0
 public function __construct($label = NULL, array $items = NULL)
 {
     parent::__construct($label);
     if ($items !== NULL) {
         $this->setItems($items);
     }
 }
Exemplo n.º 2
0
 /**
  * @return ShiftPatternDate
  */
 public function __construct(Template $template, DateTime $date, $templateFileName)
 {
     parent::__construct(null);
     $this->addRule(__CLASS__ . '::validatePattern', 'Shift pattern is invalid.');
     $this->_template = $template;
     $this->_template->setFile(__DIR__ . "/{$templateFileName}");
     $this->_template->registerHelper('dayName', function ($dayNumber) {
         return DateTime::dayName($dayNumber);
     });
     $this->_template->registerHelper('padTime', function ($t) {
         if ($t < 10) {
             return '0' . $t;
         }
         return $t;
     });
     $this->_template->registerHelper('selectOption', function ($timeUnit, $time, $type) {
         $timeUnit = (int) $timeUnit;
         list($hour, $minute) = explode(':', $time);
         $hour = (int) $hour;
         $minute = (int) $minute;
         if ($type === 'h') {
             return $timeUnit === $hour ? 'selected="selected"' : '';
         }
         if ($type === 'm') {
             return $timeUnit === $minute ? 'selected="selected"' : '';
         }
     });
     // returns curren formated date and moves date one day forward
     $this->_template->registerHelper('day', function ($date) {
         $day = $date->format('j F');
         $date->addDay();
         return $day;
     });
     $this->_date = $date;
 }
 /**
  * Class constructor.
  *
  * @param    string            date format
  * @param    string            label
  */
 public function __construct($format = self::W3C_DATE_FORMAT, $language = self::DEFAULT_LANGUAGE, $label = NULL)
 {
     parent::__construct($label);
     $this->control->type = 'text';
     $this->format = $format;
     $this->language = $language;
 }
Exemplo n.º 4
0
 /**
  * Constructor
  *
  * @param string $label
  * @param string|Template $content
  */
 public function __construct($label, $content)
 {
     parent::__construct($label);
     $this->setDisabled(TRUE);
     $this->setOmitted(TRUE);
     $this->setContent($content);
 }
Exemplo n.º 5
0
 public function __construct($label = null, array $entity = NULL, array $config = NULL)
 {
     parent::__construct($label);
     $this->entity = $entity;
     $this->labelName = $label;
     $this->options = $config;
 }
Exemplo n.º 6
0
 /**
  * @param  string  label
  * @param  bool  allows to upload multiple files
  */
 public function __construct($label = NULL, $multiple = FALSE)
 {
     parent::__construct($label);
     $this->control->type = 'file';
     $this->control->multiple = (bool) $multiple;
     $this->setOption('type', 'file');
 }
Exemplo n.º 7
0
 public function __construct($caption, $publicKey, $privateKey)
 {
     $this->monitor('Nette\\Forms\\Form');
     parent::__construct($caption);
     $this->publicKey = $publicKey;
     $this->privateKey = $privateKey;
 }
Exemplo n.º 8
0
 /**
  * @param null $label
  * @param $config
  * @param null $display
  * @param null $remote
  */
 public function __construct($label, $config, $display = NULL, $remote = NULL)
 {
     parent::__construct($label);
     $this->monitor('Nette\\Application\\UI\\Presenter');
     $this->remote = $remote;
     $this->display = $display;
 }
Exemplo n.º 9
0
 /**
  * @param  string  label
  */
 public function __construct($label = NULL)
 {
     parent::__construct($label);
     $this->control->type = 'checkbox';
     $this->wrapper = Nette\Utils\Html::el();
     $this->setOption('type', 'checkbox');
 }
Exemplo n.º 10
0
 /**
  * @param string $siteKey
  * @param string $label
  */
 public function __construct($siteKey, $label = NULL)
 {
     parent::__construct($label);
     $this->siteKey = $siteKey;
     $this->control = Html::el('div');
     $this->control->addClass('g-recaptcha');
 }
Exemplo n.º 11
0
 /**
  * @param string $label
  * @param CaptchaProvider $provider
  */
 public function __construct($label, CaptchaProvider $provider)
 {
     parent::__construct($label);
     $this->provider = $provider;
     $this->control = Html::el('img');
     $this->control->addClass('captcha-image seznam-captcha-image');
 }
Exemplo n.º 12
0
 /**
  * @param  string  label
  * @param  array   items from which to choose
  * @param  int     number of rows that should be visible
  */
 public function __construct($type, $label = NULL, $size = NULL)
 {
     parent::__construct($label);
     $this->control->setName('select');
     $this->control->size = $size > 1 ? (int) $size : NULL;
     $this->type = $type;
 }
Exemplo n.º 13
0
 public function __construct($caption = NULL, $side, $border)
 {
     $this->monitor('Nette\\Forms\\Form');
     parent::__construct($caption);
     $this->side = $side;
     $this->border = $border;
 }
Exemplo n.º 14
0
 public function __construct($caption = NULL, $min, $max)
 {
     $this->monitor('Nette\\Forms\\Form');
     parent::__construct($caption);
     $this->min = $min;
     $this->max = $max;
 }
Exemplo n.º 15
0
 public function __construct($forcedValue = NULL)
 {
     parent::__construct();
     $this->control->type = 'hidden';
     $this->value = (string) $forcedValue;
     $this->forcedValue = $forcedValue;
 }
 /**
  * @param  ReCaptcha $reCaptcha
  * @param  Http\Request $httpRequest
  * @param  string $caption
  */
 public function __construct(ReCaptcha $reCaptcha, Http\Request $httpRequest, $caption = NULL)
 {
     parent::__construct($caption);
     $this->setOmitted();
     $this->reCaptcha = $reCaptcha;
     $this->httpRequest = $httpRequest;
     $this->control = $reCaptcha->getHtml();
 }
Exemplo n.º 17
0
 public function __construct($label = NULL)
 {
     parent::__construct($label);
     $this->baseNetteGMap = new \BaseNetteGMap(array(), $this);
     if ($this->baseNetteGMap->getZoom() === NULL) {
         $this->baseNetteGMap->setZoom(12);
     }
 }
Exemplo n.º 18
0
 /**
  * @param  string  label
  * @param  bool  allows to upload multiple files
  */
 public function __construct($label = NULL, $multiple = FALSE)
 {
     parent::__construct($label);
     $this->control->type = 'file';
     $this->control->multiple = (bool) $multiple;
     $this->setOption('type', 'file');
     $this->addCondition(Forms\Form::FILLED)->addRule([$this, 'isOk'], Forms\Validator::$messages[self::VALID]);
 }
Exemplo n.º 19
0
 public function __construct($label = null, $type = self::TYPE_DATETIME_LOCAL)
 {
     if (!isset(self::$formats[$type])) {
         throw new \InvalidArgumentException("invalid type '{$type}' given.");
     }
     parent::__construct($label);
     $this->control->type = $this->type = $type;
 }
Exemplo n.º 20
0
 /**
  * Constructor
  *
  * @param string $label
  * @param mixed $content
  * @param string $wrapper
  */
 public function __construct($label, $content, $wrapper = NULL)
 {
     parent::__construct($label);
     $this->setDisabled(TRUE);
     $this->setOmitted(TRUE);
     $this->setContent($content);
     $this->wrapper = Html::el($wrapper);
 }
 public function __construct(IManager $mediaManager, $namespace, $label = null, $withPrimary = false)
 {
     parent::__construct($label);
     $this->mediaManager = $mediaManager;
     $this->namespace = $namespace;
     $this->fileFilter = FileFilter::create()->getByNamespace($this->namespace);
     $this->withPrimary = $withPrimary;
 }
Exemplo n.º 22
0
 /**
  * @param  string  label
  * @param  array   items from which to choose
  * @param  int     number of rows that should be visible
  */
 public function __construct($label = null, array $items = null, $size = null)
 {
     parent::__construct($label);
     $this->control->setName('select');
     $this->control->size = $size > 1 ? (int) $size : null;
     if ($items !== null) {
         $this->setItems($items);
     }
 }
Exemplo n.º 23
0
 /**
  * @param  string  label
  * @param  array   items from which to choose
  * @param  int     number of rows that should be visible
  */
 public function __construct($label = NULL, array $items = NULL, $size = NULL)
 {
     parent::__construct($label);
     $this->control->setName('select');
     $this->control->size = $size > 1 ? (int) $size : NULL;
     if ($items !== NULL) {
         $this->setItems($items);
     }
 }
Exemplo n.º 24
0
 /**
  * @param  string|NULL
  * @param  string
  */
 public function __construct($label = NULL, $invalidDateMessage = self::DEFAULT_INVALID_DATE_MESSAGE)
 {
     parent::__construct($label);
     $this->invalidDateMessage = $invalidDateMessage;
     $this->setMask($this->useTime ? self::DEFAULT_MASK_DATETIME : self::DEFAULT_MASK_DATE);
     $this->addCondition(Form::FILLED)->addRule($this->validateDate, $this->invalidDateMessage);
     $this->parseDateCallback = array($this, 'parseDate');
     $this->formatDateCallback = array($this, 'formatDate');
 }
Exemplo n.º 25
0
 /**
  * @param  string $label
  * @param  string $value
  */
 public function __construct($value = NULL, $label = NULL)
 {
     parent::__construct($label);
     $this->container = Html::el();
     if ($value !== NULL) {
         $this->setValue($value);
     }
     $this->setOmitted();
 }
Exemplo n.º 26
0
 public function __construct($persistentValue = NULL)
 {
     parent::__construct();
     $this->control->type = 'hidden';
     if ($persistentValue !== NULL) {
         $this->unmonitor(Nette\Forms\Form::class);
         $this->persistValue = TRUE;
         $this->value = (string) $persistentValue;
     }
 }
Exemplo n.º 27
0
 /**
  * @param  string  label
  * @param  array   options from which to choose
  */
 public function __construct($label = NULL, array $items = NULL)
 {
     parent::__construct($label);
     $this->control->type = 'radio';
     $this->container = Html::el();
     $this->separator = Html::el('br');
     if ($items !== NULL) {
         $this->setItems($items);
     }
 }
Exemplo n.º 28
0
 /**
  * @param string $siteKey
  * @param string $theme
  * @param string|NULL $caption
  */
 public function __construct($siteKey, $theme, $type, $size, $caption = NULL)
 {
     parent::__construct($caption);
     $this->siteKey = $siteKey;
     $this->theme = $theme;
     $this->type = $type;
     $this->size = $size;
     $this->control = Html::el('div')->addAttributes(['class' => 'g-recaptcha', 'data-sitekey' => $this->siteKey, 'data-theme' => $this->theme, 'data-type' => $this->type, 'data-size' => $this->size]);
     $this->setOmitted();
 }
Exemplo n.º 29
0
 /**
  * @param  string  label
  * @param  array   options from which to choose
  */
 public function __construct($label = NULL, array $items = NULL)
 {
     parent::__construct($label);
     $this->control->type = 'radio';
     $this->container = Html::el();
     $this->itemContainer = Html::el('div')->addClass('radio');
     if ($items !== NULL) {
         $this->setItems($items);
     }
 }
Exemplo n.º 30
0
 /**
  * @param null $label
  * @param $config
  */
 public function __construct($label, $config)
 {
     parent::__construct($label, $config);
     $this->control->type = 'text';
     foreach ($config as $key => $value) {
         if ($key == 'language') {
             $this->setLanguage($value);
         }
     }
 }