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

$action = (isset($_GET['action']) ? $_GET['action'] : "");
function loadModule($active, $site, $language){
    $query                        = "SELECT * FROM main_module WHERE active = " . $active;
    $result                       = @mysqli_query($GLOBALS['mysql_con'], $query);
    while ($row = @mysqli_fetch_array($result)) { 

        ?>
        <div class="module-card-list">
            <div class="module-card-container state_<?= $row['active'] ?>">
                <div class="module-card-image"><img src="/layout/admin/img/module/<?= $row['code'] ?>" alt=""></div>
                <div class="module-card-titel"><?= $row['title'] ?></div>
                <div class="module-card-text"><?= $row['description'] ?></div>
                <?php        
                if($active == 1){ ?>
                    <div class="module-card-status">bereits aktiviert</div>
                    <?php if($row['code'] != "basic"){ ?>
                        <div class="module-card-link"><a href="<?php echo get_menu_link('module/'.$row['code'], $site, $language); ?>"></a></div>
                    <?php } ?>
                <?php }else{ ?>
                    <div class="module-card-status">nicht aktiviert</div>
                    <div class="module-card-status-vertrieb"><a target="_blank" href="https://www.breadcrumb-solutions.de/bc/de/kontakt/"></a>Jetzt anfragen</div>
                <?php }?>
                
            </div>
        </div>
<?php } } ?>
<? $formname = "form_module"; ?>
<div id="mainContent" class="dashboard-mysyde">
    <div class="module-wrapper dashboard-wrapper">
        <div class="module-content dashboard-left-content">
            <img class="mysyde-icon img-fluid"src="/layout/admin/img/icons/mysyde-icon.svg" alt="MySyde Icon">
            <div class="text-content">
                <div class="text-white"><?php echo current_website_language($site, $language); ?></div>
                <h1 class="new-h1 text-white"><?php echo $translation->get("top_module") ?></h1>
                <p class="text-white">Wir arbeiten stetig daran, MySyde zu einem besseren Ort zu machen.</p>
            </div>
            <img src="/layout/admin/img/icons/mysyde-bg.jpg" alt="" class="module-content-img hintergrund module-hintergrund position-absolute top-0 left-0 z-index-1">
        </div>
        <div class="module-container">
            <h2>Deine Module</h2>        
            <div class="module-wrapper-list">
                <?php loadModule(1, $site, $language) ?>
            </div>
            </div>
            <div class="module-container weitere">
            <h2>Verfügbare Module</h2>
            <div class="module-wrapper-list">
                <?php loadModule(0, $site, $language) ?>
            </div>
            </div>
        </div>
    </div>
</div>