/**
  * @param User $sender
  * @param array $usersByRestrictions
  * @param bool $multi
  * @return MultiSelectBox|SelectBox
  */
 public function create(User $sender, array $usersByRestrictions, $multi = false)
 {
     $recipients = $this->prepareRecipients($sender, $usersByRestrictions);
     $selectBox = null;
     if ($multi === true) {
         $selectBox = new MultiSelectBox('Příjemci', $recipients);
     } else {
         $selectBox = new SelectBox('Příjemce', $recipients);
     }
     $selectBox->setAttribute('size', 13);
     $selectBox->setRequired('Vyberte příjemce.');
     return $selectBox;
 }
示例#2
0
 /**
  * Adds select box control that allows single item selection.
  * @param  string  control name
  * @param  string  label
  * @param  array   items from which to choose
  * @param  int     number of rows that should be visible
  * @return Nette\Forms\Controls\SelectBox
  */
 public function addSelect($name, $label = NULL, array $items = NULL, $size = NULL)
 {
     $control = new Controls\SelectBox($label, $items);
     if ($size > 1) {
         $control->setAttribute('size', (int) $size);
     }
     return $this[$name] = $control;
 }