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");
function getUnitAdminUser() {
global $default;
// find out what unit we're in
$iUnitID = User::getUnitID($_SESSION["userID"]);
if ($iUnitID) {
// then find the group that is unit_admin
$sql = $default->db;
$sEmail = "";
if ($sql->query("SELECT group_id FROM $default->owl_groups_units_table GUL " .
"INNER JOIN $default->owl_groups_table GL on GUL.group_id=GL.id " .
"WHERE GL.is_unit_admin=1 " .
"AND unit_id=$iUnitID")) {
// get the first record
if ($sql->next_record()) {
$iGroupID = $sql->f("group_id");
// then find the first user in this group that has an email address
if ($sql->query("SELECT U.id, U.email FROM $default->owl_users_table U " .
"INNER JOIN $default->owl_users_groups_table UGL on UGL.user_id=U.id " .
"WHERE group_id=$iGroupID")) {
while ($sql->next_record()) {
if (strlen($sql->f("email")) > 0) {
return User::get($sql->f("id"));
}
}
}
}
}
}
return false;
}
// create the navbar and north payload
$navbar = & new NavBar($fBrowseType, $fFolderID, $fDocumentID, $fCategoryName, $fDocumentTypeID);
if ($sectionName == "")
//get the section name if not specified in the url
{
$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 = "
\n" .
" graphicsUrl/tree.gif\"/> |
\n" .
" |
\n" .
"
";
$nwPayLoad = new PatternCustom;
$nwPayLoad ->setHtml($nwestLoad);
// set up the west payload
//get section links
if ($sectionName != "General") {
$sectionArray = $default->siteMap->getSectionLinks($sectionName);
$output1["links"] = $sectionArray["links"];
$output2["descriptions"] = $sectionArray["descriptions"];
//create links
$westLinks = new PatternTableLinks($sectionArray["links"], $sectionArray["descriptions"], 40 , 1 ,1,null);
$westRender = $westLinks->render();
} else {
$westLinks = new PatternTableLinks(array(), array(), 40 , 1 ,1,null);
$westRender = $westLinks->render();
}
//set up links
$cAdmin = "$default->graphicsUrl/leftnav/cadmin.gif" ;
$uAdmin = "$default->graphicsUrl/leftnav/uadmin.gif" ;
$oUnitAdmin = getUnitAdminUser();
$sUnitAdminEmail = $oUnitAdmin ? $oUnitAdmin->getEmail() : $default->emailAdmin;
//setup the westpayload
$westLoad = "\n" .
"\t| $westRender |
\n" .
"
" .
"";
$westPayLoad = new PatternCustom;
$westPayLoad->setHtml($westLoad);
$main = new PatternMainPage();
$main->setNorthPayload($navbar);
$main->setNorthWestPayload($nwPayLoad);
$main->setWestPayload($westPayLoad);
$main->setWestPayloadBackGroundColour("#F0F0E4");
?>