webpageTemplate.inc
4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?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");
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 = "<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") {
$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 = "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" width=\"100%\" height=\"75%\">\n" .
"\t<tr><td>$westRender</td></tr>\n" .
"</table>" .
"<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" width=\"100%\" height=\"25%\">\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=\"middle\"><td align=left><a href=\"mailto:$sUnitAdminEmail\"><img src=\"$uAdmin\"/ border=\"0\"></a></td></tr>\n" .
"</table>";
$westPayLoad = new PatternCustom;
$westPayLoad->setHtml($westLoad);
$main = new PatternMainPage();
$main->setNorthPayload($navbar);
$main->setNorthWestPayload($nwPayLoad);
$main->setWestPayload($westPayLoad);
$main->setWestPayloadBackGroundColour("#F0F0E4");
?>