public function changeCategoryRankFormSucceeded(Form $form)
 {
     $values = (object) $form->getHttpData();
     $this->categoryFacade->changeRanks($values->categoryRank);
     $form->getPresenter()->flashMessage("Pořadí kategorií bylo úspěšně změněno.", "alert-success");
     $form->getPresenter()->redirect("this");
 }
Example #2
0
 public function uspesne(Form $form, $hodnoty)
 {
     $zaznam = $this->database->table('druhZivocicha')->get($this->Id);
     $zaznam->update($hodnoty);
     $form->getPresenter()->flashMessage('Úspešne editované!', 'uspech');
     $form->getPresenter()->redirect('Druh:viac', $this->Id);
 }
 public function uspesne(Form $form, $hodnoty)
 {
     foreach ($hodnoty['umiestnenie'] as &$hodnota) {
         if ($hodnota === '') {
             $hodnota = NULL;
         }
     }
     $zaznam = $this->database->table('umiestnenie')->insert($hodnoty['umiestnenie']);
     if ($this->mod == 0) {
         foreach ($hodnoty['klietka'] as &$hodnota) {
             if ($hodnota === '') {
                 $hodnota = NULL;
             }
         }
         $hodnoty['klietka']->IDUmiestnenia = $zaznam->IDUmiestnenia;
         $this->database->table('klietka')->insert($hodnoty['klietka']);
     } else {
         foreach ($hodnoty['vybeh'] as &$hodnota) {
             if ($hodnota === '') {
                 $hodnota = NULL;
             }
         }
         $hodnoty['vybeh']->IDUmiestnenia = $zaznam->IDUmiestnenia;
         $this->database->table('vybeh')->insert($hodnoty['vybeh']);
     }
     $form->getPresenter()->flashMessage('Úspešne pridané!', 'uspech');
     $form->getPresenter()->redirect('Umiestnenie:vypis');
 }
 /**
  * Zpracovani formulare s anketou
  * @param Form $form
  * @param Nette\Utils\ArrayHash $values
  */
 public function formSucceeded(Form $form, $values)
 {
     $result = TRUE;
     if ($result) {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestS'), 'success');
     } else {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestN'), 'danger');
     }
 }
Example #5
0
 /**
  * Zpracovani formulare s rubrikou
  * @param Form $form
  * @param Nette\Utils\ArrayHash $values
  */
 public function formSucceeded(Form $form, $values)
 {
     //nova rubrika nebo jeji editace
     $result = empty($values->id) ? $this->newTag($values) : $this->editTag($values);
     if ($result) {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestS'));
     } else {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestN'));
     }
 }
 public function changeSystemSettingsFormSucceeded(Form $form, $values)
 {
     $systemSettings = new SystemSettingsCollection();
     foreach ($values as $name => $value) {
         $systemSettings->addItem(SystemSettingsService::loadForUpdate($name, $value));
     }
     $this->systemSettingsFacade->save($systemSettings);
     $form->getPresenter()->flashMessage("Systémové údaje byly úspěšně uloženy.", "alert-success");
     $form->getPresenter()->redirect("this");
 }
Example #7
0
 /**
  * @param Form $form
  * @param $values
  */
 function solutionFormSucceeded(Form $form, $values)
 {
     if ($values->file->isOk()) {
         $values->projects_id = $this->projectManager->accepted($this->user->id)->id;
         $values->file = FileUploadHandler::upload($values->file);
         $this->database->table('solutions')->insert($values);
         $form->getPresenter()->flashMessage('Solution has been successfully uploaded.', 'success');
     } else {
         $form->getPresenter()->flashMessage('Something went wrong while uploading a file :( .', 'danger');
     }
 }
 public function monthFilterFormSucceeded(Form $form, $values)
 {
     $form->getPresenter()->month = $values->month;
     $form->getPresenter()->year = $values->year;
     if ($values->offsetExists("user") && $values->user > 0) {
         $form->getPresenter()->userId = $values->user;
     } else {
         $form->getPresenter()->userId = null;
     }
     $form->getPresenter()->redirect("this");
 }
Example #9
0
 public function uspesne(Form $form, $hodnoty)
 {
     $uzivatel = $form->getPresenter()->getUser();
     try {
         $uzivatel->login($hodnoty->RodneCislo, $hodnoty->heslo);
         $uzivatel->setExpiration('1 hour', FALSE);
         $form->getPresenter()->redirect('Umiestnenie:vypis');
     } catch (Nette\Security\AuthenticationException $chyba) {
         $form->getPresenter()->redirect('Homepage:prihlasenieNeuspech');
     }
 }
 public function formSucceeded(Form $form, $values)
 {
     try {
         $userManager = new Model\UserManager($this->user, $this->database);
         $userManager->register($values->username, $values->password, $values->repassword);
     } catch (Nette\Security\AuthenticationException $e) {
         $form->addError($e->getMessage());
     }
     if ($form->getPresenter()->isAjax()) {
         $form->getPresenter()->redrawControl('register');
     }
 }
 public function uspesne(Form $form, $hodnoty)
 {
     foreach ($hodnoty as &$hodnota) {
         if ($hodnota === '') {
             $hodnota = NULL;
         }
     }
     //kvoli db chcem tam mat null a nie prazdny string
     $this->database->table('zivocich')->insert($hodnoty);
     $form->getPresenter()->flashMessage('Úspešne pridané!', 'uspech');
     $form->getPresenter()->redirect('Zivocich:vypis');
 }
Example #12
0
 public function passwordChangeFormSucceeded(Form $form, $values)
 {
     $user = $this->userFacade->findOneById($this->user->getId());
     if (!Passwords::verify($values->actualPassword, $user->hash)) {
         $form->addError("Zadal si špatné aktuální heslo. Zkus to znovu!");
     } else {
         $user->changePassword($values->password);
         $this->userFacade->save($user);
         $form->getPresenter()->flashMessage("Tvoje heslo bylo úspěšně změněno", "alert-success");
         $form->getPresenter()->redirect("this");
     }
 }
 public function uspesne(Form $form, $hodnoty)
 {
     foreach ($hodnoty as &$hodnota) {
         if ($hodnota === '') {
             $hodnota = NULL;
         }
     }
     //kvoli db lebo tam chcem null a nie prazdnyretazec
     $zaznam = $this->database->table('zivocich')->get($this->Id);
     $zaznam->update($hodnoty);
     $form->getPresenter()->flashMessage('Úspešne editované!', 'uspech');
     $form->getPresenter()->redirect('Zivocich:viac', $this->Id);
 }
 public function uspesne(Form $form, $hodnoty)
 {
     foreach ($hodnoty as &$hodnota) {
         if ($hodnota === '') {
             $hodnota = NULL;
         }
     }
     //menim prazdne stringy na nully kvoli db
     $hodnoty['heslo'] = md5($hodnoty['heslo']);
     $this->database->table('zamestnanec')->insert($hodnoty);
     $form->getPresenter()->flashMessage('Úspešne pridané!', 'uspech');
     $form->getPresenter()->redirect('Zamestnanec:vypis');
 }
 public function uspesne(Form $form, $hodnoty)
 {
     foreach ($hodnoty as &$hodnota) {
         if ($hodnota === '') {
             $hodnota = NULL;
         }
     }
     // zmenim prazdne stringy na nully, kvoli db
     $zaznam = $this->database->table('zamestnanec')->get($this->RodneCislo);
     $zaznam->update($hodnoty);
     $form->getPresenter()->flashMessage('Úspešne editované!', 'uspech');
     $form->getPresenter()->redirect('Zamestnanec:viac', $this->RodneCislo);
 }
Example #16
0
 public function generateStatsFormSucceeded(Form $form, $values)
 {
     $stats = $this->articleFacade->findStatistics($values->month, $values->year);
     foreach ($stats as $stat) {
         $values->user = $this->userFacade->findOneById($stat->user_id);
         $values->articleCount = $stat->article_count;
         $statistic = StatisticService::create($values);
         $this->statisticFacade->save($statistic);
     }
     $form->getPresenter()->month = $values->month;
     $form->getPresenter()->year = $values->year;
     $form->getPresenter()->firstLoad = false;
     $form->getPresenter()->redirect("this");
 }
Example #17
0
 public function sendStatsFormSucceeded(Form $form, $values)
 {
     $month = $form->getPresenter()->month;
     $year = $form->getPresenter()->year;
     try {
         $stats = $this->statisticFacade->findAll($month, $year);
     } catch (EntitiesNotFoundException $ex) {
         \Tracy\Debugger::log($ex);
         $stats = null;
     }
     $monthInWords = DateTimeUtils::getMonthByIndex($month);
     $this->mailSender->send("*****@*****.**", $values->email, "Statistiky za {$monthInWords} {$year}", $this->createSendStatisticTemplate($form, $stats, $monthInWords, $year));
     $form->getPresenter()->flashMessage("Statistiky za {$monthInWords} {$year} byly úspěšně odeslány.", "alert-success");
     $form->getPresenter()->redirect("this");
 }
Example #18
0
 private function formValuesToEntity(Form $form, $values)
 {
     $user = UserService::loadFromSession($form->getPresenter()->getUser());
     $values->releaseDate = DateTimeUtils::createDbDatetimeFormatFromDateParts($values->year, $values->month, $values->day, "0", "0", "0");
     if ($values->reservationId == 0) {
         return ReservationService::create($values, $user);
     } else {
         return ReservationService::loadForUpdate($values);
     }
 }
Example #19
0
 public function signInFormSucceeded(Form $form, $values)
 {
     try {
         $this->user->login($values->email, $values->password);
         $form->getPresenter()->flashMessage("Přihlášení proběhlo úspěšně.", "alert-success");
         $form->getPresenter()->redirect("Homepage:default");
     } catch (AuthenticationException $ex) {
         \Tracy\Debugger::log($ex);
         if ($ex->getCode() == IAuthenticator::IDENTITY_NOT_FOUND) {
             $form->addError("Uživatel se zadaným emailem nebyl nalezen.");
         } elseif ($ex->getCode() == IAuthenticator::INVALID_CREDENTIAL) {
             $form->addError("Zadané heslo není správné.");
         }
     } catch (InactiveUserException $ex) {
         \Tracy\Debugger::log($ex);
         $form->addError("Ještě sis neaktivoval svůj účet.");
     } catch (BlockedUserException $ex) {
         \Tracy\Debugger::log($ex);
         $form->addError("Bohužel si blokován šéfredaktorem.");
     }
 }
 public function formNotSucceeded(Form $form)
 {
     if ($this->id == null) {
         if ($form->getPresenter()->isAjax()) {
             $form->getPresenter()->redrawControl('registration');
         }
     } else {
         if ($form->getPresenter()->isAjax()) {
             $form->getPresenter()->redrawControl('profile');
         }
     }
 }
Example #21
0
 public function personalChangeFormSucceeded(Form $form, $values)
 {
     try {
         $user = $this->userFacade->findOneById($form->getPresenter()->getUser()->getId());
         $user->changePersonalData($values->email, $values->firstName, $values->lastName);
         $this->userFacade->save($user);
         $form->getPresenter()->getUser()->getIdentity()->email = $values->email;
         $form->getPresenter()->getUser()->getIdentity()->firstName = $values->firstName;
         $form->getPresenter()->getUser()->getIdentity()->lastName = $values->lastName;
         $form->getPresenter()->flashMessage("Tvoje osobní údaje byly úspěšně změněny", "alert-success");
         $form->getPresenter()->redirect("this");
     } catch (\Exceptions\EntityNotFoundException $ex) {
         \Tracy\Debugger::log($ex);
         $form->getPresenter()->flashMessage("Došlo k chybě v aplikaci, osobní údaje nebyly změneny", "alert-danger");
         $form->getPresenter()->redirect("this");
     } catch (\Exceptions\DuplicateEmailException $ex) {
         \Tracy\Debugger::log($ex);
         $form->getPresenter()->flashMessage("Zadaný email už používá jiný uživatel, zvol si prosím jiný", "alert-danger");
         $form->getPresenter()->redirect("this");
     }
 }
Example #22
0
 public function formSucceeded(Form $form, $values)
 {
     if ($values->remember) {
         $this->user->setExpiration('14 days', FALSE);
     } else {
         $this->user->setExpiration('20 minutes', TRUE);
     }
     try {
         $this->user->login($values->username, $values->password);
         $form->getPresenter()->redirect('Admin:Reservation:default');
     } catch (Nette\Security\AuthenticationException $e) {
         $form->addError($e->getMessage());
     }
 }
Example #23
0
 public function usersFilterFormSucceeded(Form $form, $values)
 {
     if ($values->role === "null") {
         $form->getPresenter()->role = null;
     } else {
         $form->getPresenter()->role = $values->role;
     }
     if ($values->active === "null") {
         $form->getPresenter()->active = null;
     } else {
         $form->getPresenter()->active = $values->active;
     }
     if ($values->blocked === "null") {
         $form->getPresenter()->blocked = null;
     } else {
         $form->getPresenter()->blocked = $values->blocked;
     }
     $form->getPresenter()->redirect("this");
 }
Example #24
0
 public function addCategoryFormSucceeded(Form $form, $values)
 {
     if ($values->categoryId == 0) {
         $values->rank = $this->categoryFacade->findMaxRank() + 1;
         $category = CategoryService::create($values);
     } else {
         $category = CategoryService::loadForUpdate($values);
     }
     $this->categoryFacade->save($category);
     if ($form->getPresenter()->isAjax()) {
         if ($values->categoryId == 0) {
             $form->setValues([], true);
             $form->getPresenter()->redrawControl("addCategoryForm");
         } else {
             $form->getPresenter()->getTemplate()->edit = true;
             $form->getPresenter()->redrawControl("editCategoryForm");
         }
         $form->getPresenter()->redrawControl("categories");
     } else {
         $form->getPresenter()->flashMessage("Nová kategorie byla úspěšně vytvořena.", "alert-success");
         $form->getPresenter()->redirect("this");
     }
 }
Example #25
0
 /**
  * Zpracovani formulare s anketou
  * @param Form $form
  * @param Nette\Utils\ArrayHash $values
  */
 public function formSucceeded(Form $form, $values)
 {
     $requestInfo = $this->getRequestInfo($this->request);
     $result = $this->processPoll($this->vote, $requestInfo, $values);
     if ($result) {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestS'), 'success');
     } else {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestN'), 'danger');
     }
 }
Example #26
0
 public function uspesne(Form $form, $hodnoty)
 {
     $form->getPresenter()->redirect($this->stranka, $this->Id);
 }
Example #27
0
 public function uspesne(Form $form, $hodnoty)
 {
     foreach ($hodnoty as &$hodnota) {
         if ($hodnota === '') {
             $hodnota = NULL;
         }
     }
     //prazdne polia budu nully a nie praznde stringy ukladane do db
     $this->database->table('testoval')->insert($hodnoty);
     $form->getPresenter()->flashMessage('Úspešne pridané!', 'uspech');
     $this->redirect('Test:vypis');
 }
Example #28
0
 public function uspesne(Form $form, $hodnoty)
 {
     $this->database->table('druhZivocicha')->insert($hodnoty);
     $form->getPresenter()->flashMessage('Úspešne pridané!', 'uspech');
     $form->getPresenter()->redirect('Druh:vypis');
 }
 public function uspesne(Form $form, $hodnoty)
 {
     foreach ($hodnoty['umiestnenie'] as &$hodnota) {
         if ($hodnota === '') {
             $hodnota = NULL;
         }
     }
     //premena prazdnch retazcov na null kvoli db
     $zaznam = $this->database->table('umiestnenie')->get($this->Id);
     $zaznam->update($hodnoty['umiestnenie']);
     if ($this->mod == 0) {
         foreach ($hodnoty['klietka'] as &$hodnota) {
             if ($hodnota === '') {
                 $hodnota = NULL;
             }
         }
         $zaznam = $this->database->table('klietka')->get($this->Id);
         $zaznam->update($hodnoty['klietka']);
     } else {
         foreach ($hodnoty['vybeh'] as &$hodnota) {
             if ($hodnota === '') {
                 $hodnota = NULL;
             }
         }
         $zaznam = $this->database->table('vybeh')->get($this->Id);
         $zaznam->update($hodnoty['vybeh']);
     }
     $form->getPresenter()->flashMessage('Úspešne editované!', 'uspech');
     $form->getPresenter()->redirect('Umiestnenie:viac', $this->Id);
 }
 public function formNotSucceeded(Form $form)
 {
     if ($form->getPresenter()->isAjax()) {
         $form->getPresenter()->redrawControl('sign');
     }
 }