<?php
 
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");

$formname    = "form_collection_list";
$inputname   = "input_id";

?>

<ul class="toolbar_menu" style="z-index:999999;">
    <?= button("new", $translation->get("new"), $formname, "loadCard('new_sitemapform', true)"); ?>
    <?= button("delete", $translation->get("delete"), $formname, "sendRequest('delete_sitemapform', false, '{$translation->get('delete_data_confirm')}')"); ?>
</ul>

<div id="mainContent">

    <?php echo current_website_language($site, $language); ?>
    <h1><?php echo get_translation('sitemap'); ?></h1>

    <form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
        <input type="hidden" class="selected_linklist_row" name="input_id" value="" />

        <div class="requestLoader"></div>
        <?
        $query = "SELECT sm.id, ms.name AS '" . $translation->get("name") . "', from_unixtime(sm.modified_date, '%d.%m.%Y %H:%i:%s') AS '" . $translation->get("changed_on") . "', main_admin_user.name AS '" . $translation->get("changed_by") . "', sitemap_url as URL  from sitemap AS sm left join main_admin_user ON sm.modified_user = main_admin_user.id INNER JOIN main_site as ms on sm.main_site_id = ms.id  where   (sm.main_language_id = " . (int)$GLOBALS["language"]['id'] . ")  ORDER BY id DESC";
          
        $format = array('option', 'text', 'text', 'text', 'href');
        if ($result = @mysqli_query($GLOBALS['mysql_con'], $query)) {
            linklist($result, $formname, $format, "input_id", "edit_sitemapform", FALSE, 'update_sortorder_sitemap', "sendRequest('delete_sitemapform', false, '{$translation->get('delete_data_confirm')}')"); 
        }
        ?>
    </form>

</div>