2013-01-24 10:35:33 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Implementation of RewindWorkflow view
|
|
|
|
*
|
|
|
|
* @category DMS
|
2013-02-14 11:10:53 +00:00
|
|
|
* @package SeedDMS
|
2013-01-24 10:35:33 +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
|
|
|
|
*/
|
2021-04-18 05:08:00 +00:00
|
|
|
//require_once("class.Bootstrap.php");
|
2013-01-24 10:35:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class which outputs the html page for Rewindorkflow view
|
|
|
|
*
|
|
|
|
* @category DMS
|
2013-02-14 11:10:53 +00:00
|
|
|
* @package SeedDMS
|
2013-01-24 10:35:33 +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@
|
|
|
|
*/
|
2021-04-18 05:08:00 +00:00
|
|
|
class SeedDMS_View_RewindWorkflow extends SeedDMS_Theme_Style {
|
2013-01-24 10:35:33 +00:00
|
|
|
|
|
|
|
function show() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$folder = $this->params['folder'];
|
2021-08-20 09:16:03 +00:00
|
|
|
$accessobject = $this->params['accessobject'];
|
2013-01-24 10:35:33 +00:00
|
|
|
$document = $this->params['document'];
|
|
|
|
|
|
|
|
$latestContent = $document->getLatestContent();
|
|
|
|
|
|
|
|
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
|
|
|
|
$this->globalNavigation($folder);
|
|
|
|
$this->contentStart();
|
2013-03-08 16:55:14 +00:00
|
|
|
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
|
2013-01-24 10:35:33 +00:00
|
|
|
$this->contentHeading(getMLText("rewind_workflow"));
|
|
|
|
|
|
|
|
$currentstate = $latestContent->getWorkflowState();
|
2021-08-20 06:46:18 +00:00
|
|
|
$wkflogs = $latestContent->getWorkflowLog();
|
|
|
|
$wkflog = array_shift($wkflogs);
|
2013-01-24 10:35:33 +00:00
|
|
|
$workflow = $latestContent->getWorkflow();
|
|
|
|
|
2021-06-01 08:52:45 +00:00
|
|
|
if($currentstate) {
|
|
|
|
$msg = "The document is currently in state: ".$currentstate->getName()."<br />";
|
|
|
|
if($wkflog) {
|
|
|
|
foreach($wkflog as $entry) {
|
|
|
|
if($entry->getTransition()->getNextState()->getID() == $currentstate->getID()) {
|
|
|
|
$enterdate = $entry->getDate();
|
|
|
|
$enterts = makeTsFromLongDate($enterdate);
|
|
|
|
}
|
2013-01-24 10:35:33 +00:00
|
|
|
}
|
2021-08-20 07:45:58 +00:00
|
|
|
if(!empty($enterdate)) {
|
|
|
|
$msg .= "The state was entered at ".$enterdate." which was ";
|
|
|
|
$msg .= getReadableDuration((time()-$enterts))." ago.<br />";
|
|
|
|
}
|
2013-01-24 10:35:33 +00:00
|
|
|
}
|
2021-06-01 08:52:45 +00:00
|
|
|
$msg .= "The document may stay in this state for ".$currentstate->getMaxTime()." sec.";
|
|
|
|
} else {
|
|
|
|
$msg = getMLText('workflow_in_unknown_state');
|
2013-01-24 10:35:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Display the Workflow form.
|
2020-10-08 05:57:23 +00:00
|
|
|
$this->rowStart();
|
|
|
|
$this->columnStart(4);
|
2021-08-20 07:45:58 +00:00
|
|
|
$this->infoMsg($msg);
|
|
|
|
$this->warningMsg(getMLText("rewind_workflow_warning"));
|
2013-01-24 10:35:33 +00:00
|
|
|
?>
|
2016-03-18 16:12:53 +00:00
|
|
|
<form method="post" action="../op/op.RewindWorkflow.php" name="form1">
|
2013-01-24 10:35:33 +00:00
|
|
|
<?php echo createHiddenFieldWithKey('rewindworkflow'); ?>
|
|
|
|
<input type='hidden' name='documentid' value='<?php echo $document->getId(); ?>'/>
|
|
|
|
<input type='hidden' name='version' value='<?php echo $latestContent->getVersion(); ?>'/>
|
2021-04-18 05:08:00 +00:00
|
|
|
<button type='submit' class="btn btn-danger"><i class="fa fa-refresh"></i> <?php printMLText("rewind_workflow"); ?></button>
|
2013-01-24 10:35:33 +00:00
|
|
|
</form>
|
2020-10-08 05:57:23 +00:00
|
|
|
<?php
|
|
|
|
$this->columnEnd();
|
|
|
|
$this->columnStart(8);
|
|
|
|
?>
|
|
|
|
<div id="workflowgraph">
|
2021-08-20 09:16:03 +00:00
|
|
|
<?php
|
|
|
|
if($accessobject->check_view_access('WorkflowGraph')) {
|
|
|
|
?>
|
2021-08-20 07:45:58 +00:00
|
|
|
<iframe src="out.WorkflowGraph.php?workflow=<?php echo $workflow->getID(); ?>" width="100%" height="600" style="border: 1px solid #AAA;"></iframe>
|
2021-08-20 09:16:03 +00:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2013-01-24 10:35:33 +00:00
|
|
|
</div>
|
|
|
|
<?php
|
2020-10-08 05:57:23 +00:00
|
|
|
$this->columnEnd();
|
|
|
|
$this->rowEnd();
|
2013-01-24 10:35:33 +00:00
|
|
|
|
|
|
|
if($wkflog) {
|
2021-08-20 07:45:58 +00:00
|
|
|
$this->contentHeading(getMLText("workflow_log"));
|
2021-04-18 05:08:00 +00:00
|
|
|
echo "<table class=\"table table-condensed table-sm\">";
|
2013-01-24 10:35:33 +00:00
|
|
|
echo "<tr><th>".getMLText('action')."</th><th>Start state</th><th>End state</th><th>".getMLText('date')."</th><th>".getMLText('user')."</th><th>".getMLText('comment')."</th></tr>";
|
|
|
|
foreach($wkflog as $entry) {
|
|
|
|
echo "<tr>";
|
2021-08-20 07:45:58 +00:00
|
|
|
echo "<td>".htmlspecialchars(getMLText('action_'.$entry->getTransition()->getAction()->getName()))."</td>";
|
|
|
|
echo "<td>".htmlspecialchars($entry->getTransition()->getState()->getName())."</td>";
|
|
|
|
echo "<td>".htmlspecialchars($entry->getTransition()->getNextState()->getName())."</td>";
|
2013-01-24 10:35:33 +00:00
|
|
|
echo "<td>".$entry->getDate()."</td>";
|
2021-08-20 07:45:58 +00:00
|
|
|
echo "<td>".htmlspecialchars($entry->getUser()->getFullname())."</td>";
|
|
|
|
echo "<td>".htmlspecialchars($entry->getComment())."</td>";
|
2013-01-24 10:35:33 +00:00
|
|
|
echo "</tr>";
|
|
|
|
}
|
|
|
|
echo "</table>\n";
|
|
|
|
}
|
|
|
|
|
2016-03-15 07:30:53 +00:00
|
|
|
$this->contentEnd();
|
2013-01-24 10:35:33 +00:00
|
|
|
$this->htmlEndPage();
|
|
|
|
} /* }}} */
|
|
|
|
}
|
|
|
|
?>
|