-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove
Photo
thumbnails and switch admin viewer to PhotoSwipe
- Loading branch information
Showing
25 changed files
with
697 additions
and
1,234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,10 @@ | |
use Laminas\Http\Request; | ||
use Laminas\Http\Response; | ||
use Laminas\Mvc\Controller\AbstractActionController; | ||
use Laminas\Mvc\I18n\Translator; | ||
use Laminas\View\Model\JsonModel; | ||
use Laminas\View\Model\ViewModel; | ||
use Photo\Service\AclService; | ||
use Photo\Service\Admin as AdminService; | ||
use Photo\Service\Album as AlbumService; | ||
use Throwable; | ||
|
@@ -18,8 +20,11 @@ | |
class AlbumAdminController extends AbstractActionController | ||
{ | ||
public function __construct( | ||
Check failure on line 22 in module/Photo/src/Controller/AlbumAdminController.php GitHub Actions / php-codesniffer / PHP_CodeSniffer (8.2)
|
||
private readonly AclService $aclService, | ||
private readonly Translator $translator, | ||
private readonly AdminService $adminService, | ||
private readonly AlbumService $albumService, | ||
private readonly array $photoConfig, | ||
) { | ||
} | ||
|
||
|
@@ -28,22 +33,55 @@ public function __construct( | |
*/ | ||
public function indexAction(): ViewModel | ||
{ | ||
// TODO: Add ACL | ||
$years = $this->albumService->getAlbumYears(); | ||
$albumsByYear = []; | ||
foreach ($years as $year) { | ||
$albumsByYear[$year] = $this->albumService->getAlbumsByYear($year); | ||
} | ||
|
||
$albumsWithoutDate = $this->albumService->getAlbumsWithoutDate(); | ||
|
||
return new ViewModel( | ||
[ | ||
'albumsByYear' => array_reverse($albumsByYear, true), | ||
'albumsWithoutDate' => $albumsWithoutDate, | ||
'years' => $years, | ||
], | ||
); | ||
} | ||
|
||
/** | ||
* Show a specific album. | ||
*/ | ||
public function viewAction(): ViewModel | ||
{ | ||
// TODO: Add ACL | ||
$albumId = (int) $this->params()->fromRoute('album_id'); | ||
$album = $this->albumService->getAlbum($albumId); | ||
|
||
if (null === $album) { | ||
return $this->notFoundAction(); | ||
} | ||
|
||
$years = $this->albumService->getAlbumYears(); | ||
|
||
return new ViewModel([ | ||
'album' => $album, | ||
'config' => $this->photoConfig, | ||
'years' => $years, | ||
'year' => $this->albumService->getAssociationYear($album->getStartDateTime()), | ||
]); | ||
} | ||
|
||
/** | ||
* Show all albums in a specific year. | ||
*/ | ||
public function yearAction(): ViewModel | ||
{ | ||
// TODO: Add ACL | ||
$year = (int) $this->params()->fromRoute('year'); | ||
$years = $this->albumService->getAlbumYears(); | ||
|
||
return new ViewModel([ | ||
'albums' => $this->albumService->getAlbumsByYear($year), | ||
'years' => $years, | ||
'year' => $year, | ||
]); | ||
} | ||
|
||
/** | ||
* Retrieves the album creation form and saves data if needed. | ||
*/ | ||
|
@@ -72,25 +110,6 @@ public function createAction(): Response|ViewModel | |
); | ||
} | ||
|
||
/** | ||
* Retrieves photos on a certain page. | ||
*/ | ||
public function pageAction(): JsonModel|ViewModel | ||
{ | ||
$albumId = (int) $this->params()->fromRoute('album_id'); | ||
$activePage = (int) $this->params()->fromRoute('page'); | ||
|
||
if (0 !== $albumId) { | ||
$albumPage = $this->plugin('AlbumPlugin')->getAlbumPageAsArray($albumId, $activePage); | ||
|
||
if (null !== $albumPage) { | ||
return new JsonModel($albumPage); | ||
} | ||
} | ||
|
||
return $this->notFoundAction(); | ||
} | ||
|
||
/** | ||
* Retrieves the album editing form and saves changes. | ||
*/ | ||
|
@@ -115,6 +134,7 @@ public function editAction(): Response|ViewModel | |
return new ViewModel( | ||
[ | ||
'form' => $form, | ||
'album' => $form->getObject(), | ||
], | ||
); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
module/Photo/src/Controller/Factory/Plugin/AlbumPluginFactory.php
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.