/**
  * Přesměruje zpět na RequestButton a potlačí v uživatelských událostech případný redirect.
  *
  * @return self
  * @throw AbortException
  */
 public function fireEvents()
 {
     try {
         parent::fireEvents();
     } catch (AbortException $e) {
     }
     RequestButtonHelper::redirectBack($this);
     if (isset($e)) {
         throw $e;
     }
 }
Example #2
0
 public function saveItem($input)
 {
     $form = new AppForm();
     $form = $input;
     $values = $form->getValues();
     $update = false;
     if (isset($this->request->post['id'])) {
         $id = $this->request->post['id'];
         $update = true;
     } else {
         $id = 0;
     }
     try {
         if ($update) {
             $this->items->update($id, $values);
         } else {
             $id = $this->items->insert($values);
         }
     } catch (DibiException $e) {
         $this->flashMessage('Error! ' . $e->getMessage(), 'err');
     }
     $this->cleanCache('application/system', 'localities');
     if ($form['save']->isSubmittedBy()) {
         $this->flashMessage('Item has been saved.', 'ok');
         \RequestButton\RequestButtonHelper::redirectBack();
         $this->redirect('edit', array('id' => $id));
     } elseif ($form['add']->isSubmittedBy()) {
         $this->flashMessage('Item has been saved.', 'ok');
         $this->redirect('add');
     } else {
         $this->flashMessage('Item has been saved.', 'ok');
         $this->redirect('default');
     }
 }