예제 #1
0
 public function nahratSouboryFormSubmitted(NahratSouboryForm $form)
 {
     $this->overitClanek($this->id_clanku);
     $this->opravneni = $this->opravneni(0, $this->id_clanku);
     if (!$this->opravneni['clanek_edit']) {
         $this->redirect('prilohy', $this->id_clanku);
     }
     $values = $form->getValues();
     foreach ($values as $key => $polozka) {
         if (preg_match('~soubor_(.*)~', $key)) {
             $prilohy[] = $polozka;
         }
     }
     $vysledek_chyby = $this->redakce->ulozitPrilohy($prilohy, $this->id_clanku);
     if (count($vysledek_chyby)) {
         foreach ($vysledek_chyby as $id => $chyba) {
             $form->addError("{$id} - {$chyba}");
         }
     } else {
         foreach ($prilohy as $priloha) {
             $this->logg('k clanku ' . $this->id_clanku . ' nahrana priloha ' . $priloha);
         }
         $this->flashMessage('Přílohy byly nahrány.');
         $this->redirect('prilohy', $this->id_clanku);
     }
 }