public function processEntireForm(SubmitButton $button)
 {
     $form = $button->getForm();
     $values = $form->getValues(TRUE);
     foreach ($values["rows"] as $containerId => $containerValues) {
         $this->saveMeta($this->targetList[$containerId], $containerValues);
     }
     $this->onProcessEntireForm($form);
 }
Esempio n. 2
0
 public function processFilter(SubmitButton $buttonControl)
 {
     $values = $buttonControl->getForm()->getValues();
     foreach ($values as $k => $v) {
         if ($v === '') {
             $values[$k] = null;
         }
     }
     $this->presenter->redirect('this', ['name' => $values['name'], 'extension' => $values['extension'], 'maxWidth' => $values['maxWidth'], 'maxHeight' => $values['maxHeight']]);
 }
 /**
  * @secured
  */
 public function generatePdf(SubmitButton $button)
 {
     $values = $button->getForm()->getHttpData(Form::DATA_TEXT);
     if (!empty($values['listingsSettings'])) {
         array_walk($values['listingsSettings'], function (&$value) {
             $value = (bool) $value;
         });
     }
     $zipPath = $this->PDFGenerator->generate($values['year'], $this->user, $values);
     $this->presenter->sendResponse(new FileResponse($zipPath));
 }
Esempio n. 4
0
 public function processFilter(SubmitButton $button)
 {
     $values = $button->getForm()->getValues();
     $this->localities = $this->localityFacade->findLocalities($values['search'], self::VISIBLE_LOCALITIES);
     $this->search = $values['search'];
     if ($this->isAjax()) {
         $this->redrawControl('localitiesList');
     } else {
         $this->redirect('Locality:itemAutocomplete');
     }
 }
 public function generatePdf(SubmitButton $button)
 {
     $values = $button->getForm()->getValues(true);
     $items = $this->listingItemsReader->findListingsItems([$this->listingResult->getListingId()]);
     $listing = $this->listingResult->getListing();
     $listingData = ['l_id' => $listing->id, 'l_year' => $listing->year, 'l_month' => $listing->month, 'l_description' => $listing->description, 'l_hourlyWage' => $listing->hourlyWage, 'u_id' => $listing->user->id, 'u_name' => $listing->user->name, 'worked_days' => $this->listingResult->getWorkedDays(), 'worked_hours' => $this->listingResult->getWorkedHours(), 'total_worked_hours_in_sec' => $this->listingResult->getTotalWorkedHours()->toSeconds(), 'lunch_hours' => $this->listingResult->getLunchHours(), 'other_hours' => $this->listingResult->getOtherHours()];
     /** @var IListingPdfFile $pdf */
     $pdf = $this->listingPDFGenerator->generate($listingData, $items, $values);
     $response = new Nette\Application\Responses\FileResponse($pdf->getStoragePath(), $pdf->getFileName());
     $this->presenter->sendResponse($response);
 }
Esempio n. 6
0
 public function processDeleteMessages(SubmitButton $button)
 {
     $messagesIDs = $button->getForm()->getHttpData(Form::DATA_TEXT, 'msg[]');
     if (!empty($messagesIDs)) {
         try {
             $this->loader->removeMessages($messagesIDs);
             $this->flashMessage('Vybrané zprávy byli úspěšně smazány.', 'success');
         } catch (\DibiException $e) {
             $this->flashMessage('Při pokusu o hromadné smazání zpráv došlo k chybě.
                  Zkuste akci opakovat později.', 'error');
         }
         if ($this->presenter->isAjax()) {
             $this->redrawControl();
         } else {
             $this->redirect('this');
         }
     }
 }
Esempio n. 7
0
 public function filter(Nette\Forms\Controls\SubmitButton $button)
 {
     $this->filter = $this->prepareFilterValues($button->getForm()->getValues(TRUE));
     $this->redirect('this');
 }
Esempio n. 8
0
 /**
  * @param \Nette\Forms\Controls\SubmitButton $button
  * @internal
  */
 public function handleOperations(\Nette\Forms\Controls\SubmitButton $button)
 {
     $grid = $this->getGrid();
     !empty($grid->onRegistered) && $grid->onRegistered($grid);
     $form = $button->getForm();
     $this->addCheckers($form[self::ID]);
     $values = $form[self::ID]->values;
     if (empty($values[self::ID])) {
         $httpData = $form->getHttpData();
         if (!empty($httpData[self::ID][self::ID]) && ($operation = $httpData[self::ID][self::ID])) {
             $grid->__triggerUserNotice("Operation with name '{$operation}' does not exist.");
         }
         $grid->reload();
     }
     $ids = [];
     $operation = $values[self::ID];
     unset($values[self::ID]);
     foreach ($values as $key => $val) {
         if ($val) {
             $ids[] = $key;
         }
     }
     $this->onSubmit($operation, $ids);
     $grid->page = 1;
     if ($this->presenter->isAjax()) {
         $grid['form'][self::ID][self::ID]->setValue(NULL);
         $grid->getData(TRUE, FALSE);
     }
     $grid->reload();
 }
Esempio n. 9
0
 public function processPageSavingAsDraft(SubmitButton $buttonControl)
 {
     $this->pageSaving($buttonControl->getForm(), true);
 }
Esempio n. 10
0
 /**
  * Confirm NO clicked
  *
  * @param Forms\Controls\SubmitButton $button
  */
 public function cancelClicked(Forms\Controls\SubmitButton $button)
 {
     // Get submitted values from form
     $values = $button->getForm(TRUE)->getValues();
     // Get token from post
     $token = $values->secureToken;
     if ($this->getConfirmerValues($token)) {
         $this->sessionStorage->clear($token);
     }
     $this->getDialog()->resetConfirmer();
     // Check if request is done via ajax...
     if ($this->getPresenter() instanceof Application\UI\Presenter && !$this->getPresenter()->isAjax()) {
         // ...if not redirect to actual page
         $this->getPresenter()->redirect('this');
     }
 }
Esempio n. 11
0
 /**
  * @param \Nette\Forms\Controls\SubmitButton $button
  * @internal
  */
 public function handleOperations(\Nette\Forms\Controls\SubmitButton $button)
 {
     $this->grid->onRegistered && $this->grid->onRegistered($this->grid);
     $form = $button->getForm();
     $this->addCheckers($form[self::ID]);
     $values = $form[self::ID]->values;
     if (empty($values[self::ID])) {
         $httpData = $form->getHttpData();
         if (!empty($httpData[self::ID][self::ID]) && ($operation = $httpData[self::ID][self::ID])) {
             trigger_error("Operation with name '{$operation}' does not exist.", E_USER_NOTICE);
         }
         $this->grid->reload();
     }
     $ids = array();
     $operation = $values[self::ID];
     unset($values[self::ID]);
     foreach ($values as $key => $val) {
         if ($val) {
             $ids[] = $key;
         }
     }
     $this->onSubmit($operation, $ids);
 }
Esempio n. 12
0
 /**
  * @param SubmitButton $button
  * @return void
  */
 public function filterFormReset(SubmitButton $button)
 {
     $values = $button->getForm()->getValues();
     foreach ($values as $key => $value) {
         $this->{$key} = NULL;
     }
     $this->resetPaginator();
     $this->redirect('this');
 }
Esempio n. 13
0
 public function generatePdf(SubmitButton $button)
 {
     $values = $button->getForm()->getValues();
     $template = $this->createTemplate()->setFile(__DIR__ . '/../templates/Listing/pdf.latte');
     $template->itemsCollection = $this->itemFacade->generateEntireTable($this->listing);
     $template->listing = $this->listing;
     $template->username = $values['name'] == null ?: $values['name'];
     $template->employer = $values['employer'];
     $template->employeeName = $values['name'];
     $template->wage = $values['wage'];
     $template->otherHours = $values['otherHours'];
     $template->workedHours = $values['workedHours'];
     $template->lunchHours = $values['lunch'];
     $pdf = new \PdfResponse\PdfResponse($template);
     $this->presenter->sendResponse($pdf);
 }
Esempio n. 14
0
 /**
  * Confirm NO clicked
  * @param Nette\Forms\Controls\SubmitButton $button
  */
 public function cancelClicked($button)
 {
     $form = $button->getForm(TRUE);
     $values = $form->getValues();
     if (isset($this->session->{$values['token']})) {
         unset($this->session->{$values['token']});
     }
     $this->visible = FALSE;
     $this->invalidateControl();
     if (!$this->presenter->isAjax()) {
         $this->presenter->redirect('this');
     }
 }
Esempio n. 15
0
 /**
  * @param SubmitButton $button
  */
 public function submitStep(SubmitButton $button)
 {
     $form = $button->getForm();
     $submitName = $button->getName();
     if ($submitName === self::PREV_SUBMIT_NAME) {
         $currentStep = $this->getCurrentStep();
         $this->getSection()->currentStep = $currentStep - 1;
     } else {
         if ($submitName === self::NEXT_SUBMIT_NAME && $form->isValid()) {
             $this->merge($form->getValues(TRUE));
             $this->getSection()->lastStep = $this->getSection()->currentStep = $this->getCurrentStep() + 1;
         } else {
             if ($submitName === self::FINISH_SUBMIT_NAME && $form->isValid() && $this->getSection()->values !== NULL) {
                 $this->merge($form->getValues(TRUE));
                 $this->isSuccess = TRUE;
                 $this->finish();
                 foreach ($this->onSuccess as $callback) {
                     $callback($this);
                 }
                 $this->resetSection();
             }
         }
     }
 }
Esempio n. 16
0
 public function filterTags(SubmitButton $button)
 {
     $values = $button->getForm()->getValues();
     $this->name = $values['name'];
     if (!$this->presenter->isAjax()) {
         $this->redirect('this');
     } else {
         $this->redrawControl('tagsList');
     }
 }