Esempio n. 1
0
 /**
  * @param int $articleId
  */
 public function handleDelete($articleId)
 {
     $article = $this->getItem($articleId, $this->articleRepository);
     if (!$article) {
         $this->throw404();
     }
     $this->articleRepository->delete($article);
     $this->flashWithRedirect($this->translator->translate('locale.item.deleted'));
 }
Esempio n. 2
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();
 }
Esempio n. 3
0
 public function formSucceeded(Form $form)
 {
     try {
         $p = $this->getPresenter();
         $values = $form->getValues();
         $tag = $this->getSelectedTag($form);
         if ($this->item) {
             $ent = $this->articleRepository->update($values, $tag, $this->user, $this->item);
             $p->flashMessage($this->translator->translate('locale.item.updated'));
         } else {
             $ent = $this->articleRepository->create($values, $tag, $this->user, new Entities\ArticleEntity());
             $p->flashMessage($this->translator->translate('locale.item.created'));
         }
     } catch (Exceptions\MissingTagException $e) {
         $this->addFormError($form, $e);
     } catch (PossibleUniqueKeyDuplicationException $e) {
         $this->addFormError($form, $e);
     } catch (\Exception $e) {
         $this->addFormError($form, $e, $this->translator->translate('locale.error.occurred'));
     }
     if (!empty($ent)) {
         $p->redirect('this');
     }
 }