コード例 #1
1
 /**
  * factory to create form of new item
  * @return \Nette\Application\UI\Form
  */
 public function createComponentAddForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText("name", _("Node name"), 50)->setRequired(_("You must enter name"));
     $form->addTextArea("comment", _("Comment"), 52)->setRequired(_("You must enter comment"));
     $form->addText("aet", _("AE title"), 16)->setRequired(_("You must enter AE title"))->addRule(\Nette\Application\UI\Form::PATTERN, _("Only letters, numbers and *,_,-,. characters allowed"), "([a-zA-Z0-9\\*\\.\\-\\_]*)")->addRule(\Nette\Application\UI\Form::MAX_LENGTH, _("Maximal length of AE title is 16 characters"), 16);
     $form->addText("ip_address", _("IP address"), 20)->setRequired(_("You must enter ip address"))->addRule(\Nette\Application\UI\Form::PATTERN, _("Format of IP address is not valid"), "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})");
     $form->addText("port", _("Port"), 5)->setRequired(_("You must enter port"))->addRule(\Nette\Application\UI\Form::INTEGER, _("Port must be a number"))->addRule(\Nette\Application\UI\Form::RANGE, _("Port must be between 1 and 65536"), 1, 65536);
     $form->addSelect("compression", _("Compression type"), $this->compressions);
     $groups = $this->groups;
     unset($groups[""]);
     $form->addSelect("group", _("Node group"), $groups);
     $form->addSubmit('save', _("Save"));
     $form->onSuccess[] = array($this, 'processAddForm');
     $this->setFromBootstrap($form);
     return $form;
 }
コード例 #2
1
ファイル: PacsConfigPresenter.php プロジェクト: OCC2/occ2pacs
 /**
  * factory to create form of new item
  * @return \Nette\Application\UI\Form
  */
 public function createComponentAddForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addTextArea("comment", _("Comment of item"), 60)->setRequired(_("You must enter comment"));
     $form->addText("item", _("Item key"), 60)->setRequired(_("You must enter item key"));
     $form->addText("value", _("Value"), 60)->setRequired(_("You must enter item value"));
     $groups = $this->groups;
     unset($groups[""]);
     $form->addSelect("group", _("Configuration group"), $groups);
     $form->addSubmit('save', _("Save"));
     $form->onSuccess[] = array($this, 'processAddForm');
     $this->setFromBootstrap($form);
     return $form;
 }
コード例 #3
0
ファイル: StitkyPresenter.php プロジェクト: hleumas/databaza
 public function createComponentForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addTextArea('sql', $this->sql);
     $form->addSubmit('submit', 'getStitky');
     $form->onSuccess[] = callback($this, 'sendStitky');
     return $form;
 }
コード例 #4
0
 public function createComponentAddToChangelog()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addText('description', 'Short description')->setRequired('Write short description what you are changing');
     $form->addTextArea('queries', 'SQL queries', 60, 20)->setRequired('Huh?')->getControlPrototype()->class('long');
     $form->addSubmit('send', 'Save')->getControlPrototype()->class('btn btn-primary')->style("padding: 4px 25px;");
     $form->onSuccess[] = callback($this, 'addToChangelog');
     return $form;
 }
コード例 #5
0
ファイル: CompetitionsPresenter.php プロジェクト: soundake/pd
 public function createComponentForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->setTranslator($this->translator);
     $form->addHidden('id');
     $form->addText('name', 'Title');
     $form->addText('term', 'Term')->setOption('description', 'Termin kdy se akce kona.');
     $form->addText('published', 'Published')->setRequired('Date of publication is required!')->setDefaultValue(new \DibiDateTime());
     $form->addTextArea('perex', 'Perex')->addRule(\Nette\Application\UI\Form::FILLED, 'Perex must be filled')->getControlPrototype()->class('texyla');
     foreach ($this->context->createServiceFiles()->where('isImage', '1')->where('isnull(deleted)')->where('visible', '1')->limit(500)->order('created DESC') as $item) {
         $el = \Nette\Utils\Html::el('option')->value($item->id)->setText('' . $item->name . '       __      ' . $this->presenter->getHttpRequest()->url->baseUrl . 'image/crop-100x100/' . $item->code);
         $arr[$item->id] = $el;
     }
     foreach ($this->context->createServiceFiles()->where('id', $this->event->file_id) as $item) {
         $el = \Nette\Utils\Html::el('option')->value($item->id)->setText($this->presenter->getHttpRequest()->url->baseUrl . 'image/crop-100x100/' . $item->code);
         $arr[$item->id] = $el;
     }
     $form->addSelect('file_id', 'File:', $arr)->setPrompt('Choose image')->setAttribute('class', 'egg');
     //		foreach ($this->context->createServiceFiles()->where('isImage', '1')->where('isnull(deleted)')->where('visible','1')->limit(100)->order('created DESC') as $item) {
     //			$el = \Nette\Utils\Html::el('option')->value($item->id)->setText($item->name)->data(array('imagesrc' => $this->presenter->getHttpRequest()->url->baseUrl . 'image/crop-40x40/' . $item->code, 'description' => $item->description));
     //			//if($key == $data->doprava_id)
     //			//$el->selected(TRUE);
     //			$arr[$item->id] = $el;
     //		}
     //
     //		$form->addSelect('file_id', 'File:', $arr)
     //			->setPrompt('Choose image')->setAttribute('class', 'ddslick');
     //		$form->addSelect('file_id', 'File', $this->context->createServiceFiles()->where('isImage','1')->where('isnull(deleted)')->fetchPairs('id', 'name'))->setPrompt('Choose image');
     $form->addTextArea('description', 'Description')->addRule(\Nette\Application\UI\Form::FILLED, 'Body must be filled')->getControlPrototype()->class('texyla');
     $form->addTextArea('results', 'Results')->getControlPrototype()->class('texyla');
     $form->addTextArea('notes', 'Notes');
     $form->addCheckbox('visible', 'Visible')->setDefaultValue(1);
     $form->addCheckbox('ad', 'Recommended');
     $form->onSuccess[] = callback($this, 'onSuccess');
     $form->addSubmit('save', 'Save')->getControlPrototype()->class('primary');
     $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = callback($this, 'onCancel');
     $form['cancel']->getControlPrototype()->class('cancel');
     return $form;
 }
コード例 #6
0
ファイル: FlagsControl.php プロジェクト: soundake/pd
 public function createComponentForm()
 {
     $form = new \Nette\Application\UI\Form();
     //$form->getElementPrototype()->class('form-horizontal');
     $form->setTranslator($this->parent->translator);
     $form->getElementPrototype()->setClass("ajax");
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = 'div class="control-group"';
     $renderer->wrappers['label']['container'] = NULL;
     $renderer->wrappers['control']['container'] = NULL;
     $form->addTextArea('text', 'Sdělte nám prosím, co je potřeba upravit. Pokud chcete, abychom vám odpověděli, napište do zprávy svůj e-mail:')->setRequired('Text must be filled.')->getControlPrototype()->class('span12');
     $form->addHidden('id');
     $form->addHidden('subject_id');
     $form->addHidden('event_id');
     $form->addText('www')->setAttribute('class', 'hidden')->setDefaultValue('');
     $form->addSubmit('login', 'Send')->setAttribute("class", "btn");
     $form->onSuccess[] = array($this, 'save');
     return $form;
 }