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

936 lines
35 KiB
PHP
Raw Normal View History

2012-12-14 07:53:13 +00:00
<?php
/**
* Implementation of MyDocuments 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 MyDocuments 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_MyDocuments extends SeedDMS_Bootstrap_Style {
2012-12-14 07:53:13 +00:00
2016-07-27 19:02:02 +00:00
function js() { /* {{{ */
header('Content-Type: application/javascript');
?>
$(document).ready( function() {
$('body').on('click', 'ul.bs-docs-sidenav li a', function(ev){
ev.preventDefault();
$('#kkkk.ajax').data('action', $(this).data('action'));
$('#kkkk.ajax').trigger('update', {orderby: $(this).data('orderby')});
});
$('body').on('click', 'table th a', function(ev){
ev.preventDefault();
$('#kkkk.ajax').data('action', $(this).data('action'));
$('#kkkk.ajax').trigger('update', {orderby: $(this).data('orderby'), orderdir: $(this).data('orderdir')});
2016-07-27 19:02:02 +00:00
});
});
<?php
} /* }}} */
function listReviews() { /* {{{ */
2012-12-14 07:53:13 +00:00
$dms = $this->params['dms'];
$user = $this->params['user'];
2016-08-09 15:16:04 +00:00
$orderby = $this->params['orderby'];
$orderdir = $this->params['orderdir'];
2013-01-24 09:25:20 +00:00
$cachedir = $this->params['cachedir'];
2014-03-18 09:55:24 +00:00
$previewwidth = $this->params['previewWidthList'];
$previewconverters = $this->params['previewconverters'];
2016-02-19 07:04:45 +00:00
$timeout = $this->params['timeout'];
2016-02-15 09:57:37 +00:00
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout);
$previewer->setConverters($previewconverters);
2012-12-14 07:53:13 +00:00
2013-02-02 15:56:35 +00:00
// Get document list for the current user.
$reviewStatus = $user->getReviewStatus();
2016-08-09 15:16:04 +00:00
$resArr = $dms->getDocumentList('AppRevByMe', $user, $orderby, $orderdir);
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.
*/
2013-02-02 15:56:35 +00:00
$docIdx = array();
foreach ($resArr as $res) {
$docIdx[$res["id"]][$res["version"]] = $res;
}
// List the documents for which a review has been requested.
$this->contentHeading(getMLText("documents_to_review"));
$printheader=true;
$iRev = array();
$dList = array();
foreach ($reviewStatus["indstatus"] as $st) {
2013-02-02 15:56:35 +00:00
if ( $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]]) && !in_array($st["documentID"], $dList) ) {
$dList[] = $st["documentID"];
$document = $dms->getDocument($st["documentID"]);
$document->verifyLastestContentExpriry();
if ($printheader){
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
2016-08-09 15:16:04 +00:00
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
2016-08-09 15:16:04 +00:00
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($document, $previewer, false, $st['version']);
}
2013-02-02 15:56:35 +00:00
}
}
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"]);
$document->verifyLastestContentExpriry();
2013-02-02 15:56:35 +00:00
if ($printheader){
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
2016-08-09 15:16:04 +00:00
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
2013-02-02 15:56:35 +00:00
2016-08-09 15:16:04 +00:00
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($document, $previewer, false, $st['version']);
}
2013-02-02 15:56:35 +00:00
}
}
if (!$printheader){
echo "</tbody>\n</table>";
}else{
printMLText("no_docs_to_review");
}
2016-07-27 19:02:02 +00:00
} else {
$this->contentHeading(getMLText("documents_to_review"));
$this->contentContainerStart();
printMLText("no_review_needed");
$this->contentContainerEnd();
2016-07-27 19:02:02 +00:00
}
} /* }}} */
function listApprovals() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
2016-08-09 15:16:04 +00:00
$orderby = $this->params['orderby'];
$orderdir = $this->params['orderdir'];
2016-07-27 19:02:02 +00:00
$cachedir = $this->params['cachedir'];
$previewwidth = $this->params['previewWidthList'];
$previewconverters = $this->params['previewconverters'];
$timeout = $this->params['timeout'];
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout);
$previewer->setConverters($previewconverters);
$approvalStatus = $user->getApprovalStatus();
2016-08-09 15:16:04 +00:00
$resArr = $dms->getDocumentList('AppRevByMe', $user, $orderby, $orderdir);
2016-07-27 19:02:02 +00:00
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) {
$docIdx[$res["id"]][$res["version"]] = $res;
2013-02-02 15:56:35 +00:00
}
// List the documents for which an approval has been requested.
2013-02-02 15:56:35 +00:00
$this->contentHeading(getMLText("documents_to_approve"));
$printheader=true;
foreach ($approvalStatus["indstatus"] as $st) {
if ( $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]]) && $docIdx[$st["documentID"]][$st["version"]]['status'] == S_DRAFT_APP) {
2013-02-02 15:56:35 +00:00
$document = $dms->getDocument($st["documentID"]);
$document->verifyLastestContentExpriry();
2013-02-02 15:56:35 +00:00
if ($printheader){
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
2016-08-09 15:16:04 +00:00
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
2013-02-02 15:56:35 +00:00
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
2016-08-09 15:16:04 +00:00
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($document, $previewer, false, $st['version']);
2013-02-02 15:56:35 +00:00
}
}
}
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"]]['status'] == S_DRAFT_APP /* && $docIdx[$st["documentID"]][$st["version"]]['owner'] != $user->getId() */) {
2013-06-17 13:50:28 +00:00
$document = $dms->getDocument($st["documentID"]);
$document->verifyLastestContentExpriry();
2013-02-02 15:56:35 +00:00
if ($printheader){
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
2016-08-09 15:16:04 +00:00
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
2013-02-02 15:56:35 +00:00
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
2016-08-09 15:16:04 +00:00
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($document, $previewer, false, $st['version']);
2013-02-02 15:56:35 +00:00
}
}
}
if (!$printheader){
echo "</tbody>\n</table>\n";
}else{
printMLText("no_docs_to_approve");
}
}
else {
$this->contentHeading(getMLText("documents_to_approve"));
$this->contentContainerStart();
printMLText("no_approval_needed");
$this->contentContainerEnd();
}
2016-07-27 19:02:02 +00:00
} /* }}} */
2012-12-14 07:53:13 +00:00
2016-07-27 19:02:02 +00:00
function listDocsToLookAt() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
2016-08-09 15:16:04 +00:00
$orderby = $this->params['orderby'];
$orderdir = $this->params['orderdir'];
2016-07-27 19:02:02 +00:00
$workflowmode = $this->params['workflowmode'];
$cachedir = $this->params['cachedir'];
$previewwidth = $this->params['previewWidthList'];
$previewconverters = $this->params['previewconverters'];
$timeout = $this->params['timeout'];
2012-12-14 07:53:13 +00:00
2016-07-27 19:02:02 +00:00
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout);
$previewer->setConverters($previewconverters);
2016-07-27 19:02:02 +00:00
if($workflowmode != 'advanced') {
/* Get list of documents owned by current user that are
* pending review or pending approval.
*/
2016-08-09 15:16:04 +00:00
$resArr = $dms->getDocumentList('AppRevOwner', $user, $orderby, $orderdir);
2016-07-27 19:02:02 +00:00
if (is_bool($resArr) && !$resArr) {
$this->contentHeading(getMLText("warning"));
$this->contentContainer(getMLText("internal_error_exit"));
$this->htmlEndPage();
exit;
}
2016-07-27 19:02:02 +00:00
$this->contentHeading(getMLText("documents_user_requiring_attention"));
if (count($resArr)>0) {
2016-07-27 19:02:02 +00:00
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>";
2016-08-09 15:16:04 +00:00
print "<th><a data-action=\"listDocsToLookAt\" data-orderby=\"n\" data-orderdir=\"".($orderdir == 'desc' ? '' : 'desc')."\">".getMLText("name")."</a> ".($orderby == 'n' || $orderby == '' ? ($orderdir == 'desc' ? '<i class="icon-arrow-up"></i>' : '<i class="icon-arrow-down"></i>') : '')." / <a data-action=\"listDocsToLookAt\" data-orderby=\"u\" data-orderdir=\"".($orderdir == 'desc' ? '' : 'desc')."\">".getMLText("last_update")."</a> ".($orderby == 'u' ? ($orderdir == 'desc' ? '<i class="icon-arrow-up"></i>' : '<i class="icon-arrow-down"></i>') : '')." / <a data-action=\"listDocsToLookAt\" data-orderby=\"e\" data-orderdir=\"".($orderdir == 'desc' ? '' : 'desc')."\">".getMLText("expires")."</a> ".($orderby == 'e' ? ($orderdir == 'desc' ? '<i class="icon-arrow-up"></i>' : '<i class="icon-arrow-down"></i>') : '')."</th>\n";
2016-07-27 19:02:02 +00:00
print "<th>".getMLText("status")."</th>\n";
2016-08-09 15:16:04 +00:00
print "<th>".getMLText("action")."</th>\n";
2016-07-27 19:02:02 +00:00
print "</tr>\n</thead>\n<tbody>\n";
2016-07-27 19:02:02 +00:00
foreach ($resArr as $res) {
$document = $dms->getDocument($res["documentID"]);
$document->verifyLastestContentExpriry();
2016-08-09 15:16:04 +00:00
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($document, $previewer, false, $res['version']);
}
2016-07-27 19:02:02 +00:00
}
print "</tbody></table>";
2012-12-14 07:53:13 +00:00
}
2016-07-27 19:02:02 +00:00
else printMLText("no_docs_to_look_at");
} else {
2016-08-09 15:16:04 +00:00
$resArr = $dms->getDocumentList('WorkflowOwner', $user, $orderby, $orderdir);
2015-07-03 18:52:55 +00:00
if (is_bool($resArr) && !$resArr) {
$this->contentHeading(getMLText("warning"));
2016-07-27 19:02:02 +00:00
$this->contentContainer("Internal error. Unable to complete request. Exiting.");
2015-07-08 16:59:14 +00:00
$this->htmlEndPage();
exit;
}
2016-07-27 19:02:02 +00:00
$this->contentHeading(getMLText("documents_user_requiring_attention"));
2015-07-08 16:59:14 +00:00
if (count($resArr)>0) {
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
2016-08-09 15:16:04 +00:00
print "<th>".getMLText("action")."</th>\n";
2015-07-08 16:59:14 +00:00
print "</tr>\n</thead>\n<tbody>\n";
foreach ($resArr as $res) {
$document = $dms->getDocument($res["documentID"]);
$document->verifyLastestContentExpriry();
2015-07-08 16:59:14 +00:00
2016-08-09 15:16:04 +00:00
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($document, $previewer, false, $res['version']);
2015-07-08 16:59:14 +00:00
}
}
print "</tbody></table>";
}
2016-07-27 19:02:02 +00:00
else printMLText("no_docs_to_look_at");
}
} /* }}} */
function listMyDocs() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$orderby = $this->params['orderby'];
$orderdir = $this->params['orderdir'];
2016-07-27 19:02:02 +00:00
$cachedir = $this->params['cachedir'];
$showtree = $this->params['showtree'];
2016-07-27 19:02:02 +00:00
$previewwidth = $this->params['previewWidthList'];
$previewconverters = $this->params['previewconverters'];
$timeout = $this->params['timeout'];
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout);
$previewer->setConverters($previewconverters);
/* Get list of documents owned by current user */
2016-08-09 15:16:04 +00:00
$resArr = $dms->getDocumentList('MyDocs', $user, $orderby, $orderdir);
2016-07-27 19:02:02 +00:00
if (is_bool($resArr) && !$resArr) {
$this->contentHeading(getMLText("warning"));
$this->contentContainer(getMLText("internal_error_exit"));
$this->htmlEndPage();
exit;
}
$this->contentHeading(getMLText("all_documents"));
if (count($resArr)>0) {
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>";
2016-08-09 15:16:04 +00:00
print "<th><a data-action=\"listMyDocs\" data-orderby=\"n\" data-orderdir=\"".($orderdir == 'desc' ? '' : 'desc')."\">".getMLText("name")."</a> ".($orderby == 'n' || $orderby == '' ? ($orderdir == 'desc' ? '<i class="icon-arrow-up"></i>' : '<i class="icon-arrow-down"></i>') : '')." / <a data-action=\"listMyDocs\" data-orderby=\"u\" data-orderdir=\"".($orderdir == 'desc' ? '' : 'desc')."\">".getMLText("last_update")."</a> ".($orderby == 'u' ? ($orderdir == 'desc' ? '<i class="icon-arrow-up"></i>' : '<i class="icon-arrow-down"></i>') : '')." / <a data-action=\"listMyDocs\" data-orderby=\"e\" data-orderdir=\"".($orderdir == 'desc' ? '' : 'desc')."\">".getMLText("expires")."</a> ".($orderby == 'e' ? ($orderdir == 'desc' ? '<i class="icon-arrow-up"></i>' : '<i class="icon-arrow-down"></i>') : '')."</th>\n";
print "<th><a data-action=\"listMyDocs\" data-orderby=\"s\">".getMLText("status")."</a></th>\n";
print "<th>".getMLText("action")."</th>\n";
2016-07-27 19:02:02 +00:00
print "</tr>\n</thead>\n<tbody>\n";
foreach ($resArr as $res) {
$document = $dms->getDocument($res["documentID"]);
$document->verifyLastestContentExpriry();
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($document, $previewer, false, $res['version']);
}
2012-12-14 07:53:13 +00:00
}
2016-07-27 19:02:02 +00:00
print "</tbody></table>";
}
else printMLText("empty_notify_list");
} /* }}} */
2012-12-14 07:53:13 +00:00
2016-07-27 19:02:02 +00:00
function listWorkflow() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
2016-08-09 15:16:04 +00:00
$orderby = $this->params['orderby'];
$orderdir = $this->params['orderdir'];
2016-07-27 19:02:02 +00:00
$cachedir = $this->params['cachedir'];
$previewwidth = $this->params['previewWidthList'];
$previewconverters = $this->params['previewconverters'];
$timeout = $this->params['timeout'];
2012-12-14 07:53:13 +00:00
2016-07-27 19:02:02 +00:00
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout);
$previewer->setConverters($previewconverters);
2012-12-14 07:53:13 +00:00
2016-07-27 19:02:02 +00:00
// Get document list for the current user.
$workflowStatus = $user->getWorkflowStatus();
2016-08-09 15:16:04 +00:00
$resArr = $dms->getDocumentList('WorkflowByMe', $user, $orderby, $orderdir);
2016-07-27 19:02:02 +00:00
if (is_bool($resArr) && !$resArr) {
$this->contentHeading(getMLText("warning"));
$this->contentContainer(getMLText("internal_error_exit"));
$this->htmlEndPage();
exit;
}
if (count($resArr)>0) {
// 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) {
$docIdx[$res["id"]][$res["version"]] = $res;
}
// List the documents where a review has been requested.
$this->contentHeading(getMLText("documents_to_process"));
$printheader=true;
$iRev = array();
$dList = array();
foreach ($workflowStatus["u"] as $st) {
if ( isset($docIdx[$st["document"]][$st["version"]]) && !in_array($st["document"], $dList) ) {
$dList[] = $st["document"];
$document = $dms->getDocument($st["document"]);
$document->verifyLastestContentExpriry();
2012-12-14 07:53:13 +00:00
2016-07-27 19:02:02 +00:00
if ($printheader){
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
2016-08-09 15:16:04 +00:00
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
2016-07-27 19:02:02 +00:00
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
2016-08-09 15:16:04 +00:00
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($document, $previewer, false, $st['version']);
2013-01-24 09:25:20 +00:00
}
2016-07-27 19:02:02 +00:00
}
2012-12-14 07:53:13 +00:00
}
2016-07-27 19:02:02 +00:00
foreach ($workflowStatus["g"] as $st) {
if (!in_array($st["document"], $iRev) && isset($docIdx[$st["document"]][$st["version"]]) && !in_array($st["document"], $dList) /* && $docIdx[$st["documentID"]][$st["version"]]['owner'] != $user->getId() */) {
$dList[] = $st["document"];
$document = $dms->getDocument($st["document"]);
$document->verifyLastestContentExpriry();
2015-04-23 14:44:55 +00:00
2016-07-27 19:02:02 +00:00
if ($printheader){
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
2016-08-09 15:16:04 +00:00
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
2016-07-27 19:02:02 +00:00
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
2015-04-23 14:44:55 +00:00
2016-08-09 15:16:04 +00:00
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($document, $previewer, false, $st['version']);
2016-07-27 19:02:02 +00:00
}
}
}
if (!$printheader){
echo "</tbody>\n</table>";
}else{
printMLText("no_docs_to_check");
2015-04-23 14:44:55 +00:00
}
2016-07-27 19:02:02 +00:00
}
2015-04-23 14:44:55 +00:00
2016-07-27 19:02:02 +00:00
} /* }}} */
2015-04-23 14:44:55 +00:00
2016-07-27 19:02:02 +00:00
function listRevisions() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
2016-08-09 15:16:04 +00:00
$orderby = $this->params['orderby'];
$orderdir = $this->params['orderdir'];
2016-07-27 19:02:02 +00:00
$cachedir = $this->params['cachedir'];
$previewwidth = $this->params['previewWidthList'];
$previewconverters = $this->params['previewconverters'];
$timeout = $this->params['timeout'];
2015-04-23 14:44:55 +00:00
2016-07-27 19:02:02 +00:00
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout);
$previewer->setConverters($previewconverters);
// Get document list for the current user.
$revisionStatus = $user->getRevisionStatus();
2016-08-09 15:16:04 +00:00
$resArr = $dms->getDocumentList('ReviseByMe', $user, $orderby, $orderdir);
2016-07-27 19:02:02 +00:00
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) {
$docIdx[$res["id"]][$res["version"]] = $res;
}
$this->contentHeading(getMLText("documents_to_revise"));
$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"]);
2016-08-09 15:16:04 +00:00
$document->verifyLastestContentExpriry();
2015-04-23 14:44:55 +00:00
2016-07-27 19:02:02 +00:00
if ($printheader){
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
2016-08-09 15:16:04 +00:00
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
2016-07-27 19:02:02 +00:00
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
2015-04-23 14:44:55 +00:00
}
2016-08-09 15:16:04 +00:00
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($document, $previewer, false, $st['version']);
2015-04-23 14:44:55 +00:00
}
2016-07-27 19:02:02 +00:00
}
2015-04-23 14:44:55 +00:00
}
2016-07-27 19:02:02 +00:00
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"]);
2016-08-09 15:16:04 +00:00
$document->verifyLastestContentExpriry();
2015-04-23 14:44:55 +00:00
2016-07-27 19:02:02 +00:00
if ($printheader){
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
2016-08-09 15:16:04 +00:00
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
2016-07-27 19:02:02 +00:00
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
2015-04-23 14:44:55 +00:00
2016-08-09 15:16:04 +00:00
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($document, $previewer, false, $st['version']);
2016-07-27 19:02:02 +00:00
}
}
}
if (!$printheader){
echo "</tbody>\n</table>";
}else{
printMLText("no_docs_to_revise");
}
2012-12-14 07:53:13 +00:00
}
else {
2016-07-27 19:02:02 +00:00
$this->contentHeading(getMLText("documents_to_revise"));
2012-12-14 07:53:13 +00:00
$this->contentContainerStart();
2016-07-27 19:02:02 +00:00
printMLText("no_revision_needed");
$this->contentContainerEnd();
}
} /* }}} */
2012-12-14 07:53:13 +00:00
2016-07-27 19:02:02 +00:00
function listReceipts() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
2016-08-09 15:16:04 +00:00
$orderby = $this->params['orderby'];
$orderdir = $this->params['orderdir'];
2016-07-27 19:02:02 +00:00
$cachedir = $this->params['cachedir'];
$previewwidth = $this->params['previewWidthList'];
$previewconverters = $this->params['previewconverters'];
$timeout = $this->params['timeout'];
2012-12-14 07:53:13 +00:00
2016-07-27 19:02:02 +00:00
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout);
$previewer->setConverters($previewconverters);
2012-12-14 07:53:13 +00:00
2016-07-27 19:02:02 +00:00
$receiptStatus = $user->getReceiptStatus();
2016-08-09 15:16:04 +00:00
$resArr = $dms->getDocumentList('ReceiptByMe', $user, $orderby, $orderdir);
2016-07-27 19:02:02 +00:00
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) {
$docIdx[$res["id"]][$res["version"]] = $res;
}
$this->contentHeading(getMLText("documents_to_receipt"));
$printheader=true;
$iRev = array();
$dList = array();
foreach ($receiptStatus["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"]);
2016-08-09 15:16:04 +00:00
$document->verifyLastestContentExpriry();
2012-12-14 07:53:13 +00:00
2016-07-27 19:02:02 +00:00
if ($printheader){
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
2016-08-09 15:16:04 +00:00
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
2016-07-27 19:02:02 +00:00
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
2012-12-14 07:53:13 +00:00
}
2016-08-09 15:16:04 +00:00
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($document, $previewer, false, $st['version']);
2013-01-24 09:25:20 +00:00
}
2012-12-14 07:53:13 +00:00
}
}
2016-07-27 19:02:02 +00:00
foreach ($receiptStatus["grpstatus"] as $st) {
2012-12-14 07:53:13 +00:00
2016-07-27 19:02:02 +00:00
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"]);
2016-08-09 15:16:04 +00:00
$document->verifyLastestContentExpriry();
2016-07-27 19:02:02 +00:00
if ($printheader){
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
2016-08-09 15:16:04 +00:00
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
2016-07-27 19:02:02 +00:00
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
2016-08-09 15:16:04 +00:00
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($document, $previewer, false, $st['version']);
2016-07-27 19:02:02 +00:00
}
}
}
if (!$printheader){
echo "</tbody>\n</table>";
}else{
printMLText("no_docs_to_receipt");
}
}
else {
$this->contentHeading(getMLText("documents_to_receipt"));
$this->contentContainerStart();
printMLText("no_receipt_needed");
2012-12-14 07:53:13 +00:00
$this->contentContainerEnd();
}
2016-07-27 19:02:02 +00:00
} /* }}} */
function listRejects() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
2016-08-09 15:16:04 +00:00
$orderby = $this->params['orderby'];
$orderdir = $this->params['orderdir'];
2016-07-27 19:02:02 +00:00
$cachedir = $this->params['cachedir'];
$previewwidth = $this->params['previewWidthList'];
$previewconverters = $this->params['previewconverters'];
$timeout = $this->params['timeout'];
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout);
$previewer->setConverters($previewconverters);
/* Get list of documents owned by current user that has
* been rejected.
*/
2016-08-09 15:16:04 +00:00
$resArr = $dms->getDocumentList('RejectOwner', $user, $orderby, $orderdir);
2016-07-27 19:02:02 +00:00
if (is_bool($resArr) && !$resArr) {
$this->contentHeading(getMLText("warning"));
$this->contentContainer(getMLText("internal_error_exit"));
$this->htmlEndPage();
exit;
}
if (count($resArr)>0) {
$this->contentHeading(getMLText("documents_user_rejected"));
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
2016-08-09 15:16:04 +00:00
print "<th>".getMLText("action")."</th>\n";
2016-07-27 19:02:02 +00:00
print "</tr>\n</thead>\n<tbody>\n";
foreach ($resArr as $res) {
$document = $dms->getDocument($res["documentID"]);
$document->verifyLastestContentExpriry();
2016-08-09 15:16:04 +00:00
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($document, $previewer, false, $res['version']);
2016-07-27 19:02:02 +00:00
}
}
print "</tbody></table>";
}
} /* }}} */
function listLockedDocs() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
2016-08-09 15:16:04 +00:00
$orderby = $this->params['orderby'];
$orderdir = $this->params['orderdir'];
2016-07-27 19:02:02 +00:00
$cachedir = $this->params['cachedir'];
$previewwidth = $this->params['previewWidthList'];
$previewconverters = $this->params['previewconverters'];
$timeout = $this->params['timeout'];
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout);
$previewer->setConverters($previewconverters);
/* Get list of documents locked by current user */
2016-08-09 15:16:04 +00:00
$resArr = $dms->getDocumentList('LockedByMe', $user, $orderby, $orderdir);
2016-07-27 19:02:02 +00:00
if (is_bool($resArr) && !$resArr) {
$this->contentHeading(getMLText("warning"));
$this->contentContainer(getMLText("internal_error_exit"));
$this->htmlEndPage();
exit;
}
$this->contentHeading(getMLText("documents_locked_by_you"));
if (count($resArr)>0) {
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
2016-08-09 15:16:04 +00:00
print "<th>".getMLText("action")."</th>\n";
2016-07-27 19:02:02 +00:00
print "</tr>\n</thead>\n<tbody>\n";
foreach ($resArr as $res) {
$document = $dms->getDocument($res["documentID"]);
2016-08-09 15:16:04 +00:00
$document->verifyLastestContentExpriry();
2016-07-27 19:02:02 +00:00
2016-08-09 15:16:04 +00:00
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($document, $previewer, false, $res['version']);
2016-07-27 19:02:02 +00:00
}
}
print "</tbody></table>";
}
else printMLText("no_docs_locked");
} /* }}} */
function listCheckedoutDocs() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
2016-08-09 15:16:04 +00:00
$orderby = $this->params['orderby'];
$orderdir = $this->params['orderdir'];
2016-07-27 19:02:02 +00:00
$cachedir = $this->params['cachedir'];
$previewwidth = $this->params['previewWidthList'];
$previewconverters = $this->params['previewconverters'];
$timeout = $this->params['timeout'];
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout);
$previewer->setConverters($previewconverters);
/* Get list of documents checked out by current user */
2016-08-09 15:16:04 +00:00
$resArr = $dms->getDocumentList('CheckedOutByMe', $user, $orderby, $orderdir);
2016-07-27 19:02:02 +00:00
if (is_bool($resArr) && !$resArr) {
$this->contentHeading(getMLText("warning"));
$this->contentContainer(getMLText("internal_error_exit"));
$this->htmlEndPage();
exit;
}
$this->contentHeading(getMLText("documents_checked_out_by_you"));
// $this->contentContainerStart();
if (count($resArr)>0) {
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
2016-08-09 15:16:04 +00:00
print "<th>".getMLText("action")."</th>\n";
2016-07-27 19:02:02 +00:00
print "</tr>\n</thead>\n<tbody>\n";
foreach ($resArr as $res) {
$document = $dms->getDocument($res["documentID"]);
2016-08-09 15:16:04 +00:00
$document->verifyLastestContentExpriry();
2016-07-27 19:02:02 +00:00
2016-08-09 15:16:04 +00:00
$txt = $this->callHook('documentListItem', $document, $previewer);
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($document, $previewer, false, $res['version']);
2016-07-27 19:02:02 +00:00
}
}
print "</tbody></table>";
}
else printMLText("no_docs_checked_out");
// $this->contentContainerEnd();
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$orderby = $this->params['orderby'];
$orderdir = $this->params['orderdir'];
2016-07-27 19:02:02 +00:00
$showInProcess = $this->params['showinprocess'];
$cachedir = $this->params['cachedir'];
$workflowmode = $this->params['workflowmode'];
$previewwidth = $this->params['previewWidthList'];
$previewconverters = $this->params['previewconverters'];
$timeout = $this->params['timeout'];
$db = $dms->getDB();
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout);
$previewer->setConverters($previewconverters);
$this->htmlStartPage(getMLText("my_documents"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("my_documents"), "my_documents");
if($showInProcess) {
echo '<div class="row-fluid">';
echo '<div class="span3">';
echo '<ul class="nav nav-list bs-docs-sidenav _affix">';
$resArr = $dms->getDocumentList('MyDocs', $user);
echo '<li class=""><a data-href="#all_documents" data-action="listMyDocs"><span class="badge '.($resArr ? 'badge-info ' : '').'badge-right">'.count($resArr).'</span>'.getMLText("all_documents").'</a></li>';
2016-07-27 19:02:02 +00:00
if($workflowmode == 'traditional') {
$resArr = $dms->getDocumentList('AppRevByMe', $user);
echo '<li class=""><a data-href="#documents_to_review" data-action="listReviews"><span class="badge '.($resArr ? 'badge-info ' : '').'badge-right">'.count($resArr).'</span>'.getMLText("documents_to_review").'</a></li>';
2016-07-27 19:02:02 +00:00
}
if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
$resArr = $dms->getDocumentList('AppRevByMe', $user);
echo '<li class=""><a data-href="#documents_to_approve" data-action="listApprovals"><span class="badge '.($resArr ? 'badge-info ' : '').'badge-right">'.count($resArr).'</span>'.getMLText("documents_to_approve").'</a></li>';
2016-07-27 19:02:02 +00:00
} else {
$resArr = $dms->getDocumentList('WorkflowByMe', $user);
echo '<li class=""><a data-href="#documents_to_process" data-action="listWorkflow"><span class="badge '.($resArr ? 'badge-info ' : '').'badge-right">'.count($resArr).'</span>'.getMLText("documents_to_process").'</a></li>';
2016-07-27 19:02:02 +00:00
}
$resArr = $dms->getDocumentList('AppRevOwner', $user);
echo '<li class=""><a data-href="#documents_user_requiring_attention" data-action="listDocsToLookAt"><span class="badge '.($resArr ? 'badge-info ' : '').'badge-right">'.count($resArr).'</span>'.getMLText("documents_user_requiring_attention").'</a></li>';
2016-07-27 19:02:02 +00:00
$resArr = $dms->getDocumentList('ReviseByMe', $user);
echo '<li class=""><a data-href="#documents_to_revise" data-action="listRevisions"><span class="badge '.($resArr ? 'badge-info ' : '').'badge-right">'.count($resArr).'</span>'.getMLText("documents_to_revise").'</a></li>';
2016-07-27 19:02:02 +00:00
$resArr = $dms->getDocumentList('ReceiptByMe', $user);
echo '<li class=""><a data-href="#documents_to_receipt" data-action="listReceipts"><span class="badge '.($resArr ? 'badge-info ' : '').'badge-right">'.count($resArr).'</span>'.getMLText("documents_to_receipt").'</a></li>';
2016-07-27 19:02:02 +00:00
$resArr = $dms->getDocumentList('RejectOwner', $user);
echo '<li class=""><a data-href="#documents_user_rejected" data-action="listRejects"><span class="badge '.($resArr ? 'badge-info ' : '').'badge-right">'.count($resArr).'</span>'.getMLText("documents_user_rejected").'</a></li>';
2016-07-27 19:02:02 +00:00
$resArr = $dms->getDocumentList('LockedByMe', $user);
echo '<li class=""><a data-href="#documents_locked_by_you" data-action="listLockedDocs"><span class="badge '.($resArr ? 'badge-info ' : '').'badge-right">'.count($resArr).'</span>'.getMLText("documents_locked_by_you").'</a></li>';
2016-07-27 19:02:02 +00:00
$resArr = $dms->getDocumentList('CheckedOutByMe', $user);
echo '<li class=""><a data-href="#documents_checked_out_by_you" data-action="listCheckedoutDocs"><span class="badge '.($resArr ? 'badge-info ' : '').'badge-right">'.count($resArr).'</span>'.getMLText("documents_checked_out_by_you").'</a></li>';
2016-07-27 19:02:02 +00:00
echo '</ul>';
echo '</div>';
echo '<div class="span9">';
echo '<div id="kkkk" class="ajax" data-view="MyDocuments" data-action="listReviews"></div>';
echo '</div>';
echo '</div>';
} else {
echo '<div class="ajax" data-view="MyDocuments" data-action="listMyDocs"></div>';
}
$this->contentEnd();
2012-12-14 07:53:13 +00:00
$this->htmlEndPage();
} /* }}} */
}
?>