HosipLan

Untitled

Mar 30th, 2012
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. use Nette\Application\UI;
  2.  
  3.  
  4. class SearchComponent extends UI\Control
  5. {
  6.  
  7.     /** @persistent */
  8.     public $param1;
  9.  
  10.     /** @persistent */
  11.     public $param2;
  12.  
  13.     private $model;
  14.  
  15.  
  16.  
  17.     public function __construct($model)
  18.     {
  19.         $this->model = $model;
  20.     }
  21.  
  22.  
  23.  
  24.     public function render()
  25.     {
  26.         $this->template->results = $this->model->search($this->param1, $this->param2);
  27.         $this->template->render();
  28.     }
  29.    
  30.  
  31.  
  32.     protected function createComponentForm()
  33.     {
  34.         $form = new UI\Form;
  35.         $form->setMethod('GET');
  36.  
  37.         $search = $form->addContainer($this->name); // jmeno komponenty - naivní implementace
  38.         $search->addText('param1', 'Jedna');
  39.         $search->addText('param2', 'Dva');
  40.  
  41.         $form->addSubmit('search', 'Hledat');
  42.         return $form;
  43.     }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment