Exemple #1
0
 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');
     }
 }
Exemple #3
0
 /**
  * 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;
 }
Exemple #4
0
 public function __construct($caption = NULL)
 {
     parent::__construct($caption);
     $this->control->setName('a');
 }
Exemple #5
0
 /**
  * @param  string  caption
  */
 public function __construct($caption = NULL)
 {
     parent::__construct($caption);
     $this->control->type = 'submit';
 }
Exemple #6
0
	/**
	 * 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,
		));
	}
Exemple #7
0
 /**
  * @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');
 }
Exemple #10
0
Nette\Forms\ISubmitterControl{public$onClick;public$onInvalidClick;private$validationScope=TRUE;function
__construct($caption=NULL){parent::__construct($caption);$this->control->type='submit';}function
Exemple #11
0
 public function goBack(Button $button)
 {
     $this->redirect('place', array('id' => $button->getForm()->getValues()->id));
 }