Changes the ConfirmDelete page and updates database code.

The ConfirmDelete page now uses parts of the photopage. The
Confirmation dialog is its own template which is based on Alert.

The database now updates the album thumb to the most recent
addition to the album, when the album thumb asset is being deleted.
When there are no pictures left in the album 0 will be set.
This commit is contained in:
2018-07-08 08:19:37 +00:00
parent e40c05c1f8
commit 16ec547064
12 changed files with 197 additions and 113 deletions

View File

@@ -289,6 +289,34 @@ class Tag
]);
}
public function resetIdAsset()
{
$db = Registry::get('db');
$row = $db->query('
SELECT MAX(id_asset) as new_id
FROM assets_tags
WHERE id_tag = {int:id_tag}',
[
'id_tag' => $this->id_tag,
]);
$new_id = 0;
if(!empty($row))
{
$new_id = $row->fetch_assoc()['new_id'];
}
return $db->query('
UPDATE tags
SET id_asset_thumb = {int:new_id}
WHERE id_tag = {int:id_tag}',
[
'new_id' => $new_id,
'id_tag' => $this->id_tag,
]);
}
public static function match($tokens)
{
if (!is_array($tokens))