webpageTemplate.inc 3.47 KB
<?php
/**
* webTemplate.inc
*
* Used in conjunction with the navbar to create the north, west and north west payloads
* and in doing so creating the webtemplate 
*
*
* @author Mukhtar Dharsey
* @date 20 January 2003
* @package presentation.lookandfeel
*/

require_once("$default->fileSystemRoot/lib/users/User.inc");
require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc");
require_once("$default->fileSystemRoot/lib/visualpatterns/PatternImage.inc");
require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableLinks.inc");
require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc");
require_once("$default->fileSystemRoot/lib/visualpatterns/NavBar.inc");

// create the navbar and north payload
$navbar = & new NavBar($fBrowseType, $fFolderID, $fDocumentID, $fCategoryName, $fDocumentTypeID);

//get the section name if not specified in the url
if ($sectionName == "") {
    $sectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
}

//highlight the respective section
$navbar->setHighlightedSection($sectionName);

// setup nw payload
$colourBar = $navbar->getNWColourbar();
$nwestLoad   = "<table cellspacing=0 cellpadding=0 border=0>\n" . 
               "<tr><td><img valign=\"top\" src=\"$default->graphicsUrl/tree.gif\"/></td></tr>\n" .
               "<tr><td><img valign=\"top\" src=\"$colourBar\"/></td></tr>\n" .
               "</table>";

$nwPayLoad = new PatternCustom;
$nwPayLoad ->setHtml($nwestLoad);

// set up the west payload
//get section links
if ($sectionName != "General") {

	$bSortLinks = !($sectionName == "Administration");

    $sectionArray = $default->siteMap->getSectionLinks($sectionName, $bSortLinks);

    $output1["links"] = $sectionArray["links"];
    $output2["descriptions"] = $sectionArray["descriptions"];

    //create links
    $westLinks = new PatternTableLinks($sectionArray["links"], $sectionArray["descriptions"], 15 , 1 ,1,null);
    $westRender = $westLinks->render();

} else {
    $westLinks = new PatternTableLinks(array(), array(), 20, 1 ,1,null);
    $westRender = $westLinks->render();
}

//set up links
$cAdmin = "$default->graphicsUrl/leftnav/cadmin.gif" ;
$uAdmin = "$default->graphicsUrl/leftnav/uadmin.gif" ;

$oUnitAdmin = User::getUnitAdminUser();
$sUnitAdminEmail = $oUnitAdmin ? $oUnitAdmin->getEmail() : $default->emailAdmin; 
//setup the westpayload
$westLoad = "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" width=\"100%\" height=\"75%\">\n" .
            "\t<tr valign=\"top\"><td>$westRender</td></tr>\n" .
            "</table>" .
            (isset($default->contactAdminPosition) ? "<div style=\"position:absolute;top:" . $default->contactAdminPosition . "px;left:8px\">" : "") . 
            "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" width=\"100%\">\n" .            
            "\t<tr valign=\"bottom\"><td align=left><a href=\"mailto:$default->emailAdmin\"><img src=\"$cAdmin\"/ border=\"0\"></a></td></tr>\n" .
            "\t<tr valign=\"top\"><td align=left><a href=\"mailto:$sUnitAdminEmail\"><img src=\"$uAdmin\"/ border=\"0\"></a></td></tr>\n" .
            "</table>" .
            (isset($default->contactAdminPosition) ? "</div>" : "");

$westPayLoad = new PatternCustom;
$westPayLoad->setHtml($westLoad);

$main = new PatternMainPage();
$main->setNorthPayload($navbar);
$main->setNorthWestPayload($nwPayLoad);
$main->setWestPayload($westPayLoad);
$main->setWestPayloadBackGroundColour("#F0F0E4");
?>