public function formSucceeded(Form $form, $values) { // provedu prihoz if ($this->product != null) { $auction_manager = new Model\Auction($this->database); // stara se o logiku prihozu $alert_manager = new Model\Alert($this->database); // stara se o logiku upozorneni if ($this->product->id_type_auction == 1) { // aukce "kup hned" $this->error = $auction_manager->bidBuyNow($this->product, $this->id_user); if ($this->error == null) { $alert_manager->endOfAuction($this->product); $msg = 'Zakoupili jste si produkt ' . $this->product->name . '.'; } } else { // klasická aukce $this->error = $auction_manager->bidClasicAuction($this->product, $this->id_user, $values['deposit']); if ($this->error == null) { $alert_manager->newBid($this->product); $msg = 'Navýšili jste cenu u produktu ' . $this->product->name . '.'; } } } // zjistim, zda vse probehlo v poradku if ($this->error != null) { $form->getPresenter()->flashMessage($this->error); } else { $form->getPresenter()->flashMessage($msg); } // presmeruji $form->getPresenter()->redirect('Homepage:product', $this->product->id); }
public function formSucceeded(Form $form, $values) { $alert_manager = new Model\Alert($this->database); if ($this->alerts != null) { if ($form['btndel']->isSubmittedBy()) { // mazani alertu $alert_manager->delete($values, $this->alerts); $form->getPresenter()->flashMessage('Vybraná upozornění byla smazána.'); $form->getPresenter()->redirect('Alert:alerts', $this->kat); } else { if ($this->kat == 'read') { // oznaceni alertu jako neprectene $alert_manager->activate($values, $this->alerts); $form->getPresenter()->flashMessage('Vybraná upozornění byla označena jako nepřečtená.'); $form->getPresenter()->redirect('Alert:alerts', 'unread'); } else { // oznaceni alertu jako prectene $alert_manager->inactivate($values, $this->alerts); $form->getPresenter()->flashMessage('Vybraná upozornění byla označena jako přečtená.'); $form->getPresenter()->redirect('Alert:alerts', 'read'); } } } }