From 1e4d9518c58c79e51783290d412feda7e9ca260a Mon Sep 17 00:00:00 2001 From: steinm Date: Sat, 2 Feb 2013 15:56:35 +0000 Subject: [PATCH] - check for workflow mode --- views/bootstrap/class.MyDocuments.php | 578 +++++++++++++------------- 1 file changed, 290 insertions(+), 288 deletions(-) diff --git a/views/bootstrap/class.MyDocuments.php b/views/bootstrap/class.MyDocuments.php index f35477b1a..446ebe7c1 100644 --- a/views/bootstrap/class.MyDocuments.php +++ b/views/bootstrap/class.MyDocuments.php @@ -37,6 +37,7 @@ class LetoDMS_View_MyDocuments extends LetoDMS_Bootstrap_Style { $orderby = $this->params['orderby']; $showInProcess = $this->params['showinprocess']; $cachedir = $this->params['cachedir']; + $workflowmode = $this->params['workflowmode']; $db = $dms->getDB(); $previewer = new LetoDMS_Preview_Previewer($cachedir, 40); @@ -55,40 +56,267 @@ class LetoDMS_View_MyDocuments extends LetoDMS_Bootstrap_Style { exit; } - // Get document list for the current user. - $reviewStatus = $user->getReviewStatus(); - $approvalStatus = $user->getApprovalStatus(); - - // Create a comma separated list of all the documentIDs whose information is - // required. - $dList = array(); - foreach ($reviewStatus["indstatus"] as $st) { - if (!in_array($st["documentID"], $dList)) { - $dList[] = $st["documentID"]; + if($workflowmode == 'traditional') { + // Get document list for the current user. + $reviewStatus = $user->getReviewStatus(); + $approvalStatus = $user->getApprovalStatus(); + + // Create a comma separated list of all the documentIDs whose information is + // required. + $dList = array(); + foreach ($reviewStatus["indstatus"] as $st) { + if (!in_array($st["documentID"], $dList)) { + $dList[] = $st["documentID"]; + } } - } - foreach ($reviewStatus["grpstatus"] as $st) { - if (!in_array($st["documentID"], $dList)) { - $dList[] = $st["documentID"]; + foreach ($reviewStatus["grpstatus"] as $st) { + if (!in_array($st["documentID"], $dList)) { + $dList[] = $st["documentID"]; + } } - } - foreach ($approvalStatus["indstatus"] as $st) { - if (!in_array($st["documentID"], $dList)) { - $dList[] = $st["documentID"]; + foreach ($approvalStatus["indstatus"] as $st) { + if (!in_array($st["documentID"], $dList)) { + $dList[] = $st["documentID"]; + } } - } - foreach ($approvalStatus["grpstatus"] as $st) { - if (!in_array($st["documentID"], $dList)) { - $dList[] = $st["documentID"]; + foreach ($approvalStatus["grpstatus"] as $st) { + if (!in_array($st["documentID"], $dList)) { + $dList[] = $st["documentID"]; + } } - } - $docCSV = ""; - foreach ($dList as $d) { - $docCSV .= (strlen($docCSV)==0 ? "" : ", ")."'".$d."'"; - } - - if (strlen($docCSV)>0) { - // Get the document information. + $docCSV = ""; + foreach ($dList as $d) { + $docCSV .= (strlen($docCSV)==0 ? "" : ", ")."'".$d."'"; + } + + if (strlen($docCSV)>0) { + // Get the document information. + $queryStr = "SELECT `tblDocuments`.*, `tblDocumentLocks`.`userID` as `lockUser`, ". + "`tblDocumentContent`.`version`, `tblDocumentStatus`.*, `tblDocumentStatusLog`.`status`, ". + "`tblDocumentStatusLog`.`comment` AS `statusComment`, `tblDocumentStatusLog`.`date` as `statusDate`, ". + "`tblDocumentStatusLog`.`userID`, `oTbl`.`fullName` AS `ownerName`, `sTbl`.`fullName` AS `statusName` ". + "FROM `tblDocumentContent` ". + "LEFT JOIN `tblDocuments` ON `tblDocuments`.`id` = `tblDocumentContent`.`document` ". + "LEFT JOIN `tblDocumentStatus` ON `tblDocumentStatus`.`documentID` = `tblDocumentContent`.`document` ". + "LEFT JOIN `tblDocumentStatusLog` ON `tblDocumentStatusLog`.`statusID` = `tblDocumentStatus`.`statusID` ". + "LEFT JOIN `ttstatid` ON `ttstatid`.`maxLogID` = `tblDocumentStatusLog`.`statusLogID` ". + "LEFT JOIN `ttcontentid` ON `ttcontentid`.`maxVersion` = `tblDocumentStatus`.`version` AND `ttcontentid`.`document` = `tblDocumentStatus`.`documentID` ". + "LEFT JOIN `tblDocumentLocks` ON `tblDocuments`.`id`=`tblDocumentLocks`.`document` ". + "LEFT JOIN `tblUsers` AS `oTbl` on `oTbl`.`id` = `tblDocuments`.`owner` ". + "LEFT JOIN `tblUsers` AS `sTbl` on `sTbl`.`id` = `tblDocumentStatusLog`.`userID` ". + "WHERE `ttstatid`.`maxLogID`=`tblDocumentStatusLog`.`statusLogID` ". + "AND `ttcontentid`.`maxVersion` = `tblDocumentContent`.`version` ". + "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.", ".S_EXPIRED.") ". + "AND `tblDocuments`.`id` IN (" . $docCSV . ") ". + "ORDER BY `statusDate` DESC"; + + $resArr = $db->getResultArray($queryStr); + if (is_bool($resArr) && !$resArr) { + $this->contentHeading(getMLText("warning")); + $this->contentContainer(getMLText("internal_error_exit")); + $this->htmlEndPage(); + exit; + } + + // Create an array to hold all of these results, and index the array by + // document id. This makes it easier to retrieve document ID information + // later on and saves us having to repeatedly poll the database every time + // new document information is required. + $docIdx = array(); + foreach ($resArr as $res) { + + // verify expiry + if ( $res["expires"] && time()>$res["expires"]+24*60*60 ){ + if ( $res["status"]==S_DRAFT_APP || $res["status"]==S_DRAFT_REV ){ + $res["status"]=S_EXPIRED; + } + } + + $docIdx[$res["id"]][$res["version"]] = $res; + } + + // List the documents where a review has been requested. + $this->contentHeading(getMLText("documents_to_review")); + $this->contentContainerStart(); + $printheader=true; + $iRev = array(); + $dList = array(); + foreach ($reviewStatus["indstatus"] as $st) { + + if ( $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]]) && !in_array($st["documentID"], $dList) ) { + $dList[] = $st["documentID"]; + $document = $dms->getDocument($st["documentID"]); + + if ($printheader){ + print ""; + print "\n\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n\n\n"; + $printheader=false; + } + + print "\n"; + $latestContent = $document->getLatestContent(); + $previewer->createPreview($latestContent); + print ""; + print ""; + print ""; + print ""; + print ""; + print "".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"])).""; + print "\n"; + } + } + foreach ($reviewStatus["grpstatus"] as $st) { + + if (!in_array($st["documentID"], $iRev) && $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]]) && !in_array($st["documentID"], $dList) && $docIdx[$st["documentID"]][$st["version"]]['owner'] != $user->getId()) { + $dList[] = $st["documentID"]; + $document = $dms->getDocument($st["documentID"]); + + if ($printheader){ + print "
".getMLText("name")."".getMLText("owner")."".getMLText("version")."".getMLText("last_update")."".getMLText("expires")."
"; + if($previewer->hasPreview($latestContent)) { + print "getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + } else { + print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + } + print "".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["name"])."".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["ownerName"])."".$st["version"]."".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"]) ."
"; + print "\n\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n\n\n"; + $printheader=false; + } + + print "\n"; + $latestContent = $document->getLatestContent(); + $previewer->createPreview($latestContent); + print ""; + print ""; + print ""; + print ""; + print ""; + print "".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"])).""; + print "\n"; + } + } + if (!$printheader){ + echo "\n
".getMLText("name")."".getMLText("owner")."".getMLText("version")."".getMLText("last_update")."".getMLText("expires")."
"; + if($previewer->hasPreview($latestContent)) { + print "getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + } else { + print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + } + print "".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["name"])."".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["ownerName"])."".$st["version"]."".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"])."
"; + }else{ + printMLText("no_docs_to_review"); + } + $this->contentContainerEnd(); + + // List the documents where an approval has been requested. + $this->contentHeading(getMLText("documents_to_approve")); + $this->contentContainerStart(); + $printheader=true; + + foreach ($approvalStatus["indstatus"] as $st) { + + if ( $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]])) { + $document = $dms->getDocument($st["documentID"]); + + if ($printheader){ + print ""; + print "\n\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n\n\n"; + $printheader=false; + } + + print "\n"; + $latestContent = $document->getLatestContent(); + $previewer->createPreview($latestContent); + print ""; + print ""; + print ""; + print ""; + print ""; + print "".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"])).""; + print "\n"; + } + } + foreach ($approvalStatus["grpstatus"] as $st) { + + if (!in_array($st["documentID"], $iRev) && $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]]) && $docIdx[$st["documentID"]][$st["version"]]['owner'] != $user->getId()) { + if ($printheader){ + print "
".getMLText("name")."".getMLText("owner")."".getMLText("version")."".getMLText("last_update")."".getMLText("expires")."
"; + if($previewer->hasPreview($latestContent)) { + print "getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + } else { + print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + } + print "".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["name"])."".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["ownerName"])."".$st["version"]."".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"])."
"; + print "\n\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n\n\n"; + $printheader=false; + } + print "\n"; + $latestContent = $document->getLatestContent(); + $previewer->createPreview($latestContent); + print ""; + print ""; + print ""; + print ""; + print ""; + print "".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"])).""; + print "\n"; + } + } + if (!$printheader){ + echo "\n
".getMLText("name")."".getMLText("owner")."".getMLText("version")."".getMLText("last_update")."".getMLText("expires")."
"; + if($previewer->hasPreview($latestContent)) { + print "getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + } else { + print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + } + print "".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["name"])."".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["ownerName"])."".$st["version"]."".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"])."
\n"; + }else{ + printMLText("no_docs_to_approve"); + } + $this->contentContainerEnd(); + } + else { + + $this->contentHeading(getMLText("documents_to_review")); + $this->contentContainerStart(); + printMLText("no_review_needed"); + $this->contentContainerEnd(); + $this->contentHeading(getMLText("documents_to_approve")); + $this->contentContainerStart(); + printMLText("no_approval_needed"); + $this->contentContainerEnd(); + } + + // Get list of documents owned by current user that are pending review or + // pending approval. $queryStr = "SELECT `tblDocuments`.*, `tblDocumentLocks`.`userID` as `lockUser`, ". "`tblDocumentContent`.`version`, `tblDocumentStatus`.*, `tblDocumentStatusLog`.`status`, ". "`tblDocumentStatusLog`.`comment` AS `statusComment`, `tblDocumentStatusLog`.`date` as `statusDate`, ". @@ -104,292 +332,66 @@ class LetoDMS_View_MyDocuments extends LetoDMS_Bootstrap_Style { "LEFT JOIN `tblUsers` AS `sTbl` on `sTbl`.`id` = `tblDocumentStatusLog`.`userID` ". "WHERE `ttstatid`.`maxLogID`=`tblDocumentStatusLog`.`statusLogID` ". "AND `ttcontentid`.`maxVersion` = `tblDocumentContent`.`version` ". - "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.", ".S_EXPIRED.") ". - "AND `tblDocuments`.`id` IN (" . $docCSV . ") ". + "AND `tblDocuments`.`owner` = '".$user->getID()."' ". + "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.") ". "ORDER BY `statusDate` DESC"; $resArr = $db->getResultArray($queryStr); if (is_bool($resArr) && !$resArr) { $this->contentHeading(getMLText("warning")); - $this->contentContainer(getMLText("internal_error_exit")); + $this->contentContainer("Internal error. Unable to complete request. Exiting."); $this->htmlEndPage(); exit; } - - // Create an array to hold all of these results, and index the array by - // document id. This makes it easier to retrieve document ID information - // later on and saves us having to repeatedly poll the database every time - // new document information is required. - $docIdx = array(); - foreach ($resArr as $res) { - - // verify expiry - if ( $res["expires"] && time()>$res["expires"]+24*60*60 ){ - if ( $res["status"]==S_DRAFT_APP || $res["status"]==S_DRAFT_REV ){ - $res["status"]=S_EXPIRED; - } - } - $docIdx[$res["id"]][$res["version"]] = $res; - } - - // List the documents where a review has been requested. - $this->contentHeading(getMLText("documents_to_review")); + $this->contentHeading(getMLText("documents_user_requiring_attention")); $this->contentContainerStart(); - $printheader=true; - $iRev = array(); - $dList = array(); - foreach ($reviewStatus["indstatus"] as $st) { - - if ( $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]]) && !in_array($st["documentID"], $dList) ) { - $dList[] = $st["documentID"]; - $document = $dms->getDocument($st["documentID"]); + if (count($resArr)>0) { + + print ""; + print "\n\n"; + print ""; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n\n\n"; + + foreach ($resArr as $res) { + $document = $dms->getDocument($res["documentID"]); - if ($printheader){ - print "
".getMLText("name")."".getMLText("status")."".getMLText("version")."".getMLText("last_update")."".getMLText("expires")."
"; - print "\n\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n\n\n"; - $printheader=false; + // verify expiry + if ( $res["expires"] && time()>$res["expires"]+24*60*60 ){ + if ( $res["status"]==S_DRAFT_APP || $res["status"]==S_DRAFT_REV ){ + $res["status"]=S_EXPIRED; + } } print "\n"; $latestContent = $document->getLatestContent(); $previewer->createPreview($latestContent); - print ""; - print ""; - print ""; - print ""; - print ""; - print "".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"])).""; + print "\n"; + print ""; + print ""; + print ""; + print ""; print "\n"; - } - } - foreach ($reviewStatus["grpstatus"] as $st) { - - if (!in_array($st["documentID"], $iRev) && $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]]) && !in_array($st["documentID"], $dList) && $docIdx[$st["documentID"]][$st["version"]]['owner'] != $user->getId()) { - $dList[] = $st["documentID"]; - $document = $dms->getDocument($st["documentID"]); - - if ($printheader){ - print "
".getMLText("name")."".getMLText("owner")."".getMLText("version")."".getMLText("last_update")."".getMLText("expires")."
"; + print ""; if($previewer->hasPreview($latestContent)) { print "getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; } else { print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; } print "".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["name"])."".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["ownerName"])."".$st["version"]."".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"]) ."" . htmlspecialchars($res["name"]) . "".getOverallStatusText($res["status"])."".$res["version"]."".$res["statusDate"]." ".htmlspecialchars($res["statusName"])."".(!$res["expires"] ? "-":getReadableDate($res["expires"]))."
"; - print "\n\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n\n\n"; - $printheader=false; - } - - print "\n"; - $latestContent = $document->getLatestContent(); - $previewer->createPreview($latestContent); - print ""; - print ""; - print ""; - print ""; - print ""; - print "".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"])).""; - print "\n"; - } - } - if (!$printheader){ - echo "\n
".getMLText("name")."".getMLText("owner")."".getMLText("version")."".getMLText("last_update")."".getMLText("expires")."
"; - if($previewer->hasPreview($latestContent)) { - print "getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; - } else { - print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; - } - print "".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["name"])."".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["ownerName"])."".$st["version"]."".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"])."
"; - }else{ - printMLText("no_docs_to_review"); - } - $this->contentContainerEnd(); - - // List the documents where an approval has been requested. - $this->contentHeading(getMLText("documents_to_approve")); - $this->contentContainerStart(); - $printheader=true; - - foreach ($approvalStatus["indstatus"] as $st) { - - if ( $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]])) { - $document = $dms->getDocument($st["documentID"]); + } + print ""; - if ($printheader){ - print ""; - print "\n\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n\n\n"; - $printheader=false; - } - - print "\n"; - $latestContent = $document->getLatestContent(); - $previewer->createPreview($latestContent); - print ""; - print ""; - print ""; - print ""; - print ""; - print "".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"])).""; - print "\n"; - } } - foreach ($approvalStatus["grpstatus"] as $st) { + else printMLText("no_docs_to_look_at"); - if (!in_array($st["documentID"], $iRev) && $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]]) && $docIdx[$st["documentID"]][$st["version"]]['owner'] != $user->getId()) { - if ($printheader){ - print "
".getMLText("name")."".getMLText("owner")."".getMLText("version")."".getMLText("last_update")."".getMLText("expires")."
"; - if($previewer->hasPreview($latestContent)) { - print "getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; - } else { - print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; - } - print "".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["name"])."".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["ownerName"])."".$st["version"]."".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"])."
"; - print "\n\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n\n\n"; - $printheader=false; - } - print "\n"; - $latestContent = $document->getLatestContent(); - $previewer->createPreview($latestContent); - print ""; - print ""; - print ""; - print ""; - print ""; - print "".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"])).""; - print "\n"; - } - } - if (!$printheader){ - echo "\n
".getMLText("name")."".getMLText("owner")."".getMLText("version")."".getMLText("last_update")."".getMLText("expires")."
"; - if($previewer->hasPreview($latestContent)) { - print "getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; - } else { - print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; - } - print "".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["name"])."".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["ownerName"])."".$st["version"]."".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"])."
\n"; - }else{ - printMLText("no_docs_to_approve"); - } $this->contentContainerEnd(); } - else { - - $this->contentHeading(getMLText("documents_to_review")); - $this->contentContainerStart(); - printMLText("no_review_needed"); - $this->contentContainerEnd(); - $this->contentHeading(getMLText("documents_to_approve")); - $this->contentContainerStart(); - printMLText("no_approval_needed"); - $this->contentContainerEnd(); - } - - // Get list of documents owned by current user that are pending review or - // pending approval. - $queryStr = "SELECT `tblDocuments`.*, `tblDocumentLocks`.`userID` as `lockUser`, ". - "`tblDocumentContent`.`version`, `tblDocumentStatus`.*, `tblDocumentStatusLog`.`status`, ". - "`tblDocumentStatusLog`.`comment` AS `statusComment`, `tblDocumentStatusLog`.`date` as `statusDate`, ". - "`tblDocumentStatusLog`.`userID`, `oTbl`.`fullName` AS `ownerName`, `sTbl`.`fullName` AS `statusName` ". - "FROM `tblDocumentContent` ". - "LEFT JOIN `tblDocuments` ON `tblDocuments`.`id` = `tblDocumentContent`.`document` ". - "LEFT JOIN `tblDocumentStatus` ON `tblDocumentStatus`.`documentID` = `tblDocumentContent`.`document` ". - "LEFT JOIN `tblDocumentStatusLog` ON `tblDocumentStatusLog`.`statusID` = `tblDocumentStatus`.`statusID` ". - "LEFT JOIN `ttstatid` ON `ttstatid`.`maxLogID` = `tblDocumentStatusLog`.`statusLogID` ". - "LEFT JOIN `ttcontentid` ON `ttcontentid`.`maxVersion` = `tblDocumentStatus`.`version` AND `ttcontentid`.`document` = `tblDocumentStatus`.`documentID` ". - "LEFT JOIN `tblDocumentLocks` ON `tblDocuments`.`id`=`tblDocumentLocks`.`document` ". - "LEFT JOIN `tblUsers` AS `oTbl` on `oTbl`.`id` = `tblDocuments`.`owner` ". - "LEFT JOIN `tblUsers` AS `sTbl` on `sTbl`.`id` = `tblDocumentStatusLog`.`userID` ". - "WHERE `ttstatid`.`maxLogID`=`tblDocumentStatusLog`.`statusLogID` ". - "AND `ttcontentid`.`maxVersion` = `tblDocumentContent`.`version` ". - "AND `tblDocuments`.`owner` = '".$user->getID()."' ". - "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.") ". - "ORDER BY `statusDate` DESC"; - - $resArr = $db->getResultArray($queryStr); - if (is_bool($resArr) && !$resArr) { - $this->contentHeading(getMLText("warning")); - $this->contentContainer("Internal error. Unable to complete request. Exiting."); - $this->htmlEndPage(); - exit; - } - - $this->contentHeading(getMLText("documents_user_requiring_attention")); - $this->contentContainerStart(); - if (count($resArr)>0) { - - print ""; - print "\n\n"; - print ""; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n\n\n"; - - foreach ($resArr as $res) { - $document = $dms->getDocument($res["documentID"]); - - // verify expiry - if ( $res["expires"] && time()>$res["expires"]+24*60*60 ){ - if ( $res["status"]==S_DRAFT_APP || $res["status"]==S_DRAFT_REV ){ - $res["status"]=S_EXPIRED; - } - } - - print "\n"; - $latestContent = $document->getLatestContent(); - $previewer->createPreview($latestContent); - print ""; - print "\n"; - print ""; - print ""; - print ""; - print ""; - print "\n"; - } - print "
".getMLText("name")."".getMLText("status")."".getMLText("version")."".getMLText("last_update")."".getMLText("expires")."
"; - if($previewer->hasPreview($latestContent)) { - print "getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; - } else { - print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; - } - print "" . htmlspecialchars($res["name"]) . "".getOverallStatusText($res["status"])."".$res["version"]."".$res["statusDate"]." ".htmlspecialchars($res["statusName"])."".(!$res["expires"] ? "-":getReadableDate($res["expires"]))."
"; - - } - else printMLText("no_docs_to_look_at"); - - $this->contentContainerEnd(); - // Get list of documents locked by current user $queryStr = "SELECT `tblDocuments`.*, `tblDocumentLocks`.`userID` as `lockUser`, ".