dashboardUI.inc
6.06 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
<?php
require_once("$default->fileSystemRoot/presentation/Html.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
*/
/**
* just a tmp document forging class
*/
class tmpDocument {
var $title;
var $id;
var $status;
var $days;
var $statuses = array("good", "bad", "indifferent");
/**
* generate random attribute data on instantiation
*/
function tmpDocument() {
// initialise the random number generator
srand ((float) microtime() * 10000000);
// generate a random document title
$number = rand(0,500);
$this->title = "document title $number";
$this->id = $number;
// generate a random status
$this->status = $this->statuses[array_rand($this->statuses, 1)];
// random days
$this->days = rand(0,25);
}
function getTitleLink() {
/*
return "<a href=\"control.php?action=viewDocument&fDocumentID=" . $this->id . "\">" .
$this->title . "</a>";
*/
return "<u>$this->title</u>";
}
function getStatus() {
return $this->status;
}
function getDays() {
return $this->days;
}
}
function getPendingDocuments() {
// generate random document objects and return
return array(new tmpDocument(), new tmpDocument(), new tmpDocument());
}
function getCheckedoutDocuments() {
// generate random document objects and return
return array(new tmpDocument(), new tmpDocument(), new tmpDocument());
}
function getSubscriptionDocuments() {
/*
global $default;
$sQuery = "SELECT D.name, D.modified, DTT.datetime AS created, U.name AS initiator, CONCAT(CONCAT(D.major_version, '.'), D.minor_version) AS version, WDSL.name AS status " .
"FROM $default->owl_documents_table AS D INNER JOIN $default->owl_web_documents_table AS WD ON WD.document_id = D.ID " .
"INNER JOIN $default->owl_web_documents_status_table AS WDSL ON WD.status_id = WDSL.id " .
"INNER JOIN $default->owl_users_table AS U ON U.id = D.creator_id " .
"INNER JOIN $default->owl_document_transactions_table AS DTT ON DTT.document_id = D.id " .
"INNER JOIN $default->owl_transaction_types_table AS TT ON DTT.transaction_id = TT.id " .
"WHERE D.id = " . $oDocument->getID() . " " .
"AND TT.name LIKE 'Create'";
$aColumns = array("name", "last_modified", "created", "initiator", "version", "status");
$aColumnNames = array("Document title", "Last updated", "Created", "Document initiator", "Version", "Status");
$aColumnTypes = array(1,1,1,1,1);
$oPatternListFromQuery = & new PatternListFromQuery($sQuery, $aColumns, $aColumnNames, $aColumnTypes);
$oPatternListFromQuery->setTableHeading("Document Data");
$oPatternListFromQuery->setTableWidth("90%");
return $oPatternListFromQuery->render();
*/
// you know the drill
return array(new tmpDocument(), new tmpDocument(), new tmpDocument());
}
function pendingDocumentsHeaders() {
return "<th align=\"left\" width=\"33%\" class=\"sectionColumns\">
Title
</th>
<th align=\"left\" width=\"33%\" class=\"sectionColumns\">
Status
</th>
<th align=\"left\" width=\"33%\" class=\"sectionColumns\">
Days
</th>";
}
function checkedOutDocumentsHeaders() {
return "<th align=\"left\" width=\"33%\" class=\"sectionColumns\">
Title
</th>
<th align=\"left\" width=\"66%\" class=\"sectionColumns\">
Days
</th>";
}
function subscriptionDocumentsHeaders() {
return "<th align=\"left\" width=\"33%\" class=\"sectionColumns\">
Title
</th>
<th align=\"left\" width=\"33%\" class=\"sectionColumns\">
Status
</th>
<th align=\"left\" width=\"33%\" class=\"sectionColumns\">
Days
</th>";
}
function getPage() {
$sToRender = renderDocumentPath($oDocument) . "\n<br>\n";
$sToRender .= "<table border = 0>\n";
$sToRender .= "<tr>\n";
$sToRender .= "<td>\n";
$sToRender .= "\t<table border = 0 width = 280>\n";
$sToRender .= "\t<tr width>\n";
$sToRender .= "\t\t<td>" . wrapInTable(renderDocumentData($oDocument)) . "</td>\n";
//$sToRender .= "\t\t<td>" . renderGenericDocumentMetaData($oDocument) . "</td>\n";
$sToRender .= "\t</tr>\n";
$sToRender .= "\t<tr>\n";
$sToRender .= "\t<td>" . wrapInTable(renderGenericMetaData($oDocument)) . "</td>\n";
$sToRender .= "\t<tr>\n";
$sToRender .= "\t<tr>\n";
$sToRender .= "\t\t<td>" . wrapInTable(renderTypeSpecificMetaData($oDocument)) . "</td>\n";
//$sToRender .= "\t\t<td>" . renderTypeSpecificMetaData($oDocument) . "</td>\n";
$sToRender .= "\t</tr>\n";
$sToRender .= "\t</table>\n";
$sToRender .= "</td>\n";
$sToRender .= "<td valign=top>\n";
$sToRender .= "\t<table border = 0, width = 230>\n";
$sToRender .= "\t<tr>\n";
$sToRender .= "\t\t<td>" . wrapInTable(renderNonEditableDocumentRouting($oDocument)) . "</td>\n";
//$sToRender .= "\t\t<td>" . renderDocumentRouting($oDocument) . "</td>\n";
$sToRender .= "\t</tr>";
$sToRender .= "\t</table>";
$sToRender .= "</td>\n";
$sToRender .= "</tr>\n";
$sToRender .= "</table>";
$sToRender .= "<table>\n";
$sToRender .= "<tr>\n";
$sToRender .= "<td><a href=\"" . $_SERVER["PHP_SELF"] . "?fDocumentID=" . $oDocument->getID() . "&fForDownload=1\"><img src=\"$default->graphicsUrl/widgets/download.gif\" border=\"0\" /></a></td>\n";
$sToRender .= "<td><a href=\"" . generateControllerLink("emailDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/email.gif\" border=\"0\" /></a></td>\n";
$sToRender .= "</tr>\n";
$sToRender .= "</table>\n";
}
?>