pics/templates/AssetManagementWrapper.php

37 lines
1018 B
PHP

<?php
/*****************************************************************************
* AssetManagementWrapper.php
* Defines asset management wrapper template.
*
* Kabuki CMS (C) 2013-2015, Aaron van Geffen
*****************************************************************************/
class AssetManagementWrapper extends Template
{
public function html_main()
{
echo '
<form action="" method="post">';
foreach ($this->_subtemplates as $template)
$template->html_main();
echo '
</form>
<script type="text/javascript" defer="defer">
const allAreSelected = () => {
return document.querySelectorAll(".asset_select").length ===
document.querySelectorAll(".asset_select:checked").length;
};
const selectAll = document.getElementById("selectall");
selectAll.addEventListener("change", event => {
const newSelectedState = !allAreSelected();
document.querySelectorAll(".asset_select").forEach(el => {
el.checked = newSelectedState;
});
});
</script>';
}
}