Commit fa9352ea03c34fa0cdb984caec6b239416a29cba
1 parent
1e27d772
completed dashboard integration
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1218 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
72 additions
and
104 deletions
presentation/lookAndFeel/knowledgeTree/dashboardBL.php
| @@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
| 4 | require_once("../../../config/dmsDefaults.php"); | 4 | require_once("../../../config/dmsDefaults.php"); |
| 5 | require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionManager.inc"); | 5 | require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionManager.inc"); |
| 6 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | 6 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); |
| 7 | +require_once("$default->fileSystemRoot/lib/links/link.inc"); | ||
| 7 | require_once("$default->uiDirectory/dashboardUI.inc"); | 8 | require_once("$default->uiDirectory/dashboardUI.inc"); |
| 8 | 9 | ||
| 9 | /** | 10 | /** |
| @@ -24,6 +25,24 @@ require_once("$default->uiDirectory/dashboardUI.inc"); | @@ -24,6 +25,24 @@ require_once("$default->uiDirectory/dashboardUI.inc"); | ||
| 24 | // page start | 25 | // page start |
| 25 | // ------------------------------- | 26 | // ------------------------------- |
| 26 | 27 | ||
| 28 | +/** | ||
| 29 | + * Retrieves the collaboration documents that the current user has pending | ||
| 30 | + * | ||
| 31 | + * @param integer the user to retrieve pending collaboration documents for | ||
| 32 | + */ | ||
| 33 | +function getPendingCollaborationDocuments($iUserID) { | ||
| 34 | + // TODO: move this to a more logical class/file | ||
| 35 | + global $default; | ||
| 36 | + $sQuery = "SELECT document_id FROM $default->owl_folders_user_roles_table WHERE active=1 AND user_id=" . $_SESSION["userID"]; | ||
| 37 | + $aDocumentList = array(); | ||
| 38 | + if ($default->db->query($sQuery)) { | ||
| 39 | + while ($default->db->next_record()) { | ||
| 40 | + $aDocumentList[] = & Document::get($default->db->f("id")); | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + return $aDocumentList; | ||
| 44 | +} | ||
| 45 | + | ||
| 27 | if (checkSession()) { | 46 | if (checkSession()) { |
| 28 | // include the page template (with navbar) | 47 | // include the page template (with navbar) |
| 29 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | 48 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| @@ -32,14 +51,18 @@ if (checkSession()) { | @@ -32,14 +51,18 @@ if (checkSession()) { | ||
| 32 | $oContent = new PatternCustom(); | 51 | $oContent = new PatternCustom(); |
| 33 | 52 | ||
| 34 | // retrieve collaboration pending documents for this user | 53 | // retrieve collaboration pending documents for this user |
| 35 | - $aPendingDocumentList = getPendingDocuments($_SESSION["userID"]); | 54 | + $aPendingDocumentList = getPendingCollaborationDocuments($_SESSION["userID"]); |
| 36 | // retrieve checked out documents for this user | 55 | // retrieve checked out documents for this user |
| 37 | - $aCheckedOutDocumentList = getCheckedoutDocuments($_SESSION["userID"]); | 56 | + $aCheckedOutDocumentList = Document::getList("checked_out_user_id=" . $_SESSION["userID"]); |
| 57 | + | ||
| 38 | // retrieve subscription alerts for this user | 58 | // retrieve subscription alerts for this user |
| 39 | $aSubscriptionAlertList = SubscriptionManager::listSubscriptionAlerts($_SESSION["userID"]); | 59 | $aSubscriptionAlertList = SubscriptionManager::listSubscriptionAlerts($_SESSION["userID"]); |
| 40 | 60 | ||
| 61 | + // retrieve quicklinks | ||
| 62 | + $aQuickLinks = Link::getList(); | ||
| 63 | + | ||
| 41 | // generate the html | 64 | // generate the html |
| 42 | - $oContent->setHtml(renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList)); | 65 | + $oContent->setHtml(renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks)); |
| 43 | 66 | ||
| 44 | // display | 67 | // display |
| 45 | $main->setCentralPayload($oContent); | 68 | $main->setCentralPayload($oContent); |
presentation/lookAndFeel/knowledgeTree/dashboardUI.inc
| @@ -15,107 +15,37 @@ require_once("$default->fileSystemRoot/lib/users/User.inc"); | @@ -15,107 +15,37 @@ require_once("$default->fileSystemRoot/lib/users/User.inc"); | ||
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | /** | 17 | /** |
| 18 | - * just a tmp document forging class | 18 | + * Displays the pending collaboration documents |
| 19 | + * | ||
| 20 | + * @param array of pending collaboration documents | ||
| 19 | */ | 21 | */ |
| 20 | -class tmpDocument { | ||
| 21 | - | ||
| 22 | - var $title; | ||
| 23 | - var $id; | ||
| 24 | - var $status; | ||
| 25 | - var $days; | ||
| 26 | - var $statuses = array("good", "bad", "indifferent"); | ||
| 27 | - | ||
| 28 | - /** | ||
| 29 | - * generate random attribute data on instantiation | ||
| 30 | - */ | ||
| 31 | - function tmpDocument() { | ||
| 32 | - // initialise the random number generator | ||
| 33 | - srand ((float) microtime() * 10000000); | ||
| 34 | - | ||
| 35 | - // generate a random document title | ||
| 36 | - $number = rand(0,500); | ||
| 37 | - $this->title = "document title $number"; | ||
| 38 | - $this->id = $number; | ||
| 39 | - | ||
| 40 | - // generate a random status | ||
| 41 | - $this->status = $this->statuses[array_rand($this->statuses, 1)]; | ||
| 42 | - | ||
| 43 | - // random days | ||
| 44 | - $this->days = rand(0,25); | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | - function getTitleLink() { | ||
| 48 | - /* | ||
| 49 | - return "<a href=\"control.php?action=viewDocument&fDocumentID=" . $this->id . "\">" . | ||
| 50 | - $this->title . "</a>"; | ||
| 51 | - */ | ||
| 52 | - return "<u>$this->title</u>"; | ||
| 53 | - | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - function getStatus() { | ||
| 57 | - return $this->status; | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | - function getDays() { | ||
| 61 | - return $this->days; | ||
| 62 | - } | ||
| 63 | -} | ||
| 64 | - | ||
| 65 | -function getPendingDocuments() { | ||
| 66 | - // generate random document objects and return | ||
| 67 | - return array(new tmpDocument(), new tmpDocument(), new tmpDocument()); | ||
| 68 | -} | ||
| 69 | - | ||
| 70 | -function getCheckedoutDocuments() { | ||
| 71 | - // generate random document objects and return | ||
| 72 | - return array(new tmpDocument(), new tmpDocument(), new tmpDocument()); | ||
| 73 | -} | ||
| 74 | - | ||
| 75 | -function getSubscriptionDocuments() { | ||
| 76 | - /* | ||
| 77 | - global $default; | ||
| 78 | - $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 " . | ||
| 79 | - "FROM $default->owl_documents_table AS D INNER JOIN $default->owl_web_documents_table AS WD ON WD.document_id = D.ID " . | ||
| 80 | - "INNER JOIN $default->owl_web_documents_status_table AS WDSL ON WD.status_id = WDSL.id " . | ||
| 81 | - "INNER JOIN $default->owl_users_table AS U ON U.id = D.creator_id " . | ||
| 82 | - "INNER JOIN $default->owl_document_transactions_table AS DTT ON DTT.document_id = D.id " . | ||
| 83 | - "INNER JOIN $default->owl_transaction_types_table AS TT ON DTT.transaction_id = TT.id " . | ||
| 84 | - "WHERE D.id = " . $oDocument->getID() . " " . | ||
| 85 | - "AND TT.name LIKE 'Create'"; | ||
| 86 | - | ||
| 87 | - $aColumns = array("name", "last_modified", "created", "initiator", "version", "status"); | ||
| 88 | - $aColumnNames = array("Document title", "Last updated", "Created", "Document initiator", "Version", "Status"); | ||
| 89 | - $aColumnTypes = array(1,1,1,1,1); | ||
| 90 | - $oPatternListFromQuery = & new PatternListFromQuery($sQuery, $aColumns, $aColumnNames, $aColumnTypes); | ||
| 91 | - $oPatternListFromQuery->setTableHeading("Document Data"); | ||
| 92 | - $oPatternListFromQuery->setTableWidth("90%"); | ||
| 93 | - return $oPatternListFromQuery->render(); | ||
| 94 | - */ | ||
| 95 | - | ||
| 96 | - // you know the drill | ||
| 97 | - return array(new tmpDocument(), new tmpDocument(), new tmpDocument()); | ||
| 98 | -} | ||
| 99 | - | ||
| 100 | -function renderPendingDocuments($aPendingDocumentList) { | 22 | +function renderPendingCollaborationDocuments($aPendingDocumentList) { |
| 101 | $sToRender = "\t<tr align=\"left\" bgcolor=\"#996600\">\n"; | 23 | $sToRender = "\t<tr align=\"left\" bgcolor=\"#996600\">\n"; |
| 102 | - $sToRender .= "\t\t<th class=\"sectionHeading\" colspan=\"3\">Pending Documents</th>\n"; | 24 | + $sToRender .= "\t\t<th class=\"sectionHeading\" colspan=\"2\">Pending Documents</th>\n"; |
| 103 | $sToRender .= "\t</tr>\n"; | 25 | $sToRender .= "\t</tr>\n"; |
| 104 | for ($i = 0; $i < count($aPendingDocumentList); $i++) { | 26 | for ($i = 0; $i < count($aPendingDocumentList); $i++) { |
| 27 | + $oDocument = $aPendingDocumentList[$i]; | ||
| 105 | $sToRender .= "\t<tr>\n"; | 28 | $sToRender .= "\t<tr>\n"; |
| 106 | - $sToRender .= "<td>" . $aPendingDocumentList[$i]->getTitleLink() . "</td>\n"; | 29 | + //$sToRender .= "<td nowrap >" . $aPendingDocumentList[$i]->getTitleLink() . "</td>\n"; |
| 30 | + $sToRender .= "<td nowrap colspan=\"2\">" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), $oDocument->getDisplayPath()) . "</td>\n"; | ||
| 107 | $sToRender .= "\t</tr>\n"; | 31 | $sToRender .= "\t</tr>\n"; |
| 108 | } | 32 | } |
| 109 | return $sToRender; | 33 | return $sToRender; |
| 110 | } | 34 | } |
| 111 | 35 | ||
| 36 | +/** | ||
| 37 | + * Displays the checked out documents | ||
| 38 | + * | ||
| 39 | + * @param array of checked out documents | ||
| 40 | + */ | ||
| 112 | function renderCheckedOutDocuments($aCheckedOutDocumentList) { | 41 | function renderCheckedOutDocuments($aCheckedOutDocumentList) { |
| 42 | + global $default; | ||
| 113 | $sToRender = "\t<tr align=\"left\" bgcolor=\"#996600\">\n"; | 43 | $sToRender = "\t<tr align=\"left\" bgcolor=\"#996600\">\n"; |
| 114 | - $sToRender .= "\t\t<th class=\"sectionHeading\" colspan=\"3\">Checked Out Documents</th>\n"; | 44 | + $sToRender .= "\t\t<th class=\"sectionHeading\" colspan=\"2\">Checked Out Documents</th>\n"; |
| 115 | $sToRender .= "\t</tr>\n"; | 45 | $sToRender .= "\t</tr>\n"; |
| 116 | 46 | ||
| 117 | $sToRender .= "\t<tr>\n"; | 47 | $sToRender .= "\t<tr>\n"; |
| 118 | - $sToRender .= "<th align=\"left\" width=\"66%\" class=\"sectionColumns\" colspan=\"2\">\n"; | 48 | + $sToRender .= "<th align=\"left\" width=\"66%\" class=\"sectionColumns\">\n"; |
| 119 | $sToRender .= "Title\n"; | 49 | $sToRender .= "Title\n"; |
| 120 | $sToRender .= "</th>\n"; | 50 | $sToRender .= "</th>\n"; |
| 121 | $sToRender .= "<th align=\"left\" width=\"33%\" class=\"sectionColumns\">\n"; | 51 | $sToRender .= "<th align=\"left\" width=\"33%\" class=\"sectionColumns\">\n"; |
| @@ -124,27 +54,47 @@ function renderCheckedOutDocuments($aCheckedOutDocumentList) { | @@ -124,27 +54,47 @@ function renderCheckedOutDocuments($aCheckedOutDocumentList) { | ||
| 124 | $sToRender .= "\t\t</tr>\n"; | 54 | $sToRender .= "\t\t</tr>\n"; |
| 125 | 55 | ||
| 126 | for ($i = 0; $i < count($aCheckedOutDocumentList); $i++) { | 56 | for ($i = 0; $i < count($aCheckedOutDocumentList); $i++) { |
| 57 | + $oDocument = $aCheckedOutDocumentList[$i]; | ||
| 127 | $sToRender .= "\t<tr>\n"; | 58 | $sToRender .= "\t<tr>\n"; |
| 128 | - $sToRender .= "<td colspan=\"2\">" . $aCheckedOutDocumentList[$i]->getTitleLink() . "</td>\n"; | ||
| 129 | - $sToRender .= "<td>" . $aCheckedOutDocumentList[$i]->getDays() . "</td>\n"; | 59 | + $sToRender .= "<td nowrap>" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), "<img src=\"$default->graphicsUrl/widgets/dstatus.gif\" border=\"0\"/>" . $oDocument->getDisplayPath()) . "</td>\n"; |
| 60 | + $sToRender .= "<td>" . $oDocument->getDaysSinceLastModified() . "</td>\n"; | ||
| 130 | $sToRender .= "\t</tr>\n"; | 61 | $sToRender .= "\t</tr>\n"; |
| 131 | - } | 62 | + } |
| 132 | return $sToRender; | 63 | return $sToRender; |
| 133 | } | 64 | } |
| 134 | 65 | ||
| 66 | +/** | ||
| 67 | + * Displays the subscription alerts | ||
| 68 | + * | ||
| 69 | + * @param array of subscription alerts | ||
| 70 | + */ | ||
| 135 | function renderSubscriptionAlerts($aSubscriptionAlertList) { | 71 | function renderSubscriptionAlerts($aSubscriptionAlertList) { |
| 72 | + global $default; | ||
| 136 | $sToRender = "\t<tr align=\"left\" bgcolor=\"#996600\">\n"; | 73 | $sToRender = "\t<tr align=\"left\" bgcolor=\"#996600\">\n"; |
| 137 | - $sToRender .= "\t\t<th class=\"sectionHeading\" colspan=\"3\">Subscription Alerts</th>\n"; | 74 | + $sToRender .= "\t\t<th class=\"sectionHeading\" colspan=\"2\">Subscription Alerts</th>\n"; |
| 138 | $sToRender .= "\t</tr>\n"; | 75 | $sToRender .= "\t</tr>\n"; |
| 139 | for ($i = 0; $i < count($aSubscriptionAlertList); $i++) { | 76 | for ($i = 0; $i < count($aSubscriptionAlertList); $i++) { |
| 140 | $sToRender .= "\t<tr>\n"; | 77 | $sToRender .= "\t<tr>\n"; |
| 141 | - $sToRender .= "<td colspan=\"3\">" . $aSubscriptionAlertList[$i]->getAlertLink() . "</td>\n"; | 78 | + $sToRender .= "<td nowrap colspan=\"2\">" . $aSubscriptionAlertList[$i]->getAlertLink() . "</td>\n"; |
| 142 | $sToRender .= "\t</tr>\n"; | 79 | $sToRender .= "\t</tr>\n"; |
| 143 | } | 80 | } |
| 144 | return $sToRender; | 81 | return $sToRender; |
| 145 | } | 82 | } |
| 146 | 83 | ||
| 147 | -function quickLinkHeaders() { | 84 | +/** |
| 85 | + * Displays the quicklinks | ||
| 86 | + */ | ||
| 87 | +function renderQuickLinks($aQuickLinks) { | ||
| 88 | + global $default; | ||
| 89 | + $sToRender .= "\t<tr align=\"left\" bgcolor=\"#996600\">\n"; | ||
| 90 | + $sToRender .= "\t\t<th class=\"sectionHeading\">Quick Links</th>\n"; | ||
| 91 | + $sToRender .= "\t</tr>\n"; | ||
| 92 | + for ($i = 0; $i < count($aQuickLinks); $i++) { | ||
| 93 | + $sToRender .= "\t<tr>\n"; | ||
| 94 | + $sToRender .= "<td nowrap colspan=\"2\"><a href=\"" . $aQuickLinks[$i]->getUrl() . "\" target=\"_new\"><img src=\"$default->graphicsUrl/widgets/qlink.gif\" border=\"0\"/>" . $aQuickLinks[$i]->getName() . "</a></td>\n"; | ||
| 95 | + $sToRender .= "\t</tr>\n"; | ||
| 96 | + } | ||
| 97 | + return $sToRender; | ||
| 148 | } | 98 | } |
| 149 | 99 | ||
| 150 | /** | 100 | /** |
| @@ -154,7 +104,7 @@ function quickLinkHeaders() { | @@ -154,7 +104,7 @@ function quickLinkHeaders() { | ||
| 154 | * @param array checked out documents for this user | 104 | * @param array checked out documents for this user |
| 155 | * @param array subscription alerts for this user | 105 | * @param array subscription alerts for this user |
| 156 | */ | 106 | */ |
| 157 | -function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList) { | 107 | +function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks) { |
| 158 | global $default; | 108 | global $default; |
| 159 | 109 | ||
| 160 | $sToRender = "<table border=\"0\" width=\"600\" >\n"; | 110 | $sToRender = "<table border=\"0\" width=\"600\" >\n"; |
| @@ -169,8 +119,8 @@ function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscript | @@ -169,8 +119,8 @@ function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscript | ||
| 169 | // dashboard alerts | 119 | // dashboard alerts |
| 170 | $sToRender .= "\t<tr>\n"; | 120 | $sToRender .= "\t<tr>\n"; |
| 171 | $sToRender .= "\t\t<td width=\"50%\">\n"; | 121 | $sToRender .= "\t\t<td width=\"50%\">\n"; |
| 172 | - $sToRender .= "\t\t\t<table width=\"100%\">\n"; | ||
| 173 | - $sToRender .= renderPendingDocuments($aPendingDocumentList); | 122 | + $sToRender .= "\t\t\t<table border=\"0\" width=\"100%\">\n"; |
| 123 | + $sToRender .= renderPendingCollaborationDocuments($aPendingDocumentList); | ||
| 174 | $sToRender .= renderCheckedOutDocuments($aCheckedOutDocumentList) . "\n"; | 124 | $sToRender .= renderCheckedOutDocuments($aCheckedOutDocumentList) . "\n"; |
| 175 | $sToRender .= renderSubscriptionAlerts($aSubscriptionAlertList) . "\n"; | 125 | $sToRender .= renderSubscriptionAlerts($aSubscriptionAlertList) . "\n"; |
| 176 | $sToRender .= "\t\t\t</table>\n"; | 126 | $sToRender .= "\t\t\t</table>\n"; |
| @@ -179,12 +129,7 @@ function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscript | @@ -179,12 +129,7 @@ function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscript | ||
| 179 | // quick links | 129 | // quick links |
| 180 | $sToRender .= "\t\t<td width=\"50%\" valign=top>\n"; | 130 | $sToRender .= "\t\t<td width=\"50%\" valign=top>\n"; |
| 181 | $sToRender .= "\t\t\t<table width=\"100%\">\n"; | 131 | $sToRender .= "\t\t\t<table width=\"100%\">\n"; |
| 182 | - $sToRender .= "\t<tr align=\"left\" bgcolor=\"#996600\">\n"; | ||
| 183 | - $sToRender .= "\t\t<th class=\"sectionHeading\">Quick Links</th>\n"; | ||
| 184 | - $sToRender .= "\t</tr>\n"; | ||
| 185 | - $sToRender .= "\t<tr>\n"; | ||
| 186 | - $sToRender .= quickLinkHeaders(); | ||
| 187 | - $sToRender .= "\t</tr>\n"; | 132 | + $sToRender .= renderQuickLinks($aQuickLinks); |
| 188 | $sToRender .= "\t\t\t</table>\n"; | 133 | $sToRender .= "\t\t\t</table>\n"; |
| 189 | 134 | ||
| 190 | $sToRender .= "\t\t</td>\n"; | 135 | $sToRender .= "\t\t</td>\n"; |