当前位置: 首页>>代码示例>>PHP>>正文


PHP Form::isSubmitted方法代码示例

本文整理汇总了PHP中Nette\Application\UI\Form::isSubmitted方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::isSubmitted方法的具体用法?PHP Form::isSubmitted怎么用?PHP Form::isSubmitted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Application\UI\Form的用法示例。


在下文中一共展示了Form::isSubmitted方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validateAddUserForm

      $form->addSubmit('cancel', 'Cancel')->setAttribute('class', 'btn btn-default')->setValidationScope([]);
      return $form;
  }
  /** Vlastná validácia pre AddUserForm
 * @param Nette\Application\UI\Form $button
 */
  public function validateAddUserForm($button)
  {
      $values = $button->getForm()->getValues();
      if ($button->isSubmitted()->name == 'uloz') {
          // Over, ci dane username uz existuje.
          if ($this->users->findBy(['username' => $values->username])->count() > 0) {
              $button->addError(sprintf('Zadané užívateľské meno %s už existuje! Zvolte prosím iné!', $values->username));
          }
          // Over, ci dany email uz existuje.
开发者ID:petak23,项目名称:echo-msz,代码行数:15,代码来源:AddUserFormFactory.php

示例2: formSucceeded

 public function formSucceeded(Form $form, $values)
 {
     if ($values->remember) {
         $this->user->setExpiration('14 days', FALSE);
     } else {
         $this->user->setExpiration('20 minutes', TRUE);
     }
     if ($form->isSubmitted()->getName() != 'cancel') {
         try {
             $this->user->login($values->username, $values->password);
         } catch (Nette\Security\AuthenticationException $e) {
             $form->addError($e->getMessage());
         }
     }
 }
开发者ID:horakmar,项目名称:gorgon,代码行数:15,代码来源:SignFormFactory.php

示例3: processImageForm

 public function processImageForm(Form $form)
 {
     // uklada fotky
     if ($form->isSubmitted()) {
         $uploaded = 0;
         $dirPath = $this->dirPath;
         for ($i = 1; $i <= $this->uploadCount; $i++) {
             $file = $form['file' . $i]->getValue();
             if (empty($file)) {
                 $this->flashMessage('Nebyl vybrán žádný soubor nebo byl datově příliš velký.', 'warning');
             } elseif ($file->isOK()) {
                 if ($file->getContentType() == 'image/jpeg' || $file->getContentType() == 'image/jpg' || $file->getContentType() == 'image/png') {
                     $tmp = WWW_DIR . '/images/tmp/img.jpg';
                     $file->move($tmp);
                     $filename = $this->uploadingHelper();
                     $image = Image::fromFile($tmp);
                     if ($this->imageSizes['x']) {
                         $image->resize($this->imageSizes['x'], $this->imageSizes['y'], Image::SHRINK_ONLY);
                     }
                     $image->save($dirPath . $filename, 85, Image::JPEG);
                     $imageBig = Image::fromFile($tmp);
                     if ($this->imageSizes['xBig']) {
                         $imageBig->resize($this->imageSizes['xBig'], $this->imageSizes['yBig'], Image::SHRINK_ONLY);
                     }
                     $imageBig->save($dirPath . 'big/' . $filename, 85, Image::JPEG);
                     $uploaded++;
                 } else {
                     $this->flashMessage('Soubor není v požadovaném formátu.', 'warning');
                 }
             }
         }
     }
     if ($uploaded > 0) {
         $this->flashMessage($uploaded . ' obrázků bylo úspěšně nahráno.', 'success');
     } else {
         $this->flashMessage('Nahráno 0 souborů.');
     }
     $this->redirect('this');
 }
开发者ID:WebArchivCZ,项目名称:WWW,代码行数:39,代码来源:BaseAdminPresenter.php

示例4: processFeedbackWebForm

 public function processFeedbackWebForm(Form $form)
 {
     if ($form->isSubmitted()) {
         $values = $form->getValues();
         $values['added'] = new \DateTime();
         unset($values['spam']);
         unset($values['form_created']);
         // vlozime do DB
         $this->feedback->create($values);
         if ($this->lang == 'cs') {
             $this->flashMessage('Děkujeme za to, že pomáháte vylepšit český webový archiv', 'success');
         } else {
             $this->flashMessage('Thank you for your feedback!', 'success');
         }
     }
     $this->redirect('this');
 }
开发者ID:WebArchivCZ,项目名称:WWW,代码行数:17,代码来源:DefaultPresenter.php

示例5: createComponentFilter

 /**
  * FilterAndGroupAction form factory
  * @return Form
  */
 public function createComponentFilter()
 {
     $form = new Form($this, 'filter');
     $form->setMethod(static::$form_method);
     $form->setTranslator($this->getTranslator());
     /**
      * InlineEdit part
      */
     $inline_edit_container = $form->addContainer('inline_edit');
     if ($this->inlineEdit instanceof InlineEdit) {
         $inline_edit_container->addSubmit('submit', 'ublaboo_datagrid.save');
         $inline_edit_container->addSubmit('cancel', 'ublaboo_datagrid.cancel')->setValidationScope(FALSE);
         $this->inlineEdit->onControlAdd($inline_edit_container);
         $this->inlineEdit->onControlAfterAdd($inline_edit_container);
     }
     /**
      * InlineAdd part
      */
     $inline_add_container = $form->addContainer('inline_add');
     if ($this->inlineAdd instanceof InlineEdit) {
         $inline_add_container->addSubmit('submit', 'ublaboo_datagrid.save');
         $inline_add_container->addSubmit('cancel', 'ublaboo_datagrid.cancel')->setValidationScope(FALSE)->setAttribute('data-datagrid-cancel-inline-add', TRUE);
         $this->inlineAdd->onControlAdd($inline_add_container);
         $this->inlineAdd->onControlAfterAdd($inline_add_container);
     }
     /**
      * ItemDetail form part
      */
     $items_detail_form = $this->getItemDetailForm();
     if ($items_detail_form instanceof Nette\Forms\Container) {
         $form['items_detail_form'] = $items_detail_form;
     }
     /**
      * Filter part
      */
     $filter_container = $form->addContainer('filter');
     foreach ($this->filters as $filter) {
         $filter->addToFormContainer($filter_container);
     }
     if (!$this->hasAutoSubmit()) {
         $filter_container['submit'] = $this->getFilterSubmitButton();
     }
     /**
      * Group action part
      */
     $group_action_container = $form->addContainer('group_action');
     if ($this->hasGroupActions()) {
         $this->getGroupActionCollection()->addToFormContainer($group_action_container);
     }
     if (!$form->isSubmitted()) {
         $this->setFilterContainerDefaults($form['filter'], $this->filter);
     }
     /**
      * Per page part
      */
     $form->addSelect('per_page', '', $this->getItemsPerPageList())->setTranslator(NULL);
     if (!$form->isSubmitted()) {
         $form['per_page']->setValue($this->getPerPage());
     }
     $form->addSubmit('per_page_submit', 'ublaboo_datagrid.per_page_submit');
     $form->onSubmit[] = [$this, 'filterSucceeded'];
 }
开发者ID:ublaboo,项目名称:datagrid,代码行数:66,代码来源:DataGrid.php

示例6: formSuccess

 public function formSuccess(\Nette\Application\UI\Form $form)
 {
     if (isset($form['_submit']) && $form->isSubmitted() === $form['_submit']) {
         if ($this->mode === self::MODE_PLACE) {
             $this->redrawControl('formContainer');
         }
         $this->redirect('this', array('formName' => null, 'id' => null, 'mode' => null));
         $this->redrawControl('table');
     }
 }
开发者ID:venne,项目名称:venne,代码行数:10,代码来源:AdminGrid.php

示例7: formSuccess

 public function formSuccess(Form $form)
 {
     $values = $form->getValues();
     $button = $form->isSubmitted();
     if ($values->remember) {
         $form->presenter->user->setExpiration('+ 14 days', false);
     } else {
         $form->presenter->user->setExpiration('+ 20 minutes', true);
     }
     if ($button === $form['_submit']) {
         try {
             $form->presenter->user->login($values->username, $values->password);
         } catch (AuthenticationException $e) {
             $this->onError($this, $e->getMessage());
         }
     } else {
         $this->redirect('login!', str_replace('_', ' ', $button->name));
     }
     $this->onSuccess($this);
     $this->redirect('this');
 }
开发者ID:venne,项目名称:venne,代码行数:21,代码来源:LoginControl.php

示例8: formSubmitHandler

 /**
  * Data grid form submit handler
  *
  * @param \Nette\Application\UI\Form $form
  * @throws \Nette\InvalidStateException
  */
 public function formSubmitHandler(\Nette\Application\UI\Form $form)
 {
     $this->receivedSignal = 'submit';
     // was form submitted?
     if ($form->isSubmitted()) {
         $values = $form->getValues();
         if ($form['filterSubmit']->isSubmittedBy()) {
             $this->handleFilter($values['filters']);
         } elseif ($form['pageSubmit']->isSubmittedBy()) {
             $this->handlePage($values['page']);
         } elseif ($form['itemsSubmit']->isSubmittedBy()) {
             $this->handleItems($values['items']);
         } elseif ($form['resetSubmit']->isSubmittedBy()) {
             $this->handleReset();
         } elseif ($form['operationSubmit']->isSubmittedBy()) {
             if (!is_array($this->onOperationSubmit)) {
                 throw new \Nette\InvalidStateException('No user defined handler for operations; assign valid callback to operations handler into Lohini\\Components\\DataGrid\\DataGrid::$operationsHandler variable.');
             }
         } else {
             throw new \Nette\InvalidStateException('Unknown submit button.');
         }
     }
     $this->finalize();
 }
开发者ID:lohini,项目名称:cf,代码行数:30,代码来源:DataGrid.php

示例9: processTopicCollectionForm

 public function processTopicCollectionForm(Form $form)
 {
     $id = (int) $this->getParam('id');
     $suffix = "";
     if ($form->isSubmitted()) {
         $values = $form->getValues();
         // pokud bylo odeslano pomoci 'ulozit a publikovat', rovnou se to publikuje
         if (isset($form['saveAndPublish']) && $form['saveAndPublish']->isSubmittedBy()) {
             $values['active'] = TRUE;
             $suffix = " a publikována";
         }
         // ukladani nebo editace
         if ($id > 0) {
             // edit
             $topicCollection = $this->topicCollections->find($id);
             $topicCollection->update($values);
         } else {
             // add
             $topicCollection = $this->topicCollections->create($values);
             $topicCollection->update(array('order_num' => $topicCollection->id));
         }
         $this->flashMessage('Sbírka byla uložena' . $suffix . '.', 'success');
         //$this->redirect('edit',  array('id'=>$topicCollection->id));
     }
     $this->redirect('TopicCollections:');
 }
开发者ID:WebArchivCZ,项目名称:WWW,代码行数:26,代码来源:TopicCollectionsPresenter.php

示例10: processHomepageNewForm

 public function processHomepageNewForm(Form $form)
 {
     $id = (int) $this->getParam('id');
     $suffix = "";
     if ($form->isSubmitted()) {
         $values = $form->getValues();
         // pokud bylo odeslano pomoci 'ulozit a publikovat', rovnou se to publikuje
         if (isset($form['saveAndPublish']) && $form['saveAndPublish']->isSubmittedBy()) {
             $values['active'] = TRUE;
             $suffix = " a publikována";
         }
         // ukladani nebo editace
         if ($id > 0) {
             // edit
             $homepageNew = $this->homepageNews->find($id);
             $homepageNew->update($values);
         } else {
             // add
             $homepageNew = $this->homepageNews->create($values);
             $homepageNew->update(array('added' => new \DateTime(), 'order_num' => $homepageNew->id));
         }
         $this->flashMessage('Novinka byla uložena' . $suffix . '.', 'success');
         $this->redirect('edit', array('id' => $homepageNew->id));
     }
     $this->redirect('HomepageNews:');
 }
开发者ID:WebArchivCZ,项目名称:WWW,代码行数:26,代码来源:HomepageNewsPresenter.php

示例11: processSelectedResourceForm

 public function processSelectedResourceForm(Form $form)
 {
     $id = (int) $this->getParam('id');
     $suffix = "";
     if ($form->isSubmitted()) {
         $values = $form->getValues();
         // pokud bylo odeslano pomoci 'ulozit a publikovat', rovnou se to publikuje
         if (isset($form['saveAndPublish']) && $form['saveAndPublish']->isSubmittedBy()) {
             $values['active'] = TRUE;
             $suffix = " a publikován";
         }
         // nacteme si potrebne zaznamy z databaze
         $selectedResource = $this->selectedResources->find($id);
         $originalKeywords = $this->keywordsResources->findBy(array('resource_id' => $selectedResource->resource_id));
         // projdeme vsechny originalni klicova slova ke zdroji a ty co se shoduji s vybranymi, dame do pole
         $selectedKeywords = array();
         foreach ($originalKeywords as $ok) {
             if ($values['keyword_' . $ok->id] == TRUE) {
                 $selectedKeywords[] = $ok->id;
             }
             unset($values['keyword_' . $ok->id]);
             // at se to nesnazi ulozit do db
         }
         $values['keywords'] = implode(',', $selectedKeywords);
         $selectedResource->update($values);
         $this->flashMessage('Výběr zdroje byl uložen' . $suffix . '.', 'success');
         //$this->redirect('edit',  array('id'=>$selectedResource->id));
     }
     $this->redirect('SelectedResources:');
 }
开发者ID:WebArchivCZ,项目名称:WWW,代码行数:30,代码来源:SelectedResourcesPresenter.php

示例12: createComponentAdjustOrderForm

 public function createComponentAdjustOrderForm($name)
 {
     vBuilder\Application\UI\Form\IntegerPicker::register();
     $form = new Form($this, $name);
     $form->addHidden('ids');
     if ($form->isSubmitted()) {
         $this->setProductIds(explode(',', $form->values->ids));
     } else {
         $form['ids']->setDefaultValue(implode(',', $this->getProductIds()));
     }
     foreach ($this->products as $product) {
         $form->addIntegerPicker('amount' . $product->pageId)->setDefaultValue(1)->addRule(function ($control) {
             return ctype_digit($control->value);
         }, 'The amount must be a number!');
     }
     $form->onSuccess[] = callback($this, $name . 'Submitted');
     $form->onError[] = callback($this, $name . 'Error');
     $form->addProtection();
     $form->addSubmit('s', 'Přidat do košíku');
     return $form;
 }
开发者ID:rostenkowski,项目名称:vstore,代码行数:21,代码来源:AddToCartProcess.php

示例13: createComponentForm

 protected function createComponentForm($name)
 {
     $form = new Form($this, $name);
     $form->getElementPrototype()->class = 'ajax';
     $form->setTranslator($this->translator);
     if ($this->hasOperations) {
         $operations = array();
         foreach ($this->operations as $name => $operation) {
             $operations[$name] = $operation->getAlias();
         }
         $form->addSelect('operation', 'Operation', $operations);
         $form->addSubmit('btnExecuteOperation', 'Execute')->onClick[] = callback($this, 'executeOperation');
         $records = $form->addContainer('records');
         if ($form->isSubmitted()) {
             if (isset($this->persister->recordCheckboxes)) {
                 $checkboxes = $this->persister->recordCheckboxes;
                 foreach ($checkboxes as $id) {
                     $records->addCheckbox($id);
                 }
             }
         }
     }
     if ($this->hasFilters) {
         $filters = $form->addContainer('filters');
         foreach ($this->getComponents(false, 'Gridder\\Columns\\IColumn') as $column) {
             if ($column->hasFilter()) {
                 $filters->addComponent($column->getFilter(), $column->name);
                 if ($form->isSubmitted()) {
                     $httpData = $form->getHttpData();
                     if (isset($httpData['btnCancelFilters'])) {
                         unset($this->persister->filters);
                         $filters[$column->name]->setValue(null);
                     }
                 } elseif (isset($this->persister->filters[$column->name])) {
                     $filters[$column->name]->setDefaultValue($this->persister->filters[$column->name]->getValue());
                 }
             }
         }
         $form->addSubmit('btnApplyFilters', 'Apply filters')->onClick[] = callback($this, 'saveFilters');
         $form['btnApplyFilters']->getControlPrototype()->class = 'button apply';
         $form->addSubmit('btnCancelFilters', 'Cancel filters')->onClick[] = callback($this, 'cancelFilters');
         $form['btnCancelFilters']->getControlPrototype()->class = 'button cancel';
     }
 }
开发者ID:bazo,项目名称:Tatami,代码行数:44,代码来源:Gridder.php

示例14: StrFTime

          $form->addText('rok', 'Rok narodenia:', 4, 5)->addRule(Form::RANGE, 'Rok narodenia musí byť v rozsahu od %d do %d', [1900, StrFTime("%Y", Time())]);
      }
      if ($user_view_fields["telefon"]) {
          $form->addText('telefon', 'Telefón:', 20, 20);
      }
      if ($user_view_fields["poznamka"]) {
          $form->addText('poznamka', 'Poznámka:', 50, 250);
      }
      if ($user_view_fields["pohl"]) {
          $form->addSelect('pohl', 'Pohlavie:', ['M' => 'Muž', 'Z' => 'Žena']);
      }
      $form->onValidate[] = [$this, 'validateEditUserForm'];
      $form->addSubmit('uloz', 'Ulož')->setAttribute('class', 'btn btn-success')->onClick[] = [$this, 'editUserFormSubmitted'];
      $form->addSubmit('cancel', 'Cancel')->setAttribute('class', 'btn btn-default')->setValidationScope(FALSE);
      return $form;
  }
  /** Vlastná validácia
 * @param Nette\Application\UI\Form $button
开发者ID:petak23,项目名称:echo-msz,代码行数:18,代码来源:EditUserFormFactory.php


注:本文中的Nette\Application\UI\Form::isSubmitted方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。