CORE-POS/IS4C

View on GitHub
fannie/src/header.html

Summary

Maintainability
Test Coverage
<?php
global $FANNIE_DYNAMIC_MENU, $FANNIE_NAV_POSITION, $FANNIE_CSS_LOGO, $FANNIE_CHARSET, $FANNIE_CUSTOM_TITLE, $FANNIE_BACKEND_NAME;
if (isset($headerConfig) && $headerConfig instanceof FannieConfig) {
    $FANNIE_DYNAMIC_MENU = $headerConfig->get('DYNAMIC_MENU');
    $FANNIE_NAV_POSITION = $headerConfig->get('NAV_POSITION');
    $FANNIE_CSS_LOGO = $headerConfig->get('CSS_LOGO');
    $FANNIE_CHARSET = $headerConfig->get('CHARSET');
    $FANNIE_CUSTOM_TITLE = $headerConfig->get('CUSTOM_TITLE');
    $FANNIE_MENU = $headerConfig->get('MENU');
    $BACKEND_NAME = $headerConfig->get('BACKEND_NAME', 'Fannie');
} else {
    $BACKEND_NAME = $FANNIE_BACKEND_NAME;
}
if (preg_match('/^Fannie[^\w]+.*$/', $page_title)) {
    $page_title = preg_replace('/^Fannie(.*)$/', $BACKEND_NAME . '$1', $page_title);
}
if (preg_match('/^Fannie[^\w]+.*$/', $header)) {
    $header = preg_replace('/^Fannie(.*)$/', $BACKEND_NAME . '$1', $header);
}
/* try to deal with relative paths for includes */
$path = "";
$limit = 15;
$counter = 0;
while ($counter < $limit) {
    if (file_exists($path . 'classlib2.0/FannieAPI.php')) {
        break;
    }
    $path .= "../";
    $counter++;
}
if (!isset($FANNIE_CHARSET) || empty($FANNIE_CHARSET)) {
    $FANNIE_CHARSET = 'ISO-8859-1';
}
?>
<!DOCTYPE html> 
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $FANNIE_CHARSET; ?>">
<title><?php echo $page_title; ?></title>
<link rel="STYLESHEET" href="<?php echo $path; ?>src/style.css" type="text/css">
<link rel="STYLESHEET" href="<?php echo $path; ?>src/css/configurable.php" type="text/css">
<link rel="STYLESHEET" href="<?php echo $path; ?>src/javascript/jquery-ui.css?id=20140625" type="text/css">
<script type="text/javascript" src="<?php echo $path; ?>src/javascript/jquery.js?id=20140625">
</script>
<script type="text/javascript" src="<?php echo $path; ?>src/javascript/jquery-ui.js?id=20140625.1">
</script>
</head>
<body>
<div style="margin-left:3em;margin-right:3em;">
<table style="width:100%;">
<tr>
    <td colspan="2" class="secondaryBorder" 
        style="width:100%;border-bottom-style:solid; border-bottom-width: 1px;
               margin-bottom:10px;padding-bottom:5px;">
        <table cellspacing="0" cellpadding="0"> <!-- yes. sick of fighting with floating divs... -->
        <tr><td>
            <?php if (isset($FANNIE_CSS_LOGO) && !empty($FANNIE_CSS_LOGO)) { ?>
            <img src="<?php echo $FANNIE_CSS_LOGO; ?>" alt="logo" />
            <?php } ?>
        </td>
        <td>
        <div style="font-size:28px;" class="primaryColor">
        <?php
        echo $FANNIE_BACKEND_NAME;
        if (isset($FANNIE_CUSTOM_TITLE) && !empty($FANNIE_CUSTOM_TITLE)) {
            echo ' - ' . $FANNIE_CUSTOM_TITLE;
        } 
        ?>
        </div>
        <div style="font-size:20px;" class="secondaryColor">
        IT CORE maintenance & reporting
        </div>
        </td></tr>
        </table>
    </td>
</tr>
<?php
if ( isset($FANNIE_NAV_POSITION) && $FANNIE_NAV_POSITION == "top" ) {
?>
<!-- Row for nav -->
<tr>
    <td style="width:900px;background:#fff;vertical-align:top;border-right:solid 1px #ccc;">
        <div style="width:900px;">
        <!-- div style="width:900px;margin-left:auto;margin-right:auto;" -->
     <?php
        if (isset($FANNIE_DYNAMIC_MENU) && $FANNIE_DYNAMIC_MENU===True)
            include($path.'src/navbar.dynamic.php');
        else
            include($path.'src/navbar.html');
    ?>
        <!-- span style="font-size:6px"><br /></span -->
        </div>
    </td>
</tr>
<!-- Page contents -->
<tr>
    <td style="width:100%;vertical-align:top;border-right:solid 1px #ccc;">
        <span style="font-size:6px"><br /></span>
        <!-- Div for content, why fixed width? -->
        <div style="width:579;margin-left:auto;margin-right:auto;">
            <!-- Heading of contents, $header from the content script -->
            <div style="width:95%;height:27px;background:#f9f9f9;
                font-size:15px;border-top:1px #ccc solid;
                border-bottom:1px #ccc solid;padding-top:3px;"
                class="primaryColor">
                &nbsp;&nbsp;<?php echo $header; ?>
            </div>
            <!-- Body of content, STDOUT from the content script -->
            <div style="width:95%;color:#444;line-height:1.6em;margin-left:7px;">
            <!-- There are two open divs within this cell -->

<?php
}
else {
?>
<tr>
    <td style="width:170px;background:#fff;vertical-align:top;border-right-style:solid;
        border-right-width: 1px;" class="secondaryBorder">
        <div style="width:170px;margin-left:auto;margin-right:auto;">
     <?php
        if (isset($FANNIE_DYNAMIC_MENU) && $FANNIE_DYNAMIC_MENU===True)
            include($path.'src/navbar.dynamic.php');
        else
            include($path.'src/navbar.html');
    ?>
        <span style="font-size:6px"><br /></span>
        </div>
    </td>
    <td style="width:100%;vertical-align:top;border-right-style:solid;
        border-right-width: 1px;" class="secondaryBorder">
        <span style="font-size:6px"><br /></span>
        <div style="width:579;margin-left:auto;margin-right:auto;">
            <div style="width:95%;height:27px;
                font-size:15px;border-top-width:1px;border-top-style: solid;
                border-bottom-width:1px; border-bottom-style: solid;
                padding-top:3px; margin-bottom: 5px;"
                class="primaryColor secondaryBorder">
                &nbsp;&nbsp;<?php echo $header; ?>
            </div>
            <div style="width:95%;line-height:1.6em;margin-left:7px;">

<?php
}
?>