seeddms-code/views/bootstrap/class.ApprovalSummary.php

171 lines
6.4 KiB
PHP
Raw Normal View History

2012-12-14 07:53:13 +00:00
<?php
/**
* Implementation of ApprovalSummary view
*
* @category DMS
* @package SeedDMS
2012-12-14 07:53:13 +00:00
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal,
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
* 2010-2012 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Include parent class
*/
require_once("class.Bootstrap.php");
/**
* Include class to preview documents
*/
require_once("SeedDMS/Preview.php");
2012-12-14 07:53:13 +00:00
/**
* Class which outputs the html page for ApprovalSummary view
*
* @category DMS
* @package SeedDMS
2012-12-14 07:53:13 +00:00
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal,
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
* 2010-2012 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_View_ApprovalSummary extends SeedDMS_Bootstrap_Style {
2012-12-14 07:53:13 +00:00
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
2015-07-08 05:24:50 +00:00
$cachedir = $this->params['cachedir'];
$previewwidth = $this->params['previewWidthList'];
2016-02-15 09:57:37 +00:00
$timeout = $this->params['timeout'];
2015-07-08 05:24:50 +00:00
2016-02-15 09:57:37 +00:00
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout);
2012-12-14 07:53:13 +00:00
$this->htmlStartPage(getMLText("approval_summary"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("my_documents"), "my_documents");
$this->contentHeading(getMLText("approval_summary"));
$this->contentContainerStart();
// Get document list for the current user.
$approvalStatus = $user->getApprovalStatus();
// reverse order
$approvalStatus["indstatus"]=array_reverse($approvalStatus["indstatus"],true);
$approvalStatus["grpstatus"]=array_reverse($approvalStatus["grpstatus"],true);
$iRev = array();
$printheader = true;
foreach ($approvalStatus["indstatus"] as $st) {
$document = $dms->getDocument($st['documentID']);
2015-07-08 05:24:50 +00:00
$version = $document->getContentByVersion($st['version']);
$previewer->createPreview($version);
2012-12-14 07:53:13 +00:00
$owner = $document->getOwner();
$moduser = $dms->getUser($st['required']);
if ($document && $version) {
if ($printheader){
print "<table class=\"table-condensed\">";
print "<thead>\n<tr>\n";
2015-07-08 05:24:50 +00:00
print "<th></th>\n";
2012-12-14 07:53:13 +00:00
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("owner")."</th>\n";
print "<th>".getMLText("status")."</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";
2015-07-08 05:24:50 +00:00
$previewer->createPreview($version);
print "<td><a href=\"../op/op.Download.php?documentid=".$st["documentID"]."&version=".$st["version"]."\">";
if($previewer->hasPreview($version)) {
2017-03-15 15:41:32 +00:00
print "<img class=\"mimeicon\" width=\"".$previewwidth."\" src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$version->getVersion()."&width=".$previewwidth."\" title=\"".htmlspecialchars($version->getMimeType())."\">";
2015-07-08 05:24:50 +00:00
} else {
2017-03-15 15:41:32 +00:00
print "<img class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($version->getFileType())."\" title=\"".htmlspecialchars($version->getMimeType())."\">";
2015-07-08 05:24:50 +00:00
}
print "</a></td>";
2012-12-14 07:53:13 +00:00
print "<td><a href=\"out.DocumentVersionDetail.php?documentid=".$st["documentID"]."&version=".$st["version"]."\">".htmlspecialchars($document->getName())."</a></td>";
print "<td>".htmlspecialchars($owner->getFullName())."</td>";
print "<td>".getApprovalStatusText($st["status"])."</td>";
2012-12-14 07:53:13 +00:00
print "<td>".$st["version"]."</td>";
print "<td>".$st["date"]." ". htmlspecialchars($moduser->getFullName()) ."</td>";
print "<td>".(!$document->expires() ? "-":getReadableDate($document->getExpires()))."</td>";
print "</tr>\n";
}
if ($st["status"]!=-2) {
$iRev[] = $st["documentID"];
}
}
if (!$printheader) {
echo "</tbody>\n</table>\n";
}else{
printMLText("no_approval_needed");
}
$this->contentContainerEnd();
$this->contentHeading(getMLText("group_approval_summary"));
$this->contentContainerStart();
$printheader = true;
foreach ($approvalStatus["grpstatus"] as $st) {
$document = $dms->getDocument($st['documentID']);
2015-07-08 05:24:50 +00:00
$version = $document->getContentByVersion($st['version']);
2012-12-14 07:53:13 +00:00
$owner = $document->getOwner();
$modgroup = $dms->getGroup($st['required']);
if (!in_array($st["documentID"], $iRev) && $document && $version) {
if ($printheader){
print "<table class=\"table-condensed\">";
print "<thead>\n<tr>\n";
2015-07-08 05:24:50 +00:00
print "<th></th>\n";
2012-12-14 07:53:13 +00:00
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("owner")."</th>\n";
print "<th>".getMLText("status")."</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";
2015-07-08 05:24:50 +00:00
$previewer->createPreview($version);
print "<td><a href=\"../op/op.Download.php?documentid=".$st["documentID"]."&version=".$st["version"]."\">";
if($previewer->hasPreview($version)) {
2017-03-15 15:41:32 +00:00
print "<img class=\"mimeicon\" width=\"".$previewwidth."\" src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$version->getVersion()."&width=".$previewwidth."\" title=\"".htmlspecialchars($version->getMimeType())."\">";
2015-07-08 05:24:50 +00:00
} else {
2017-03-15 15:41:32 +00:00
print "<img class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($version->getFileType())."\" title=\"".htmlspecialchars($version->getMimeType())."\">";
2015-07-08 05:24:50 +00:00
}
print "</a></td>";
2012-12-14 07:53:13 +00:00
print "<td><a href=\"out.DocumentVersionDetail.php?documentid=".$st["documentID"]."&version=".$st["version"]."\">".htmlspecialchars($document->getName())."</a></td>";
print "<td>".htmlspecialchars($owner->getFullName())."</td>";
print "<td>".getApprovalStatusText($st["status"])."</td>";
2012-12-14 07:53:13 +00:00
print "<td>".$st["version"]."</td>";
print "<td>".$st["date"]." ". htmlspecialchars($modgroup->getName()) ."</td>";
print "<td>".(!$document->expires() ? "-":getReadableDate($document->getExpires()))."</td>";
print "</tr>\n";
}
}
if (!$printheader) {
echo "</tbody>\n</table>\n";
}else{
printMLText("no_approval_needed");
2012-12-14 07:53:13 +00:00
}
$this->contentContainerEnd();
$this->contentEnd();
2012-12-14 07:53:13 +00:00
$this->htmlEndPage();
} /* }}} */
}
?>