Example #1
0
function getNavMenu($inclogout, $inchome, $homeurl = HOMEURL)
{
    global $user, $viewmode, $docreaders, $authed, $userlookupUsers, $skin;
    global $mode;
    if ($authed && $mode != 'expiredemouser') {
        $computermetadata = getUserComputerMetaData();
    } else {
        $computermetadata = array("platforms" => array(), "schedules" => array());
    }
    $rt = '';
    if ($inchome) {
        $rt .= menulistLI('home');
        $rt .= "<a href=\"{$homeurl}\">HOME</a></li>\n";
    }
    $rt .= menulistLI('newReservations');
    $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=newRequest\">";
    $rt .= "New Reservation</a></li>\n";
    if (in_array("imageCheckOut", $user["privileges"]) || in_array("imageAdmin", $user["privileges"])) {
        $rt .= menulistLI('currentReservations');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=viewRequests\">";
        $rt .= "Current Reservations</a></li>\n";
    }
    if ($viewmode == ADMIN_DEVELOPER) {
        $rt .= menulistLI('blockReservations');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=blockRequest\">";
        $rt .= "Block Reservations</a></li>\n";
    }
    $rt .= menulistLI('userPreferences');
    $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=userpreferences\">";
    $rt .= "User Preferences</a></li>\n";
    if (in_array("groupAdmin", $user["privileges"])) {
        $rt .= menulistLI('manageGroups');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=viewGroups\">";
        $rt .= "Manage Groups</a></li>\n";
    }
    if (in_array("imageAdmin", $user["privileges"])) {
        $rt .= menulistLI('manageImages');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=selectImageOption\">";
        $rt .= "Manage Images</a></li>\n";
    }
    if (in_array("scheduleAdmin", $user["privileges"])) {
        $rt .= menulistLI('manageSchedules');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=viewSchedules\">";
        $rt .= "Manage Schedules</a></li>\n";
    }
    if (in_array("computerAdmin", $user["privileges"])) {
        $rt .= menulistLI('manageComputers');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=selectComputers\">";
        $rt .= "Manage Computers</a></li>\n";
    }
    if (in_array("mgmtNodeAdmin", $user["privileges"])) {
        $rt .= menulistLI('managementNodes');
        $rt .= "<a href=\"" . BASEURL . SCRIPT;
        $rt .= "?mode=selectMgmtnodeOption\">Management Nodes</a></li>\n";
    }
    if (count($computermetadata["platforms"]) && count($computermetadata["schedules"])) {
        $rt .= menulistLI('timeTable');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=pickTimeTable\">";
        $rt .= "View Time Table</a></li>\n";
    }
    if (in_array("userGrant", $user["privileges"]) || in_array("resourceGrant", $user["privileges"]) || in_array("nodeAdmin", $user["privileges"])) {
        $rt .= menulistLI('privileges');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=viewNodes\">";
        $rt .= "Privileges</a></li>\n";
    }
    if ($viewmode == ADMIN_DEVELOPER || in_array($user['id'], $userlookupUsers)) {
        $rt .= menulistLI('userLookup');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=userLookup\">";
        $rt .= "User Lookup</a></li>\n";
    }
    if (in_array("computerAdmin", $user["privileges"])) {
        $rt .= menulistLI('vm');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=editVMInfo\">";
        $rt .= "Virtual Hosts</a></li>\n";
    }
    $rt .= menulistLI('statistics');
    $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=selectstats\">";
    $rt .= "Statistics</a></li>\n";
    if ($skin != 'ecu') {
        $rt .= menulistLI('help');
        $rt .= "<a href=\"" . HELPURL . "\">Help</a></li>\n";
    }
    if ($skin == 'ecu') {
        $rt .= "<li><a href=\"http://www.ecu.edu/cs-itcs/vcl/connect.cfm\">Requirements</a></li>\n";
        $rt .= "<li><a href=\"http://www.ecu.edu/cs-itcs/vcl/save.cfm\">File Saving</a></li>\n";
        $rt .= "<li><a href=\"http://www.ecu.edu/cs-itcs/vcl/faqs.cfm\">Help</a></li>\n";
    }
    if (in_array("userGrant", $user["privileges"]) || in_array("resourceGrant", $user["privileges"]) || in_array("nodeAdmin", $user["privileges"]) || in_array($user['id'], $docreaders)) {
        $rt .= menulistLI('codeDocumentation');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=viewdocs\">";
        $rt .= "Documentation</a></li>\n";
    }
    if ($inclogout) {
        $rt .= menulistLI('authentication');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=logout\">";
        $rt .= "Logout</a></li>\n";
    }
    return $rt;
}
Example #2
0
function getNavMenu($inclogout, $inchome, $homeurl = HOMEURL)
{
    global $user, $docreaders, $authed, $mode;
    if ($authed && $mode != 'expiredemouser') {
        $computermetadata = getUserComputerMetaData();
        $requests = getUserRequests("all", $user["id"]);
    } else {
        $computermetadata = array("platforms" => array(), "schedules" => array());
    }
    $rt = '';
    if ($inchome) {
        $rt .= menulistLI('home');
        $rt .= "<a href=\"{$homeurl}\">" . i("HOME") . "</a></li>\n";
    }
    $rt .= menulistLI('reservations');
    $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=viewRequests\">";
    $rt .= i("Reservations") . "</a></li>\n";
    #$rt .= menulistLI('config');
    #$rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=config\">";
    #$rt .= i("Manage Configs") . "</a></li>\n";
    $rt .= menulistLI('blockAllocations');
    $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=blockAllocations\">";
    $rt .= i("Block Allocations") . "</a></li>\n";
    $rt .= menulistLI('userPreferences');
    $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=userpreferences\">";
    $rt .= i("User Preferences") . "</a></li>\n";
    if (in_array("groupAdmin", $user["privileges"])) {
        $rt .= menulistLI('manageGroups');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=viewGroups\">";
        $rt .= i("Manage Groups") . "</a></li>\n";
    }
    if (in_array("imageAdmin", $user["privileges"])) {
        $rt .= menulistLI('image');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=image\">";
        $rt .= i("Manage Images") . "</a></li>\n";
    }
    if (in_array("scheduleAdmin", $user["privileges"])) {
        $rt .= menulistLI('schedule');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=schedule\">";
        $rt .= i("Manage Schedules") . "</a></li>\n";
    }
    if (in_array("computerAdmin", $user["privileges"])) {
        $rt .= menulistLI('computer');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=computer\">";
        $rt .= i("Manage Computers") . "</a></li>\n";
    }
    if (in_array("mgmtNodeAdmin", $user["privileges"])) {
        $rt .= menulistLI('managementnode');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=managementnode\">";
        $rt .= i("Management Nodes") . "</a></li>\n";
    }
    if (in_array("serverProfileAdmin", $user["privileges"]) || in_array("serverCheckOut", $user["privileges"])) {
        $rt .= menulistLI('serverProfiles');
        $rt .= "<a href=\"" . BASEURL . SCRIPT;
        $rt .= "?mode=serverProfiles\">" . i("Server Profiles") . "</a></li>\n";
    }
    if (count($computermetadata["platforms"]) && count($computermetadata["schedules"])) {
        $rt .= menulistLI('timeTable');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=pickTimeTable\">";
        $rt .= i("View Time Table") . "</a></li>\n";
    }
    if (in_array("userGrant", $user["privileges"]) || in_array("resourceGrant", $user["privileges"]) || in_array("nodeAdmin", $user["privileges"])) {
        $rt .= menulistLI('privileges');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=viewNodes\">";
        $rt .= i("Privileges") . "</a></li>\n";
    }
    if (checkUserHasPerm('User Lookup (global)') || checkUserHasPerm('User Lookup (affiliation only)')) {
        $rt .= menulistLI('userLookup');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=userLookup\">";
        $rt .= i("User Lookup") . "</a></li>\n";
    }
    if (in_array("computerAdmin", $user["privileges"])) {
        $rt .= menulistLI('vm');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=editVMInfo\">";
        $rt .= i("Virtual Hosts") . "</a></li>\n";
    }
    if (checkUserHasPerm('Schedule Site Maintenance')) {
        $rt .= menulistLI('sitemaintenance');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=siteMaintenance\">";
        $rt .= i("Site Maintenance") . "</a></li>\n";
    }
    $rt .= menulistLI('statistics');
    $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=selectstats\">";
    $rt .= i("Statistics") . "</a></li>\n";
    if (checkUserHasPerm('View Dashboard (global)') || checkUserHasPerm('View Dashboard (affiliation only)')) {
        $rt .= menulistLI('dashboard');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=dashboard\">";
        $rt .= i("Dashboard") . "</a></li>\n";
    }
    if (checkUserHasPerm('Site Configuration (global)') || checkUserHasPerm('Site Configuration (affiliation only)')) {
        $rt .= menulistLI('siteconfig');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=siteconfig\">";
        $rt .= i("Site Configuration") . "</a></li>\n";
    }
    $rt .= menulistLI('codeDocumentation');
    $rt .= "<a href=\"" . DOCUMENTATIONURL . "\">";
    $rt .= i("Documentation") . "</a></li>\n";
    if ($inclogout) {
        $rt .= menulistLI('authentication');
        $rt .= "<a href=\"" . BASEURL . SCRIPT . "?mode=logout\">";
        $rt .= i("Logout") . "</a></li>\n";
    }
    return $rt;
}