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

<ul class="toolbar_menu">
    <?= button("new", $translation->get("new"), $formname, "loadCard('new_faq_list', true)"); ?>
    <?= button("edit", $translation->get("edit"), $formname, "loadCard('edit_faq_list')"); ?>
    <?= button("delete", $translation->get("delete"), $formname, "sendRequest('delete_faq_list', false, '{$translation->get('delete_faq_group')}')"); ?>
</ul>

<div id="mainContent">

    <?php echo current_website_language($site, $language); ?>
    <h1><?php echo get_translation('top_faq'); ?></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 main_faq.id, GROUP_CONCAT(' ', IF(main_faq_group_link.active = 1,main_faq_setup_group.description,NULL)) AS '".$translation->get("linked_with")."',main_faq.description AS '" . $translation->get("description") . "', from_unixtime(modified_date, '%d.%m.%Y %H:%i:%s') as '" . $translation->get("changed_on") . "', main_admin_user.name as '" . $translation->get("changed_by") . "' from main_faq
            LEFT JOIN
                main_admin_user
            ON
                main_admin_user.id = main_faq.modified_user
            LEFT JOIN
                main_faq_group_link 
            ON 
                main_faq_group_link.main_faq_id = main_faq.id
            LEFT JOIN 
                main_faq_setup_group
            ON 
                main_faq_setup_group.id = main_faq_group_link.main_faq_setup_group_id
            GROUP BY main_faq_group_link.main_faq_id ORDER BY main_faq.sorting asc";

        $format = array('option', 'text', 'text', 'text', 'text');
        if ($result = @mysqli_query($GLOBALS['mysql_con'], $query)) {
            linklist($result, $formname, $format, "input_id", "edit_faq_list", TRUE, 'update_sortorder_faq');
        }
        ?>
    </form>

</div>