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

<ul class="toolbar_menu">
    <?= button("new", $translation->get("new"), $formname, "loadCard('new_community_board_post', true)"); ?>
    <?= button("edit", $translation->get("edit"), $formname, "loadCard('edit_community_board_post')"); ?>
</ul>
<div id="mainContent">

    <h1><?php echo get_translation('community_board_post'); ?></h1>

    <form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
    <input name="input_id" type="hidden" value="<?= $input_id ?>">
    <input type="hidden" class="selected_linklist_row" name="input_post_id" value="" />
        <div class="requestLoader"></div>
        <?
            $query = "SELECT
		    DISTINCT community_board_post.id, 
		    community_board_post.title AS '" . $translation->get("title") . "',
		    main_contact.name AS '" . $translation->get("contact") . "'
	        FROM 
	        	community_board_post 
            LEFT JOIN
                main_contact
	        ON 
                community_board_post.creation_contact = main_contact.id
            ORDER BY community_board_post.id ASC";
            $format = array("option", "text", "text", "text");
            if ($result = mysqli_query($GLOBALS['mysql_con'], $query)) {
                linklist($result, $formname, $format, "input_post_id", "edit_community_board_post");
            }
        ?>
    </form>
</div>