Commit a384b0a507f4552569f6d6528994ba8755173dad
1 parent
2b1f9c04
integrated pending web documents into dashboard
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1474 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
54 additions
and
2 deletions
presentation/lookAndFeel/knowledgeTree/dashboardBL.php
| ... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 | // main library routines and defaults |
| 4 | 4 | require_once("../../../config/dmsDefaults.php"); |
| 5 | 5 | require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionManager.inc"); |
| 6 | +require_once("$default->fileSystemRoot/lib/web/WebDocument.inc"); | |
| 6 | 7 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); |
| 7 | 8 | require_once("$default->fileSystemRoot/lib/links/link.inc"); |
| 8 | 9 | require_once("$default->uiDirectory/dashboardUI.inc"); |
| ... | ... | @@ -44,6 +45,27 @@ function getPendingCollaborationDocuments($iUserID) { |
| 44 | 45 | return $aDocumentList; |
| 45 | 46 | } |
| 46 | 47 | |
| 48 | +/** | |
| 49 | + * Retrieves the web documents that the current user has pending | |
| 50 | + * | |
| 51 | + * @param integer the user to retrieve pending web documents for | |
| 52 | + */ | |
| 53 | +function getPendingWebDocuments($iUserID) { | |
| 54 | + // TODO: move this to a more logical class/file | |
| 55 | + global $default; | |
| 56 | + $sQuery = "SELECT wd.id FROM web_documents wd " . | |
| 57 | + "INNER JOIN web_sites ws ON wd.web_site_id = ws.id " . | |
| 58 | + "WHERE ws.web_master_id=$iUserID AND wd.status_id=1"; | |
| 59 | + $aDocumentList = array(); | |
| 60 | + $sql = $default->db; | |
| 61 | + if ($sql->query($sQuery)) { | |
| 62 | + while ($sql->next_record()) { | |
| 63 | + $aDocumentList[] = & WebDocument::get($sql->f("id")); | |
| 64 | + } | |
| 65 | + } | |
| 66 | + return $aDocumentList; | |
| 67 | +} | |
| 68 | + | |
| 47 | 69 | if (checkSession()) { |
| 48 | 70 | // include the page template (with navbar) |
| 49 | 71 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| ... | ... | @@ -62,8 +84,11 @@ if (checkSession()) { |
| 62 | 84 | // retrieve quicklinks |
| 63 | 85 | $aQuickLinks = Link::getList(); |
| 64 | 86 | |
| 87 | + // retrieve pending web documents | |
| 88 | + $aPendingWebDocuments = getPendingWebDocuments($_SESSION["userID"]); | |
| 89 | + | |
| 65 | 90 | // generate the html |
| 66 | - $oContent->setHtml(renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks)); | |
| 91 | + $oContent->setHtml(renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks, $aPendingWebDocuments)); | |
| 67 | 92 | |
| 68 | 93 | // display |
| 69 | 94 | $main->setCentralPayload($oContent); | ... | ... |
presentation/lookAndFeel/knowledgeTree/dashboardUI.inc
| ... | ... | @@ -14,6 +14,32 @@ require_once("$default->fileSystemRoot/lib/users/User.inc"); |
| 14 | 14 | * @package presentation |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | + /** | |
| 18 | + * Displays the pending web documents | |
| 19 | + * | |
| 20 | + * @param array of pending web documents | |
| 21 | + */ | |
| 22 | +function renderPendingWebDocuments($aPendingDocumentList) { | |
| 23 | + global $default; | |
| 24 | + | |
| 25 | + if (count($aPendingDocumentList) > 0) { | |
| 26 | + $sBgColor = "#9D9D7F"; | |
| 27 | + $sToRender = "\t<tr align=\"left\" bgcolor=\"$sBgColor\">\n"; | |
| 28 | + | |
| 29 | + $sToRender .= "\t\t<th class=\"sectionHeading\" colspan=\"2\">Pending Web Documents</th>\n"; | |
| 30 | + $sToRender .= "\t</tr>\n"; | |
| 31 | + for ($i = 0; $i < count($aPendingDocumentList); $i++) { | |
| 32 | + $oWebDocument = $aPendingDocumentList[$i]; | |
| 33 | + $sToRender .= "\t<tr>\n"; | |
| 34 | + $sToRender .= "<td colspan=\"2\">" . generateControllerLink("webDocument", "fWebDocumentID=" . $oWebDocument->getID(), "<img src=\"$default->graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oWebDocument->getDisplayPath()) . "</td>\n"; | |
| 35 | + $sToRender .= "\t</tr>\n"; | |
| 36 | + } | |
| 37 | + return $sToRender; | |
| 38 | + } else { | |
| 39 | + return ""; | |
| 40 | + } | |
| 41 | +} | |
| 42 | + | |
| 17 | 43 | /** |
| 18 | 44 | * Displays the pending collaboration documents |
| 19 | 45 | * |
| ... | ... | @@ -123,7 +149,7 @@ function renderQuickLinks($aQuickLinks) { |
| 123 | 149 | * @param array checked out documents for this user |
| 124 | 150 | * @param array subscription alerts for this user |
| 125 | 151 | */ |
| 126 | -function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks) { | |
| 152 | +function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks, $aWebDocuments) { | |
| 127 | 153 | global $default; |
| 128 | 154 | |
| 129 | 155 | $sToRender = "<table border=\"0\" width=\"600\" >\n"; |
| ... | ... | @@ -140,6 +166,7 @@ function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscript |
| 140 | 166 | $sToRender .= "\t<tr>\n"; |
| 141 | 167 | $sToRender .= "\t\t<td width=\"50%\" valign=\"top\" colspan=2>\n"; |
| 142 | 168 | $sToRender .= "\t\t\t<table border=\"0\" width=\"100%\">\n"; |
| 169 | + $sToRender .= renderPendingWebDocuments($aWebDocuments) . "\n"; | |
| 143 | 170 | $sToRender .= renderPendingCollaborationDocuments($aPendingDocumentList); |
| 144 | 171 | $sToRender .= renderCheckedOutDocuments($aCheckedOutDocumentList) . "\n"; |
| 145 | 172 | $sToRender .= renderSubscriptionAlerts($aSubscriptionAlertList) . "\n"; | ... | ... |