<?php
// config.php MUST have already been brought in
// via require_once() prior to calling this script.
require_once('database.php');
require_once('refolder.php');
function buildAdminPage($header, $onload, $title, $content) {
$html = templateRefolderCSSAndJavascript(FILE_TEMPLATE_ADMIN);
$html = str_replace('[Header]', $header, $html);
$html = str_replace('[Onload]', $onload, $html);
$html = str_replace('[Title]', ORGANIZATION . ' - ' . $title, $html);
$html = str_replace('[H1]', $title, $html);
$html = str_replace('[Content]', fileRead($content), $html);
$html = str_replace('[Navbar]', buildAdminNavbar($title), $html);
return $html;
}
function buildAdminNavbar($calling_page_name) {
if ($calling_page_name == 'Admin Login') {
$html = "\n\t\t\t<div class=\"navbar_current_div\"><a class=\"navbar_current_link\" href=\"../admin_login/admin_login.php\">Admin Login</a></div>\n\t\t";
return $html;
}
$i = 0;
$links = array(
$i++ => "admin_home/admin_home.php\">Admin Home"
, $i++ => "admin_pages/admin_pages_list.php\">Pages"
, $i++ => "admin_stories/admin_stories_list.php\">Stories"
, $i++ => "admin_panes/admin_panes.php\">Panes"
, $i++ => "admin_files/admin_files_list.php\">Files"
, $i++ => "admin_calendar/admin_calendar_list.php\">Calendar"
, $i++ => "admin_users/admin_users_list.php\">Users"
);
$i = 0;
$index = 0;
if ($calling_page_name == 'Admin Home') $index = 0;
if ($calling_page_name == 'Pages') $index = 1;
if ($calling_page_name == 'Stories') $index = 2;
if ($calling_page_name == 'Panes') $index = 3;
if ($calling_page_name == 'Files') $index = 4;
if ($calling_page_name == 'Calendar') $index = 5;
if ($calling_page_name == 'Users') $index = 6;
$html = "\n\n";
for ($i = 0; $i < count($links); $i++) {
if ($i == $index) {
$html .= '<div class="navbar_current_div"><a class="story_current_link" href="../' . $links[$i] . '</a></div>' . "\n";
} else {
$html .= '<div class="navbar_div"><a class="story_link" href="../' . $links[$i] . '</a></div>' . "\n";
}
}
$html .= "\n\t\t";
return $html;
}
?>