/** * Delete existing image * $texts - localized labels and hints * $current_gallery - selected gallery (if any) * $current_image - selected image (if any) * $images - available images info */ public static function renderDeleteImageForm($texts, $current_gallery, $current_image, $images) { include_once getcwd() . '/scripts/admin-helpers/admin-forms/elrh_forms_image.php'; return ELRHImageFormRenderer::renderDeleteImageForm($texts, $current_gallery, $current_image, $images); }
/** * Delete existing image * $texts - localized labels and hints * $current_gallery - selected gallery (if any) * $current_image - selected image (if any) * $images - available images info */ public static function renderDeleteImageForm($texts, $current_gallery, $current_image, $images) { // to avoid php warnings... if (!$current_gallery["exists"]) { $current_gallery["id"] = 0; } if (!$current_image["exists"]) { $current_image["id"] = 0; } // render form // including JS confirmation echo '<form method="post" action="/admin/delete_image" onsubmit="return confirm(\'' . $texts["admin_delete_image_confirm"] . '\');">' . PHP_EOL; echo '<table class="admin">' . PHP_EOL; // info about selected gallery echo '<tr>' . PHP_EOL; echo '<td class="label">' . $texts["admin_gallery_current"] . ':</td>' . PHP_EOL; echo '<td class="value">' . PHP_EOL; if ($current_gallery["exists"]) { echo '<a href="/gallery/g/' . $current_gallery["id"] . '">' . $current_gallery["name"] . '</a>' . PHP_EOL; } else { echo $texts["admin_gallery_notselected"] . PHP_EOL; } echo '<input type="hidden" name="gid" value="' . $current_gallery["id"] . '">'; // store ID value for processing script (0 means new) echo '</td>' . PHP_EOL; echo '</tr>' . PHP_EOL; // select image echo '<tr>' . PHP_EOL; echo '<td class="label">' . $texts["admin_image_delete"] . ':</td>' . PHP_EOL; echo '<td class="value">' . PHP_EOL; if ($current_gallery["exists"]) { if (!empty($images)) { echo ELRHImageFormRenderer::renderImagesSelect($images, $current_image["id"]) . PHP_EOL; echo ' <input type="submit" value="' . $texts["admin_delete"] . '">' . PHP_EOL; } else { echo $texts["admin_no_images"] . PHP_EOL; } } else { echo $texts["admin_gallery_notselected"] . PHP_EOL; } echo '</td>' . PHP_EOL; echo '</tr>' . PHP_EOL; echo '</table>' . PHP_EOL; echo '</form>' . PHP_EOL; }