Beispiel #1
0
 public function upravitMenuFormSubmitted(UpravitMenuForm $form)
 {
     $this->overitRubriku($this->id);
     $this->opravneni = $this->opravneni($this->id);
     if (!$this->opravneni['menu_edit']) {
         $this->redirect('rubriky', $this->id);
     }
     $values = $form->getValues();
     $polozky = array();
     $poradi = 0;
     foreach ($values as $key => $value) {
         if (preg_match('~nazev_(.*)~', $key, $tmp)) {
             $i = $tmp[1];
             if (!$value) {
                 continue;
             }
             //pokud není název, není platná položka
             $poradi++;
             $polozka['nazev'] = $value;
             $polozka['url'] = $values["url_{$i}"];
             $polozka['poradi'] = $poradi;
             $polozka['id'] = $values["id_{$i}"];
             $polozky[$poradi] = $polozka;
         }
     }
     $menu = new Menu($this->id);
     $menu->setPolozky($polozky);
     $this->redakce->ulozitMenu($menu);
     $this->logg("upraveno menu rubriky " . $this->id);
     $this->flashMessage('Menu je upraveno.');
     $this->redirect('rubriky', $this->id);
 }