<div class="clear">
    <?php foreach ($module as $m) : ?>
        <div class="icon" id="module_<?php echo htmlspecialchars($m['id']); ?>">
            <div class="content">
                <a href="module/edit/<?php echo htmlspecialchars($m['id']); ?>">
                    <img src="admin/skin/icon/file3.png" /><br /><?php echo htmlspecialchars($m['name']); ?>
                </a>
            </div>
            <div class="action">
                <a href="module/edit/<?php echo htmlspecialchars($m['id']); ?>">Edit</a>
                <a href="javascript:delete_module(<?php echo htmlspecialchars($m['id']); ?>);">Delete</a>
            </div>
        </div>
    <?php endforeach; ?>
</div>

<script type="text/javascript">
    function delete_module(id)
    {
        if (confirm('Are you sure?'))
        {
            $.post('module/delete', { id:id },
                function(data, status) {
                    if (data.error != '')
                    {
                        alert(data.error);
                    }
                    else
                    {
                        $('#module_' + id).remove();
                    }
                }, 'json');
        }
    }
</script>