Пример #1
0
 function createComponentWidgetForm($name)
 {
     $f = new MyForm();
     $f->addText('identifier', 'Identifikátor')->addRule(NForm::FILLED, 'Identifikátor musí byť vyplnený');
     $f->addText('name', 'Názov');
     $f->addTextarea('template', 'Šablóna')->getControlPrototype()->class = 'long';
     $f->addHidden('id_widget');
     $f->addContainer('params');
     $f->addSubmit('save', 'Uložiť');
     $f->addSubmit('addNewParam', 'Pridať parameter')->onClick[] = callback($this, 'handleAddNewParam');
     $f->onSuccess[] = array($this, 'handleSaveForm');
     $values = (array) $this->getService('Widget')->get($this->getParam('id'));
     foreach ($values['params'] as $k => $p) {
         $container = $f['params']->addContainer($k);
         $container->addText('name', 'Názov');
         $container->addText('value', 'Hodnota');
         //->setDefaultValue(array($p['value']));
         $container->setDefaults((array) $p);
     }
     //		unset($values['params']);
     return $f;
 }
Пример #2
0
 /**
  * Form to show list of topics with checkboxes
  *
  * @access protected
  * @return Nette\Application\UI\Form
  * @since 1.0.0
  */
 protected function createComponentForumTopicsForm()
 {
     $form = new MyForm();
     $form->setMethod('get');
     $container = $form->addContainer($this->forumSelectedTopicsContainer);
     foreach ($this->forumThreads as $thread) {
         $container->addCheckbox($thread->id_thread, $thread->title);
     }
     $form->addSubmit('show', 'View selected');
     return $form;
 }