/** * @param int $imageId */ public function handleDelete($imageId) { $image = $this->getItem($imageId, $this->imageRepository); if (!$image) { $this->throw404(); } $this->imageRepository->delete($image); $this->flashWithRedirect($this->translator->translate('locale.item.deleted')); }
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(); }
public function formSucceeded(Form $form) { try { $p = $this->getPresenter(); $tag = $this->getSelectedTag($form); $images = $form->getHttpData(Form::DATA_FILE, 'images[]'); $this->imageRepository->uploadImages($tag, $images, $this->user); $p->flashMessage($this->translator->translate('locale.item.images_uploaded')); } 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')); } $p->redirect('this'); }