Exemplo n.º 1
0
 public function createComponentForm()
 {
     $form = new \Nette\Application\UI\Form();
     $form->setTranslator($this->translator);
     $form->addHidden('id');
     $form->addText('title', 'Title');
     $form->addText('description', 'Description');
     $form->addText('link', 'Link URL');
     $form->addText('link_text', 'Link Text');
     $form->addSelect('file_id', 'File', $this->context->createServiceFiles()->where('isImage', '1')->where('isnull(deleted)')->fetchPairs('id', 'name'))->setPrompt('Choose image');
     $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;
 }
Exemplo n.º 2
0
 public function createComponentLoginForm()
 {
     $form = new Nette\Application\UI\Form();
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'div class="control-group"';
     $renderer->wrappers['pair']['container'] = NULL;
     $renderer->wrappers['label']['container'] = NULL;
     $renderer->wrappers['control']['container'] = 'div class="controls"';
     $form->setTranslator($this->parent->translator);
     $form->getElementPrototype()->setClass("ajax");
     // ajax
     $form->addText('username', 'Username')->setRequired()->getLabelPrototype()->setClass('control-label');
     $form['username']->getControlPrototype()->setClass(' input-block-level');
     $form->addPassword('password', 'Password')->setRequired()->getLabelPrototype()->setClass('control-label');
     $form['password']->getControlPrototype()->setClass(' input-block-level');
     $form->addSubmit('login', 'Log in')->setAttribute("class", "btn");
     $form->onSuccess[] = callback($this, "login");
     return $form;
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
 protected function createComponentForm($name)
 {
     $form = new \Nette\Application\UI\Form($this, $name);
     $form->setTranslator($this->getTranslator());
     $form->setMethod($form::GET);
     $buttons = $form->addContainer(self::BUTTONS);
     $buttons->addSubmit('search', 'Grido.Search')->onClick[] = [$this, 'handleFilter'];
     $buttons->addSubmit('reset', 'Grido.Reset')->onClick[] = [$this, 'handleReset'];
     $buttons->addSubmit('perPage', 'Grido.ItemsPerPage')->onClick[] = [$this, 'handlePerPage'];
     $form->addSelect('count', 'Count', $this->getItemsForCountSelect())->setTranslator(NULL)->controlPrototype->attrs['title'] = $this->getTranslator()->translate('Grido.ItemsPerPage');
 }
Exemplo n.º 6
0
 public function createComponentOrderby()
 {
     $form = new \Nette\Application\UI\Form();
     $form->getElementPrototype()->class('form-inline');
     $form->setTranslator($this->translator);
     $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->addSelect('orderby', 'Order by:', array('name' => 'Sort Alpabeticaly', 'created DESC' => 'Recent first', 'recommended' => 'Tips', 'likes' => 'Recommendations'))->setValue($this->order)->setAttribute('onchange', 'submit()');
     $form->onSuccess[] = array($this, 'setOrder');
     return $form;
 }
Exemplo n.º 7
0
 public function createComponentOrderby()
 {
     $form = new \Nette\Application\UI\Form();
     $form->getElementPrototype()->class('form-inline');
     $form->setTranslator($this->translator);
     $form->addSelect('orderby', 'Order by:', array('date_from' => 'Start date', 'created DESC' => 'Recent first'))->setValue($this->order)->setAttribute('onchange', 'submit()');
     $form->onSuccess[] = array($this, 'setOrder');
     return $form;
 }