/**
 * Formular pre editaciu udajov
 * @param boolean $admin
 * @param array $druh
 * @return Nette\Application\UI\Form
 */
  public function create($admin, $druh, $ur_reg)
  {
      $this->ur_reg = $ur_reg;
      $form = new Form();
      $form->addProtection();
      $form->addGroup();
      $form->addHidden('id');
      $form->addHidden('id_udaje_typ');
      if ($admin) {
          $form->addText('nazov', 'Názov prvku:', 20, 20)->addRule(Form::MIN_LENGTH, 'Názov musí mať spoň %d znaky!', 2)->setAttribute('class', 'heading')->setRequired('Názov musí byť zadaný!');
          $form->addText('comment', 'Komentár k hodnote :', 90, 255)->addRule(Form::MIN_LENGTH, 'Komentár musí mať spoň %d znaky!', 2)->setRequired('Komentár musí byť zadaný!');
      } else {
          $form->addHidden('nazov');
          $form->addHidden('comment');
      }
      $form->addText('text', 'Hodnota prvku:', 90, 255)->setRequired('Hodnota prvku musí byť zadaná!');
      if ($admin) {
          $form->addCheckbox('spravca', ' Povolená zmena pre správcu')->setDefaultValue(1);
          $form->addCheckbox("druh_null", " Hodnota druhu je NULL")->setDefaultValue(1)->addCondition(Form::EQUAL, TRUE)->toggle("druh", FALSE);
          $form->addGroup()->setOption('container', Html::el('fieldset')->id("druh"));
          $form->addSelect('id_druh', 'Druhová skupina pre nastavenia:', $druh)->setDefaultValue(1);
          $form->setCurrentGroup(NULL);
 protected function createComponentForm()
 {
     $form = new Nette\Application\UI\Form();
     $addEventHandler = callback($this, 'handleAddItem');
     $removeEventHandler = callback($this, 'handleRemoveItem');
     $form->addGroup('Footer menu');
     $form->addDynamic('sections', function (Container $column) use($removeEventHandler, $addEventHandler) {
         $column->addText('title', 'Column Title')->getControlPrototype()->addClass('col-sm-5')->addAttributes(['placeholder' => 'Column Title']);
         $column->addDynamic('menuItems', function (Container $menuItems) use($removeEventHandler) {
             $menuItems->addText('text', 'Text')->getControlPrototype()->addClass('col-sm-5')->addAttributes(['placeholder' => 'Text']);
             $menuItems->addText('url', 'Url')->getControlPrototype()->addClass('col-sm-5')->addAttributes(['placeholder' => 'Url']);
             $menuItems->addSubmit('remove', '-')->setValidationScope(false)->setAttribute('class', 'btn-danger btn-sm')->setAttribute('data-replicator-item-remove', 'yes')->addRemoveOnClick($removeEventHandler);
             $this->controlsInit($menuItems);
         }, 1, true)->addSubmit('add', '+')->setValidationScope(false)->setAttribute('class', 'btn btn-success btn-sm')->addCreateOnClick(true, $addEventHandler);
         $column->addSubmit('remove', '-')->setValidationScope(false)->setAttribute('class', 'btn-sm btn-danger')->setAttribute('data-replicator-item-remove', 'yes')->addRemoveOnClick($removeEventHandler);
         $this->controlsInit($column);
     }, 2, true)->addSubmit('add', '+')->setValidationScope(false)->setAttribute('class', 'btn btn-sm btn-success')->addCreateOnClick(true, $addEventHandler);
     $form->addGroup();
     $form->addSubmit('submit', 'Save');
     $form->addSubmit('cancel', 'Cancel');
     $this->controlsInit($form);
     $form->getElementPrototype()->addClass('form-horizontal');
     $form->onSuccess[] = $this->processForm;
     $form->setRenderer(new Bs3FormRenderer());
     return $form;
 }
class ZmenDatumPlatnostiFormFactory
{
    /** @var DbTable\Hlavne_menu */
    private $hlavne_menu;
    /**
   * @param DbTable\Hlavne_menu $hlavne_menu */
    public function __construct(DbTable\Hlavne_menu $hlavne_menu)
    {
        $this->hlavne_menu = $hlavne_menu;
    }
    /**
   * Formular pre zmenu datumu platnosti polozky.
   * @param int $id Id polozky v hlavnom menu
   * @param Nette\Utils\DateTime $datum_platnosti Datum platnosti polozky
   * @return Nette\Application\UI\Form */
Beispiel #4
0
 /**
  * @return Nette\Application\UI\Form
  */
 protected function createComponentConfigForm()
 {
     $form = new Nette\Application\UI\Form();
     $form->addGroup('Server related');
     $form->addText('ServerName', 'Server name')->setRequired();
     $form->addSelect('timeZone', 'Time zone', ['Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe (Bucharest)', 'Europe (London)', 'Indian', 'Pacific']);
     $form->addText('speed', 'Speed')->setDefaultValue(1);
     $form->addText('troopSpeed', 'Troop speed')->setDefaultValue(1);
     $form->addText('evasionSpeed', 'Evasion speed')->setDefaultValue(1);
     $form->addText('traderMultiplier', 'Trader multiplier')->setDefaultValue(1);
     $form->addText('crannyMultiplier', 'Cranny multiplier')->setDefaultValue(1);
     $form->addText('storageMultiplier', 'Storage multiplier')->setDefaultValue(1);
     $form->addText('trapMultiplier', 'Trap multiplier')->setDefaultValue(1);
     $form->addText('natarMultiplier', 'Natar multiplier')->setDefaultValue(1);
     $form->addText('worldSize', 'World size (square)')->setDefaultValue(100);
     $form->addCheckbox('registrationOpen', 'Open registrations')->setDefaultValue(TRUE);
     $form->addSelect('beginnerProtection', 'Beginner protection', [Nette\Utils\DateTime::HOUR * 2 => '2 Hours', Nette\Utils\DateTime::HOUR * 6 => '6 Hour', Nette\Utils\DateTime::HOUR * 12 => '12 Hour', Nette\Utils\DateTime::DAY * 1 => '1 Day', Nette\Utils\DateTime::DAY * 2 => '2 Days', Nette\Utils\DateTime::DAY * 3 => '3 Days', Nette\Utils\DateTime::DAY * 7 => '7 Days']);
     $form->addSelect('plusLength', 'Plus length', [Nette\Utils\DateTime::HOUR * 12 => '12 Hour', Nette\Utils\DateTime::DAY * 1 => '1 Day', Nette\Utils\DateTime::DAY * 2 => '2 Days', Nette\Utils\DateTime::DAY * 3 => '3 Days', Nette\Utils\DateTime::DAY * 7 => '7 Days']);
     $form->addSelect('productionBoostLength', 'Production boost length', [Nette\Utils\DateTime::HOUR * 12 => '12 Hour', Nette\Utils\DateTime::DAY * 1 => '1 Day', Nette\Utils\DateTime::DAY * 2 => '2 Days', Nette\Utils\DateTime::DAY * 3 => '3 Days', Nette\Utils\DateTime::DAY * 7 => '7 Days']);
     $form->addSelect('natureRegeneration', 'Nature troops regeneration time', [Nette\Utils\DateTime::HOUR * 2 => '2 Hours', Nette\Utils\DateTime::HOUR * 6 => '6 Hour', Nette\Utils\DateTime::HOUR * 12 => '12 Hour', Nette\Utils\DateTime::DAY * 1 => '1 Day']);
     $form->addSelect('medalInterval', 'Medal interval', [Nette\Utils\DateTime::DAY * 1 => '1 Day', Nette\Utils\DateTime::DAY * 2 => '2 Days', Nette\Utils\DateTime::DAY * 3 => '3 Days', Nette\Utils\DateTime::DAY * 7 => '7 Days']);
     $form->addText('tourThreshold', 'Tour threshold')->setDefaultValue(20);
     $form->addCheckbox('greatWorkshop', 'Great workshop');
     $form->addCheckbox('worldWonder', 'World wonder');
     $form->addCheckbox('showNatarStatistics', 'Show natars in statistics');
     $form->addSelect('peaceSystem', 'Peace system', ['None', 'Normal', 'Christmas', 'New year', 'Easter']);
     $form->addGroup('Admin account');
     $form->addText('adminName', 'Admin name');
     $form->addText('adminEmail', 'Admin email');
     $form->addCheckbox('showAdminStatistics', 'Show admin in statistics');
     $form->addGroup('Sql related');
     $form->addText('hostname', 'Hostname');
     $form->addText('username', 'Username');
     $form->addPassword('password', 'Password');
     $form->addText('dbName', 'Database name');
     $form->addGroup('Other');
     $form->addCheckbox('newsBoxOne', 'Newsbox 1');
     $form->addCheckbox('newsBoxTwo', 'Newsbox 2');
     $form->addCheckbox('newsBoxThree', 'Newsbox 3');
     $form->addCheckbox('log', 'Log actions');
     $form->addCheckbox('quest', 'Enable quests');
     $form->addCheckbox('questExtended', 'Enable extended quests');
     $form->addCheckbox('autoActivate', 'Auto activate accounts');
     $form->addGroup('Start time');
     $form->addText('startDate', 'Start date Year-month-day format')->setDefaultValue(Nette\Utils\DateTime::from('now')->format('Y-m-d'));
     $form->addText('startTime', 'Start time')->setDefaultValue(Nette\Utils\DateTime::from('now')->format('H:i'));
     $form->onSuccess[] = [$this, 'processConfig'];
     $form->addSubmit('Next', 'Next');
     return $form;
 }
  /**
 * @param User $user
 * @param DbTable\Registracia $registracia
 * @param DbTable\Lang $lang
 * @param DbTable\Hlavicka $hlavicka
 * @param DbTable\Dlzka_novinky $dlzka_novinky
 */
  public function __construct(User $user, DbTable\Registracia $registracia, DbTable\Lang $lang, DbTable\Hlavicka $hlavicka, DbTable\Dlzka_novinky $dlzka_novinky)
  {
      $this->user = $user;
      $this->urovneReg = $registracia->urovneReg($this->user->isLoggedIn() ? $this->user->getIdentity()->id_registracia : 0);
      $this->lang = $lang;
      $this->hlavickaForm = $hlavicka->hlavickaForm();
      $this->dlzkaNovinkyForm = $dlzka_novinky->dlzkaNovinkyForm();
  }
  /**
 * Edit hlavne menu form component factory.
 * @param int $uroven Uroven polozky v menu
 * @param string $uloz Text tlacitka uloz
 * @param boolean $vlastnik Vlastnictvo editovanej polozky
 * @param boolean $edit Pre skrytie poloziek pri editacii
 * @param boolean $opravnenia Opravnenia pre nevlastnikov
 * @return Form
 */
  public function form($uroven, $uloz, $vlastnik, $edit, $opravnenia)
  {
      $form = new Form();
      $form->addProtection();
      $form->addGroup();
      $form->addHidden("id");
      $form->addHidden("id_druh");
      $form->addHidden("id_user_profiles");
      $form->addHidden("spec_nazov");
      $form->addHidden("langtxt");
      $form->addHidden("id_hlavne_menu_cast");
      $form->addHidden("uroven");
      $form->addHidden("id_nadradenej");
      $form->addHidden("modified");
      if (!$edit) {
          $form->addSelect('id_registracia', 'Povolené prezeranie pre min. úroveň:', $this->urovneReg);
      }
      if ($this->user->isInRole("admin")) {
          $form->addText('nazov_ul_sub', 'Názov alternatívneho vzhľadu:', 20, 20);
          $form->addText('ikonka', 'Názov class ikonky pre FontAwesome:', 90, 30);
          if ($uroven) {
              $form->addHidden('id_hlavicka');
          } else {
              $form->addSelect('id_hlavicka', 'Druh priradenej hlavičky:', $this->hlavickaForm)->addRule(Form::FILLED, 'Je nutné vybrať hlavičku.');
          }
          //      $form->addCheckbox('zvyrazni', ' Zvýraznenie položky pri pridaní obsahu');
      }
Beispiel #6
0
 /**
  * @return Form
  */
 public function create()
 {
     $form = new Form();
     $form->addGroup();
     $form->addText('username', 'Login:'******'Zadejte prosím uživatelské jméno.');
     $form->addPassword('password', 'Heslo:')->setRequired('Zadejte prosím heslo.');
     $form->addCheckbox('remember', 'Zůstat přihlášen');
     $form->addGroup();
     $form->addSubmit('send', 'Přihlásit');
     $form->addSubmit('cancel', 'Zpět')->setValidationScope(FALSE);
     $form->setDefaults(array('username' => 'user', 'password' => NULL, 'remember' => TRUE));
     $form->onSuccess[] = array($this, 'formSucceeded');
     $form->setRenderer(new Bs3FormRenderer());
     return $form;
 }
Beispiel #7
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = new Form();
     $form->addGroup($this->user ? 'Upravit uživatele' : 'Přidat uživatele');
     $form->addText("name", 'Jméno:')->setRequired('Vyplňte jméno');
     $form->addText("email", 'Email:')->setRequired('Vyplňte email')->addRule(function ($ctrl) {
         if ($this->user and $this->user->email == $ctrl->getValue()) {
             return TRUE;
         }
         return (bool) (!$this->userFacade->findUserByEmail($ctrl->getValue()));
     }, 'Email je obsazen, zvolte prosím jiný');
     $password = $form->addPassword("password", 'Heslo:');
     $password2 = $form->addPassword("password2", 'Heslo znovu:');
     if (!$this->user) {
         $password->setRequired('Vyplňte heslo');
         $password2->addRule(Form::FILLED, 'Vyplňte heslo znovu pro kontrolu')->addRule(Form::EQUAL, 'Hesla se neshodují', $password);
     } else {
         $password2->addConditionOn($password, Form::FILLED)->setRequired('Vyplňte heslo znovu pro kontrolu')->addRule(Form::EQUAL, 'Hesla se neshodují', $password);
     }
     $form->addSubmit("send", $this->user ? 'Upravit uživatele' : 'Přidat uživatele');
     $form->setRenderer(new Bs3FormRenderer());
     $form->onSuccess[] = $this->processForm;
     if ($this->user) {
         $form->setDefaults(["name" => $this->user->name, "email" => $this->user->email]);
     }
     return $form;
 }
 /**
  * @return Form
  */
 protected function createForm()
 {
     $form = new Form();
     $form->addGroup('Základní údaje');
     $basic = $form->addContainer('basic');
     $basic->addText('name', 'Name');
     $form->addSubmit('save', 'Uložit');
     return $form;
 }
 public function create()
 {
     $form = new Form();
     $form->addGroup("Set Google Webmaster tools");
     $form->addUpload("file", "Google Webmaster tools file:")->setRequired("Upload Google Webmaster tools file");
     $form->addSubmit("send", "Set Google Webmaster tools");
     $form->onSuccess[] = $this->processForm;
     return $form;
 }
 public function create()
 {
     $form = new Form();
     $form->addGroup("Set base title");
     $form->addText("baseTitle", "Base title:");
     $form->addSubmit("send", "Set base title");
     $form->onSuccess[] = $this->processForm;
     $form->setDefaults(array("baseTitle" => $this->settingsDao->getBaseTitle()));
     return $form;
 }
Beispiel #11
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function createComponentPasswordForm()
 {
     $form = new Form();
     $form->addGroup('Heslo');
     $form->addPassword('newpass', 'Nové heslo:')->addRule(Form::FILLED, 'Zadejte prosím heslo.')->addRule(Form::MIN_LENGTH, 'Heslo musí mít alespoň %d znaků.', 6);
     $form->addHidden('changedId', NULL);
     $form->addSubmit('submit', 'Odeslat');
     $form->onSuccess[] = $this->passwordFormSubmitted;
     return $form;
 }
 /**
  * @param \Nette\Application\UI\Form $form
  * @param string[] Items
  */
 protected function addOrder($form, $items)
 {
     $form->addGroup('Řazení');
     $order = $form->addDynamic('order', function (Container $order) use($items) {
         $order->addSelect('by', 'Položka', $items);
         $order->addRadioList('dir', 'Směr', array('asc' => 'vzestupně', 'desc' => 'sestupně'));
         $order->addSubmit('removeOrder', 'Odstranit')->setAttribute("class", "ajax btn btn-xs")->setValidationScope(FALSE)->onClick[] = array($this, 'removeItem');
     });
     $order->addSubmit('addOrder', 'Přidat řazení')->setValidationScope(FALSE)->setAttribute("class", "ajax btn btn-xs")->onClick[] = array($this, 'addItem');
 }
 public function create()
 {
     $form = new Form();
     $form->addGroup("Set Google Analytics key");
     $form->addText("key", "Google Analytics api key:")->setRequired('Fill Google Analytics api key');
     $form->addSubmit("send", "Set Google Analytics key");
     $form->onSuccess[] = $this->processForm;
     $form->setDefaults(array("key" => $this->settingsDao->getGoogleAnalyticsKey()));
     return $form;
 }
 public function create()
 {
     $form = new Form();
     $form->addGroup("Set robots.txt");
     $form->addTextArea("robots", "Robots.txt content:");
     $form->addSubmit("send", "Set robots.txt");
     $form->onSuccess[] = $this->processForm;
     $form->setDefaults(array("robots" => $this->settingsDao->getRobots()));
     return $form;
 }
 /**
  * @param Category[] $categories
  * @param string|null $code
  * @return Form
  */
 public function create($categories, $code = null)
 {
     $validaton_message = "Vyplňte prosím %s. Pomůže mi to lépe zpracovat výsledky průzkumu. Díky ;)";
     $form = new Form($this->parent, $this->name);
     $form->addGroup("Obecné");
     $sex = array(Respondent::GENDER_MALE => 'muž', Respondent::GENDER_FEMALE => 'žena');
     $form->addRadioList('gender', 'Pohlaví:', $sex)->setAttribute("class", "buttons-group")->addRule(Form::REQUIRED, $validaton_message, "svoje pohlaví");
     $age = array(Respondent::AGE_15 => 'méne něž 15', Respondent::AGE_15_20 => '15-20', Respondent::AGE_21_30 => '21-30', Respondent::AGE_31_45 => '31-45', Respondent::AGE_46_60 => '46-60', Respondent::AGE_60 => 'více než 60');
     $form->addRadioList('age', 'Věk', $age)->setAttribute('class', 'buttons-group')->addRule(Form::REQUIRED, $validaton_message, "svůk věk");
     $truefalseoptions = array(1 => "Ano", 0 => "Ne");
     $form->addRadioList("english", "Navštěvuji anglické webové stránky", $truefalseoptions)->setAttribute('class', 'buttons-group')->addRule(Form::REQUIRED, $validaton_message, "zda navštěvujete i anglické webové stránky");
     $form->addRadioList("it", "Pracuji v oboru IT nebo tento obor studuji", $truefalseoptions)->setAttribute('class', 'buttons-group')->addRule(Form::REQUIRED, $validaton_message, "zda pracujete v oboru IT nebo ho studujete");
     if ($code !== null) {
         $form->addHidden("code", $code);
     }
     $form->addTextArea("sites", "Jaké stránky často navštěvuji");
     $devices = array(Respondent::DEVICE_COMPUTER => "Počítač nebo notebook", Respondent::DEVICE_PHONE => "Smartphone", Respondent::DEVICE_TABLET => "Tablet");
     $form->addCheckboxList('device', 'K přístupu na internet používám:', $devices)->setAttribute("class", "buttons-group")->addRule(Form::REQUIRED, $validaton_message, "které zařízení používáte pro přístup k internetu");
     $form->addRadioList("device_most", "A z toho nejčastěji", $devices)->setAttribute("class", "buttons-group")->addRule(Form::REQUIRED, $validaton_message, "které zařízení nejčastěji používáte pro přístup k internetu");
     $period = array(EntityCategory::PERIOD_NEVER => "vůbec", EntityCategory::PERIOD_DAILY => "denně", EntityCategory::PERIOD_FEW_TIMES_A_WEEK => "několikrát týdně", EntityCategory::PERIOD_FEW_TIMES_A_MONTH => "několikrát měsíčně", EntityCategory::PERIOD_FEW_TIMES_A_YEAR => "několikrát ročně");
     $categories_container = $form->addContainer("category");
     foreach ($categories as $holder_category) {
         $category_container = $categories_container->addContainer($holder_category->getCategory()->id_category);
         $category_container->setCurrentGroup($categories_container->getForm()->addGroup($holder_category->getCategory()->label));
         $category_container->addRadioList("period", "Jak často?", $period)->setAttribute("class", "buttons-group");
         if ($holder_category->getChildren()) {
             $items = array();
             foreach ($holder_category->getChildren() as $child) {
                 $items[$child->id_category] = $child->label;
             }
             $category_container->addCheckboxList("items", $holder_category->getCategory()->child_label, $items)->setAttribute("class", "buttons-group");
         }
     }
     $form->setCurrentGroup(NULL);
     $form->addGroup("Zajímá mě to");
     $form->addText("nickname", "Nick (chci být v highscore)");
     $form->addText("email", "E-mail")->setType("email");
     $form->addTextArea("message", "Vzkaz");
     $form->addSubmit("validate", "Pokračovat")->setAttribute("class", "btn btn-primary");
     $form->addSubmit("nonvalidate", "Přejít rovnou k otázkám")->setValidationScope(FALSE)->setAttribute("class", "btn btn-default");
     return $form;
 }
 public function createComponentDemoForm()
 {
     $form = new Form();
     if (class_exists('Instante\\Bootstrap3Renderer\\BootstrapRenderer')) {
         $form->setRenderer(new BootstrapRenderer());
     }
     $form->addGroup('Text fields');
     $form->addText('email', 'Email')->setType('email')->setOption('placeholder', 'Email');
     $form->addTextArea('textarea', 'Textarea');
     $form->addPassword('password', 'Heslo')->setOption('placeholder', 'Heslo');
     $form->addGroup('Other fields');
     $form->addSelect('select', 'Select', ['foo' => 'Foo', 'bar' => 'Bar'])->setPrompt('-choose-')->addError('This field is in an error state');
     $form->addCheckboxList('checkboxlist', 'Checkbox List', ['foo' => 'Foo', 'bar' => 'Bar']);
     $form->addRadioList('rlist', 'Radio List', ['foo' => 'Foo', 'bar' => 'Bar']);
     $form->addCheckbox('remember', 'Neodhlašovat');
     $form->addSubmit('send', 'Přihlásit')->setOption('btn-class', 'btn-primary');
     $form->addSubmit('s2', 'Submit 2');
     $form->addError('This is global form error');
     return $form;
 }
Beispiel #17
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = new Form();
     $form->addGroup("Přihlásit se");
     $form->addText('email', 'Email:', 50)->setType("email")->setRequired(Form::FILLED, 'Vyplňte prosím email');
     $form->addPassword('password', 'Heslo:', 50)->addRule(Form::FILLED, 'Vyplňte prosím heslo:');
     $form->addCheckbox('persistent', 'Pamatovat si mě na tomto počítači');
     $form->addSubmit('login', 'Přihlásit se');
     $form->onSuccess[] = $this->processForm;
     $form->setRenderer(new Bs3FormRenderer());
     return $form;
 }
Beispiel #18
0
 public function createComponentSignInForm()
 {
     $form = new UI\Form();
     $form->addGroup('');
     $form->addText('username', 'Username:'******'Please enter your username.');
     $form->addPassword('password', 'Password:'******'Please enter your password.');
     $form->addCheckbox('remember', 'Keep me signed in');
     $form->addSubmit('submit', 'Sign in');
     // call method signInFormSubmitted() on success
     $form->onSuccess[] = $this->signInFormSuccess;
     return $form;
 }
Beispiel #19
0
 public function createComponentObodujForm()
 {
     $form = new Form();
     $form->setRenderer(new \EditFormRenderer());
     $form->addGroup('Body');
     $form->addHidden('priklad');
     $form->onSuccess[] = callback($this, 'submitOboduj');
     $priklad = $this->context->httpRequest->getPost('priklad');
     if (!is_null($priklad)) {
         return $this->populateObodujForm($priklad, $form);
     }
     return $form;
 }
 /**
  * @param string[] $websites
  * @param \App\Holder\PageRelated[] $duels
  * @return Form
  */
 public function create($websites, $duels)
 {
     $periods = array(RespondentWebsite::PERIOD_KNOW_AND_VISIT => "Znám a navštěvuji", RespondentWebsite::PERIOD_KNOW_THAT_EXISTS => "Pouze vím, že existuje", RespondentWebsite::PERIOD_DONT_KNOW => "Neznám");
     $form = new Form($this->parent, "finalForm");
     $form->addGroup("Znáte následující stránky?");
     $websites_container = $form->addContainer("website");
     foreach ($websites as $website_id => $website_name) {
         $website_container = $websites_container->addContainer($website_id);
         $website_container->addRadioList("period", $website_name, $periods)->setAttribute("class", "buttons-group");
     }
     $form->addGroup("Jaké stránky navštěvujete častěji?");
     $duels_container = $form->addContainer("duels");
     foreach ($duels as $page_related_holder) {
         $duel_container = $duels_container->addContainer($page_related_holder->getPageRelated()->id_page_related);
         $title = $page_related_holder->getPageA()->getWebsite()->name . " vs. " . $page_related_holder->getPageB()->getWebsite()->name;
         $options = array($page_related_holder->getPageA()->getPage()->id_page => $page_related_holder->getPageA()->getWebsite()->name, RespondentPageDuel::MORE_OFTEN_BOTH => "nastejno", $page_related_holder->getPageB()->getPage()->id_page => $page_related_holder->getPageB()->getWebsite()->name, RespondentPageDuel::MORE_OFTEN_NONE => "nenavštěvuji ani jeden web");
         $duel_container->addRadioList("page", $title, $options)->setAttribute("class", "buttons-group");
     }
     $form->addGroup(null);
     $form->addText("email", "E-mail")->setType("email");
     $form->addSubmit("send", "Dokončit dotazník")->setAttribute("class", "btn btn-lg btn-primary");
     return $form;
 }
  /**
 * Edit hlavne menu form component factory.
 * @return Nette\Application\UI\Form
 */
  public function create($slider_i, $wwwDir)
  {
      $this->slider_i = $slider_i;
      $this->wwwDir = $wwwDir;
      $form = new Form();
      $form->addProtection();
      $form->addHidden('id');
      $form->addGroup();
      $form->addUpload('subor', 'Obrázok slideru')->setOption('description', 'Odporúčaný rozmer obrázku je: ' . $this->slider_i['x'] . 'x' . $this->slider_i['y'] . ' alebo násobky tejto veľkosti. Inak môže dôjsť k deformácii alebo orezaniu obrázku pri ukladaní!')->addCondition(Form::FILLED)->addRule(Form::IMAGE, 'Obrázok musí byť JPEG, PNG alebo GIF.')->addRule(Form::MAX_FILE_SIZE, 'Maximálna veľkosť súboru je 1 MB.', 1024 * 1024);
      $form->addText('nadpis', 'Nadpis:', 50, 50);
      $form->addText('popis', 'Popis:', 50, 150);
      $form->addText('poradie', 'Poradie:', 10, 10);
      if ($slider_i['odkaz']) {
          $form->addText('id_hlavne_menu', 'Id článku pre odkaz:', 5, 5)->setType('number')->addCondition(Form::FILLED)->addRule(Form::INTEGER, 'Id článku musí byť číslo!');
      }
      $form->addCheckbox("zobrazenie_null", " Obrázok sa zobrazí vždy")->addCondition(Form::EQUAL, TRUE)->toggle("zobr", FALSE);
      $form->addGroup()->setOption('container', Html::el('fieldset')->id("zobr"));
      $form->addText('zobrazenie', 'Zobrazenie:', 20, 20)->setOption('description', 'Zapíšte tie id hlavného menu, pre ktoré sa daný obrázok zobrazí. Ak viac id oddelte medzerou.');
      $form->setCurrentGroup(NULL);
      $form->addSubmit('uloz', 'Ulož')->setAttribute('class', 'btn btn-success')->onClick[] = array($this, 'editSliderFormSubmitted');
Beispiel #22
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = new Form();
     $form->addGroup($this->performance ? "Upravit představení" : "Přidat představení");
     $form->addTextArea("songAuthor", "Autor skladby:")->setRequired("Vyplňte prosím autora skladby");
     $form->addTextArea("songName", "Jméno skladby:")->setRequired("Vyplňte prosím jméno skladby");
     $form->addTextArea("note", "Poznámka:");
     $form->addSubmit("send", $this->performance ? "Upravit představení" : "Přidat představení");
     $form->onSuccess[] = $this->processForm;
     if ($this->performance) {
         $form->setDefaults(["songAuthor" => $this->performance->songAuthor, "songName" => $this->performance->songName, "note" => $this->performance->note]);
     }
     return $form;
 }
Beispiel #23
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = new Form();
     $form->addGroup($this->event ? "Upravit událost" : "Přidat událost");
     $form->addText("name", "Jméno:")->setRequired("Vyplňte prosím jméno");
     $form->addText("date", "Datum:")->setAttribute('class', 'datepicker')->setRequired("Vyberte prosím datum");
     $form->addText("place", "Místo:")->setRequired("Vyplňte prosím místo");
     $form->addTextArea("note", "Poznámka:");
     $form->addSubmit("send", $this->event ? "Upravit událost" : "Přidat událost");
     $form->onSuccess[] = $this->processForm;
     if ($this->event) {
         $form->setDefaults(["name" => $this->event->name, "date" => $this->event->date->format('Y-m-d'), "place" => $this->event->place, "note" => $this->event->note]);
     }
     return $form;
 }
 protected function createComponentFilterForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addGroup('Filtrování');
     $form->addText('id', 'Id');
     $form->addText('subquestions', 'Počet otázek');
     $form->addText('correct', 'Počet správně');
     $form->addText('almost', 'Počet téměř');
     $form->addText('wrong', 'Počet špatně');
     $form->addText('disqualified', 'Počet nepočítaných');
     $form->addText('percentages', 'Úspěšnost');
     $this->addOrder($form, array('total_subquestions' => 'počet otázek', 'total_correct_subquestions' => 'počet správně', 'total_correct_subquestions_percents' => 'úspěšnost'));
     $form->onSuccess[] = $this->filterFormSubmited;
     $form->addGroup();
     $form->addSubmit('filter', 'Filtrovat')->setAttribute("class", "btn btn-primary ajax");
     return $form;
 }
  /**
 * Edit hlavne menu form component factory.
 * @return Nette\Application\UI\Form
 */
  public function create()
  {
      $form = new Form();
      $form->addProtection();
      $form->addGroup();
      $form->addHidden('id');
      $form->addText('nazov', 'Názov kontaktu:', 40, 30)->addRule(Form::MIN_LENGTH, 'Názov kontaktu musí mať aspoň %s znakov', 2)->setAttribute('autofocus', 'autofocus')->setRequired('Názov kontaktu musí byť zadaný!');
      $form->addText('meno', 'Meno a priezvisko:', 90, 70);
      $form->addText('adresa', 'Adresa:', 90, 255);
      $form->addText('telefon', 'Telefónne číslo:', 40, 30);
      $form->addText('mobil', 'Mobilné číslo:', 40, 20);
      $form->addText('email', 'E-mailová adresa', 40, 40)->setType('email')->addCondition(Form::FILLED)->addRule(Form::EMAIL, 'Musí byť zadaná korektná e-mailová adresa(napr. janko@hrasko.sk)');
      $form->addText('poznamka', 'Poznámka:', 90, 255);
      $form->addSubmit('uloz', 'Ulož')->setAttribute('class', 'btn btn-success')->onClick[] = [$this, 'editAdresaFormSubmitted'];
  /**
 * Edit hlavne menu form component factory.
 * @return Nette\Application\UI\Form
 */
  public function create($send_e_mail_news = FALSE)
  {
      $form = new Form();
      $form->addProtection();
      $form->addGroup();
      $form->addHidden("id");
      $form->addHidden("id_user_profiles");
      $form->addText('cislo', 'Číslo verzie:', 50, 80)->setAttribute('autofocus', 'autofocus')->addRule(Form::FILLED, 'Číslo verzie musí byť zadané!');
      $form->addText('subory', 'Zmenené súbory:', 50, 80);
      if ($send_e_mail_news) {
          $form->addCheckbox('posli_news', ' Posielatie NEWS o tejto aktualite');
      } else {
          $form->addHidden("posli_news", FALSE);
      }
      $form->addTextArea('text', 'Popis zmien:', 60, 15);
      $form->addSubmit('uloz', 'Ulož')->setAttribute('class', 'btn btn-success');
Beispiel #27
0
 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $teacherList = [];
     foreach ($this->userFacade->getUsersList() as $user) {
         $teacherList[$user->id] = $user->name;
     }
     $form = new Form();
     $form->addGroup($this->child ? "Upravit žáka" : "Přidat žáka");
     $form->addText("name", "Jméno:")->setRequired("Vyplňte prosím jméno");
     $form->addSelect("instrument", "Hudební nástroj", ["klavír" => "klavír", "zob. flétna" => "zob. flétna", "flétna" => "flétna", "klarinet" => "klarinet", "saxofon" => "saxofon", "trubka" => "trubka", "baskřídlovka" => "baskřídlovka", "trombon" => "trombon", "tuba" => "tuba", "bicí nástroje" => "bicí nástroje", "zpěv" => "zpěv", "housle" => "housle", "kontrabas" => "kontrabas", "kytara" => "kytara", "cimbál" => "cimbál", "LDO" => "LDO", "safoxon" => "safoxon", "altsafoxon" => "altsafoxon", "tenorsaxofon" => "tenorsaxofon", "baritonsaxofon" => "baritonsaxofon", "sopránsaxofon" => "sopránsaxofon", "cimbálová muzika" => "cimbálová muzika", "dechová hudba" => "dechová hudba", "komorní hra" => "komorní hra", "komorní zpěv" => "komorní zpěv", "žesťové kvinteto" => "žesťové kvinteto", "žesťové kvarteto" => "žesťové kvarteto", "duo zob. fléten" => "duo zob. fléten", "trio zob. fléten" => "duo zob. fléten", "kytarové duo" => "kytarové duo", "kytarové trio" => "kytarové trio", "taneční obor" => "taneční obor", "klarinetové duo" => "klarinetové duo", "sbor" => "sbor"])->setPrompt("-- Vyberte prosím nástroj --")->setRequired("Vyplňte prosím hudební nástroj");
     $form->addSelect("teacher", "Učitel", $teacherList)->setPrompt("-- Bez učitele --");
     $form->addSelect("class", "Ročník:", ["PHV" => "PHV", "1. roč. " => "1. roč. ", "2. roč. " => "2. roč. ", "3. roč. " => "3. roč. ", "4. roč. " => "4. roč. ", "5. roč. " => "5. roč. ", "6. roč. " => "6. roč. ", "7. roč. " => "7. roč. ", "1./II. " => "1./II. ", "2./II. " => "2./II. ", "3./II. " => "3./II. ", "4./II. " => "4./II. ", "j. h." => "j. h. "])->setPrompt("-- Bez ročníku --");
     $form->addSubmit("send", $this->child ? "Upravit žáka" : "Přidat žáka");
     $form->setRenderer(new Bs3FormRenderer());
     $form->onSuccess[] = $this->processForm;
     if ($this->child) {
         $form->setDefaults(["name" => $this->child->name, "instrument" => $this->child->instrument, "teacher" => $this->child->teacher ? $this->child->teacher->id : null, "class" => $this->child->class]);
     }
     return $form;
 }
Beispiel #28
0
 public function createComponentNameForm()
 {
     $form = new Form();
     $form->setRenderer(new \EditFormRenderer());
     $dataRiesitelia = $this->context->sources->riesitelSource->getAll();
     $riesitelia = array();
     $riesitelia['-1'] = 'Riešim prvýkrát';
     foreach ($dataRiesitelia as $riesitel) {
         $riesitelia[$riesitel['id']] = "{$riesitel['meno']} {$riesitel['priezvisko']}";
     }
     $form->addGroup('Kto som');
     $form->addSelect('riesitel', 'Moje meno:', $riesitelia);
     $form['riesitel']->setPrompt('Nájdi sa v zozname');
     $form['riesitel']->addRule(Form::FILLED, 'Nájdite svoje meno v zozname, alebo zvoľte možnosť „Riešim prvýkrát.“');
     /** Inteligent javascript selectBox */
     $form['riesitel']->getControlPrototype()->class[] = 'chosen';
     $form->addSubmit('next', 'Pokračuj v registrácii');
     $form->onSuccess[] = callback($this, 'onNameSubmit');
     return $form;
 }
Beispiel #29
0
 /**
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentNewServerForm()
 {
     $form = new Form();
     $form->addGroup('Vytvořit nový server');
     $form->addText('name', "Jméno serveru:")->addRule(Form::FILLED, "Server musíte nějak pojmenovat.")->addRule(Form::PATTERN, 'Jméno serveru musí obsahovat pouze písmena bez diakritiky a čísla.', '[a-zA-Z_0-9]+');
     if ($this->config['storage']['common'] == "0") {
         $form->addText('path', 'Cesta v systému souborů:', 36)->addRule(Form::FILLED, " ")->addRule(Form::PATTERN, "Toto není platná cesta ke složce, ty začínají a končí lomítkem.", "^/[a-z/]+[/]\$");
     } else {
         $form->addHidden('path', $this->config['storage']['common']);
     }
     $form->addHidden('storage', $this->config['storage']['common']);
     $form->addSubmit('send', 'Pokračovat');
     $form->onSuccess[] = $this->newServerFormSubmitted;
     $servers = $this->serverRepo->findBy(array('user_id' => $this->user->id))->fetchPairs('id', 'name');
     if (count($servers) >= $this->config['server']['number']) {
         $form['send']->setDisabled();
         $form['name']->setDisabled();
         $form['span'] = new InfoSpan(NULL, "Máte maximální počet(" . $this->config['server']['number'] . ") serverů na hráče!", "icon warning");
     }
     return $form;
 }
 /**
  * @return Nette\Application\UI\Form
  */
 protected function createComponentServerParams()
 {
     $form = new Form();
     $form->addGroup('runtime');
     $form->addText('name', 'Jméno: ', 30, 20)->addRule(Form::FILLED, 'server musí mít jméno');
     $form->addText('path', 'Cesta: ', 30)->addRule(Form::FILLED, 'je nutné specifikovat cestu')->addRule(Form::PATTERN, "Toto není platná cesta ke složce, ty začínají a končí lomítkem.", "^/[^/].*/\$");
     $form->addText('executable', 'jméno .jar: ', 30)->addRule(Form::FILLED, 'je nutno specifikovat jméno .jar souboru');
     $form->addSubmit('update', 'Upravit')->setAttribute('class', 'ajax');
     if ($this->commonStorage) {
         $form['path']->setDisabled();
         $form['executable']->setDisabled();
     }
     if (!$this->user->isAllowed('server-settings', 'edit')) {
         $form['update']->setDisabled();
     }
     //defaults
     $values = $this->serverRepo->findById($this->selectedServerId)->fetch();
     $form->setValues($values);
     $form->onSuccess[] = $this->serverParamsFormSubmitted;
     return $form;
 }