Exemplo n.º 1
0
 public function formSucceeded(Form $form)
 {
     try {
         $p = $this->getPresenter();
         $values = $form->getValues();
         $tag = $this->getSelectedTag($form);
         if ($this->item) {
             $ent = $this->videoRepository->update($values, $tag, $this->user, $this->item);
             $p->flashMessage($this->translator->translate('locale.item.updated'));
         } else {
             $ent = $this->videoRepository->create($values, $tag, $this->user, new Entities\VideoEntity());
             $p->flashMessage($this->translator->translate('locale.item.created'));
         }
     } catch (Exceptions\MissingTagException $e) {
         $this->addFormError($form, $e);
     } catch (PossibleUniqueKeyDuplicationException $e) {
         $this->addFormError($form, $e);
     } catch (InvalidVideoUrlException $e) {
         $this->addFormError($form, $e);
     } catch (\Exception $e) {
         $this->addFormError($form, $e, $this->translator->translate('locale.error.occurred'));
     }
     if (!empty($ent)) {
         $p->redirect('this');
     }
 }
Exemplo n.º 2
0
 /**
  * @param int $videoId
  */
 public function handleDelete($videoId)
 {
     $video = $this->getItem($videoId, $this->videoRepository);
     if (!$video) {
         $this->throw404();
     }
     $this->videoRepository->delete($video);
     $this->flashWithRedirect($this->translator->translate('locale.item.deleted'));
 }
Exemplo n.º 3
0
 public function renderDefault()
 {
     $this->template->uploadDir = $this->context->parameters['uploadDir'];
     $this->template->videoThumbnail = $this->videoThumbnail;
     $this->template->news = $this->articleRepository->getAllNews();
     $this->template->latestArticles = $this->articleRepository->getLatestArticles();
     $this->template->latestImages = $this->imageRepository->getLatestImages();
     $this->template->latestVideos = $this->videoRepository->getLatestVideos();
     $this->template->latestGames = $this->wikiRepository->getLatestGames();
     $this->template->latestMovies = $this->wikiRepository->getLatestMovies();
     $this->template->latestBooks = $this->wikiRepository->getLatestBooks();
 }