Commit 98d86a38458c7ecc7f4cbfdc1817abdd4f06be25

Authored by Michael Joseph
1 parent 340ac2af

implemented dashboard with html helper functions


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@395 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 108 additions and 158 deletions
dashboard.php
1 1 <?php
2   -/**
3   - * dashboard.php -- Main dashboard page.
4   - *
5   - * This page is presented to the user after login.
6   - * It contains a high level overview of the users subscriptions, checked out
7   - * document, pending approval routing documents, etc.
8   - *
9   - * Licensed under the GNU GPL. For full terms see the file COPYING.
10   - *
11   - * @version $Id$
12   - * @Copyright (c) 1999-2003 The Owl Project Team
13   - * @author michael@jamwarehouse.com
14   - * @package dms
15   - */
16 2  
17 3 // main library routines and defaults
18   -
19 4 require_once("./config/dmsDefaults.php");
20   -require_once("$default->owl_fs_root/lib/SiteMap.inc");
  5 +require_once("$default->owl_fs_root/presentation/DashboardUI.inc");
21 6 require_once("$default->owl_fs_root/lib/visualpatterns/PatternMainPage.inc");
22 7 require_once("$default->owl_fs_root/lib/visualpatterns/PatternImage.inc");
23 8 require_once("$default->owl_fs_root/lib/visualpatterns/PatternTableLinks.inc");
24 9 require_once("$default->owl_fs_root/lib/visualpatterns/PatternTableSqlQuery.inc");
25 10 require_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc");
26 11  
  12 +/**
  13 + * $Id$
  14 + *
  15 + * Main dashboard page -- This page is presented to the user after login.
  16 + * It contains a high level overview of the users subscriptions, checked out
  17 + * document, pending approval routing documents, etc.
  18 + *
  19 + * Licensed under the GNU GPL. For full terms see the file COPYING.
  20 + *
  21 + * @version $Revision$
  22 + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
  23 + * @package presentation
  24 + */
  25 +
27 26 // -------------------------------
28 27 // page start
29 28 // -------------------------------
30 29  
31 30 if (checkSession()) {
  31 + // create a page
32 32  
33   - // check if this page is authorised, ie. has come from control.php
34   - if ($_SESSION["authorised"]) {
35   - // create a page
36   -
37   - // logo
38   - $img = new PatternImage("$default->owl_root_url/locale/$default->owl_lang/graphics/$default->logo");
39   - $img->setImgSize(238, 178);
40   -
41   - // build the top menu of links
42   - // TODO: this is a function of the sitemap
43   - // get list of sections
44   - $aTopMenuLinks = array(generateControllerUrl("dashboard"), generateControllerUrl("browse"), generateControllerUrl("subscriptions"),
45   - generateControllerUrl("search"), generateControllerUrl("administration"), generateControllerUrl("preferences"),
46   - generateControllerUrl("help"), generateControllerUrl("logout"));
47   - $aTopMenuText = array("Dashboard", "Browse Documents", "Subscriptions", "Advanced Search", "Administration", "Preferences", "Help", "Logout");
48   - $aTopMenuImages = array("$default->owl_graphics_url/dashboard.jpg", "$default->owl_graphics_url/browse.jpg",
49   - "$default->owl_graphics_url/subscriptions.jpg", "$default->owl_graphics_url/search.jpg",
50   - "$default->owl_graphics_url/administration.jpg", "$default->owl_graphics_url/preferences.jpg",
51   - "$default->owl_graphics_url/help.jpg", "$default->owl_graphics_url/logout.jpg");
52   -
53   - $oPatternTableLinks = new PatternTableLinks($aTopMenuLinks, null, 1, 8, 2, $aTopMenuImages);
54   -
55   - $sHtml = "<table border=\"0\" width=\"100%\">
56   - <tr><td>
57   - <table width=\"100%\">
58   - <tr align=\"left\" bgcolor=\"#996600\">
59   - <th colspan=\"3\" >
60   - <span class=\"dashboardHeadings\">Pending Documents</span>
61   - </th>
62   - </tr>
63   - <tr>
64   - <th align=\"left\" width=\"33%\">
65   - Title
66   - </th>
67   - <th align=\"left\" width=\"33%\">
68   - Status
69   - </th>
70   - <th align=\"left\" width=\"33%\">
71   - Days
72   - </th>
73   - </tr>";
74   - /*
75   - $aPendingDocumentList = getPendingDocuments($_SESSION["userID"]);
76   - $sHtml = $sHtml . "<tr>";
77   - for ($i = 0; $i < count($aPendingDocumentList); $i++) {
78   - $sHtml = $sHtml . "<td>" . $aPendingDocumentList[$i].getTitle() . "</td>" .
79   - "<td>" . $aPendingDocumentList[$i].getStatus() . "</td>" .
80   - "<td>" . $aPendingDocumentList[$i].getDays() . "</td>";
81   - }
82   - $sHtml = $sHtml . "</tr>";
83   - */
84   - $sHtml = $sHtml . " <tr>
85   - <td>made up title</td>
86   - <td>bad</td>
87   - <td>5</td>
88   - </tr>";
89   -
90   - $sHtml = $sHtml . " </table>
91   - </td></tr>
92   -
93   - <tr><td width=80%>
94   - <table width=\"100%\">
95   - <tr align=\"left\" bgcolor=\"#996600\">
96   - <th colspan=2>
97   - <span class=\"dashboardHeadings\">Checked Out Documents</span>
98   - </th>
99   - </tr>
100   - <tr>
101   - <th align=\"left\" width=\"33%\">
102   - Title
103   - </th>
104   - <th align=\"left\" width=\"66%\">
105   - Days
106   - </th>
107   - </tr>";
108   - /*
109   - $aCheckedOutDocumentList = getCheckedOutDocuments($_SESSION["userID"]);
110   - for ($i = 0; $i < count($aCheckedOutDocumentList); $i++) {
111   - $sHtml = $sHtml . "<tr><td>" . $aCheckedOutDocumentList[$i] . "</td></tr>";
112   - }
113   - */
114   -
115   - $sHtml = $sHtml . " <tr>
116   - <td>another made up title</td>
117   - <td>8.473</td>
118   - </tr>";
119   -
120   - $sHtml = $sHtml . " </table>
121   - </td></tr>
122   -
123   - <tr><td>
124   - <table width=\"100%\">
125   - <tr align=\"left\" bgcolor=\"#996600\">
126   - <th colspan=\"3\">
127   - <span class=\"dashboardHeadings\">Subscriptions Alerts</span>
128   - </th>
129   - </tr>
130   - <tr>
131   - <th align=\"left\" width=\"33%\">
132   - Title
133   - </th>
134   - <th align=\"left\" width=\"33%\">
135   - Status
136   - </th>
137   - <th align=\"left\" width=\"33%\">
138   - Days
139   - </th>
140   - </tr>";
141   - /*
142   - $aSubscriptionList = getSubscriptionAlerts($_SESSION["userID"]);
143   - for ($i = 0; $i < count($aSubscriptionList); $i++) {
144   - $sHtml = $sHtml . "<tr><td>" . $aSubscriptionList[$i] . "</td></tr>";
145   - }
146   - */
147   - $sHtml = $sHtml . " <tr>
148   - <td>the last made up title</td>
149   - <td>poor to middling</td>
150   - <td>1</td>
151   - </tr>";
152   -
153   - $sHtml = $sHtml . " </table>
154   - </td></tr>
155   - </table>";
156   -
157   -
158   - $oContent = new PatternCustom();
159   - $oContent->setHtml($sHtml);
160   -
161   - /* get a page */
162   - $tmp = new PatternMainPage();
163   -
164   - /* put the page together */
165   - $tmp->setNorthWestPayload($img);
166   - $tmp->setNorthPayload($oPatternTableLinks);
167   - $tmp->setCentralPayload($oContent);
168   - $tmp->setFormAction("dashboard.php");
169   - $tmp->render();
  33 + // logo
  34 + $img = new PatternImage("$default->owl_root_url/locale/$default->owl_lang/graphics/$default->logo");
  35 + $img->setImgSize(238, 178);
  36 +
  37 + // build the top menu of links
  38 + // TODO: this is a function of the sitemap
  39 + // get list of sections
  40 + $aTopMenuLinks = array(generateControllerUrl("dashboard"), generateControllerUrl("browse"), generateControllerUrl("subscriptions"),
  41 + generateControllerUrl("search"), generateControllerUrl("administration"), generateControllerUrl("preferences"),
  42 + generateControllerUrl("documentBrowserTest"), generateControllerUrl("logout"));
  43 + $aTopMenuText = array("Dashboard", "Browse Documents", "Subscriptions", "Advanced Search", "Administration", "Preferences", "Help", "Logout");
  44 + $aTopMenuImages = array("$default->owl_graphics_url/dashboard.jpg", "$default->owl_graphics_url/browse.jpg",
  45 + "$default->owl_graphics_url/subscriptions.jpg", "$default->owl_graphics_url/search.jpg",
  46 + "$default->owl_graphics_url/administration.jpg", "$default->owl_graphics_url/preferences.jpg",
  47 + "$default->owl_graphics_url/help.jpg", "$default->owl_graphics_url/logout.jpg");
  48 +
  49 + $oPatternTableLinks = new PatternTableLinks($aTopMenuLinks, null, 1, 8, 2, $aTopMenuImages);
  50 +
  51 + $sHtml = startTable("0", "100%") .
  52 + // pending documents
  53 + startTableRowCell() .
  54 + startTable("0", "100%") .
  55 + tableRow("left", "#996600", tableHeading("sectionHeading", 3, "Pending Documents")) .
  56 + tableRow("", "", pendingDocumentsHeaders());
  57 + // FIXME: replace with the real method when its implemented
  58 + // something like:
  59 + // DocumentManager::getPendingDocuments();
  60 + $aPendingDocumentList = getPendingDocuments($_SESSION["userID"]);
  61 + for ($i = 0; $i < count($aPendingDocumentList); $i++) {
  62 + $row = tableData($aPendingDocumentList[$i]->getTitleLink()) .
  63 + tableData($aPendingDocumentList[$i]->getStatus()) .
  64 + tableData($aPendingDocumentList[$i]->getDays());
  65 + $sHtml = $sHtml . tableRow("", "", $row);
  66 + }
  67 + $sHtml = $sHtml .
  68 + stopTable() .
  69 + endTableRowCell() .
  70 + // checked out documents
  71 + startTableRowCell() .
  72 + startTable("0", "100%") .
  73 + tableRow("left", "#996600", tableHeading("sectionHeading", 2, "Checked Out Documents")) .
  74 + tableRow("", "", checkedOutDocumentsHeaders());
  75 + // FIXME: replace with the real method when its implemented
  76 + // something like:
  77 + // DocumentManager::getCheckoutDocuments();
  78 + $aCheckedOutDocumentList = getCheckedoutDocuments($_SESSION["userID"]);
  79 + for ($i = 0; $i < count($aCheckedOutDocumentList); $i++) {
  80 + $row = tableData($aCheckedOutDocumentList[$i]->getTitleLink()) .
  81 + tableData($aCheckedOutDocumentList[$i]->getDays());
  82 + $sHtml = $sHtml . tableRow("", "", $row);
  83 + }
  84 + $sHtml = $sHtml .
  85 + stopTable() .
  86 + endTableRowCell() .
  87 +
  88 + // subscription alerts
  89 + startTableRowCell() .
  90 + startTable("0", "100%") .
  91 + tableRow("left", "#996600", tableHeading("sectionHeading", 3, "Subscriptions Alerts")) .
  92 + tableRow("", "", subscriptionDocumentsHeaders());
  93 + // FIXME: replace with the real method when its implemented
  94 + // something like:
  95 + // SubscriptionManager::getAlerts();
  96 + $aSubscriptionList = getSubscriptionDocuments($_SESSION["userID"]);
  97 + for ($i = 0; $i < count($aSubscriptionList); $i++) {
  98 + $row = tableData($aSubscriptionList[$i]->getTitleLink()) .
  99 + tableData($aSubscriptionList[$i]->getStatus()) .
  100 + tableData($aSubscriptionList[$i]->getDays());
  101 + $sHtml = $sHtml . tableRow("", "", $row);
  102 + }
  103 + $sHtml = $sHtml .
  104 + stopTable() .
  105 + endTableRowCell() .
  106 +
  107 + stopTable();
  108 +
  109 + $oContent = new PatternCustom();
  110 + $oContent->setHtml($sHtml);
  111 +
  112 + /* get a page */
  113 + $tmp = new PatternMainPage();
  114 +
  115 + /* put the page together */
  116 + $tmp->setNorthWestPayload($img);
  117 + $tmp->setNorthPayload($oPatternTableLinks);
  118 + $tmp->setCentralPayload($oContent);
  119 + $tmp->setFormAction("dashboard.php");
  120 + $tmp->render();
170 121  
171   - } else {
172   - // FIXME: redirect to no permission page
173   - print "you do not have access to view this page! please go away, and come back when you do.<br>";
174   - echo generateLink("logout") . "logout</a>";
175   - }
  122 +} else {
  123 + // FIXME: redirect to no permission page
  124 + print "you do not have access to view this page! please go away, and come back when you do.<br>";
  125 + echo generateLink("logout") . "logout</a>";
176 126 }
177 127 ?>
178 128  
... ...