コード例 #1
0
ファイル: DependencyHelper.php プロジェクト: mike227/n-forms
 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;
 }
コード例 #2
0
 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');
     }
 }
コード例 #3
0
ファイル: SubmitButton.php プロジェクト: ublaboo/datagrid
 /**
  * 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;
 }
コード例 #4
0
ファイル: LinkSubmit.php プロジェクト: zaxcms/framework
 public function __construct($caption = NULL)
 {
     parent::__construct($caption);
     $this->control->setName('a');
 }
コード例 #5
0
ファイル: SubmitButton.php プロジェクト: svobodni/web
 /**
  * @param  string  caption
  */
 public function __construct($caption = NULL)
 {
     parent::__construct($caption);
     $this->control->type = 'submit';
 }
コード例 #6
0
ファイル: SubmitButton.php プロジェクト: nakoukal/fakturace
	/**
	 * 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,
		));
	}
コード例 #7
0
ファイル: ResetButton.php プロジェクト: lohini/framework
 /**
  * @param string $caption
  */
 public function __construct($caption = NULL)
 {
     parent::__construct($caption);
     $this->control->type = 'reset';
     $this->control->class = 'button';
 }
コード例 #8
0
 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');
 }
コード例 #9
0
 /**
  * @param Button $button
  */
 private function decorateFormButton(Button $button)
 {
     $button->getControlPrototype()->addClass($this->usedPrimary ? 'btn btn-primary' : 'btn btn-default');
 }
コード例 #10
0
ファイル: loader.php プロジェクト: JanTvrdik/NetteExtras
Nette\Forms\ISubmitterControl{public$onClick;public$onInvalidClick;private$validationScope=TRUE;function
__construct($caption=NULL){parent::__construct($caption);$this->control->type='submit';}function
コード例 #11
0
ファイル: PlacesPresenter.php プロジェクト: soundake/pd
 public function goBack(Button $button)
 {
     $this->redirect('place', array('id' => $button->getForm()->getValues()->id));
 }