Esempio n. 1
0
 protected function createComponentAddReference()
 {
     $form = new NAppForm();
     $form->addText('name', 'Jméno reference:');
     $form->addText('client', 'Klient:');
     $form->addText('scale', 'Rozsah:');
     $form->addText('realized', 'Realizováno:');
     $form->addText('url', 'SEO url (v rámci webu):');
     $form->addSelect('typ', 'Typ:', array('web' => "Webová reference", 'adv' => "Reklama"));
     // Reference positions
     $container = $form->addContainer('pos');
     $container->addCheckbox(ReferencesManager::REF_T_UVOD, ' Úvod');
     $container->addCheckbox(ReferencesManager::REF_T_RWEB, ' Reference (webdesign)');
     $container->addCheckbox(ReferencesManager::REF_T_RREK, ' Reference (reklama)');
     $container->addCheckbox(ReferencesManager::REF_T_WEBD, ' Webdesign');
     $container->addCheckbox(ReferencesManager::REF_T_VENK, ' Venkovní reklama');
     $container->addCheckbox(ReferencesManager::REF_T_TISK, ' Tisk');
     $container->addCheckbox(ReferencesManager::REF_T_GRAF, ' Grafika a Design');
     $container->addCheckbox(ReferencesManager::REF_T_PRED, ' Reklamní předměty');
     $container->addCheckbox(ReferencesManager::REF_T_RAZI, ' Razítka');
     $container->addCheckbox(ReferencesManager::REF_T_INZE, ' Inzerce');
     $container->addCheckbox(ReferencesManager::REF_T_FOTO, ' Fotografie');
     $container->addCheckbox(ReferencesManager::REF_T_MARK, ' Marketing');
     // Images
     $size = NEnvironment::getVariable('sizes');
     $form->addFile('pic_1', 'Obr. úvodka (' . $size[0][0] . 'x' . $size[0][1] . '):')->addCondition(NForm::FILLED)->addRule(NForm::MIME_TYPE, 'Obrázek musí být ve formátu JPG, PNG nebo GIF.', 'image/*');
     $form->addFile('pic_2', 'Obr. náhled (' . $size[1][0] . 'x' . $size[1][1] . '):')->addCondition(NForm::FILLED)->addRule(NForm::MIME_TYPE, 'Obrázek musí být ve formátu JPG, PNG nebo GIF.', 'image/*');
     $form->addFile('pic_3', 'Obr. popup: (' . $size[2][0] . 'x' . $size[2][1] . '):')->addCondition(NForm::FILLED)->addRule(NForm::MIME_TYPE, 'Obrázek musí být ve formátu JPG, PNG nebo GIF.', 'image/*');
     $form['pic_1']->getControlPrototype()->class('file');
     $form['pic_2']->getControlPrototype()->class('file');
     $form['pic_3']->getControlPrototype()->class('file');
     $form->addSubmit('addref', 'Uložit');
     $form->onSubmit[] = callback($this, 'addReferenceSubmited');
     return $form;
 }