/** * @param int $id * @param string $action * * @return \Symfony\Component\HttpFoundation\RedirectResponse * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException */ public function execute($id, $action) { if (($action === 'up' || $action === 'down') && $this->pictureRepository->pictureExists($id) === true) { if ($action === 'up') { $this->sortHelper->up(Gallery\Model\Repository\PictureRepository::TABLE_NAME, 'id', 'pic', $id, 'gallery_id'); } else { $this->sortHelper->down(Gallery\Model\Repository\PictureRepository::TABLE_NAME, 'id', 'pic', $id, 'gallery_id'); } $galleryId = $this->pictureRepository->getGalleryIdFromPictureId($id); $this->galleryCache->saveCache($galleryId); Core\Cache\Purge::doPurge($this->appPath->getCacheDir() . 'http'); return $this->redirect()->temporary('acp/gallery/index/edit/id_' . $galleryId); } throw new Core\Controller\Exception\ResultNotExistsException(); }
/** * Setzt einen einzelnen Alias für ein Bild einer Fotogalerie * * @param integer $pictureId * * @return boolean */ protected function generatePictureAlias($pictureId) { if ($this->aliases && $this->metaStatements && $this->uriAliasManager) { $galleryId = $this->pictureRepository->getGalleryIdFromPictureId($pictureId); $alias = $this->aliases->getUriAlias(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId), true); if (!empty($alias)) { $alias .= '/img-' . $pictureId; } $seoKeywords = $this->metaStatements->getKeywords(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId)); $seoDescription = $this->metaStatements->getDescription(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId)); return $this->uriAliasManager->insertUriAlias(sprintf(Gallery\Helpers::URL_KEY_PATTERN_PICTURE, $pictureId), $alias, $seoKeywords, $seoDescription); } return true; }