Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use Nette\Application\UI;
- class SearchComponent extends UI\Control
- {
- /** @persistent */
- public $param1;
- /** @persistent */
- public $param2;
- private $model;
- public function __construct($model)
- {
- $this->model = $model;
- }
- public function render()
- {
- $this->template->results = $this->model->search($this->param1, $this->param2);
- $this->template->render();
- }
- protected function createComponentForm()
- {
- $form = new UI\Form;
- $form->setMethod('GET');
- $search = $form->addContainer($this->name); // jmeno komponenty - naivní implementace
- $search->addText('param1', 'Jedna');
- $search->addText('param2', 'Dva');
- $form->addSubmit('search', 'Hledat');
- return $form;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment