EditAsset: allow changing an asset's parent album

This commit is contained in:
2023-11-12 17:26:03 +01:00
parent 44c6bf5914
commit 0c861bf976
3 changed files with 106 additions and 6 deletions

View File

@@ -8,13 +8,17 @@
class EditAssetForm extends Template
{
private $allAlbums;
private $asset;
private $currentAlbumId;
private $thumbs;
public function __construct(Asset $asset, array $thumbs = [])
public function __construct(array $options)
{
$this->asset = $asset;
$this->thumbs = $thumbs;
$this->allAlbums = $options['allAlbums'];
$this->asset = $options['asset'];
$this->currentAlbumId = $options['currentAlbumId'];
$this->thumbs = $options['thumbs'];
}
public function html_main()
@@ -67,6 +71,21 @@ class EditAssetForm extends Template
<div class="content-box key_info">
<h3>Key info</h3>
<div class="row mb-2">
<label class="col-form-label col-sm-3">Album:</label>
<div class="col-sm">
<select class="form-select" name="id_album">';
foreach ($this->allAlbums as $id_album => $album)
echo '
<option value="', $id_album, '"',
$this->currentAlbumId == $id_album ? ' selected' : '',
'>', htmlspecialchars($album), '</option>';
echo '
</select>
</div>
</div>
<div class="row mb-2">
<label class="col-form-label col-sm-3">Title (internal):</label>
<div class="col-sm">