<?php

function activePage($pageName) {
    
    $activePage = isset($_GET['page']) ? $_GET['page'] : '';
    
    if($activePage == $pageName) {
        return 'active';
    }
    
}

$menuArray = 
array(
    1 => array(OVIS_PAGE_SLUG_1, OVIS_PAGE_NAME_1),
    2 => array(OVIS_PAGE_SLUG_2, OVIS_PAGE_NAME_2),
    3 => array(OVIS_PAGE_SLUG_3, OVIS_PAGE_NAME_3),
    4 => array(OVIS_PAGE_SLUG_4, OVIS_PAGE_NAME_4),
    5 => array(OVIS_PAGE_SLUG_5, OVIS_PAGE_NAME_5),
    6 => array(OVIS_PAGE_SLUG_6, OVIS_PAGE_NAME_6)
);


$sHTML = "<nav class='ovis-menu'>";

    $slugCount = 1;
	
	$isHTTPS = 'http';
	if(isset($_SERVER['HTTPS'])){
		$isHTTPS = 'https';
	}

    foreach($menuArray as $menuItem) {
        
        $pageUrl = admin_url("admin.php?page=" . OVIS_PLUGIN_SLUG . "-" . constant("OVIS_PAGE_SLUG_" . $slugCount) . "", $isHTTPS);
        
        if($menuItem[0] == 'activities') {
            $menuItem[1] = $menuItem[1] . " (" . $oActivities->activity_count()[0] . ")";
        }
        
        $sHTML .= "<a class='" . activePage('easybooking-' . $menuItem[0]) . "' href='" . $pageUrl . "' title='" . $menuItem[1] . "'>" . $menuItem[1] . "</a>";
        $sHTML .= "<div class='line'></div>";
        
        $slugCount++;
        
    }

$sHTML .= "</nav>";

echo $sHTML;