public function createButton() { if ($this->button) { return FALSE; } /** @var Nette\Forms\Container $container */ $container = $this->control->lookup('Nette\\Forms\\Container'); $name = $this->control->getName() . self::$buttonSuffix; $this->button = new SubmitButton("Apply"); $this->button->setValidationScope(false); $container->addComponent($this->button, $name); $this->control->getControlPrototype()->addAttributes(array('data-apply-button' => $this->button->getHtmlId())); return TRUE; }
public function savePlace(\Nette\Forms\Controls\Button $button) { $form = $button->getForm(); $values = $form->getValues(); $place = $this->context->createServicePlaces()->wherePrimary($values->id); $place->update($values); $this->presenter->flashMessage('Done', 'success'); $cache = new Cache($this->context->getService('cacheStorage')); $cache->clean(array(Cache::TAGS => array('subject', 'subjects', 'place', 'places'))); if ($this->presenter->isAjax()) { $this->redrawControl('content'); $this->presenter->redrawControl('flash'); } else { $this->redirect('this'); } }
/** * Generates control's HTML element. * @param string * @return Nette\Utils\Html */ public function getControl($caption = NULL) { $el = parent::getControl(''); $el->type = 'submit'; $el->class = $this->getClass(); if ($this->getIcon()) { $el->addHtml(Html::el('span')->class(DataGrid::$icon_prefix . $this->getIcon())); if (strlen($this->getText())) { $el->addHtml(' '); } } $el->addText($this->grid->getTranslator()->translate($this->getText())); return $el; }
public function __construct($caption = NULL) { parent::__construct($caption); $this->control->setName('a'); }
/** * @param string caption */ public function __construct($caption = NULL) { parent::__construct($caption); $this->control->type = 'submit'; }
/** * Generates control's HTML element. * @param string * @return Nette\Utils\Html */ public function getControl($caption = NULL) { $scope = array(); foreach ((array) $this->validationScope as $control) { $scope[] = $control->lookupPath('Nette\Forms\Form'); } return parent::getControl($caption)->addAttributes(array( 'formnovalidate' => $this->validationScope !== NULL, 'data-nette-validation-scope' => $scope ?: NULL, )); }
/** * @param string $caption */ public function __construct($caption = NULL) { parent::__construct($caption); $this->control->type = 'reset'; $this->control->class = 'button'; }
public function formInviteCollaboratorBtnAdminClicked(Button $button) { $values = $button->getForm()->getValues(); $id = $values->id; $user = $this->context->userFacade->find($id); $level = Access::ADMIN; $access = $this->context->projectFacade->addCollaboratorToProject($user, $this->project, $level); $this->log($this->project, Activity::ADD_COLLABORATOR, $access); $this->flash(sprintf('User <strong>%s</strong> has been added to project %s as %s', $user->getNick(), $this->project->getCaption(), $level)); $this->redirect('this'); }
/** * @param Button $button */ private function decorateFormButton(Button $button) { $button->getControlPrototype()->addClass($this->usedPrimary ? 'btn btn-primary' : 'btn btn-default'); }
Nette\Forms\ISubmitterControl{public$onClick;public$onInvalidClick;private$validationScope=TRUE;function __construct($caption=NULL){parent::__construct($caption);$this->control->type='submit';}function
public function goBack(Button $button) { $this->redirect('place', array('id' => $button->getForm()->getValues()->id)); }