<?php

/**
 * Admin Navigation list for Form management.
 *
 * @category Forms
 * @package  Mtc_Form_Builder
 * @author   mtc. Martins Fridenbergs <martins.fridenbergs@mtcmedia.co.uk>
 */
$current_id = 0;
if (! empty($_REQUEST['id'])) {
    $current_id = (int) $_REQUEST['id'];
}
?>
<ul class="tabnav el">
    <?php

    $selected = '';
    if (
        $_SERVER['SCRIPT_NAME'] == '/modules/FormBuilder/admin/index.php'
        || $_SERVER['SCRIPT_NAME'] == '/modules/FormBuilder/admin/edit.php' && $current_id > 0
    ) {
        $selected = 'class="selected"';
    } ?>
    <li <?= $selected ?>>
        <a href="/modules/FormBuilder/admin/index.php">Manage</a>
    </li>
    <?php

    $selected = '';
    if ($_SERVER['SCRIPT_NAME'] == '/modules/FormBuilder/admin/edit.php' && is_null($current_id)) {
        $selected = 'class="selected"';
    } ?>
    <li <?= $selected ?>>
        <a href="/modules/FormBuilder/admin/edit.php">Add</a>
    </li>
    <?php

    if ($current_id > 0) {
        $selected = '';
        if ($_SERVER['SCRIPT_NAME'] == '/modules/FormBuilder/admin/responses.php') {
            $selected = 'class="selected"';
        }
        ?>
        <li <?= $selected ?>>
            <a href="/modules/FormBuilder/admin/responses.php?id=<?= $current_id ?>">
                View Responses
            </a>
        </li>
        <?php
    }
    ?>
</ul>
