dashboardUI.inc
12.8 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
<?php
require_once("$default->fileSystemRoot/lib/users/User.inc");
/**
* $Id$
*
* Dashboard page html UI building functions.
*
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* @version $Revision$
* @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
* @package presentation
*/
/**
* Displays the pending web documents
*
* @param array of pending web documents
*/
function renderPendingWebDocuments($aPendingDocumentList) {
global $default;
if (count($aPendingDocumentList) > 0) {
$sBgColor = "#9D9D7F";
$sToRender = "\t\t\t<tr align=\"left\" bgcolor=\"$sBgColor\">\n";
$sToRender .= "\t\t\t\t<th class=\"sectionHeading\" colspan=\"2\"><font color=\"ffffff\">Pending Web Documents</font></th>\n";
$sToRender .= "\t\t\t</tr>\n";
for ($i = 0; $i < count($aPendingDocumentList); $i++) {
$oWebDocument = $aPendingDocumentList[$i];
$sToRender .= "\t\t\t<tr>\n";
$sToRender .= "\t\t\t\t<td colspan=\"2\">" . generateControllerLink("webDocument", "fWebDocumentID=" . $oWebDocument->getID(), "<img src=\"$default->graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oWebDocument->getDisplayPath()) . "</td>\n";
$sToRender .= "\t\t\t</tr>\n";
}
return $sToRender;
} else {
return "";
}
}
function renderRestorationRequests($aRestorationRequests) {
global $default;
if (count($aRestorationRequests) > 0) {
$sBgColor = "#9D9D7F";
$sToRender = "\t\t\t<tr align=\"left\" bgcolor=\"$sBgColor\">\n";
$sToRender .= "\t\t\t\t<th class=\"sectionHeading\" colspan=\"2\"><font color=\"ffffff\">Archived Document Restoration Requests</font></th>\n";
$sToRender .= "\t\t\t</tr>\n";
for ($i = 0; $i < count($aRestorationRequests); $i++) {
$oDocument = Document::get($aRestorationRequests[$i]->getDocumentID());
if ($oDocument) {
$sToRender .= "\t\t\t<tr>\n";
$sToRender .= "\t\t\t\t<td colspan=\"2\">" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), "<img src=\"$default->graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oDocument->getDisplayPath()) . "</td>\n";
$sToRender .= "\t\t\t</tr>\n";
}
}
return $sToRender;
} else {
return "";
}
}
/**
* Displays the pending collaboration documents
*
* @param array of pending collaboration documents
*/
function renderPendingCollaborationDocuments($aPendingDocumentList) {
global $default;
if (count($aPendingDocumentList) > 0) {
$sBgColor = "#9D9D7F";
} else {
$sBgColor = "#CECEBF";
}
$sToRender = "\t\t\t<tr align=\"left\" bgcolor=\"$sBgColor\">\n";
$sToRender .= "\t\t\t\t<th class=\"sectionHeading\" colspan=\"2\"><font color=\"ffffff\">Pending Documents</font></th>\n";
$sToRender .= "\t\t\t</tr>\n";
for ($i = 0; $i < count($aPendingDocumentList); $i++) {
$oDocument = $aPendingDocumentList[$i];
$sToRender .= "\t\t\t<tr>\n";
$sToRender .= "\t\t\t\t<td colspan=\"2\">" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), "<img src=\"$default->graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oDocument->getDisplayPath()) . "</td>\n";
$sToRender .= "\t\t\t</tr>\n";
}
return $sToRender;
}
/**
* Displays the checked out documents
*
* @param array of checked out documents
*/
function renderCheckedOutDocuments($aCheckedOutDocumentList) {
global $default;
if (count($aCheckedOutDocumentList) > 0) {
$sBgColor = "#9D9D7F";
} else {
$sBgColor = "#CECEBF";
}
$sToRender = "\t\t\t<tr align=\"left\" bgcolor=\"$sBgColor\">\n";
$sToRender .= "\t\t\t\t<th class=\"sectionHeading\" colspan=\"2\"><font color=\"ffffff\">Checked Out Documents</font></th>\n";
$sToRender .= "\t\t\t</tr>\n";
if (count($aCheckedOutDocumentList) > 0) {
$sToRender .= "\t\t\t<tr>\n";
$sToRender .= "\t\t\t\t<th align=\"left\" width=\"66%\" class=\"sectionColumns\">";
$sToRender .= "Title";
$sToRender .= "</th>\n";
$sToRender .= "\t\t\t\t<th align=\"right\" width=\"33%\" class=\"sectionColumns\">";
$sToRender .= "Days";
$sToRender .= "\t\t\t\t</th>\n";
$sToRender .= "\t\t\t</tr>\n";
}
for ($i = 0; $i < count($aCheckedOutDocumentList); $i++) {
$oDocument = $aCheckedOutDocumentList[$i];
$sToRender .= "\t\t\t<tr>\n";
$sToRender .= "\t\t\t\t<td>" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), "<img src=\"$default->graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oDocument->getDisplayPath()) . "</td>\n";
$sToRender .= "\t\t\t\t<td align=right>" . $oDocument->getDaysSinceLastModified() . "</td>\n";
$sToRender .= "\t\t\t</tr>\n";
}
return $sToRender;
}
/**
* Displays the subscription alerts
*
* @param array of subscription alerts
*/
function renderSubscriptionAlerts($aSubscriptionAlertList) {
global $default;
if (count($aSubscriptionAlertList) > 0) {
$sBgColor = "#9D9D7F";
} else {
$sBgColor = "#CECEBF";
}
$sToRender = "\t\t\t<tr align=\"left\" bgcolor=\"$sBgColor\">\n";
$sToRender .= "\t\t\t\t<th class=\"sectionHeading\" colspan=\"2\"><font color=\"ffffff\">Subscription Alerts</font></th>\n";
$sToRender .= "\t\t\t</tr>\n";
for ($i = 0; $i < count($aSubscriptionAlertList); $i++) {
$sToRender .= "\t\t\t<tr>\n";
$sToRender .= "\t\t\t\t<td colspan=\"2\">" . $aSubscriptionAlertList[$i]->getAlertLink() . "</td>\n";
$sToRender .= "\t\t\t</tr>\n";
}
return $sToRender;
}
function renderDependantDocuments($aDependantDocumentList) {
global $default;
if (count($aCheckedOutDocumentList) > 0) {
$sBgColor = "#9D9D7F";
} else {
$sBgColor = "#CECEBF";
}
$sToRender = "\t\t\t<tr align=\"left\" bgcolor=\"$sBgColor\">\n";
$sToRender .= "\t\t\t\t<th class=\"sectionHeading\" colspan=\"2\"><font color=\"ffffff\">Dependant Documents</font></th>\n";
$sToRender .= "\t\t\t</tr>\n";
if (count($aDependantDocumentList) > 0) {
$sToRender .= "\t\t\t<tr>\n";
$sToRender .= "\t\t\t\t<th align=\"left\" width=\"33%\" class=\"sectionColumns\">";
$sToRender .= "Title";
$sToRender .= "</th>\n";
$sToRender .= "\t\t\t\t<th align=\"left\" width=\"66%\" class=\"sectionColumns\">";
$sToRender .= "Template document";
$sToRender .= "\t\t\t\t</th>\n";
$sToRender .= "\t\t\t</tr>\n";
}
for ($i = 0; $i < count($aDependantDocumentList); $i++) {
$oDependantDocument = $aDependantDocumentList[$i];
$oTemplateDocument = Document::get($oDependantDocument->getTemplateDocumentID());
$sToRender .= "\t\t\t<tr>\n";
$sToRender .= "\t\t\t\t<td>" . generateControllerLink("addDocument", "fFolderID=" . User::getUserRootFolderID() . "&fDependantDocumentID=" . $oDependantDocument->getID(), $oDependantDocument->getDocumentTitle()) . "</td>";
if (!($oTemplateDocument === false)) {
$sToRender .= "<td>" . generateControllerLink("viewDocument", "fDocumentID=" . $oTemplateDocument->getID(), "<img src=\"$default->graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oTemplateDocument->getName()) . "</td>\n";
} else {
$sToRender .= "<td>No template specified</td>\n";
}
$sToRender .= "\t\t\t</tr>\n";
}
return $sToRender;
}
/**
* Displays the quicklinks
*/
function renderQuickLinks($aQuickLinks) {
global $default;
$sToRender .= "\t\t\t<tr align=\"left\" bgcolor=\"#9D9D7F\">\n";
$sToRender .= "\t\t\t\t<th class=\"sectionHeading\"><font color=\"ffffff\">Quick Links</font></th>\n";
$sToRender .= "\t\t\t</tr>\n";
for ($i = 0; $i < count($aQuickLinks); $i++) {
$sToRender .= "\t\t\t<tr>\n";
$sToRender .= "\t\t\t\t<td colspan=\"2\"><a href=\"" . $aQuickLinks[$i]->getUrl() . "\" target=\"_new\"><img src=\"$default->graphicsUrl/widgets/qlink.gif\" border=\"0\"/>" . $aQuickLinks[$i]->getName() . "</a></td>\n";
$sToRender .= "\t\t\t</tr>\n";
}
return $sToRender;
}
/**
* Displays the dashboard news items
*
*/
function renderDashboardNews() {
global $default;
// retrieve all news items
$aDashboardNews = DashboardNews::getList("active=1");
$sToRender .= "\t\t\t<table border=\"0\" width=\"100%\">\n";
// the main news item
$oMainDashboardNews = $aDashboardNews[0];
if ($oMainDashboardNews) {
$sToRender .= "\t\t\t\t<tr><td><strong>" . $oMainDashboardNews->getSynopsis() . "</strong></td></tr>\n";
$sToRender .= "\t\t\t\t<tr><td>" . $oMainDashboardNews->getImageLink() . "</td></tr>\n";
$sToRender .= "\t\t\t\t<tr><td>" . $oMainDashboardNews->getBodyFragment() . "..... <a href=\"#\" onClick=\"javascript:window.open('" . generateControllerUrl("viewNewsItem", "fNewsID=" . $oMainDashboardNews->getID()) . "', 'newwindow', config='height=200,width=300,left=0,top=0, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, directories=no, status=no');return false;\">more</a></td></tr>\n";
}
// links to old news items
/*
for ($i=1; $i<count($aDashboardNews); $i++) {
$sToRender .= "\t\t\t\t<tr><td>" . generateControllerLink("viewNewsItem", "fNewsID=" . $aDashboardNews[$i]->getID(), $aDashboardNews[$i]->getSynopsis()) . "</td></tr>\n";
}
*/
$sToRender .= "\t\t\t</table>\n";
return $sToRender;
}
/**
* Renders the dashboard
*
* @param array pending collaboration documents for this user
* @param array checked out documents for this user
* @param array subscription alerts for this user
*/
function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks, $aWebDocuments, $aDependantDocuments, $aRestorationRequests) {
global $default;
$sToRender = "<table border=\"0\" width=\"600\" >\n";
$sToRender .= "\t<tr valign=\"top\">\n";
$sToRender .= "\t\t<td><img src=\"$default->graphicsUrl/welcome.gif\" border=\"0\"/></td>\n";
// some arb welcoming text goes here
$oUser = & User::get($_SESSION["userID"]);
$sUserName = $oUser->getName();
$sToRender .= "\t\t<td>Hi" . (strlen($sUserName) > 0 ? " " . $sUserName : "") . ", welcome back to the " . lookupField($default->owl_organisations_table, "name", "id", $default->organisationID) . " DMS, part of the Knowledge Tree.</td>\n";
// dashboard news
$sToRender .= "\t\t<td>\n";
$sToRender .= renderDashboardNews();
$sToRender .= "\t\t</td>\n";
$sToRender .= "\t</tr>\n";
// dashboard alerts
$sToRender .= "\t<tr>\n";
$sToRender .= "\t\t<td width=\"50%\" valign=\"top\" colspan=\"2\">\n";
$sToRender .= "\t\t\t<table border=\"0\" width=\"100%\">\n";
$sToRender .= renderPendingWebDocuments($aWebDocuments) . "\n";
$sToRender .= renderRestorationRequests($aRestorationRequests) . "\n";
$sToRender .= renderPendingCollaborationDocuments($aPendingDocumentList);
$sToRender .= renderCheckedOutDocuments($aCheckedOutDocumentList) . "\n";
$sToRender .= renderSubscriptionAlerts($aSubscriptionAlertList) . "\n";
$sToRender .= renderDependantDocuments($aDependantDocuments) . "\n";
$sToRender .= "\t\t\t</table>\n";
$sToRender .= "\t\t</td>\n";
// quick links
$sToRender .= "\t\t<td width=\"50%\" valign=top>\n";
$sToRender .= "\t\t\t<table width=\"100%\">\n";
$sToRender .= renderQuickLinks($aQuickLinks);
$sToRender .= "\t\t\t</table>\n";
$sToRender .= "\t\t</td>\n";
$sToRender .= "\t</tr>\n";
$sToRender .= "</table>\n";
return $sToRender;
}
/**
* Displays a news item
*/
function renderNewsItemPage($oDashboardNews) {
global $default;
$sToRender .= "<html>\n";
$sToRender .= "<head>\n";
$sToRender .= "<meta http-equiv=\"refresh\" content=\"" . ($default->sessionTimeout+3) . "\">\n";
$sToRender .= "<link rel=\"SHORTCUT ICON\" href=\"$default->graphicsUrl/tree.ico\">\n";
$sToRender .= "<link rel=\"stylesheet\" href=\"$default->uiUrl/stylesheet.php\">\n";
$sToRender .= "</head>\n";
$sToRender .= "<body marginleft=\"0\" marginheight=\"0\">\n";
$sToRender .= "\t\t\t<table border=\"0\" width=\"100%\">\n";
$sToRender .= "\t\t\t\t<tr><td><strong>" . $oDashboardNews->getSynopsis() . "</strong></td></tr>\n";
$sToRender .= "\t\t\t\t<tr><td>" . $oDashboardNews->getImageLink() . "</td></tr>\n";
$sToRender .= "\t\t\t\t<tr><td>" . $oDashboardNews->getBody() . "</td></tr>\n";
$sToRender .= "<tr><td><a href=\"javascript:window.close()\">close</a></td></tr>\n";
$sToRender .= "</table>";
$sToRender .= "</body>";
$sToRender .= "</html>";
return $sToRender;
}
?>