Exemple #1
0
 protected function createComponent($name)
 {
     switch ($name) {
         case 'EshopProduct':
             $p = new EshopProductControl();
             $p->invalidateControl();
             return $p;
             break;
         case 'referenceForm':
             $params = NEnvironment::getApplication()->getPresenter()->getParam();
             $form = new MyForm();
             $form->addText('name', 'Meno:');
             $form->addProtection();
             $form->addText('email', 'Email:');
             $form->addTextarea('text', 'Text:');
             if (class_exists('reCAPTCHA')) {
                 $form->addRecaptcha('recaptcha_input', 'Overenie:')->addRule('reCAPTCHA::validate', 'Prosím prepíšte správne text z obrázku.');
             }
             $form->addSubmit('submit', 'Odoslať');
             $form->onSuccess[] = array($this, 'handleSendReference');
             $form->addHidden('id_product');
             $form->setDefaults(array('id_product' => ProductModel::getIdProductByUrl($params['url_identifier'], 1)));
             return $form;
             break;
         default:
             return parent::createComponent($name);
             break;
     }
 }