diff --git a/presentation/lookAndFeel/knowledgeTree/dashboardBL.php b/presentation/lookAndFeel/knowledgeTree/dashboardBL.php
index 43060a8..4784c46 100644
--- a/presentation/lookAndFeel/knowledgeTree/dashboardBL.php
+++ b/presentation/lookAndFeel/knowledgeTree/dashboardBL.php
@@ -4,6 +4,7 @@
require_once("../../../config/dmsDefaults.php");
require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionManager.inc");
require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
+require_once("$default->fileSystemRoot/lib/links/link.inc");
require_once("$default->uiDirectory/dashboardUI.inc");
/**
@@ -24,6 +25,24 @@ require_once("$default->uiDirectory/dashboardUI.inc");
// page start
// -------------------------------
+/**
+ * Retrieves the collaboration documents that the current user has pending
+ *
+ * @param integer the user to retrieve pending collaboration documents for
+ */
+function getPendingCollaborationDocuments($iUserID) {
+ // TODO: move this to a more logical class/file
+ global $default;
+ $sQuery = "SELECT document_id FROM $default->owl_folders_user_roles_table WHERE active=1 AND user_id=" . $_SESSION["userID"];
+ $aDocumentList = array();
+ if ($default->db->query($sQuery)) {
+ while ($default->db->next_record()) {
+ $aDocumentList[] = & Document::get($default->db->f("id"));
+ }
+ }
+ return $aDocumentList;
+}
+
if (checkSession()) {
// include the page template (with navbar)
require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
@@ -32,14 +51,18 @@ if (checkSession()) {
$oContent = new PatternCustom();
// retrieve collaboration pending documents for this user
- $aPendingDocumentList = getPendingDocuments($_SESSION["userID"]);
+ $aPendingDocumentList = getPendingCollaborationDocuments($_SESSION["userID"]);
// retrieve checked out documents for this user
- $aCheckedOutDocumentList = getCheckedoutDocuments($_SESSION["userID"]);
+ $aCheckedOutDocumentList = Document::getList("checked_out_user_id=" . $_SESSION["userID"]);
+
// retrieve subscription alerts for this user
$aSubscriptionAlertList = SubscriptionManager::listSubscriptionAlerts($_SESSION["userID"]);
+ // retrieve quicklinks
+ $aQuickLinks = Link::getList();
+
// generate the html
- $oContent->setHtml(renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList));
+ $oContent->setHtml(renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks));
// display
$main->setCentralPayload($oContent);
diff --git a/presentation/lookAndFeel/knowledgeTree/dashboardUI.inc b/presentation/lookAndFeel/knowledgeTree/dashboardUI.inc
index 1de8693..9ee9fb5 100644
--- a/presentation/lookAndFeel/knowledgeTree/dashboardUI.inc
+++ b/presentation/lookAndFeel/knowledgeTree/dashboardUI.inc
@@ -15,107 +15,37 @@ require_once("$default->fileSystemRoot/lib/users/User.inc");
*/
/**
- * just a tmp document forging class
+ * Displays the pending collaboration documents
+ *
+ * @param array of pending collaboration documents
*/
-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 "id . "\">" .
- $this->title . "";
- */
- return "$this->title";
-
- }
-
- 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 renderPendingDocuments($aPendingDocumentList) {
+function renderPendingCollaborationDocuments($aPendingDocumentList) {
$sToRender = "\t
\n";
- $sToRender .= "\t\t| Pending Documents | \n";
+ $sToRender .= "\t\tPending Documents | \n";
$sToRender .= "\t
\n";
for ($i = 0; $i < count($aPendingDocumentList); $i++) {
+ $oDocument = $aPendingDocumentList[$i];
$sToRender .= "\t\n";
- $sToRender .= "| " . $aPendingDocumentList[$i]->getTitleLink() . " | \n";
+ //$sToRender .= "" . $aPendingDocumentList[$i]->getTitleLink() . " | \n";
+ $sToRender .= "" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), $oDocument->getDisplayPath()) . " | \n";
$sToRender .= "\t
\n";
}
return $sToRender;
}
+/**
+ * Displays the checked out documents
+ *
+ * @param array of checked out documents
+ */
function renderCheckedOutDocuments($aCheckedOutDocumentList) {
+ global $default;
$sToRender = "\t\n";
- $sToRender .= "\t\t| Checked Out Documents | \n";
+ $sToRender .= "\t\tChecked Out Documents | \n";
$sToRender .= "\t
\n";
$sToRender .= "\t\n";
- $sToRender .= "| \n";
+ $sToRender .= " | \n";
$sToRender .= "Title\n";
$sToRender .= " | \n";
$sToRender .= "\n";
@@ -124,27 +54,47 @@ function renderCheckedOutDocuments($aCheckedOutDocumentList) {
$sToRender .= "\t\t |
\n";
for ($i = 0; $i < count($aCheckedOutDocumentList); $i++) {
+ $oDocument = $aCheckedOutDocumentList[$i];
$sToRender .= "\t\n";
- $sToRender .= "| " . $aCheckedOutDocumentList[$i]->getTitleLink() . " | \n";
- $sToRender .= "" . $aCheckedOutDocumentList[$i]->getDays() . " | \n";
+ $sToRender .= "" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), " graphicsUrl/widgets/dstatus.gif\" border=\"0\"/>" . $oDocument->getDisplayPath()) . " | \n";
+ $sToRender .= "" . $oDocument->getDaysSinceLastModified() . " | \n";
$sToRender .= "\t
\n";
- }
+ }
return $sToRender;
}
+/**
+ * Displays the subscription alerts
+ *
+ * @param array of subscription alerts
+ */
function renderSubscriptionAlerts($aSubscriptionAlertList) {
+ global $default;
$sToRender = "\t\n";
- $sToRender .= "\t\t| Subscription Alerts | \n";
+ $sToRender .= "\t\tSubscription Alerts | \n";
$sToRender .= "\t
\n";
for ($i = 0; $i < count($aSubscriptionAlertList); $i++) {
$sToRender .= "\t\n";
- $sToRender .= "| " . $aSubscriptionAlertList[$i]->getAlertLink() . " | \n";
+ $sToRender .= "" . $aSubscriptionAlertList[$i]->getAlertLink() . " | \n";
$sToRender .= "\t
\n";
}
return $sToRender;
}
-function quickLinkHeaders() {
+/**
+ * Displays the quicklinks
+ */
+function renderQuickLinks($aQuickLinks) {
+ global $default;
+ $sToRender .= "\t\n";
+ $sToRender .= "\t\t| Quick Links | \n";
+ $sToRender .= "\t
\n";
+ for ($i = 0; $i < count($aQuickLinks); $i++) {
+ $sToRender .= "\t\n";
+ $sToRender .= "getUrl() . "\" target=\"_new\"> graphicsUrl/widgets/qlink.gif\" border=\"0\"/>" . $aQuickLinks[$i]->getName() . " | \n";
+ $sToRender .= "\t
\n";
+ }
+ return $sToRender;
}
/**
@@ -154,7 +104,7 @@ function quickLinkHeaders() {
* @param array checked out documents for this user
* @param array subscription alerts for this user
*/
-function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList) {
+function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks) {
global $default;
$sToRender = "\n";
@@ -169,8 +119,8 @@ function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscript
// dashboard alerts
$sToRender .= "\t\n";
$sToRender .= "\t\t\n";
- $sToRender .= "\t\t\t\n";
- $sToRender .= renderPendingDocuments($aPendingDocumentList);
+ $sToRender .= "\t\t\t\n";
+ $sToRender .= renderPendingCollaborationDocuments($aPendingDocumentList);
$sToRender .= renderCheckedOutDocuments($aCheckedOutDocumentList) . "\n";
$sToRender .= renderSubscriptionAlerts($aSubscriptionAlertList) . "\n";
$sToRender .= "\t\t\t \n";
@@ -179,12 +129,7 @@ function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscript
// quick links
$sToRender .= "\t\t\n";
$sToRender .= "\t\t\t\n";
- $sToRender .= "\t\n";
- $sToRender .= "\t\t| Quick Links | \n";
- $sToRender .= "\t \n";
- $sToRender .= "\t\n";
- $sToRender .= quickLinkHeaders();
- $sToRender .= "\t \n";
+ $sToRender .= renderQuickLinks($aQuickLinks);
$sToRender .= "\t\t\t \n";
$sToRender .= "\t\t | \n";
|