add more lists of documents

This commit is contained in:
Uwe Steinmann 2015-05-12 19:13:08 +02:00
parent bc7407ad85
commit d538bde579

View File

@ -267,6 +267,118 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
$this->contentContainerEnd();
}
// Get document list for the current user.
$revisionStatus = $user->getRevisionStatus();
$resArr = $dms->getDocumentList('ReviseByMe', $user);
if (is_bool($resArr) && !$resArr) {
$this->contentHeading(getMLText("warning"));
$this->contentContainer(getMLText("internal_error_exit"));
$this->htmlEndPage();
exit;
}
if($resArr) {
/* 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 ){
$res["status"]=S_EXPIRED;
}
$docIdx[$res["id"]][$res["version"]] = $res;
}
$this->contentHeading(getMLText("documents_to_revise"));
$this->contentContainerStart();
$printheader=true;
$iRev = array();
$dList = array();
foreach ($revisionStatus["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 "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("owner")."</th>\n";
print "<th>".getMLText("version")."</th>\n";
print "<th>".getMLText("last_update")."</th>\n";
print "<th>".getMLText("expires")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
print "<tr>\n";
$latestContent = $document->getLatestContent();
$previewer->createPreview($latestContent);
print "<td><a href=\"../op/op.Download.php?documentid=".$st["documentID"]."&version=".$st["version"]."\">";
if($previewer->hasPreview($latestContent)) {
print "<img class=\"mimeicon\" width=\"".$previewwidth."\"src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidth."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
} else {
print "<img class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
}
print "</a></td>";
print "<td><a href=\"out.ViewDocument.php?documentid=".$st["documentID"]."\">".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["name"])."</a></td>";
print "<td>".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["ownerName"])."</td>";
print "<td>".$st["version"]."</td>";
print "<td>".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"]) ."</td>";
print "<td".($docIdx[$st["documentID"]][$st["version"]]['status']!=S_EXPIRED?"":" class=\"warning\"").">".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"]))."</td>";
print "</tr>\n";
}
}
foreach ($revisionStatus["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 "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("owner")."</th>\n";
print "<th>".getMLText("version")."</th>\n";
print "<th>".getMLText("last_update")."</th>\n";
print "<th>".getMLText("expires")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
print "<tr>\n";
$latestContent = $document->getLatestContent();
$previewer->createPreview($latestContent);
print "<td><a href=\"../op/op.Download.php?documentid=".$st["documentID"]."&version=".$st["version"]."\">";
if($previewer->hasPreview($latestContent)) {
print "<img class=\"mimeicon\" width=\"".$previewwidth."\"src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidth."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
} else {
print "<img class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
}
print "</a></td>";
print "<td><a href=\"out.ViewDocument.php?documentid=".$st["documentID"]."\">".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["name"])."</a></td>";
print "<td>".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["ownerName"])."</td>";
print "<td>".$st["version"]."</td>";
print "<td>".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"])."</td>";
print "<td".($docIdx[$st["documentID"]][$st["version"]]['status']!=S_EXPIRED?"":" class=\"warning\"").">".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"]))."</td>";
print "</tr>\n";
}
}
if (!$printheader){
echo "</tbody>\n</table>";
}else{
printMLText("no_docs_to_revise");
}
$this->contentContainerEnd();
}
/* Get list of documents owned by current user that are
* pending review or pending approval.
*/
@ -344,12 +456,10 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
*/
$docIdx = array();
foreach ($resArr as $res) {
/* verify expiry */
if ( $res["expires"] && time()>$res["expires"]+24*60*60 ){
$res["status"]=S_EXPIRED;
}
$docIdx[$res["id"]][$res["version"]] = $res;
}
$this->contentHeading(getMLText("documents_to_receipt"));