<?php
namespace App\Controller;
use App\Service\CanonicalRedirectHelper;
use App\Twig\LayoutExtension;
use App\Twig\LinkGenerator;
use App\Twig\PressExtension;
use App\Twig\RegionExtension;
use Carbon\Carbon;
use Elements\Bundle\CmsToolsBundle\Templating\Helper\CutStringRespectingWhitespace;
use Knp\Component\Pager\PaginatorInterface;
use Pimcore\Controller\KernelControllerEventInterface;
use Pimcore\File;
use Pimcore\Mail;
use Pimcore\Model\Asset;
use Pimcore\Model\DataObject\Community;
use Pimcore\Model\DataObject\Contact;
use Pimcore\Model\DataObject\MediaAlbum;
use Pimcore\Model\DataObject\Data\BlockElement;
use Pimcore\Model\DataObject\Data\Consent;
use Pimcore\Model\DataObject\MediaAsset;
use Pimcore\Model\DataObject\MediaCategory;
use Pimcore\Model\DataObject\MediaKeyword;
use Pimcore\Model\DataObject\MediaUser;
use Pimcore\Model\DataObject\MediaVideo;
use Pimcore\Model\DataObject\PressArticle;
use Pimcore\Model\DataObject\PressCategory;
use Pimcore\Model\DataObject\PressDossier;
use Pimcore\Model\DataObject\Region;
use Pimcore\Model\DataObject\Service;
use Pimcore\Model\DataObject\SiteConfig;
use Pimcore\Model\Document;
use Pimcore\Model\Document\Email;
use Pimcore\Model\WebsiteSetting;
use Pimcore\Tool;
use Pimcore\Translation\Translator;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\ControllerEvent;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\AclBundle\Entity\Car;
// sorry for the high complexity here :(
class PressController extends AbstractController implements KernelControllerEventInterface
{
private $activePressArticlesWishlistIds;
private $activePressDossiersWishlistIds;
private $activePressPicturesWishlistIds;
private $activePressAlbumWishlistIds;
private $activePressAlbumItemsWishlistIds;
private $activePressMediaAssetsWishlistIds;
private Translator $translator;
protected array $loginCacheExcludeURLs = [
'/press/login', '/press/logout', '/press/article/remove-from-wishlist', '/press/dossiers/remove-from-wishlist', '/press/image/remove-from-wishlist',
'/press/dossiers/add-to-wishlist', '/press/image/add-to-wishlist', '/press/article/add-to-wishlist',
'/press/album/add-to-wishlist', '/press/album/remove-from-wishlist','/press/album/item/add-to-wishlist', '/press/album/item/remove-from-wishlist',
'press/media-asset/add-to-wishlist', 'press/media-asset/remove-from-wishlist'
];
protected array $watchlistExcludeURl = ['/press/wishlist'];
public function onKernelControllerEvent( ControllerEvent $event )
{
$request = $event->getRequest();
if( $request && $request->getSession() ){
$this->activePressArticlesWishlistIds = array_values( array_map( 'intval', $request->getSession()->get( 'pressArticleWishlistIds', [] ) ) );
$this->activePressDossiersWishlistIds = array_values( array_map( 'intval', $request->getSession()->get( 'pressDossierWishlistIds', [] ) ) );
$this->activePressPicturesWishlistIds = array_values( array_map( 'intval', $request->getSession()->get( 'pressImageWishlistIds', [] ) ) );
$this->activePressAlbumWishlistIds = array_values( array_map( 'intval', $request->getSession()->get( 'pressAlbumWishlistIds', [] ) ) );
$this->activePressAlbumItemsWishlistIds = array_values( array_map( 'intval', $request->getSession()->get( 'pressAlbumItemsWishlistIds', [] ) ) );
$this->activePressMediaAssetsWishlistIds = array_values( array_map( 'intval', $request->getSession()->get( 'pressMediaAssetsWishlistIds', [] ) ) );
$watchlistExcludeURl = array_merge($this->loginCacheExcludeURLs, $this->getWatchlistURLs(), $this->watchlistExcludeURl);
$anchor = '';
if($request->get('anchor')) {
$anchor = '#' . $request->get('anchor');
}
$this->addLastVisitedToSession($request, 'pressLogin', $this->loginCacheExcludeURLs,'lastVisited', $anchor);
$this->addLastVisitedToSession($request, 'watchlist', $watchlistExcludeURl,'lastVisited', $anchor);
}else{
$this->activePressArticlesWishlistIds = [];
$this->activePressDossiersWishlistIds = [];
$this->activePressPicturesWishlistIds = [];
$this->activePressAlbumWishlistIds = [];
$this->activePressAlbumItemsWishlistIds = [];
$this->activePressMediaAssetsWishlistIds = [];
}
}
public function __construct( Translator $translator, protected LayoutExtension $layoutExtension, protected PressExtension $pressExtension, protected RegionExtension $regionExtension)
{
$this->translator = $translator;
}
public function portalAction( Request $request )
{
return $this->render( '/Press/portal.html.twig' );
}
/**
* @param Request $request
* @param \Pimcore\DataObject\Consent\Service $consentService
* @param Translator $translator
* @return RedirectResponse|\Symfony\Component\HttpFoundation\Response
* @throws \Exception
*/
public function pressRegistrationAction(
Request $request,
\Pimcore\DataObject\Consent\Service $consentService,
Translator $translator
)
{
$user = $this->layoutExtension->getMediaUser($request);
$region = $this->document->getProperty('region');
$isRegisteredForRegion = $user && $this->pressExtension->isRegisteredForRegion($region, $user);
if(!$isRegisteredForRegion && $request->getMethod() === Request::METHOD_POST){
$reducedForm = false;
if(!$user) {
$requiredParams = [
'company' => $request->get( 'company' ),
'salutation' => $request->get( 'salutation' ),
'firstname' => $request->get( 'firstname' ),
'lastname' => $request->get( 'lastname' ),
'street' => $request->get( 'street' ),
'zip' => $request->get( 'zip' ),
'city' => $request->get( 'city' ),
'country' => $request->get( 'country' ),
'phone' => $request->get( 'phone' ),
'usage' => $request->get( 'usage' ),
'email' => $request->get( 'email' ),
'password' => $request->get( 'password' ),
];
$optionalParams = [
'title' => $request->get( 'title', '' ),
'message' => $request->get( 'message', '' ),
'gdpr' => $request->get('gdpr-text')
];
} else {
$reducedForm = true;
$requiredParams = [
'usage' => $request->get( 'usage' ),
];
$optionalParams = [
'message' => $request->get( 'message', '' ),
];
}
$errors = [];
foreach( $requiredParams as $key => $param ){
if( empty( $param ) ){
$errors[ $key ] = 'required';
}
}
foreach( $optionalParams as $key => $param ){
if( empty( $param ) ){
unset( $optionalParams[ $key ] );
}
}
if(!$reducedForm) {
if( !$requiredParams[ 'email' ] || !filter_var( $requiredParams[ 'email' ], FILTER_VALIDATE_EMAIL ) ){
$errors[ 'email' ] = 'no valid email';
}
if( MediaUser::getByEmail( $requiredParams[ 'email' ] )->setUnpublished( true )->getCount() > 0 ){
$errors[ 'email' ] = 'email already registered, log in and try again';
}
} //else email from user already validated
$confirmPage = $this->getDocumentEditable( 'relation', 'confirmationpage' )->getElement();
if( !$confirmPage ) $errors[ 'systemerror' ] = 'no confirm page';
$usermail = $this->getDocumentEditable( 'relation', 'usermail' )->getElement();
if( !$usermail ) $errors[ 'systemerror' ] = 'no user mail';
if( empty( $errors ) ){
$successpage = $this->getDocumentEditable( 'relation', 'successpage' )->getElement();
try{
$email = $user && $user->getEmail() ? $user->getEmail() :$requiredParams[ 'email' ];
$token = md5( 'mediaUser' . $email . time() );
$isNewUser = false;
if(!$reducedForm) {
$userArray = $this->createNewUser($requiredParams, $optionalParams, $token);
$user = $userArray[0];
$isNewUser = $userArray[1];
}
$this->addRegistrationParamsToUser($user, $region, $requiredParams, $optionalParams, $consentService, $translator, $request);
unset( $requiredParams[ 'password' ] );
$tokenArray = $reducedForm ? [] : [ 'confirmLink' => Tool::getHostUrl() . $confirmPage->getFullpath() . '?token=' . urlencode( $token ) ];
$params = array_merge(
$tokenArray,
$requiredParams,
$optionalParams
);
$params[ 'items' ] = array_keys( $params );
if($isNewUser) { //only send User Mail if new User
$mail = new Mail();
$mail->setDocument( $usermail );
$mail->setParams( $params );
$mail->addTo( $email );
$mail->send();
$success = true;
} else {
$success = $this->sendConfiremedRegistrationMail($user);
}
if( $successpage ){
return $this->redirect( $successpage->getFullPath() );
}
}catch( \Exception $exception ){
$success = false;
$errors[] = 'an error occurred';
if( \Pimcore::inDebugMode() ){
p_r( $exception->getMessage() );
die();
}
}
}else{
$success = false;
}
}
return $this->render( 'Press/pressRegistration.html.twig', [
'errors' => $errors ?? [],
'success' => $success ?? null,
'user' => $user,
'reducedForm' => !$isRegisteredForRegion && $user,
'isRegisteredForRegion' => $isRegisteredForRegion,
] );
}
/**
* @param Request $request
* @return \Symfony\Component\HttpFoundation\Response
* @throws \Exception
*/
public function confirmRegistrationAction( Request $request )
{
$token = $request->get( 'token', '' );
if( $token ){
$userList = new MediaUser\Listing();
$userList->addConditionParam( 'token = :token', [ 'token' => $token ] );
$userList->setUnpublished( true );
$userList->setLimit( 1 );
$users = $userList->getObjects();
$user = count( $users ) ? $users[ 0 ] : null;
if( $user ){
$success = $this->sendConfiremedRegistrationMail($user);
}elseif( !$this->editmode ){
throw new NotFoundHttpException( 'no (valid) token' );
}
}elseif( !$this->editmode ){
throw new NotFoundHttpException( 'no (valid) token' );
}
return $this->render( 'Press/confirmRegistration.html.twig', [
'success' => $success ?? false
] );
}
/**
* @param Request $request
* @param PaginatorInterface $paginator
* @return JsonResponse|\Symfony\Component\HttpFoundation\Response
*/
public function overviewAction( Request $request, PaginatorInterface $paginator )
{
$selectedCat = $request->get( 'category', false );
if( $selectedCat === 'all' ){
$selectedCat = false;
}
$keyword = $request->get( 'keyword', '' );
$tab = $request->get( 'tab', '' );
$now = Carbon::now()->startOfDay();
$pressCategoriesListing = new PressCategory\Listing();
$pressCategoriesListing->addConditionParam('name != "" AND name IS NOT NULL');
$pressCategoriesListing->setOrderKey( 'name' );
$pressCategoriesListing->setOrder( 'ASC' );
$categoriesDropdownItems = $this->getPressCategoriesDropdownItems( $pressCategoriesListing, $selectedCat );
$region = $this->document->getProperty('region');
$regionIds = [$region->getId()];
$regionArticlesCondition = '(region__id IN (:regionAndCommunities)' . ($region->getIsMainRegion() ? ' OR region__id IS NULL OR region__id = "" OR showInSTT = 1' : '') . ')';
$regionArticlesConditionParams = ['regionAndCommunities' => $regionIds];
$allPressArticles = new PressArticle\Listing();
$allPressArticles->addConditionParam($regionArticlesCondition, $regionArticlesConditionParams);
$allPressArticles->addConditionParam( 'title != "" AND title IS NOT NULL' );
$allPressArticles->addConditionParam( 'isArchive = 1' );
$allPressArticles->addConditionParam( '(fromDate IS NULL OR fromDate <= ' . Carbon::now()->unix() . ')' );
if( $selectedCat && ( empty( $tab ) || $tab == 'az' ) ){
$allPressArticles->addConditionParam( 'categories LIKE "%,' . $selectedCat . ',%"' );
}
if( $keyword && ( empty( $tab ) || $tab == 'az' ) ){
$allPressArticles->addConditionParam( 'title LIKE :q OR shortDescription LIKE :q', [ 'q' => '%' . $keyword . '%' ] );
}
$allPressArticles->setOrderKey( 'sort', 'pressDate' );
$allPressArticles->setOrder( 'DESC' );
$allPaginator = $paginator->paginate( $allPressArticles, $request->get( 'pageAZ', 1 ), 12 );
$allPaginator->setPageRange( 3 );
$latestPressArticles = new PressArticle\Listing();
$latestPressArticles->addConditionParam( $regionArticlesCondition, $regionArticlesConditionParams );
$latestPressArticles->addConditionParam( 'title != "" AND title IS NOT NULL' );
$latestPressArticles->addConditionParam( '((toDate IS NULL AND pressDate > ' . Carbon::now()->unix() . ') OR toDate > ' . Carbon::now()->unix() . ')' );
$latestPressArticles->addConditionParam( '(fromDate IS NULL OR fromDate <= ' . Carbon::now()->unix() . ')' );
$latestPressArticles->addConditionParam( 'isArticle = 1' );
if( $selectedCat && $tab == 'latest' ){
$latestPressArticles->addConditionParam( 'categories LIKE "%,' . $selectedCat . ',%"' );
}
if( $keyword && $tab == 'latest' ){
$latestPressArticles->addConditionParam( 'title LIKE :q OR shortDescription LIKE :q', [ 'q' => '%' . $keyword . '%' ] );
}
$latestPressArticles->setOrderKey( [ 'pressDate' ] );
$latestPressArticles->setOrder( 'DESC' );
$latestPaginator = $paginator->paginate( $latestPressArticles, $request->get( 'pageLatest', 1 ), 12 );
$latestPaginator->setPageRange( 3 );
$companyPressArticles = new PressArticle\Listing();
$companyPressArticles->addConditionParam( $regionArticlesCondition, $regionArticlesConditionParams );
$companyPressArticles->addConditionParam( 'title != "" AND title IS NOT NULL' );
$companyPressArticles->addConditionParam( '((toDate IS NULL AND pressDate > ' . Carbon::now()->unix() . ') OR toDate > ' . Carbon::now()->unix() . ')' );
$companyPressArticles->addConditionParam( '(fromDate IS NULL OR fromDate <= ' . Carbon::now()->unix() . ')' );
$companyPressArticles->addConditionParam( 'isFact = 1' );
if( $selectedCat && $tab == 'numbersCompany' ){
$companyPressArticles->addConditionParam( 'categories LIKE "%,' . $selectedCat . ',%"' );
}
if( $keyword && $tab == 'numbersCompany' ){
$companyPressArticles->addConditionParam( 'title LIKE :q OR shortDescription LIKE :q', [ 'q' => '%' . $keyword . '%' ] );
}
$companyPressArticles->setOrderKey( [ 'sort', 'pressDate' ] );
$companyPressArticles->setOrder( [ 'ASC', 'DESC' ] );
$companyPaginator = $paginator->paginate( $companyPressArticles, $request->get( 'pageCompany', 1 ), 12 );
$companyPaginator->setPageRange( 3 );
$dossierList = new PressDossier\Listing();
$dossierRegionCondition = [];
foreach ($regionIds as $key => $id) {
$dossierRegionCondition[] = 'region LIKE "%,' . $id . ',%"';
}
if($region->getIsMainRegion()) {
$dossierRegionCondition[] = 'region is null or region = ""';
}
if(!empty($dossierRegionCondition)) {
$dossierList->addConditionParam(implode(' OR ', $dossierRegionCondition));
}
$dossierList->addConditionParam( 'title != "" AND title IS NOT NULL' );
$dossierList->setOrderKey( 'title' );
$dossierList->setOrder( 'ASC' );
if( $request->isXmlHttpRequest() ){
$pag = $allPaginator;
$pageName = 'pageAZ';
if( $tab == 'latest' ){
$pag = $latestPaginator;
$pageName = 'pageLatest';
}elseif( $tab == 'numbersCompany' ){
$pag = $companyPaginator;
$pageName = 'pageCompany';
}
return $this->json( [
"success" => true,
"html" => $this->renderView( 'Press/Includes/pressOverviewList.html.twig', [
'paginator' => $pag,
'activePressArticlesWishlistIds' => $this->activePressArticlesWishlistIds,
'pageName' => $pageName,
'ajaxPaging' => true
] )
] );
}
$returnArray = array_merge([
'allPaginator' => $allPaginator,
'latestPaginator' => $latestPaginator,
'companyPaginator' => $companyPaginator,
'categoriesDropdownItems' => $categoriesDropdownItems,
'dossierList' => $dossierList,
], $this->getWishlists());
return $this->render( 'Press/overview.html.twig', $returnArray );
}
/**
* @param Request $request
* @param CanonicalRedirectHelper $redirectHelper
* @return RedirectResponse|\Symfony\Component\HttpFoundation\Response|NotFoundHttpException
*/
public function articleDetailAction( Request $request, CanonicalRedirectHelper $redirectHelper )
{
$article = PressArticle::getById( $request->get( 'id', null ) );
if( !$article ){
throw new NotFoundHttpException( 'article not found' );
}
if( CanonicalRedirectHelper::ENABLE_CANONICAL_REDIRECT && $redirect = $redirectHelper->canonicalRedirect( $article ) ){
return $redirect;
}
$returnArray = array_merge([
'article' => $article,
], $this->getWishlists());
return $this->render( 'Press/articleDetail.html.twig', $returnArray );
}
/**
* @param Request $request
* @param Translator $translator
* @param LinkGenerator $linkGenerator
* @param CutStringRespectingWhitespace $cutStringRespectingWhitespace
* @param CanonicalRedirectHelper $redirectHelper
* @return RedirectResponse|\Symfony\Component\HttpFoundation\Response|NotFoundHttpException
*/
public function dossierDetailAction( Request $request, Translator $translator, LinkGenerator $linkGenerator, CutStringRespectingWhitespace $cutStringRespectingWhitespace, CanonicalRedirectHelper $redirectHelper )
{
$dossier = PressDossier::getById( $request->get( 'id' ) );
if( !$dossier ){
throw new NotFoundHttpException( 'category not found' );
}
if( CanonicalRedirectHelper::ENABLE_CANONICAL_REDIRECT && $redirect = $redirectHelper->canonicalRedirect( $dossier ) ){
return $redirect;
}
$dossierArticlesFlatrate = [];
$articleDocuments = [];
foreach( $dossier->getArticles() as $article ){
$dossierArticlesFlatrate[] = [
'id' => $article->getId(),
'isSmallTeaser' => true,
'badgeText' => null,
'title' => $article->getTitle(),
'date' => $article->getPressDate()->format( 'd.m.Y | h:m' ) . ' ' . $translator->trans( 'press.Uhr' ),
'wysiwyg' => $cutStringRespectingWhitespace->__invoke( $article->getShortDescription(), 200 ),
'link' => $linkGenerator->generate( $article ),
'linktext' => $translator->trans( "press.Weiterlesen" ),
'isBadgeWhite' => true,
'hasWishlist' => true,
'wishlistActive' => array_key_exists( $article->getId(), $this->activePressArticlesWishlistIds ),
'wishlistId' => "press-articles",
'image' => $article->getTeaserImage(),
];
foreach( $article->getDocuments() as $doc ){
$articleDocuments[ $doc->getId() ] = $doc;
}
}
$returnArray = array_merge([
'dossier' => $dossier,
'dossierArticlesFlatrate' => $dossierArticlesFlatrate,
'articleDocuments' => $articleDocuments,
], $this->getWishlists());
return $this->render( 'Press/dossierDetail.html.twig', $returnArray );
}
/**
* @param Request $request
* @param PaginatorInterface $paginator
* @return JsonResponse|\Symfony\Component\HttpFoundation\Response
*/
public function pictureOverviewAction( Request $request, PaginatorInterface $paginator )
{
$pictureListing = $this->getPressImageListing($request);
$mediaCategoriesListing = $this->getMediaCategories($request);
$activeCategories = $this->getActiveCategories($pictureListing);
$paginator = $this->getPaginatorForPressImages($request, $paginator, $pictureListing);
if( $request->isXmlHttpRequest() ){
return new JsonResponse( [
'success' => true,
"html" => $this->renderView( 'Press/Includes/pressPictureList.html.twig', [
"paginator" => $paginator,
'activePressPicturesWishlistIds' => $this->activePressPicturesWishlistIds
] ),
] );
}
$returnArray = array_merge([
'pressCategories' => $this->getCategoriesDropdownItems( $mediaCategoriesListing, $request->get( 'category', '' ), $activeCategories ),
'seasonSelect' => $this->getSeasonSelect( $this->getDocumentEditable( 'relations', 'seasons' )->getData(), $request->get( 'season' ) ),
// 'mediaImages' => $mediaImages,
'paginator' => $paginator,
], $this->getWishlists());
return $this->render( 'Press/pictureOverview.html.twig', $returnArray );
}
/**
* @param Request $request
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse|array
*/
public function pressPictureDetailAction( Request $request )
{
$asset = Asset::getById( $request->get( 'id' ) );
if( !$asset || !$asset->getMetadata( 'General.mediaArchive' ) || $asset->getMetadata( 'General.mediaArchive' ) != 1 ){
throw new NotFoundHttpException( 'Media Image not found' );
}
$returnArray = array_merge([
'asset' => $asset,
], $this->getWishlists());
return $this->render("/Press/pressPictureDetail.html.twig", $returnArray);
}
/**
* @param Request $request
* @param PaginatorInterface $paginator
* @return JsonResponse|\Symfony\Component\HttpFoundation\Response
*/
public function videoOverviewAction( Request $request, PaginatorInterface $paginator )
{
$mediaCategoriesListing = $this->getMediaCategories($request);
$count = 1;
$region = $this->document->getProperty('region');
$videoListing = new MediaVideo\Listing();
$category = MediaCategory::getById( $request->get( 'category' ) );
$keyword = $request->get( 'keyword', '' );
$keywordObject = MediaKeyword::getByWord( $keyword, $request->getLocale(), 1 );
if( $keyword || $category ){
$count++;
}
if($region instanceof Region) {
$regionAndCommunityId = $this->regionExtension->getAllCommunityIdsByRegion($region, true, true, $request->get('clearCache', false));
$videoListing->addConditionParam('regions LIKE "%,' . implode(',%" OR regions LIKE "%,', $regionAndCommunityId) . ',%"' . ($region->getIsMainRegion() ? ' OR regions is null OR regions = ""': ''));
}
//2 sub conditions => 1 for assets 1 for yt videos
$videoListing->addConditionParam( "
(
video2 NOT LIKE '%:\"asset\";%' " . /* youtube condition */
( $category ? "and categories LIKE '%," . $category->getId() . ",%' " : "" ) .
( $keyword ? "and (title like :keyword or description like :keyword " . ( $keywordObject ? "or keywords LIKE '%," . $keywordObject->getId() . ",%'" : "" ) . ") " : "" )
. ")
OR
(
video2 LIKE '%:\"asset\";%' " . /* asset condition, check metadata */
( " and left(substr(video2, Locate(';i:', video2)+3), locate(';', substr(video2, Locate(';i:', video2)+3))-1) IN (" . /* do some string magic to get asset id from video objects with video asset instead of youtube, vimeo,... */ "
Select distinct cid
from assets_metadata am
where (name = 'General.mediaArchive' and data = 1 " .
( $keyword ? " and cid IN (Select distinct cid
FROM assets_metadata am
WHERE (
(name = 'General.mediaArchive' and data = 1 ) " .
"or (am.name = 'General.title' and am.data like '%" . $keyword . "%')" .
"or (am.name = 'General.description' and am.data like '%" . $keyword . "%')" .
( !empty( $keywordObject ) ? " or (am.name = 'General.keywords' and am.data like '%\"object\"," . $keywordObject->getId() . "]%')" : '' ) .
")
Group By cid
having count(cid) >= 2
) " : "" ) .
")" .
( $category ? " or (am.name = 'General.categories' and am.data like '%\"object\"," . $category->getId() . "]%')" : "" )
. "
Group By cid
having count(cid) = " . $count . "
) " )
. ")", [ 'keyword' => "%" . ( $keyword ?? '' ) . "%" ] );
$paginator = $paginator->paginate( $videoListing, $request->get( 'page', 1 ), 16 );
$paginator->setPageRange( 3 );
if( $request->isXmlHttpRequest() && $request->get( 'ajax' ) ){
return new JsonResponse( [
'success' => true,
'html' => $this->renderView( 'Press/Includes/pressVideoList.html.twig', [ 'paginator' => $paginator ] )
] );
}
$returnArray = array_merge([
'paginator' => $paginator,
'pressCategories' => $this->getCategoriesDropdownItems( $mediaCategoriesListing, $request->get( 'category', '' ) ),
], $this->getWishlists());
return $this->render( 'Press/videoOverview.html.twig', $returnArray );
}
/**
* @param Request $request
* @param PaginatorInterface $paginator
* @return JsonResponse|\Symfony\Component\HttpFoundation\Response
*/
public function audioOverviewAction( Request $request, PaginatorInterface $paginator )
{
$mediaCategoriesListing = $this->getMediaCategories($request);
$categoryId = $request->get( 'category' );
$keyword = $request->get( 'keyword', '' );
$keywordObject = MediaKeyword::getByWord( $keyword, $request->getLocale(), 1 );
$audioListing = new Asset\Listing();
$audioListing->addConditionParam( "type = 'audio'" );
$count = 1;
if( $keyword || $categoryId ){
$count++;
}
$audioListing->addConditionParam( "id IN (
Select distinct cid
from assets_metadata am
where (name = 'General.mediaArchive' and data = 1 ) " .
( $keyword ? " and cid IN (Select distinct cid
FROM assets_metadata am
WHERE (
(name = 'General.mediaArchive' and data = 1 ) " .
"or (am.name = 'General.title' and am.data like '%" . $keyword . "%')" .
"or (am.name = 'General.description' and am.data like '%" . $keyword . "%')" .
( !empty( $keywordObject ) ? " or (am.name = 'General.keywords' and am.data like '%\"object\"," . $keywordObject->getId() . "]%')" : '' ) .
")
Group By cid
having count(cid) >= 2
) " : "" ) .
( $categoryId ? "or (am.name = 'General.categories' and am.data like '%\"object\"," . (int)$categoryId . "]%')" : '' ) .
"
Group By cid
having count(cid) = " . $count . "
)" );
$paginator = $paginator->paginate( $audioListing, $request->get( 'page', 1 ), 16 );
if( $request->isXmlHttpRequest() && $request->get( 'ajax' ) ){
return new JsonResponse( [
'success' => true,
'html' => $this->renderView( 'Press/Includes/pressAudioList.html.twig', [ 'paginator' => $paginator ] )
] );
}
$returnArray = array_merge([
'paginator' => $paginator,
'pressCategories' => $this->getCategoriesDropdownItems( $mediaCategoriesListing, $categoryId ),
], $this->getWishlists());
return $this->render( 'Press/audioOverview.html.twig', $returnArray );
}
/**
* @param Request $request
* @return array
*/
public function videoDetailAction( Request $request, CanonicalRedirectHelper $redirectHelper, LayoutExtension $layoutExtension )
{
$video = MediaVideo::getById( $request->get( 'id' ) );
if( !$video or !$video->isPublished() ){
throw new NotFoundHttpException( 'Media Video not found' );
}
if( CanonicalRedirectHelper::ENABLE_CANONICAL_REDIRECT && $redirect = $redirectHelper->canonicalRedirect( $video ) ){
return $redirect;
}
$isYoutube = true;
if( $video->getVideo2() && $video->getVideo2()->getType() == 'asset' ){
$assetVideo = $video->getVideo2()->getData();
$isYoutube = false;
$number = $assetVideo->getMetadata( 'General.number' );
$title = $assetVideo->getMetadata( 'General.title', $request->getLocale() );
$copyright = $assetVideo->getMetadata( 'General.copyright' );
}else{
$number = $video->getNumber();
$title = $video->getTitle();
$copyright = $video->getCopyright();
}
$returnArray = [
'assetVideoObject' => $video->getVideo2(),
'videoObject' => $video,
'isYoutube' => $isYoutube,
'number' => $number,
'title' => $title,
'copyright' => $copyright,
'videoAsset' => $assetVideo ?? null, //the assets is needed for the usage guidelines, sorry for the confusion with the names.
];
return $this->render( 'Press/videoDetail.html.twig', $returnArray );
}
/**
* @param Request $request
* @param PaginatorInterface $paginator
* @return JsonResponse|\Symfony\Component\HttpFoundation\Response
*/
public function mediaAssetOverviewAction( Request $request, PaginatorInterface $paginator )
{
$mediaCategoriesListing = $this->getMediaCategories($request);
$count = 1;
$region = $this->document->getProperty('region');
$mediaAssetListing = new MediaAsset\Listing();
$mediaAssetListing->addConditionParam('asset__id is not null and asset__id != "" and asset__id IN (
Select distinct cid
from assets_metadata am
where (name = "General.mediaArchive" and data = 1 )
)');
$category = MediaCategory::getById( $request->get( 'category' ) );
$keyword = $request->get( 'keyword', '' );
$keywordObject = MediaKeyword::getByWord( $keyword, $request->getLocale(), 1 );
if( $keyword || $category ){
$count++;
}
if($region instanceof Region) {
$regionAndCommunityId = $this->regionExtension->getAllCommunityIdsByRegion($region, true, true, $request->get('clearCache', false));
$mediaAssetListing->addConditionParam('regions LIKE "%,' . implode(',%" OR regions LIKE "%,', $regionAndCommunityId) . ',%"' . ($region->getIsMainRegion() ? ' OR regions is null OR regions = ""': ''));
}
if($category) {
//todo add check for asset metadata
$mediaAssetListing->addConditionParam('categories LIKE :category OR (
asset__id IN (
Select distinct cid
from assets_metadata am2
where am2.name = "General.categories" and am2.data like :categoryMetadata)
)',
['category' => '%,' . $category->getId() . ',%', 'categoryMetadata' => "%\"object\"," . $category->getId() . "]%"] );
}
if($keyword) {
//todo add check for asset metadata
$keywordQuery = 'title LIKE :keyword';
$keywordQueryParams = ['keyword' => '%' . $keyword . '%'];
if($keywordObject) {
$keywordQuery .= ' OR keywords LIKE :keywordObject';
$keywordQueryParams['keywordObject'] = '%,' . $keywordObject?->getId() . ',%';
$keywordQueryParams['keywordObjectMetadata'] = "%\"object\"," . $keywordObject?->getId() . "]%";
}
//add metadata check:
$keywordQuery .= ' OR (
asset__id IN (
Select distinct cid
from assets_metadata am3
where (am3.name = "General.title" and am3.data like :keyword) or
(am3.name = "General.description" and am3.data like :keyword) ' .
($keywordObject ? 'or (am3.name = "General.keywords" and am3.data like :keywordObjectMetadata)' : '') .
') )';
$mediaAssetListing->addConditionParam($keywordQuery, $keywordQueryParams );
}
$mediaAssetListing->setOrderKey(['ISNULL(sorting)', 'sorting'], false);
$mediaAssetListing->setOrder(['ASC', 'ASC']);
$paginator = $paginator->paginate( $mediaAssetListing, $request->get( 'page', 1 ), 16 );
$paginator->setPageRange( 3 );
$returnArray = array_merge([
'paginator' => $paginator,
'pressCategories' => $this->getCategoriesDropdownItems( $mediaCategoriesListing, $request->get( 'category', '' ) ),
], $this->getWishlists());
if( $request->isXmlHttpRequest()) {
return new JsonResponse( [
'success' => true,
'html' => $this->renderView( 'Press/Includes/pressPictureList.html.twig', $returnArray )
] );
}
return $this->render( 'Press/mediaAssetOverview.html.twig', $returnArray );
}
public function mediaAlbumDetailAction(Request $request) {
$mediaAlbum = MediaAlbum::getById($request->get('id'));
if(!$mediaAlbum) {
throw new NotFoundHttpException('Media Album not found');
}
$assetTemplates = [];
$this->getMediaAlbumAssets($mediaAlbum->getAlbumItems(), $assetTemplates, !(bool)$mediaAlbum->getShowAssetTitle());
//overview is a content area
$returnArray = array_merge([
'mediaAlbum' => $mediaAlbum,
'assetTemplates' => $assetTemplates,
], $this->getWishlists());
return $this->render( 'Press/mediaAlbumDetail.html.twig', $returnArray );
}
public function mediaAssetDetailAction(Request $request) {
$mediaAsset = MediaAsset::getById($request->get('id'));
if(!$mediaAsset) {
throw new NotFoundHttpException('Media Asset not found');
}
$assetTemplates = [];
$posterImage = $mediaAsset?->getPosterImage();
$returnArray = array_merge([
'mediaAsset' => $mediaAsset,
'title' => $mediaAsset->getTitle() ?: $posterImage?->getMetadata('General.title'),
'description' => $mediaAsset->getDescription() ?: $posterImage?->getMetadata('General.description'),
'number' => $mediaAsset->getNumber() ?: $posterImage?->getMetadata('General.number'),
'imageTexts' => [
'copyright' => $mediaAsset?->getCopyright()?->getText() ?: $mediaAsset?->getRights() ?: $posterImage?->getMetadata('General.copyright'),
'author' => $mediaAsset?->getAuthor()?->getName(),
'usage' => $mediaAsset?->getRights() ?: $posterImage?->getMetadata('General.usage'),
],
'asset' => $mediaAsset->getAsset(),
], $this->getWishlists());
return $this->render( 'Press/mediaAssetDetail.html.twig', $returnArray );
}
/**
* @Route("/{_locale}/press/wishlist", name="press-wishlist")
* @param Request $request
* @return array
*/
public function wishlistAction( Request $request )
{
if( $request->get( 'removeAllPressArticlesFromWishlist' ) !== null ){
$request->getSession()->set( 'pressArticleWishlistIds', [] );
$this->activePressArticlesWishlistIds = [];
}
if( $request->get( 'removeAllPressImagesFromWishlist' ) !== null ){
$request->getSession()->set( 'pressImageWishlistIds', [] );
}
if( $request->get( 'removeAllPressDossiersFromWishlist' ) !== null ){
$request->getSession()->set( 'pressDossierWishlistIds', [] );
$this->activePressDossiersWishlistIds = [];
}
if( $request->get( 'removeAllPressAlbumsFromWishlist' ) !== null ){
$request->getSession()->set( 'pressAlbumWishlistIds', [] );
$this->activePressDossiersWishlistIds = [];
}
if( $request->get( 'removeAllPressAlbumItemsFromWishlist' ) !== null ){
$request->getSession()->set( 'pressAlbumItemsWishlistIds', [] );
$this->activePressDossiersWishlistIds = [];
}
if( $request->get( 'removeAllPressMediaAssetsWishlistIds' ) !== null ){
$request->getSession()->set( 'pressMediaAssetsWishlistIds', [] );
$this->activePressMediaAssetsWishlistIds = [];
}
$mainRegion = $this->regionExtension->getMainRegion();
$regions = []; //save all regions for user guidlines tabing
//themensammlungen == dossiers
$pressDossiers = [];
$pressDossierIds = $request->getSession()?->get( 'pressDossierWishlistIds', [] );
if( !empty( $pressDossierIds ) ){
foreach( $pressDossierIds as $id ){
if( $pressDossier = PressDossier::getById( $id ) ){
$pressDossiers[] = $pressDossier;
$this->addRegionsToArray(!empty($pressDossier->getRegion()) ? $pressDossier->getRegion() : [$mainRegion], $regions);
}
}
}
//Pressarticles
$pressArticleIds = $request->getSession()?->get( 'pressArticleWishlistIds', [] );
$pressArticles = [];
if( !empty( $pressArticleIds ) ){
foreach( $pressArticleIds as $id ){
if( $pressArticle = PressArticle::getById( $id ) ){
$pressArticles[] = $pressArticle;
$this->addRegionsToArray(!empty($pressArticle->getRegion()) ? [$pressArticle->getRegion()]: [$mainRegion], $regions);
}
}
}
$pressImagesIds = $request->getSession()?->get( 'pressImageWishlistIds', [] );
$pressImages = [];
if( !empty( $pressImagesIds ) ){
foreach( $pressImagesIds as $id ){
if( ( $image = Asset::getById( $id ) ) && $image->getMetadata( 'General.mediaArchive' ) && $image->getMetadata( 'General.mediaArchive' ) == 1 ){
$pressImages[] = $image;
$this->addRegionsToArray(!empty($image->getMetadata('General.regions')) ? $image->getMetadata('General.regions') : [$mainRegion], $regions);
}
}
}
$pressAlbumIds = $request->getSession()?->get( 'pressAlbumWishlistIds', [] );
$mediaAlbums = [];
if( !empty( $pressAlbumIds ) ){
foreach( $pressAlbumIds as $id ){
if($mediaAlbum = MediaAlbum::getById($id)){
$mediaAlbums[] = $mediaAlbum;
}
}
}
$pressAlbumItemsIds = $request->getSession()?->get( 'pressAlbumItemsWishlistIds', [] );
$mediaAlbumItems = [];
if( !empty( $pressAlbumItemsIds ) ){
foreach( $pressAlbumItemsIds as $id ){
if($mediaAlbumItem = Asset::getById($id)){
$mediaAlbumItems[] = $mediaAlbumItem;
}
}
}
$mediaAlbumItemsAssets = [];
$this->getMediaAlbumAssets($mediaAlbumItems, $mediaAlbumItemsAssets, false);
$pressMediaAssetIds = $request->getSession()?->get('pressMediaAssetsWishlistIds', []);
$mediaAssets = [];
if(!empty($pressMediaAssetIds)) {
foreach ($pressMediaAssetIds as $id) {
if($mediaAssetItem = MediaAsset::getById($id)) {
$mediaAssets[] = $mediaAssetItem;
}
}
}
if(empty($regions)) {
$regions[] = $mainRegion;
}
ksort($regions); //sort by id
$returnArray = array_merge([
'pressArticles' => $pressArticles,
'pressDossiers' => $pressDossiers,
'pressImages' => $pressImages,
'mediaAlbums' => $mediaAlbums,
'mediaAlbumItems' => $mediaAlbumItemsAssets,
'mediaAssets' => $mediaAssets,
'regions' => $regions,
], $this->getWishlists());
return $this->render( 'Press/wishlist.html.twig', $returnArray );
}
/**
* @param Request $request
* @Route("/{_locale}/press/password-forgotten", name="press-pw-forgotten")
*/
public function passwordForgottenAction(Request $request) {
$errors = [];
$success = null;
$step = 1;
$user = null;
$tokenInvalid = null;
if($request->get('token')) {
$step = 2;
$user = MediaUser::getByResetPWToken($request->get('token'), 1);
if(!$user) {
$tokenInvalid = true;
}
}
$config = WebsiteSetting::getByName('DefaultSiteConfig')->getData();
if($request->isMethod(Request::METHOD_POST)) {
if($request->get('email') && $request->get('resetMail')) { //send mail to reset pw
$user = MediaUser::getByEmail($request->get('email'), 1);
$usermailWS = WebsiteSetting::getByName('resetPasswordEmail', null, $request->getLocale());
$usermail = null;
if($usermailWS) {
$usermail = $usermailWS->getData();
}
if($user) {
if($user->getConfirmed()) {
$token = md5('mediaUser-resetPW' . $user->getEmail() . time());
$user->setResetPWTokenCreateTime(Carbon::now());
$user->setResetPWToken($token);
try {
$user->save();
if($usermail) {
$params = [
'link' => 'www.steiermark.com' . $this->generateUrl('press-pw-forgotten', ['token' => $token]),
];
$mail = new Mail();
$mail->setDocument($usermail);
$mail->setParams($params);
$mail->addTo($user->getEmail());
$mail->send();
}
$success = 'mail sent';
} catch (\Exception $e) {
$errors[] = 'generating token failed';
}
} else {
$errors[] = 'user not confirmed';
}
} else {
$errors[] = 'user does not exist';
}
} elseif($request->get('pw') && $request->get('pw2') && $request->get('resetPw') && $request->get('token') && $user) {
if($request->get('pw') === $request->get('pw2')) {
$user->setResetPWTokenCreateTime(null);
$user->setResetPWToken(null);
$user->setPassword($request->get('pw'));
try {
$user->save();
$step = 3;
} catch (\Exception $e) {
$errors[] = 'saving user failed';
}
} else {
$errors[] = 'passwords not equal';
}
}
}
return $this->renderTemplate('Press/passwordForgotten.html.twig', ['step' => $step, 'errors' => $errors, 'success' => $success, 'tokenInvalid' => $tokenInvalid, 'config' => $config]);
}
/**
* @Route("/{_locale}/press/dossiers/add-to-wishlist", name="pressdossiers-wishlist-add")
*/
public function addDossierFromWishlist( Request $request )
{
$id = $request->get( 'id' );
$sessionIds = $request->getSession()->get( 'pressDossierWishlistIds', [] );
$sessionIds[] = $id;
$request->getSession()->set( 'pressDossierWishlistIds', $sessionIds );
$returnArr[ 'ids' ] = $sessionIds;
$url = $this->generateUrl( 'press-wishlist' );
return new JsonResponse( [
"success" => true,
"activeIds" => array_values( array_map( 'intval', $sessionIds ) ),
"__alertNotification" => [
"type" => "notification-default",
"content" => $this->renderView( 'Press/Includes/wishlist/pressarticle-add-notification.html.twig', array_merge( $request->request->all(), [
'url' => $this->getWishlistUrl($request),
'tkText' => 'Pressedossier',
] ) )
]
] );
}
/**
* @Route("/{_locale}/press/dossiers/remove-from-wishlist", name="pressdossiers-wishlist-remove")
*/
public function removeDossierFromWishlist( Request $request )
{
$id = $request->get( 'id' );
$sessionIds = $request->getSession()->get( 'pressDossierWishlistIds', [] );
if( ( $key = array_search( $id, $sessionIds ) ) !== false ){
unset( $sessionIds[ $key ] );
}
$request->getSession()->set( 'pressDossierWishlistIds', $sessionIds );
$returnArr[ 'ids' ] = $sessionIds;
$url = $this->generateUrl( 'press-wishlist' );
return new JsonResponse( [
"success" => true,
"activeIds" => array_values( array_map( 'intval', $sessionIds ) ),
"__alertNotification" => [
"type" => "notification-default",
"content" => $this->renderView( 'Press/Includes/wishlist/pressarticle-remove-notification.html.twig', array_merge( $request->request->all(), [
'url' => $this->getWishlistUrl($request),
'tkText' => 'Pressdossier'
] ) )
]
] );
}
/**
* @Route("/{_locale}/press/image/add-to-wishlist", name="pressimage-wishlist-add")
*/
public function addPressImageToWishlist( Request $request )
{
$id = $request->get( 'id' );
$sessionIds = $request->getSession()->get( 'pressImageWishlistIds', [] );
$sessionIds[] = $id;
$request->getSession()->set( 'pressImageWishlistIds', $sessionIds );
$returnArr[ 'ids' ] = $sessionIds;
return new JsonResponse( [
"success" => true,
"activeIds" => array_values( array_map( 'intval', $sessionIds ) ),
"__alertNotification" => [
"type" => "notification-default",
"content" => $this->renderView( 'Press/Includes/wishlist/pressarticle-add-notification.html.twig', array_merge( $request->request->all(), [
'url' => $this->getWishlistUrl($request),
'tkText' => 'Presseimage',
] ) )
]
] );
}
/**
* @Route("/{_locale}/press/album/add-to-wishlist", name="pressalbum-wishlist-add")
*/
public function addPressAlbumToWishlist( Request $request )
{
$id = $request->get( 'id' );
$sessionIds = $request->getSession()->get( 'pressAlbumWishlistIds', [] );
$sessionIds[] = $id;
$request->getSession()->set( 'pressAlbumWishlistIds', $sessionIds );
$returnArr[ 'ids' ] = $sessionIds;
$url = $this->generateUrl( 'press-wishlist' );
return new JsonResponse( [
"success" => true,
"activeIds" => array_values( array_map( 'intval', $sessionIds ) ),
"__alertNotification" => [
"type" => "notification-default",
"content" => $this->renderView( 'Press/Includes/wishlist/pressarticle-add-notification.html.twig', array_merge( $request->request->all(), [
'url' => $this->getWishlistUrl($request),
'tkText' => 'media-album',
] ) )
]
] );
}
/**
* @Route("/{_locale}/press/album/remove-from-wishlist", name="pressalbum-wishlist-remove")
*/
public function removePressAlbumFromWishlist( Request $request )
{
$id = $request->get( 'id' );
$sessionIds = $request->getSession()->get( 'pressAlbumWishlistIds', [] );
if( ( $key = array_search( $id, $sessionIds ) ) !== false ){
unset( $sessionIds[ $key ] );
}
$request->getSession()->set( 'pressAlbumWishlistIds', $sessionIds );
$returnArr[ 'ids' ] = $sessionIds;
$url = $this->generateUrl( 'press-wishlist' );
return new JsonResponse( [
"success" => true,
"activeIds" => array_values( array_map( 'intval', $sessionIds ) ),
"__alertNotification" => [
"type" => "notification-default",
"content" => $this->renderView( 'Press/Includes/wishlist/pressarticle-remove-notification.html.twig', array_merge( $request->request->all(), [
'url' => $this->getWishlistUrl($request),
'tkText' => 'media-album'
] ) )
]
] );
}
/**
* @Route("/{_locale}/press/album/item/add-to-wishlist", name="pressalbum-item-wishlist-add")
*/
public function addPressAlbumItemToWishlist( Request $request )
{
$id = $request->get( 'id' );
$sessionIds = $request->getSession()->get( 'pressAlbumItemsWishlistIds', [] );
$sessionIds[] = $id;
$request->getSession()->set( 'pressAlbumItemsWishlistIds', $sessionIds );
$returnArr[ 'ids' ] = $sessionIds;
$url = $this->generateUrl( 'press-wishlist' );
return new JsonResponse( [
"success" => true,
"activeIds" => array_values( array_map( 'intval', $sessionIds ) ),
"__alertNotification" => [
"type" => "notification-default",
"content" => $this->renderView( 'Press/Includes/wishlist/pressarticle-add-notification.html.twig', array_merge( $request->request->all(), [
'url' => $this->getWishlistUrl($request),
'tkText' => 'media-album-item',
] ) )
]
] );
}
/**
* @Route("/{_locale}/press/album/item/remove-from-wishlist", name="pressalbum-item-wishlist-remove")
*/
public function removePressAlbumItemFromWishlist( Request $request )
{
$id = $request->get( 'id' );
$sessionIds = $request->getSession()->get( 'pressAlbumItemsWishlistIds', [] );
if( ( $key = array_search( $id, $sessionIds ) ) !== false ){
unset( $sessionIds[ $key ] );
}
$request->getSession()->set( 'pressAlbumItemsWishlistIds', $sessionIds );
$returnArr[ 'ids' ] = $sessionIds;
$url = $this->generateUrl( 'press-wishlist' );
return new JsonResponse( [
"success" => true,
"activeIds" => array_values( array_map( 'intval', $sessionIds ) ),
"__alertNotification" => [
"type" => "notification-default",
"content" => $this->renderView( 'Press/Includes/wishlist/pressarticle-remove-notification.html.twig', array_merge( $request->request->all(), [
'url' => $this->getWishlistUrl($request),
'tkText' => 'media-album-item'
] ) )
]
] );
}
/**
* @Route("/{_locale}/press/image/remove-from-wishlist", name="pressimage-wishlist-remove")
*/
public function removePressImageFromWishlist( Request $request )
{
$id = $request->get( 'id' );
$sessionIds = $request->getSession()->get( 'pressImageWishlistIds', [] );
if( ( $key = array_search( $id, $sessionIds ) ) !== false ){
unset( $sessionIds[ $key ] );
}
$request->getSession()->set( 'pressImageWishlistIds', $sessionIds );
$returnArr[ 'ids' ] = $sessionIds;
$url = $this->generateUrl( 'press-wishlist' );
return new JsonResponse( [
"success" => true,
"activeIds" => array_values( array_map( 'intval', $sessionIds ) ),
"__alertNotification" => [
"type" => "notification-default",
"content" => $this->renderView( 'Press/Includes/wishlist/pressarticle-remove-notification.html.twig', array_merge( $request->request->all(), [
'url' => $this->getWishlistUrl($request),
'tkText' => 'Pressimage'
] ) )
]
] );
}
/**
* @Route("/{_locale}/press/article/add-to-wishlist", name="pressarticle-wishlist-add")
*/
public function addToWishlist( Request $request )
{
$id = $request->get( 'id' );
$sessionIds = $request->getSession()->get( 'pressArticleWishlistIds', [] );
$sessionIds[] = $id;
$request->getSession()->set( 'pressArticleWishlistIds', $sessionIds );
$returnArr[ 'ids' ] = $sessionIds;
$url = $this->generateUrl( 'press-wishlist' );
return new JsonResponse( [
"success" => true,
"activeIds" => array_values( array_map( 'intval', $sessionIds ) ),
"__alertNotification" => [
"type" => "notification-default",
"content" => $this->renderView( 'Press/Includes/wishlist/pressarticle-add-notification.html.twig', array_merge( $request->request->all(), [
'url' => $this->getWishlistUrl($request)
] ) )
]
] );
}
/**
* @Route("/{_locale}/press/article/remove-from-wishlist", name="pressarticle-wishlist-remove")
*/
public function removeFromWishlist( Request $request )
{
$id = $request->get( 'id' );
$sessionIds = $request->getSession()->get( 'pressArticleWishlistIds', [] );
if( ( $key = array_search( $id, $sessionIds ) ) !== false ){
unset( $sessionIds[ $key ] );
}
$request->getSession()->set( 'pressArticleWishlistIds', $sessionIds );
$returnArr[ 'ids' ] = $sessionIds;
$url = $this->generateUrl( 'press-wishlist' );
return new JsonResponse( [
"success" => true,
"activeIds" => array_values( array_map( 'intval', $sessionIds ) ),
"__alertNotification" => [
"type" => "notification-default",
"content" => $this->renderView( 'Press/Includes/wishlist/pressarticle-remove-notification.html.twig', array_merge( $request->request->all(), [
'url' => $this->getWishlistUrl($request),
] ) )
]
] );
}
/**
* @Route("/{_locale}/press/media-asset/add-to-wishlist", name="press-media-asset-item-wishlist-add")
*/
public function addPressMediaAssetToWishlist( Request $request ) //todo
{
$id = $request->get( 'id' );
$sessionIds = $request->getSession()->get( 'pressMediaAssetsWishlistIds', [] );
$sessionIds[] = $id;
$request->getSession()->set( 'pressMediaAssetsWishlistIds', $sessionIds );
$returnArr[ 'ids' ] = $sessionIds;
$url = $this->generateUrl( 'press-wishlist' );
return new JsonResponse( [
"success" => true,
"activeIds" => array_values( array_map( 'intval', $sessionIds ) ),
"__alertNotification" => [
"type" => "notification-default",
"content" => $this->renderView( 'Press/Includes/wishlist/pressarticle-add-notification.html.twig', array_merge( $request->request->all(), [
'url' => $this->getWishlistUrl($request),
'tkText' => 'media-asset',
] ) )
]
] );
}
/**
* @Route("/{_locale}/press/media-asset/remove-from-wishlist", name="press-media-asset-item-wishlist-remove")
*/
public function removePressMediaAssetFromWishlist( Request $request ) //todo
{
$id = $request->get( 'id' );
$sessionIds = $request->getSession()->get( 'pressMediaAssetsWishlistIds', [] );
if( ( $key = array_search( $id, $sessionIds ) ) !== false ){
unset( $sessionIds[ $key ] );
}
$request->getSession()->set( 'pressMediaAssetsWishlistIds', $sessionIds );
$returnArr[ 'ids' ] = $sessionIds;
$url = $this->generateUrl( 'press-wishlist' );
return new JsonResponse( [
"success" => true,
"activeIds" => array_values( array_map( 'intval', $sessionIds ) ),
"__alertNotification" => [
"type" => "notification-default",
"content" => $this->renderView( 'Press/Includes/wishlist/pressarticle-remove-notification.html.twig', array_merge( $request->request->all(), [
'url' => $this->getWishlistUrl($request),
'tkText' => 'media-asset'
] ) )
]
] );
}
/**
* @param Request $request
* @Route("/{_locale}/press-picture-list", name="press-picture-list")
*/
public function getPressPictureList( Request $request, PaginatorInterface $paginator )
{
$paginator = $this->getPaginatorForPressImages( $request, $paginator );
return new JsonResponse( [
'success' => true,
"html" => $this->renderView( 'Press/Includes/pressPictureList.html.twig', [
"paginator" => $paginator,
'activePressPicturesWishlistIds' => $this->activePressPicturesWishlistIds
] ),
] );
}
private function getPaginatorForPressImages( Request $request, PaginatorInterface $paginator, Asset\Listing $articlesList = null )
{
if($articlesList === null) {
$articlesList = $this->getPressImageListing($request);
}
$perPage = $this->getDocumentEditable( 'numeric', 'imagesPerPage' ) ? $this->getDocumentEditable( 'numeric', 'imagesPerPage' )->getData() : 16;
if( $perPage < 4 ){
$perPage = 16;
}
return $paginator->paginate( $articlesList, $request->get( 'page', 1 ), $perPage );
}
private function getPressImageListing(Request $request): Asset\Listing
{
$prefilterRegionId = $this->getDocumentEditable( 'relation', 'prefilter-region' )->getData() ? $this->getDocumentEditable( 'relation', 'prefilter-region' )->getData()[ 'id' ] : null;
$isMainRegion = false;
if(empty($prefilterRegionId)) {
$region = $this->document->getProperty('region');
if($region) {
$prefilterRegionId = $region->getId();
$isMainRegion = $region->getIsMainRegion();
}
}
$keyword = $request->get( 'keyword', '' );
$category = $request->get( 'category', '' );
if(!empty($category) && count($category) < 2 && empty($category[0])) { //check if no empty query param is set
$category = [];
}
$season = $request->get( 'season', '' );
if(!empty($season) && count($season) < 2 && empty($season[0])) { //check if no empty query param is set
$season = [];
}
$orientation = $request->get( 'orientation', [] );
$isPortrait = false;
$isLandscape = false;
foreach( $orientation as $mode ){
if( $mode === 'portrait' ){
$isPortrait = true;
}elseif( $mode === 'landscape' ){
$isLandscape = true;
}
}
return $this->getMediaArchiveImages( $request->getLocale(), $category, $season, $keyword, $isLandscape, $isPortrait, $prefilterRegionId,$isMainRegion );
}
private function getMediaArchiveImages($locale = 'de', $categoryId = '', $seasonId = [], $keyword = '', bool $isLandscape = false, bool $isPortrait = false, int $preFilterRegionId = null, $isMainRegion = false) : Asset\Listing {
$count = 1; //count how many conditions have to be true, always has to be in media archive
if( !empty( $categoryId ) || !empty( $seasonId ) ) $count++;
$keywords = !empty($keyword) ? explode(' ', $keyword) : [];
$keywordObjects = [];
foreach ($keywords as $kw) {
$kwObject = MediaKeyword::getByWord($kw, $locale, 1);
if($kwObject) {
$keywordObjects[] = $kwObject;
}
}
$orientation = '';
if( ( $isPortrait || $isLandscape ) && !( $isPortrait && $isLandscape ) ){
if( $isPortrait ){
$orientation = 'Portrait';
}else{
$orientation = 'Landscape';
}
$count++;
}
$mediaArchiveAssetListing = new Asset\Listing();
$mediaArchiveAssetListing->addConditionParam( "assets.type = 'image'" );
$mediaArchiveAssetListing->onCreateQueryBuilder(
function( \Doctrine\DBAL\Query\QueryBuilder $queryBuilder ) use ( $mediaArchiveAssetListing ){
$queryBuilder->join( 'assets', 'assets_metadata', 'metadata', 'metadata.cid = assets.id' );
//$queryBuilder->join( ['metadata' => 'assets_metadata'], 'cid = id' );
}
);/*
$mediaArchiveAssetListing->onCreateQuery(function (\Pimcore\Db\ZendCompatibility\QueryBuilder $query) {
$query->joinLeft(
['metadata' => 'assets_metadata'],
'cid = id'
);
});*/
if( $preFilterRegionId ){
$mediaArchiveAssetListing->addConditionParam( "id IN (
Select distinct cid
from assets_metadata amr
where (amr.name = 'General.regions' and amr.data LIKE '%[\"object\",$preFilterRegionId]%')" .
($isMainRegion ? ' OR (amr.name = "General.regions" and amr.data = "[]" OR NOT EXISTS(Select * from assets_metadata am_ne where am_ne.name = "General.regions" and am_ne.cid = amr.cid))' : '') .
")" );
}
$mediaArchiveAssetListing->addConditionParam( "id IN (
Select distinct cid
from assets_metadata am
where
(" .
$this->filterBySeasonAndCategories($categoryId, $seasonId)
. //is not first condition
(!empty($orientation) ? " (am.name = 'General.is" . $orientation . "' and am.data = 1) " : "") .
( $orientation ? " or " : "") . //is orientation was set
"(name = 'General.mediaArchive' and data = 1 ) " .
$this->addKeywordAndAuthorCondition($keywords, $keywordObjects, ' OR ') .
")
Group By cid
having count(cid) = " . $count . "
)");
$mediaArchiveAssetListing->addConditionParam('metadata.name = "General.number" ');
$mediaArchiveAssetListing->setOrderKey('cast(data as unsigned) DESC', false); //number is stored as string in db
return $mediaArchiveAssetListing;
}
/**
* @param Request $request
* @Route("/{_locale}/press/login", name="press-login")
*/
public function pressLogin( Request $request )
{
$successpage = WebsiteSetting::getByName( 'pressLoginSuccesspage' )->getData();
$errorpage = WebsiteSetting::getByName( 'pressLoginErrorpage' )->getData();
if( ( $email = $request->get( 'email' ) ) && ( $password = $request->get( 'password' ) ) ){
$user = MediaUser::getByEmail( $email, 1 );
if( $user && password_verify( $password, $user->getPassword() ) ){
$pressSession = $request->getSession()->getBag( "pressLogin" );
$pressSession->set( 'userid', $user->getId() );
if( $pressSession->get( 'lastVisited' ) ){
$successpage = $pressSession->get( 'lastVisited' );
$pressSession->set( 'lastVisited', '' );
}
return new RedirectResponse( $successpage );
}
}
return new RedirectResponse( $errorpage ?: $successpage );
}
/**
* @param Request $request
* @Route("/{_locale}/press/logout", name="press-logout")
*/
public function logout( Request $request )
{
$pressSession = $request->getSession()->getBag( "pressLogin" );
$pressSession->set( 'userid', null );
$successpage = WebsiteSetting::getByName( 'pressLogoutSuccesspage' )->getData();
if( $pressSession->get( 'lastVisited' ) ){
$successpage = $pressSession->get( 'lastVisited' );
$pressSession->set( 'lastVisited', '' );
}
return new RedirectResponse( $successpage );
}
private function getCategoriesDropdownItems( MediaCategory\Listing $pressCategoriesListing, $selectedCat = false, array $activeCategories = [] )
{
if(!empty($selectedCat) && !is_array($selectedCat)) {
$selectedCat = [$selectedCat];
}
$categoryItems = [ [
"label" => "",
"value" => "",
"name" => "",
"id" => "",
"disabled" => false,
"selected" => !$selectedCat,
"checked" => !$selectedCat,
"class" => "sr-only"
] ];
foreach( $pressCategoriesListing as $cat ){
$hasParent = false;
if(empty($activeCategories) || in_array($cat->getId(), $activeCategories, true)) {
$categoryItems[] = [
"label" => $cat->getName(),
"value" => $cat->getId(),
"id" => $cat->getId(),
"name" => 'category[]',
"selected" => $selectedCat && in_array($cat->getId(), $selectedCat),
"checked" => $selectedCat && in_array($cat->getId(), $selectedCat),
"class" => "",
'is-child' => false
];
$hasParent = true;
}
if($cat->getChildren()) { //get all children in Pimcore object tree
$subCategoryList = new \Pimcore\Model\DataObject\MediaCategory\Listing();
$subCategoryList->addConditionParam('o_id IN ('. implode(',', array_map(function($child) {
return $child->getId();
}, $cat->getChildren() )) . ')');
$subCategoryList->setOrderKey('sorting');
$subCategoryList->setOrder('ASC');
foreach($subCategoryList as $child) {
if(empty($activeCategories) || in_array($child->getId(), $activeCategories, true)) {
$categoryItems[] = [
"label" => $child->getName(),
"value" => $child->getId(),
"id" => $child->getId(),
"name" => 'category[]',
"selected" => $selectedCat && in_array($child->getId(), $selectedCat),
"checked" => $selectedCat && in_array($child->getId(), $selectedCat),
"class" => "",
'is-child' => $hasParent
];
}
}
}
}
return $categoryItems;
}
private function getSeasonSelect( array $seasons, $seasonId = null )
{
$seasonItems = [ [
"label" => "",
"value" => "",
"disabled" => true,
"selected" => !$seasonId,
"class" => "sr-only"
] ];
foreach( $seasons as $season ){
if( $season instanceof MediaCategory ){
$seasonItems[] = [
"label" => $season->getName(),
"value" => $season->getId(),
"id" => $season->getId(),
"name" => 'season[]',
"selected" => $seasonId && $seasonId == $season->getId(),
"checked" => $seasonId && in_array($season->getId(), $seasonId),
"class" => "",
];
}
}
return $seasonItems;
}
private function getPressCategoriesDropdownItems( PressCategory\Listing $pressCategoriesListing, $selectedCat )
{
$categoryItems = [ [
"label" => '',
"value" => "",
"disabled" => true,
"selected" => !$selectedCat,
"class" => "sr-only"
], [
"label" => $this->translator->trans( "press.no-category" ),
"value" => "all",
"disabled" => false,
"selected" => !$selectedCat,
"class" => "sr-only"
] ];
foreach( $pressCategoriesListing as $cat ){
$categoryItems[] = [
"label" => $cat->getName(),
"value" => $cat->getId(),
"selected" => $selectedCat && $selectedCat == $cat->getId(),
"class" => "",
];
}
return $categoryItems;
}
private function getMediaCategories(Request $request, $onlyParents = true): MediaCategory\Listing
{
$mediaCategoriesListing = new MediaCategory\Listing();
$mediaCategoriesListing->addConditionParam('name != "" AND name IS NOT NULL');
$mediaCategoriesListing->addConditionParam('hidden is NULL OR hidden = 0');
if ($onlyParents){
//get all parent classes
$categoryClassId = 'MediaCategory';
$mediaCategoriesListing->addConditionParam('EXISTS(SELECT NULL FROM objects sub WHERE sub.o_id = object_localized_'.$categoryClassId.'_'.$request->getLocale().'.o_parentId AND sub.o_type = "folder")');
}
$mediaCategoriesListing->setOrderKey( [ 'sorting', 'name' ] );
$mediaCategoriesListing->setOrder( 'ASC' );
return $mediaCategoriesListing;
}
/**
* @param string[] $keywords
* @param MediaKeyword[] $keywordObjects
*/
private function addKeywordAndAuthorCondition(array $keywords, array $keywordObjects, $keywordConcat = ' AND ') : string
{
$returnString = '';
if(!empty($keywords)) {
$returnString = "and ( cid IN (
Select distinct cid
FROM assets_metadata am
WHERE (";
$first = true;
foreach($keywords as $keyword) {
$returnString .= ($first ? ' (': ($keywordConcat . ' (')) . "(name = 'General.mediaArchive' and data = 1 ) " .
"or (am.name = 'General.title' and am.data like '%" . htmlspecialchars($keyword) . "%')" .
"or (am.name = 'General.description' and am.data like '%" . htmlspecialchars($keyword) . "%')" .
"or (am.name = 'General.number' and am.data like '" . htmlspecialchars($keyword) . "%')"; //first number hast to match e.g. 15 => gets all numbers that start with 15 like 15632, 151, 15, but not 215, 1315
$first = false;
$contactListing = new Contact\Listing();
$contactListing->addConditionParam('name LIKE :authorKw or contactName LIKE :authorKw', ['authorKw' => "%" . $keyword . "%"]);
if($contactListing->getCount()) {
$contactIds = array_map(function($contact) {
return $contact->getId();
},$contactListing->getObjects());
$returnString .= "or (am.name = 'General.author' and am.data IN (" . implode(',', $contactIds) . "))";
}
$returnString .= ') ';
}
if(!empty($keywordObjects)) {
$returnString .= " or (am.name = 'General.keywords' ";
foreach($keywordObjects as $keywordObject) {
$returnString .= "AND am.data like '%\"object\"," . $keywordObject->getId() . "]%'";
}
$returnString .= ')';
}
$returnString .= ")
Group By cid
having count(cid) >= " . count($keywords)+1 . "
)
)";
}
return $returnString;
}
private function filterBySeasonAndCategories($categoryIds, $seasonIds) : string
{
$returnString = '';
if(!empty($categoryIds)) {
if(!empty($seasonIds)) {
$returnString .= '(';
}
$returnString .= '(';
$first = true;
foreach ($categoryIds as $categoryId) {
if(!$first) {
$returnString .= ' OR ';
} else {
$first = false;
}
$returnString .= " (am.name = 'General.categories' and am.data like '%\"object\"," . (int)$categoryId . "]%') ";
}
$returnString .= ')';
}
if(!empty($seasonIds)) {
$returnString .= (!empty($categoryIds) ? " AND " : "") . '(';
$first = true;
foreach ($seasonIds as $seasonId) {
if(!$first) {
$returnString .= ' OR ';
} else {
$first = false;
}
$returnString .= " (am.name = 'General.categories' and am.data like '%\"object\"," . (int)$seasonId . "]%') ";
}
$returnString .= ')' . (!empty($categoryIds) ? " ) " : "");
}
if ($returnString !== '') {
$returnString = '(' . $returnString . ')';
}
if(!empty($categoryId) || !empty($seasonIds)) {
$returnString .= ' OR ';
}
return $returnString;
}
private function isExcludedURL(string $currentPath, array $excludeURLs) : bool
{
foreach ($excludeURLs as $excludeURL) {
if(str_contains($currentPath, $excludeURL)) {
return true;
}
}
return false;
}
private function getWatchlistURLs()
{
$cacheKey = 'watchlistURLs';
$data = \Pimcore\Cache::load($cacheKey);
if (!empty($data)) {
return $data;
}
$data = [];
$configList = new SiteConfig\Listing();
$languages = Tool::getValidLanguages();
foreach ($configList as $config) {
foreach ($languages as $language) {
if($config->getPressWatchlist($language)) {
$data[$config->getPressWatchlist($language)->getId()] = $config->getPressWatchlist($language)->getFullPath();
}
}
}
$cacheTime = 86400; //== 1 day in seconds
\Pimcore\Cache::save($data, $cacheKey, [], $cacheTime, 0, true);
return $data;
}
private function addLastVisitedToSession(Request $request, string $sessionBagName, array $excludeUrl, string $flashname = 'lastVisited', string $anchor = '')
{
if( $request->getPathInfo() &&
!$this->isExcludedURL($request->getPathInfo(), $excludeUrl)
){
$pressLoginSession = $request->getSession()->getBag( $sessionBagName );
$pressLoginSession->set($flashname, $request->getRequestUri() . $anchor );
}
}
private function getMediaAlbumAssets(array $albumItems, array &$assets, bool $hideTitle = true) {
foreach ($albumItems as $item) {
if($item instanceof Asset\Image) {
$assets[] = [
'template' => 'Includes/Teaser/media-album-item-teaser.html.twig',
'params' => [
'image' => $item,
"wishlistActive" => in_array($item->getId(), $this->activePressPicturesWishlistIds, true),
"isVideo" => false,
"video" => null,
"hideTitle" => $hideTitle,
],
'id' => $item->getId(),
];
} elseif($item instanceof Asset\Video) {
$assets[] = [
'template' => 'Includes/Teaser/media-album-item-teaser.html.twig',
'params' => [
'image' => null,
"wishlistActive" => in_array($item->getId(), $this->activePressPicturesWishlistIds, true),
"isVideo" => true,
"video" => $item,
"hideTitle" => $hideTitle,
],
'id' => $item->getId(),
];
} elseif($item instanceof Asset\Folder) {
$this->getMediaAlbumAssets($item->getChildren(), $assets, $hideTitle);
}
}
}
private function createNewUser(array $requiredParams, array $optionalParams, $token)
{
$isNewUser = false;
$user = MediaUser::getByEmail($requiredParams[ 'email' ], 1);
if(!$user) {
$user = new MediaUser();
$user->setParent( Service::createFolderByPath( 'Press/User/Registered' ) );
$user->setKey( File::getValidFilename( $requiredParams[ 'email' ] ) );
$user->setToken( $token );
$user->setTokenTime( Carbon::now() );
$isNewUser = true;
$user->setPublished( false );
}
$user->setEmail( $requiredParams[ 'email' ] );
$user->setPassword( $requiredParams[ 'password' ] );
$user->setTitle( isset( $optionalParams[ 'title' ] ) ? $optionalParams[ 'title' ] : '' );
$user->setFirstname( $requiredParams[ 'firstname' ] );
$user->setLastname( $requiredParams[ 'lastname' ] );
$user->setStreet( $requiredParams[ 'street' ] );
$user->setZip( $requiredParams[ 'zip' ] );
$user->setCity( $requiredParams[ 'city' ] );
$user->setPhone( $requiredParams[ 'phone' ] );
$user->setCompany( $requiredParams[ 'company' ] );
$user->save();
return [$user, $isNewUser];
}
private function addRegistrationParamsToUser(MediaUser $user, Region $region, array $requiredParams, array $optionalParams, \Pimcore\DataObject\Consent\Service $consentService, Translator $translator, Request $request)
{
if($region->getIsMainRegion()) {
$user->setUsage( $requiredParams[ 'usage' ] );
$user->setMessage($optionalParams['message'] ?? '');
$user->setSendRegistrationCompletedMail( true );
$consentService->giveConsent( $user, 'consent', $translator->trans( 'press-registration.Ich stimme den <a href="#">Datenschutzbestimmungen</a> zu.' ), [ 'ip' => $request->getClientIp() ] );
} else {
$blockElements = $user->getFurtherRegionsBlock();
$consentNote = $consentService->insertConsentNote($user, 'consentFurtherRegion-' . $region->getName() , $translator->trans( 'press-registration.Ich stimme den <a href="#">Datenschutzbestimmungen</a> zu.', [ 'ip' => $request->getClientIp() ]));
$newBlockElement = [
'region' => new BlockElement('region', 'relation', $region),
'consentFurtherRegion' => new BlockElement('consentFurtherRegion', 'consent', new Consent(true, $consentNote->getId() )),
'confirmedFurtherRegion' => new BlockElement('confirmedFurtherRegion', 'checkbox', false),
'sendRegistrationCompletedMailFurtherRegion' => new BlockElement('sendRegistrationCompletedMailFurtherRegion', 'checkbox', true),
'usageFurtherRegion' => new BlockElement('usageFurtherRegion', 'textarea', $requiredParams[ 'usage' ]),
'messageFurtherRegion' => new BlockElement('messageFurtherRegion', 'textarea', $optionalParams['message'] ?? ''),
];
$blockElements[] = $newBlockElement;
$user->setFurtherRegionsBlock($blockElements);
}
$user->save();
}
private function sendConfiremedRegistrationMail(MediaUser $user) : bool
{
$success = false;
// $user->setPublished( false );
$user->setToken( '' );
$user->save();
$mailDoc = Document::getById( $this->getDocumentEditable( 'relation', 'notificationmail' )->getData()[ 'id' ] );
if( $mailDoc instanceof Email ){
$notification = new \Pimcore\Mail();
$params = [
'title' => $user->getTitle(),
'firstname' => $user->getFirstname(),
'lastname' => $user->getLastname(),
'street' => $user->getStreet(),
'zip' => $user->getZip(),
'city' => $user->getCity(),
'phone' => $user->getPhone(),
'company' => $user->getCompany(),
'usage' => $user->getUsage(),
'message' => $user->getMessage(),
'email' => $user->getEmail(),
];
$params[ 'deeplink' ] = Tool::getHostUrl() . '/admin/login/deeplink?object_' . $user->getId() . '_object';
$params[ 'items' ] = array_keys( $params );
$notification->setDocument( $mailDoc );
$notification->setParams( $params );
// $notification->setFrom($user->getEmail());
$notification->send();
$success = true;
}
return $success;
}
/**
* @param Region[] $getMetadata
* @param array $regionCollection
*/
private function addRegionsToArray(array $newRegions, array &$regionCollection)
{
foreach ($newRegions as $region) {
$regionCollection[$region->getId()] = $region;
}
}
private function getActiveCategories(Asset\Listing $assetListing) {
$activeCategoryIds = [];
foreach ($assetListing as $asset) {
foreach($asset->getMetadata('General.categories') ?? [] as $category) {
$activeCategoryIds[$category->getId()] = $category->getId();
}
}
return $activeCategoryIds;
}
private function getWishlistUrl(Request $request)
{
$url = '';
$document = Document::getById($request->get('documentId'));
$config = $document->getProperty('siteConfig');
if($config instanceof SiteConfig) {
$url = $config->getPressWatchlist($request->getLocale())?->getFullPath();
}
if(empty($url)) {
$url = $this->generateUrl( 'press-wishlist' );
}
return $url;
}
private function getWishlists()
{
return [
'activePressArticlesWishlistIds' => $this->activePressArticlesWishlistIds,
'activePressDossiersWishlistIds' => $this->activePressDossiersWishlistIds,
'activePressPicturesWishlistIds' => $this->activePressPicturesWishlistIds,
'activePressAlbumWishlistIds' => $this->activePressAlbumWishlistIds,
'activePressAlbumItemsWishlistIds' => $this->activePressAlbumItemsWishlistIds,
'activePressMediaAssetsWishlistIds' => $this->activePressMediaAssetsWishlistIds,
];
}
}