/** * Processing of Videos labelling Form * * @Privilege('videos') * * @param $button */ public function labelVideosFormSucceded($button) { $form = $button->form; $values = $form->getValues(TRUE); $videoStorage = $this->events->getChronicleVideos($values['id']); $videoStorage->delete(); foreach ($form['chronicle_videos']->getValues(TRUE) as $video) { $video = array_filter($video, 'strlen'); //delete empty values if (empty($video)) { continue; } //no user input row $video['event_id'] = $form->getValues()->id; $videoStorage->insert($video); } //change event visibility if (!array_key_exists('showchronicle', $values)) { //user did not have the sufficient permission $showchronicle = FALSE; } else { $showchronicle = $values['showchronicle'] ? TRUE : FALSE; } $this->events->showChronicle($values['id'], $showchronicle); $this->flashMessage('Videa ke kronice byla úspěčně editována.'); $this->redirect('default'); }