From a384b0a507f4552569f6d6528994ba8755173dad Mon Sep 17 00:00:00 2001 From: Michael Joseph Date: Mon, 10 Mar 2003 14:53:10 +0000 Subject: [PATCH] integrated pending web documents into dashboard --- presentation/lookAndFeel/knowledgeTree/dashboardBL.php | 27 ++++++++++++++++++++++++++- presentation/lookAndFeel/knowledgeTree/dashboardUI.inc | 29 ++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/presentation/lookAndFeel/knowledgeTree/dashboardBL.php b/presentation/lookAndFeel/knowledgeTree/dashboardBL.php index b66fb91..aac2379 100644 --- a/presentation/lookAndFeel/knowledgeTree/dashboardBL.php +++ b/presentation/lookAndFeel/knowledgeTree/dashboardBL.php @@ -3,6 +3,7 @@ // main library routines and defaults require_once("../../../config/dmsDefaults.php"); require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionManager.inc"); +require_once("$default->fileSystemRoot/lib/web/WebDocument.inc"); require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); require_once("$default->fileSystemRoot/lib/links/link.inc"); require_once("$default->uiDirectory/dashboardUI.inc"); @@ -44,6 +45,27 @@ function getPendingCollaborationDocuments($iUserID) { return $aDocumentList; } +/** + * Retrieves the web documents that the current user has pending + * + * @param integer the user to retrieve pending web documents for + */ +function getPendingWebDocuments($iUserID) { + // TODO: move this to a more logical class/file + global $default; + $sQuery = "SELECT wd.id FROM web_documents wd " . + "INNER JOIN web_sites ws ON wd.web_site_id = ws.id " . + "WHERE ws.web_master_id=$iUserID AND wd.status_id=1"; + $aDocumentList = array(); + $sql = $default->db; + if ($sql->query($sQuery)) { + while ($sql->next_record()) { + $aDocumentList[] = & WebDocument::get($sql->f("id")); + } + } + return $aDocumentList; +} + if (checkSession()) { // include the page template (with navbar) require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); @@ -62,8 +84,11 @@ if (checkSession()) { // retrieve quicklinks $aQuickLinks = Link::getList(); + // retrieve pending web documents + $aPendingWebDocuments = getPendingWebDocuments($_SESSION["userID"]); + // generate the html - $oContent->setHtml(renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks)); + $oContent->setHtml(renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks, $aPendingWebDocuments)); // display $main->setCentralPayload($oContent); diff --git a/presentation/lookAndFeel/knowledgeTree/dashboardUI.inc b/presentation/lookAndFeel/knowledgeTree/dashboardUI.inc index 781d69e..7de7dd9 100644 --- a/presentation/lookAndFeel/knowledgeTree/dashboardUI.inc +++ b/presentation/lookAndFeel/knowledgeTree/dashboardUI.inc @@ -14,6 +14,32 @@ require_once("$default->fileSystemRoot/lib/users/User.inc"); * @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\n"; + + $sToRender .= "\t\tPending Web Documents\n"; + $sToRender .= "\t\n"; + for ($i = 0; $i < count($aPendingDocumentList); $i++) { + $oWebDocument = $aPendingDocumentList[$i]; + $sToRender .= "\t\n"; + $sToRender .= "" . generateControllerLink("webDocument", "fWebDocumentID=" . $oWebDocument->getID(), "graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oWebDocument->getDisplayPath()) . "\n"; + $sToRender .= "\t\n"; + } + return $sToRender; + } else { + return ""; + } +} + /** * Displays the pending collaboration documents * @@ -123,7 +149,7 @@ function renderQuickLinks($aQuickLinks) { * @param array checked out documents for this user * @param array subscription alerts for this user */ -function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks) { +function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks, $aWebDocuments) { global $default; $sToRender = "\n"; @@ -140,6 +166,7 @@ function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscript $sToRender .= "\t\n"; $sToRender .= "\t\t
\n"; $sToRender .= "\t\t\t\n"; + $sToRender .= renderPendingWebDocuments($aWebDocuments) . "\n"; $sToRender .= renderPendingCollaborationDocuments($aPendingDocumentList); $sToRender .= renderCheckedOutDocuments($aCheckedOutDocumentList) . "\n"; $sToRender .= renderSubscriptionAlerts($aSubscriptionAlertList) . "\n"; -- libgit2 0.21.4