<small><a class="awesome orange right" href="<?php echo WWW_ROOT; ?>modules/positions.html" title="voir les positions">voir les positions</a></small>

<h1 align="center">Modules</h1>

<ul id="mes-modules">
    <?php foreach ((array)v('groupes') as $groupe) { ?>
    <li><?php echo $groupe->nom; ?>
        <?php if (sizeof((array)$groupe->modules) > 0) { ?>
            <ul>
                <?php foreach ((array)$groupe->modules as $module) { ?>
                <li class="<?php echo $module->installed ? 'installed' : 'not-installed'; ?> <?php echo $module->actif ? 'actif' : 'inactif'; ?>">
                    <?php echo $module->nom; ?>

                    <span>
                    <?php if (!$module->installed) { ?>

                        <a class="live" href="<?php echo WWW_ROOT; ?>modules/installer/<?php echo $module->module; ?>"
                           title="installer">installer</a>

                        <?php } else { ?>

                        <?php if ($module->customConfiguration != null) { ?>
                            <a href="<?php echo WWW_ROOT.$module->customConfiguration; ?>"
                                                               title="configurer">configurer</a> -
                            <?php } else { ?>
                            <?php if (sizeof((array)$module->configs) > 0) { ?>
                                <a href="<?php echo WWW_ROOT; ?>modules/configuration/<?php echo $module->module; ?>"
                                   title="configurer">configurer</a> -
                                <?php } ?>

                            <?php } ?>

                        <?php if ($module->actif) { ?>
                            <a class="live" href="<?php echo WWW_ROOT; ?>modules/desactiver/<?php echo $module->module; ?>"
                               title="desactiver">désactiver</a>
                            <?php } else { ?>
                            <a class="live" href="<?php echo WWW_ROOT; ?>modules/activer/<?php echo $module->module; ?>"
                               title="activer">activer</a>
                            <?php } ?>


                        - <a class="live" href="<?php echo WWW_ROOT; ?>modules/desinstaller/<?php echo $module->module; ?>"
                             title="desinstaller">désinstaller</a>

                        <?php } ?>
                    </span>
                </li>
                <?php } ?>
            </ul>
            <?php } ?>
    </li>
    <?php } ?>
</ul>
<script type="text/javascript">
    $("#mes-modules").find("a.live").live('click', function (e) {
        e.preventDefault();

        $.ajax({
            url:$(this).attr('href'),
            success:function (data) {
                location.assign(location.href);
            },
            error:function (data, message) {
                alert(data.response);
            }
        });
        return false;
    });
</script>