Example #1
0
 public function nastavitDatumDoFormSubmitted(NastavitDatumCasForm $form)
 {
     $values = $form->getValues();
     $clanek = new Clanek($this->id_clanku);
     if ($this->redakce->findClanekById($this->id_clanku)->top == 'A' && strtotime(PrevodnikDatumu::prevestDatumNaAnglicke($values->zobrazit_do_datum) . ' ' . $values->zobrazit_do_cas) < time()) {
         $form->addError('Článek je top. Datum nelze nastavit.');
     } else {
         $clanek->setUdaje($values);
         $this->redakce->ulozitClanek($clanek);
         $this->logg('clanku ' . $this->id_clanku . ' nastaven konec zobrazeni: ' . $values->zobrazit_do_datum . ' ' . $values->zobrazit_do_cas);
         $this->flashMessage('Změny byly uloženy.');
         $this->restoreRequest($this->backlink);
         $this->redirect('default');
     }
 }
Example #2
0
 public function setZobrazit_do($datum = null, $cas = null)
 {
     if (!($datum = PrevodnikDatumu::prevestDatumNaAnglicke($datum))) {
         $datum = date('Y-m-d', strtotime($this->zobrazit_od . " +1 years"));
     }
     if (!PrevodnikDatumu::zkontrolovatCas($cas)) {
         $cas = '00:00';
     }
     $this->zobrazit_do = "{$datum} {$cas}";
 }