/** * Create filter form * @return \Nette\Application\UI\Form */ protected function createComponentFilterForm() { $form = new \Nette\Application\UI\Form(); $form->setMethod(\Nette\Application\UI\Form::GET); foreach ($this->getColumns() as $column) { $name = $column->getColumn(); $label = $column->labelPrototype->getText(); if ($column instanceof Columns\OptionColumn && $column->options) { $form->addSelect($name, $label, $column->getOptions())->setPrompt($label); } else { $form->addText($name, $label); } $form[$name]->getControlPrototype()->placeholder = $label; } $form->setDefaults($this->filter); $form->addSubmit('filter', 'Filter'); $form->addSubmit('reset', 'Reset')->onClick[] = $this->resetFilters; $form->onSuccess[] = $this->filterFormSubmitted; return $form; }
/** * @return \Nette\Application\UI\Form */ protected function createComponentSetNewPassword() { $form = new \Nette\Application\UI\Form(); $form->addHidden("key", ""); $form->addHidden("id", 0); $form->addPassword("password", $this->t("forms.forgot-password.labels.password"))->setRequired($this->t("forms.forgot-password.rules.req-password")); $form->addPassword("passwordControl", $this->t("forms.forgot-password.labels.password-control"))->setRequired($this->t("forms.forgot-password.rules.req-password-control"))->addRule($form::EQUAL, $this->t("forms.forgot-password.rules.eq-password"), $form["password"]); $form["password"]->addRule($form::EQUAL, $this->t("forms.forgot-password.rules.eq-password"), $form["passwordControl"]); $form->addSubmit("send", $this->t("forms.forgot-password.labels.change")); $form->onSuccess[] = $this->setNewPassword; if (!is_null($this->actionKey)) { $form->setDefaults(array("key" => $this->actionKey->getKey(), "id" => $this->actionKey->getUserId())); } return $form; }