2017-03-20 11:41:21 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Implementation of Tasks view
|
|
|
|
*
|
|
|
|
* @category DMS
|
|
|
|
* @package SeedDMS
|
|
|
|
* @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-15 13:36:32 +00:00
|
|
|
//require_once("class.Bootstrap.php");
|
2017-03-20 11:41:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class which outputs the html page for clipboard view
|
|
|
|
*
|
|
|
|
* @category DMS
|
|
|
|
* @package SeedDMS
|
|
|
|
* @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-15 13:36:32 +00:00
|
|
|
class SeedDMS_View_Tasks extends SeedDMS_Theme_Style {
|
2017-03-20 11:41:21 +00:00
|
|
|
|
|
|
|
private function __myTasks() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
2018-04-03 07:32:36 +00:00
|
|
|
$enablereceiptworkflow = $this->params['enablereceiptworkflow'];
|
|
|
|
$enablerevisionworkflow = $this->params['enablerevisionworkflow'];
|
2018-03-27 15:47:58 +00:00
|
|
|
$workflowmode = $this->params['workflowmode'];
|
2018-03-26 08:04:05 +00:00
|
|
|
$tasksinmenu = $this->params['tasksinmenu'];
|
2019-12-20 09:54:42 +00:00
|
|
|
$tasks = array();
|
2021-02-09 08:18:21 +00:00
|
|
|
/*
|
2019-02-12 11:12:11 +00:00
|
|
|
if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
|
2018-03-27 15:47:58 +00:00
|
|
|
$tasks['approval'] = array();
|
2019-02-12 11:12:11 +00:00
|
|
|
if($workflowmode == 'traditional')
|
|
|
|
$tasks['review'] = array();
|
|
|
|
} elseif($workflowmode == 'advanced')
|
2018-03-27 15:47:58 +00:00
|
|
|
$tasks['workflow'] = array();
|
2020-10-23 15:06:19 +00:00
|
|
|
$tasks['rejected'] = array();
|
2020-10-23 15:56:11 +00:00
|
|
|
$tasks['checkedout'] = array();
|
2021-02-09 08:18:21 +00:00
|
|
|
*/
|
2018-03-27 15:47:58 +00:00
|
|
|
|
2018-03-27 16:07:08 +00:00
|
|
|
if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval')
|
|
|
|
if(!$tasksinmenu || in_array('approval', $tasksinmenu)) {
|
|
|
|
$tasks['approval'] = array();
|
2021-02-05 06:30:00 +00:00
|
|
|
$resArr = $dms->getDocumentList('ApproveByMe', $user, false, '', '', false);
|
2018-03-27 16:07:08 +00:00
|
|
|
if($resArr) {
|
2019-02-01 08:30:32 +00:00
|
|
|
$docs = array();
|
2018-03-27 16:07:08 +00:00
|
|
|
foreach ($resArr as $res) {
|
|
|
|
$document = $dms->getDocument($res["id"]);
|
2020-12-16 15:51:00 +00:00
|
|
|
if($document && $document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
2019-02-01 08:30:32 +00:00
|
|
|
$docs[] = $document;
|
2018-03-27 16:07:08 +00:00
|
|
|
}
|
2018-03-26 08:04:05 +00:00
|
|
|
}
|
2019-02-04 10:18:44 +00:00
|
|
|
if($this->hasHook('filterApprovalTaskList'))
|
|
|
|
$docs = $this->callHook('filterApprovalTaskList', $docs);
|
|
|
|
foreach($docs as $doc)
|
|
|
|
$tasks['approval'][] = array('id'=>$doc->getId(), 'name'=>$doc->getName());
|
2017-03-20 11:41:21 +00:00
|
|
|
}
|
|
|
|
}
|
2018-03-27 16:07:08 +00:00
|
|
|
if($workflowmode == 'traditional')
|
|
|
|
if(!$tasksinmenu || in_array('review', $tasksinmenu)) {
|
|
|
|
$tasks['review'] = array();
|
2021-02-05 06:30:00 +00:00
|
|
|
$resArr = $dms->getDocumentList('ReviewByMe', $user, false, '', '', false);
|
2018-03-27 16:07:08 +00:00
|
|
|
if($resArr) {
|
2019-01-31 10:23:16 +00:00
|
|
|
$docs = array();
|
2018-03-27 16:07:08 +00:00
|
|
|
foreach ($resArr as $res) {
|
|
|
|
$document = $dms->getDocument($res["id"]);
|
2020-12-16 15:51:00 +00:00
|
|
|
if($document && $document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
2019-01-31 10:23:16 +00:00
|
|
|
$docs[] = $document;
|
|
|
|
// $tasks['review'][] = array('id'=>$res['id'], 'name'=>$res['name']);
|
2018-03-27 16:07:08 +00:00
|
|
|
}
|
2018-03-26 08:04:05 +00:00
|
|
|
}
|
2019-01-31 10:23:16 +00:00
|
|
|
if($this->hasHook('filterReviewTaskList'))
|
|
|
|
$docs = $this->callHook('filterReviewTaskList', $docs);
|
|
|
|
foreach($docs as $doc)
|
|
|
|
$tasks['review'][] = array('id'=>$doc->getId(), 'name'=>$doc->getName());
|
2017-03-20 11:41:21 +00:00
|
|
|
}
|
|
|
|
}
|
2018-04-03 07:32:36 +00:00
|
|
|
if($enablereceiptworkflow)
|
|
|
|
if(!$tasksinmenu || in_array('receipt', $tasksinmenu)) {
|
|
|
|
$tasks['receipt'] = array();
|
|
|
|
$resArr = $dms->getDocumentList('ReceiptByMe', $user);
|
|
|
|
if($resArr) {
|
2019-02-01 08:30:32 +00:00
|
|
|
$docs = array();
|
2018-04-03 07:32:36 +00:00
|
|
|
foreach ($resArr as $res) {
|
|
|
|
$document = $dms->getDocument($res["id"]);
|
2020-12-16 15:51:00 +00:00
|
|
|
if($document && $document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
2019-02-01 08:30:32 +00:00
|
|
|
$docs[] = $document;
|
2018-04-03 07:32:36 +00:00
|
|
|
}
|
2018-03-26 08:04:05 +00:00
|
|
|
}
|
2019-02-01 08:30:32 +00:00
|
|
|
if($this->hasHook('filterReceiptTaskList'))
|
|
|
|
$docs = $this->callHook('filterReceiptTaskList', $docs);
|
|
|
|
foreach($docs as $doc)
|
|
|
|
$tasks['receipt'][] = array('id'=>$doc->getId(), 'name'=>$doc->getName());
|
2017-03-20 11:41:21 +00:00
|
|
|
}
|
|
|
|
}
|
2018-04-03 07:32:36 +00:00
|
|
|
if($enablerevisionworkflow)
|
|
|
|
if(!$tasksinmenu || in_array('revision', $tasksinmenu)) {
|
|
|
|
$tasks['revision'] = array();
|
|
|
|
$resArr = $dms->getDocumentList('ReviseByMe', $user);
|
|
|
|
if($resArr) {
|
2019-02-01 08:30:32 +00:00
|
|
|
$docs = array();
|
2018-04-03 07:32:36 +00:00
|
|
|
foreach ($resArr as $res) {
|
|
|
|
$document = $dms->getDocument($res["id"]);
|
2020-12-16 15:51:00 +00:00
|
|
|
if($document && $document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
2019-02-01 08:30:32 +00:00
|
|
|
$docs[] = $document;
|
2018-04-03 07:32:36 +00:00
|
|
|
}
|
2018-03-26 08:04:05 +00:00
|
|
|
}
|
2019-02-01 08:30:32 +00:00
|
|
|
if($this->hasHook('filterRevisionTaskList'))
|
|
|
|
$docs = $this->callHook('filterRevisionTaskList', $docs);
|
|
|
|
foreach($docs as $doc)
|
|
|
|
$tasks['revision'][] = array('id'=>$doc->getId(), 'name'=>$doc->getName());
|
2017-03-20 11:41:21 +00:00
|
|
|
}
|
|
|
|
}
|
2018-03-27 16:23:00 +00:00
|
|
|
if(!$tasksinmenu || in_array('needscorrection', $tasksinmenu)) {
|
|
|
|
$tasks['needscorrection'] = array();
|
|
|
|
$resArr = $dms->getDocumentList('NeedsCorrectionOwner', $user);
|
|
|
|
if($resArr) {
|
2019-01-31 10:23:16 +00:00
|
|
|
$docs = array();
|
2018-03-27 16:23:00 +00:00
|
|
|
foreach ($resArr as $res) {
|
|
|
|
$document = $dms->getDocument($res["id"]);
|
2020-12-16 15:48:30 +00:00
|
|
|
if($document && $document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
2019-01-31 10:23:16 +00:00
|
|
|
$docs[] = $document;
|
2018-03-27 16:07:08 +00:00
|
|
|
}
|
|
|
|
}
|
2019-02-01 08:30:32 +00:00
|
|
|
if($this->hasHook('filterNeedsCorrectionTaskList'))
|
|
|
|
$docs = $this->callHook('filterNeedsCorrectionTaskList', $docs);
|
2019-01-31 10:23:16 +00:00
|
|
|
foreach($docs as $doc)
|
2019-02-01 08:30:32 +00:00
|
|
|
$tasks['needscorrection'][] = array('id'=>$doc->getId(), 'name'=>$doc->getName());
|
2018-03-27 16:07:08 +00:00
|
|
|
}
|
2018-03-27 16:23:00 +00:00
|
|
|
}
|
2018-03-27 16:07:08 +00:00
|
|
|
if($workflowmode == 'advanced')
|
|
|
|
if(!$tasksinmenu || in_array('workflow', $tasksinmenu)) {
|
|
|
|
$tasks['workflow'] = array();
|
|
|
|
$resArr = $dms->getDocumentList('WorkflowByMe', $user);
|
|
|
|
if($resArr) {
|
2019-02-01 08:30:32 +00:00
|
|
|
$docs = array();
|
2018-03-27 16:07:08 +00:00
|
|
|
foreach ($resArr as $res) {
|
|
|
|
$document = $dms->getDocument($res["id"]);
|
2020-12-16 15:48:30 +00:00
|
|
|
if($document && $document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
2019-02-01 08:30:32 +00:00
|
|
|
$docs[] = $document;
|
2018-03-27 16:07:08 +00:00
|
|
|
}
|
2018-03-26 11:09:36 +00:00
|
|
|
}
|
2019-02-01 08:30:32 +00:00
|
|
|
if($this->hasHook('filterWorkflowTaskList'))
|
|
|
|
$docs = $this->callHook('filterWorkflowTaskList', $docs);
|
|
|
|
foreach($docs as $doc)
|
|
|
|
$tasks['workflow'][] = array('id'=>$doc->getId(), 'name'=>$doc->getName());
|
2018-03-26 11:09:36 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-23 15:56:11 +00:00
|
|
|
if(!$tasksinmenu || in_array('rejected', $tasksinmenu)) {
|
|
|
|
$tasks['rejected'] = array();
|
|
|
|
$resArr = $dms->getDocumentList('RejectOwner', $user);
|
2018-03-27 15:47:58 +00:00
|
|
|
if($resArr) {
|
2019-01-31 10:23:16 +00:00
|
|
|
$docs = array();
|
2018-03-27 15:47:58 +00:00
|
|
|
foreach ($resArr as $res) {
|
|
|
|
$document = $dms->getDocument($res["id"]);
|
2020-12-16 15:48:30 +00:00
|
|
|
if($document && $document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
2019-01-31 10:23:16 +00:00
|
|
|
$docs[] = $document;
|
2018-03-27 15:47:58 +00:00
|
|
|
}
|
2017-05-12 16:21:42 +00:00
|
|
|
}
|
2020-10-23 15:56:11 +00:00
|
|
|
if($this->hasHook('filterRejectedTaskList'))
|
|
|
|
$docs = $this->callHook('filterRejectedTaskList', $docs);
|
2019-01-31 10:23:16 +00:00
|
|
|
foreach($docs as $doc)
|
2020-10-23 15:56:11 +00:00
|
|
|
$tasks['rejected'][] = array('id'=>$doc->getId(), 'name'=>$doc->getName());
|
2017-05-12 16:21:42 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-23 15:56:11 +00:00
|
|
|
if(!$tasksinmenu || in_array('checkedout', $tasksinmenu)) {
|
|
|
|
$tasks['checkedout'] = array();
|
|
|
|
$resArr = $dms->getDocumentList('CheckedOutByMe', $user);
|
|
|
|
if($resArr) {
|
|
|
|
$docs = array();
|
|
|
|
foreach ($resArr as $res) {
|
|
|
|
$document = $dms->getDocument($res["id"]);
|
2020-12-16 15:51:00 +00:00
|
|
|
if($document && $document->getAccessMode($user) >= M_READ && $document->getLatestContent()) {
|
2020-10-23 15:56:11 +00:00
|
|
|
$docs[] = $document;
|
|
|
|
}
|
2020-10-23 15:06:19 +00:00
|
|
|
}
|
2020-10-23 15:56:11 +00:00
|
|
|
if($this->hasHook('filterCheckedOutTaskList'))
|
|
|
|
$docs = $this->callHook('filterCheckedOutTaskList', $docs);
|
|
|
|
foreach($docs as $doc)
|
|
|
|
$tasks['checkedout'][] = array('id'=>$doc->getId(), 'name'=>$doc->getName());
|
2020-10-23 15:06:19 +00:00
|
|
|
}
|
|
|
|
}
|
2017-03-20 11:41:21 +00:00
|
|
|
return $tasks;
|
|
|
|
} /* }}} */
|
|
|
|
|
2017-12-15 12:53:33 +00:00
|
|
|
/**
|
|
|
|
* Returns the html needed for the task list in the menu
|
|
|
|
*
|
|
|
|
* This function renders the tasks in a way suitable to be
|
|
|
|
* used as a menu
|
|
|
|
*
|
|
|
|
* @param array $clipboard clipboard containing two arrays for both
|
|
|
|
* documents and folders.
|
|
|
|
* @return string html code
|
|
|
|
*/
|
|
|
|
function countTasks() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
2018-04-03 07:32:36 +00:00
|
|
|
$enablereceiptworkflow = $this->params['enablereceiptworkflow'];
|
|
|
|
$enablerevisionworkflow = $this->params['enablerevisionworkflow'];
|
2018-03-29 14:30:46 +00:00
|
|
|
$workflowmode = $this->params['workflowmode'];
|
|
|
|
$tasksinmenu = $this->params['tasksinmenu'];
|
|
|
|
|
2017-12-15 12:53:33 +00:00
|
|
|
$startts = microtime(true);
|
2017-12-18 11:41:18 +00:00
|
|
|
$tasks = array();
|
2018-03-29 14:30:46 +00:00
|
|
|
if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval')
|
|
|
|
if(!$tasksinmenu || in_array('approval', $tasksinmenu)) {
|
|
|
|
$tasks['approval'] = $dms->countTasks('ApproveByMe', $user);
|
|
|
|
}
|
|
|
|
if($workflowmode == 'traditional')
|
|
|
|
if(!$tasksinmenu || in_array('review', $tasksinmenu)) {
|
|
|
|
$tasks['review'] = $dms->countTasks('ReviewByMe', $user);
|
|
|
|
}
|
|
|
|
if($workflowmode == 'advanced')
|
|
|
|
if(!$tasksinmenu || in_array('workflow', $tasksinmenu)) {
|
|
|
|
$tasks['workflow'] = $dms->countTasks('WorkflowByMe', $user);
|
|
|
|
}
|
2018-04-03 07:32:36 +00:00
|
|
|
if($enablereceiptworkflow)
|
|
|
|
if(!$tasksinmenu || in_array('receipt', $tasksinmenu))
|
|
|
|
$tasks['receipt'] = $dms->countTasks('ReceiptByMe', $user);
|
|
|
|
if($enablerevisionworkflow)
|
|
|
|
if(!$tasksinmenu || in_array('revision', $tasksinmenu))
|
|
|
|
$tasks['revision'] = $dms->countTasks('ReviseByMe', $user);
|
2018-03-29 14:30:46 +00:00
|
|
|
if(!$tasksinmenu || in_array('needscorrection', $tasksinmenu))
|
|
|
|
$tasks['needscorrection'] = $dms->countTasks('NeedsCorrectionOwner', $user);
|
2017-12-15 12:53:33 +00:00
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
echo json_encode(array('error'=>0, 'data'=>$tasks, 'processing_time'=>microtime(true)-$startts));
|
|
|
|
} /* }}} */
|
|
|
|
|
2017-03-20 11:41:21 +00:00
|
|
|
/**
|
2017-12-18 11:41:18 +00:00
|
|
|
* Returns a json array of tasks to be done
|
2017-03-20 11:41:21 +00:00
|
|
|
*
|
2017-12-18 11:41:18 +00:00
|
|
|
* @return string json string
|
2017-03-20 11:41:21 +00:00
|
|
|
*/
|
|
|
|
function myTasks() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$startts = microtime(true);
|
|
|
|
|
|
|
|
$tasks = $this->__myTasks();
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
echo json_encode(array('error'=>0, 'data'=>$tasks, 'processing_time'=>microtime(true)-$startts));
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the html needed for the task list in the menu
|
|
|
|
*
|
|
|
|
* This function renders the tasks in a way suitable to be
|
|
|
|
* used as a menu
|
|
|
|
*
|
|
|
|
* @return string html code
|
|
|
|
*/
|
|
|
|
function menuTasks() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
2019-11-20 12:47:57 +00:00
|
|
|
$accessobject = $this->params['accessobject'];
|
2024-04-15 15:37:20 +00:00
|
|
|
$settings = $this->params['settings'];
|
2017-03-20 11:41:21 +00:00
|
|
|
|
2020-04-06 19:26:29 +00:00
|
|
|
if(!$tasks = $this->__myTasks()) {
|
|
|
|
echo '';
|
|
|
|
return;
|
|
|
|
}
|
2017-03-20 11:41:21 +00:00
|
|
|
|
2021-04-18 05:08:00 +00:00
|
|
|
$menuitems = [];
|
|
|
|
|
2018-03-26 08:04:05 +00:00
|
|
|
$ct = array();
|
|
|
|
if(isset($tasks['review']))
|
|
|
|
$ct[] = count($tasks['review']);
|
|
|
|
if(isset($tasks['approval']))
|
|
|
|
$ct[] = count($tasks['approval']);
|
2018-03-27 16:23:00 +00:00
|
|
|
if(isset($tasks['workflow']))
|
|
|
|
$ct[] = count($tasks['workflow']);
|
2018-03-26 08:04:05 +00:00
|
|
|
if(isset($tasks['receipt']))
|
|
|
|
$ct[] = count($tasks['receipt']);
|
|
|
|
if(isset($tasks['revision']))
|
|
|
|
$ct[] = count($tasks['revision']);
|
2018-03-26 11:09:36 +00:00
|
|
|
if(isset($tasks['needscorrection']))
|
|
|
|
$ct[] = count($tasks['needscorrection']);
|
2020-10-23 15:06:19 +00:00
|
|
|
if(isset($tasks['rejected']))
|
|
|
|
$ct[] = count($tasks['rejected']);
|
2020-10-23 15:56:11 +00:00
|
|
|
if(isset($tasks['checkedout']))
|
|
|
|
$ct[] = count($tasks['checkedout']);
|
2021-04-18 05:08:00 +00:00
|
|
|
|
|
|
|
$menuitems['tasks'] = array('label'=>getMLText('tasks')." (".implode('/', $ct).")");
|
|
|
|
$menuitems['tasks']['children'] = [];
|
|
|
|
|
2024-04-16 04:36:39 +00:00
|
|
|
if(!empty($settings->_alwaysShowMenuTasks) || !empty($tasks['review']) || !empty($tasks['approval']) || !empty($tasks['receipt']) || !empty($tasks['revision']) || !empty($tasks['needscorrection']) || !empty($tasks['workflow']) || !empty($tasks['rejected']) || !empty($tasks['rejected']) || !empty($tasks['checkedout'])) {
|
2018-03-26 08:04:05 +00:00
|
|
|
if(!empty($tasks['review'])) {
|
2021-04-18 05:08:00 +00:00
|
|
|
$subitems = [];
|
2017-03-20 11:41:21 +00:00
|
|
|
foreach($tasks['review'] as $t) {
|
|
|
|
$doc = $dms->getDocument($t['id']);
|
2021-07-06 04:13:57 +00:00
|
|
|
$subitems[] = array('label'=>$doc->getName(), 'link'=>$this->params['settings']->_httpRoot."out/out.ViewDocument.php?documentid=".$doc->getID()."¤ttab=revapp", 'class'=>"table-row-document", 'rel'=>"document_".$doc->getID());
|
2017-03-20 11:41:21 +00:00
|
|
|
}
|
2021-04-18 05:08:00 +00:00
|
|
|
$menuitems['tasks']['children']['review'] = array('label'=>getMLText('documents_to_review'), 'children'=>$subitems);
|
|
|
|
|
2017-03-20 11:41:21 +00:00
|
|
|
}
|
2018-03-26 08:04:05 +00:00
|
|
|
if(!empty($tasks['approval'])) {
|
2021-04-18 05:08:00 +00:00
|
|
|
$subitems = [];
|
2017-03-20 11:41:21 +00:00
|
|
|
foreach($tasks['approval'] as $t) {
|
|
|
|
$doc = $dms->getDocument($t['id']);
|
2021-07-06 04:13:57 +00:00
|
|
|
$subitems[] = array('label'=>$doc->getName(), 'link'=>$this->params['settings']->_httpRoot."out/out.ViewDocument.php?documentid=".$doc->getID()."¤ttab=revapp", 'class'=>"table-row-document", 'rel'=>"document_".$doc->getID());
|
2017-03-20 11:41:21 +00:00
|
|
|
}
|
2021-04-18 05:08:00 +00:00
|
|
|
$menuitems['tasks']['children']['approval'] = array('label'=>getMLText('documents_to_approve'), 'children'=>$subitems);
|
2017-03-20 11:41:21 +00:00
|
|
|
}
|
2018-03-27 16:23:00 +00:00
|
|
|
if(!empty($tasks['workflow'])) {
|
2021-04-18 05:08:00 +00:00
|
|
|
$subitems = [];
|
2018-03-27 16:23:00 +00:00
|
|
|
foreach($tasks['workflow'] as $t) {
|
2017-03-20 11:41:21 +00:00
|
|
|
$doc = $dms->getDocument($t['id']);
|
2021-07-06 04:13:57 +00:00
|
|
|
$subitems[] = array('label'=>$doc->getName(), 'link'=>$this->params['settings']->_httpRoot."out/out.ViewDocument.php?documentid=".$doc->getID()."¤ttab=workflow", 'class'=>"table-row-document", 'rel'=>"document_".$doc->getID());
|
2017-03-20 11:41:21 +00:00
|
|
|
}
|
2021-04-18 05:08:00 +00:00
|
|
|
$menuitems['tasks']['children']['workflow'] = array('label'=>getMLText('documents_to_trigger_workflow'), 'children'=>$subitems);
|
2017-03-20 11:41:21 +00:00
|
|
|
}
|
2018-03-27 16:23:00 +00:00
|
|
|
if(!empty($tasks['receipt'])) {
|
2021-04-18 06:05:07 +00:00
|
|
|
$subitems = [];
|
2018-03-27 16:23:00 +00:00
|
|
|
foreach($tasks['receipt'] as $t) {
|
2018-03-27 15:47:58 +00:00
|
|
|
$doc = $dms->getDocument($t['id']);
|
2021-04-18 06:05:07 +00:00
|
|
|
$subitems[] = array('label'=>$doc->getName(), 'link'=>"../out/out.ViewDocument.php?documentid=".$doc->getID()."¤ttab=recipients", 'class'=>"table-row-document", 'rel'=>"document_".$doc->getID());
|
2018-03-27 15:47:58 +00:00
|
|
|
}
|
2021-04-18 06:05:07 +00:00
|
|
|
$menuitems['tasks']['children']['receipt'] = array('label'=>getMLText('documents_to_receipt'), 'children'=>$subitems);
|
2018-03-27 15:47:58 +00:00
|
|
|
}
|
2018-03-26 08:04:05 +00:00
|
|
|
if(!empty($tasks['revision'])) {
|
2021-04-18 06:05:07 +00:00
|
|
|
$subitems = [];
|
2017-03-20 11:41:21 +00:00
|
|
|
foreach($tasks['revision'] as $t) {
|
|
|
|
$doc = $dms->getDocument($t['id']);
|
2021-04-18 06:05:07 +00:00
|
|
|
$subitems[] = array('label'=>$doc->getName(), 'link'=>"../out/out.ViewDocument.php?documentid=".$doc->getID()."¤ttab=revision", 'class'=>"table-row-document", 'rel'=>"document_".$doc->getID());
|
2017-03-20 11:41:21 +00:00
|
|
|
}
|
2021-04-18 06:05:07 +00:00
|
|
|
$menuitems['tasks']['children']['revision'] = array('label'=>getMLText('documents_to_revise'), 'children'=>$subitems);
|
2017-03-20 11:41:21 +00:00
|
|
|
}
|
2018-03-26 11:09:36 +00:00
|
|
|
if(!empty($tasks['needscorrection'])) {
|
2021-04-18 06:05:07 +00:00
|
|
|
$subitems = [];
|
2018-03-26 11:09:36 +00:00
|
|
|
foreach($tasks['needscorrection'] as $t) {
|
|
|
|
$doc = $dms->getDocument($t['id']);
|
2021-04-18 06:05:07 +00:00
|
|
|
$subitems[] = array('label'=>$doc->getName(), 'link'=>"../out/out.ViewDocument.php?documentid=".$doc->getID()."¤ttab=docinfo", 'class'=>"table-row-document", 'rel'=>"document_".$doc->getID());
|
2018-03-26 11:09:36 +00:00
|
|
|
}
|
2021-04-18 06:05:07 +00:00
|
|
|
$menuitems['tasks']['children']['needscorrection'] = array('label'=>getMLText('documents_to_correct'), 'children'=>$subitems);
|
2018-03-26 11:09:36 +00:00
|
|
|
}
|
2020-10-23 15:06:19 +00:00
|
|
|
if(!empty($tasks['rejected'])) {
|
2021-04-18 05:08:00 +00:00
|
|
|
$subitems = [];
|
2020-10-23 15:06:19 +00:00
|
|
|
foreach($tasks['rejected'] as $t) {
|
|
|
|
$doc = $dms->getDocument($t['id']);
|
2021-07-06 04:13:57 +00:00
|
|
|
$subitems[] = array('label'=>$doc->getName(), 'link'=>$this->params['settings']->_httpRoot."out/out.ViewDocument.php?documentid=".$doc->getID()."¤ttab=docinfo", 'class'=>"table-row-document", 'rel'=>"document_".$doc->getID());
|
2020-10-23 15:06:19 +00:00
|
|
|
}
|
2021-04-18 05:08:00 +00:00
|
|
|
$menuitems['tasks']['children']['rejected'] = array('label'=>getMLText('documents_rejected'), 'children'=>$subitems);
|
2020-10-23 15:06:19 +00:00
|
|
|
}
|
2020-10-23 15:56:11 +00:00
|
|
|
if(!empty($tasks['checkedout'])) {
|
2021-04-18 06:05:07 +00:00
|
|
|
$subitems = [];
|
2020-10-23 15:56:11 +00:00
|
|
|
foreach($tasks['checkedout'] as $t) {
|
|
|
|
$doc = $dms->getDocument($t['id']);
|
2021-04-18 06:05:07 +00:00
|
|
|
$subitems[] = array('label'=>$doc->getName(), 'link'=>"../out/out.ViewDocument.php?documentid=".$doc->getID()."¤ttab=docinfo", 'class'=>"table-row-document", 'rel'=>"document_".$doc->getID());
|
2020-10-23 15:56:11 +00:00
|
|
|
}
|
2021-04-18 06:05:07 +00:00
|
|
|
$menuitems['tasks']['children']['checkedout'] = array('label'=>getMLText('documents_checked_out_by_you'), 'children'=>$subitems);
|
2020-10-23 15:56:11 +00:00
|
|
|
}
|
2019-11-20 12:47:57 +00:00
|
|
|
if ($accessobject->check_view_access('MyDocuments')) {
|
2021-04-18 05:08:00 +00:00
|
|
|
$menuitems['tasks']['children']['divider'] = array('divider'=>true);
|
2021-07-06 04:13:57 +00:00
|
|
|
$menuitems['tasks']['children']['mydocuments'] = array('label'=>getMLText('my_documents'), 'link'=>$this->params['settings']->_httpRoot.'out/out.MyDocuments.php');
|
2020-11-16 15:50:37 +00:00
|
|
|
}
|
2024-04-15 09:54:23 +00:00
|
|
|
self::showNavigationBar($menuitems, array('right'=>true));
|
2024-04-15 15:37:20 +00:00
|
|
|
}
|
2017-03-20 11:41:21 +00:00
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the html needed for the clipboard list in the menu
|
|
|
|
*
|
|
|
|
* This function renders the clipboard in a way suitable to be
|
|
|
|
* used as a menu
|
|
|
|
*
|
|
|
|
* @param array $clipboard clipboard containing two arrays for both
|
|
|
|
* documents and folders.
|
|
|
|
* @return string html code
|
|
|
|
*/
|
|
|
|
public function menuClipboard() { /* {{{ */
|
|
|
|
$clipboard = $this->params['session']->getClipboard();
|
|
|
|
if ($this->params['user']->isGuest() || (count($clipboard['docs']) + count($clipboard['folders'])) == 0) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
$content = '';
|
|
|
|
$content .= " <ul id=\"main-menu-clipboard\" class=\"nav pull-right\">\n";
|
|
|
|
$content .= " <li class=\"dropdown add-clipboard-area\">\n";
|
2020-08-27 05:52:52 +00:00
|
|
|
$content .= " <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" class=\"add-clipboard-area\">".getMLText('clipboard')." (".count($clipboard['folders'])."/".count($clipboard['docs']).") <i class=\"fa fa-caret-down\"></i></a>\n";
|
2017-03-20 11:41:21 +00:00
|
|
|
$content .= " <ul class=\"dropdown-menu\" role=\"menu\">\n";
|
|
|
|
foreach($clipboard['folders'] as $folderid) {
|
|
|
|
if($folder = $this->params['dms']->getFolder($folderid))
|
2021-07-06 04:13:57 +00:00
|
|
|
$content .= " <li><a href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID()."\"><i class=\"fa fa-folder-o\"></i> ".htmlspecialchars($folder->getName())."</a></li>\n";
|
2017-03-20 11:41:21 +00:00
|
|
|
}
|
|
|
|
foreach($clipboard['docs'] as $docid) {
|
|
|
|
if($document = $this->params['dms']->getDocument($docid))
|
2021-07-06 04:13:57 +00:00
|
|
|
$content .= " <li><a href=\"".$this->params['settings']->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID()."\"><i class=\"fa fa-file\"></i> ".htmlspecialchars($document->getName())."</a></li>\n";
|
2017-03-20 11:41:21 +00:00
|
|
|
}
|
|
|
|
$content .= " <li class=\"divider\"></li>\n";
|
|
|
|
if(isset($this->params['folder']) && $this->params['folder']->getAccessMode($this->params['user']) >= M_READWRITE) {
|
2021-07-06 04:13:57 +00:00
|
|
|
$content .= " <li><a href=\"".$this->params['settings']->_httpRoot."op/op.MoveClipboard.php?targetid=".$this->params['folder']->getID()."&refferer=".urlencode($this->params['refferer'])."\">".getMLText("move_clipboard")."</a></li>\n";
|
2017-03-20 11:41:21 +00:00
|
|
|
}
|
2021-07-06 04:13:57 +00:00
|
|
|
// $content .= " <li><a href=\"".$this->params['settings']->_httpRoot."op/op.ClearClipboard.php?refferer=".urlencode($this->params['refferer'])."\">".getMLText("clear_clipboard")."</a><a class=\"ajax-click\" data-href=\"".$this->params['settings']->_httpRoot."op/op.Ajax.php\" data-param1=\"command=clearclipboard\">kkk</a> </li>\n";
|
|
|
|
$content .= " <li><a class=\"ajax-click\" data-href=\"".$this->params['settings']->_httpRoot."op/op.Ajax.php\" data-param1=\"command=clearclipboard\">".getMLText("clear_clipboard")."</a></li>\n";
|
2017-03-20 11:41:21 +00:00
|
|
|
$content .= " </ul>\n";
|
|
|
|
$content .= " </li>\n";
|
|
|
|
$content .= " </ul>\n";
|
|
|
|
echo $content;
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return clipboard content rendered as html
|
|
|
|
*
|
|
|
|
* @param array clipboard
|
|
|
|
* @return string rendered html content
|
|
|
|
*/
|
|
|
|
public function mainClipboard() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$clipboard = $this->params['session']->getClipboard();
|
|
|
|
$cachedir = $this->params['cachedir'];
|
|
|
|
$previewwidth = $this->params['previewWidthList'];
|
|
|
|
$timeout = $this->params['timeout'];
|
2019-01-18 12:07:39 +00:00
|
|
|
$xsendfile = $this->params['xsendfile'];
|
2017-03-20 11:41:21 +00:00
|
|
|
|
2019-01-18 12:07:39 +00:00
|
|
|
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
2017-03-20 11:41:21 +00:00
|
|
|
$content = '';
|
|
|
|
$foldercount = $doccount = 0;
|
|
|
|
if($clipboard['folders']) {
|
|
|
|
foreach($clipboard['folders'] as $folderid) {
|
|
|
|
/* FIXME: check for access rights, which could have changed after adding the folder to the clipboard */
|
|
|
|
if($folder = $dms->getFolder($folderid)) {
|
|
|
|
$comment = $folder->getComment();
|
|
|
|
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
|
2019-07-12 14:44:44 +00:00
|
|
|
// $content .= "<tr draggable=\"true\" rel=\"folder_".$folder->getID()."\" class=\"folder table-row-folder\" formtoken=\"".createFormKey('movefolder')."\">";
|
|
|
|
$content .= $this->folderListRowStart($folder);
|
2017-03-20 11:41:21 +00:00
|
|
|
$content .= "<td><a draggable=\"false\" href=\"out.ViewFolder.php?folderid=".$folder->getID()."&showtree=".showtree()."\"><img draggable=\"false\" src=\"".$this->imgpath."folder.png\" width=\"24\" height=\"24\" border=0></a></td>\n";
|
|
|
|
$content .= "<td><a draggable=\"false\" href=\"out.ViewFolder.php?folderid=".$folder->getID()."&showtree=".showtree()."\">" . htmlspecialchars($folder->getName()) . "</a>";
|
|
|
|
if($comment) {
|
|
|
|
$content .= "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>";
|
|
|
|
}
|
|
|
|
$content .= "</td>\n";
|
|
|
|
$content .= "<td>\n";
|
2021-07-06 04:13:57 +00:00
|
|
|
$content .= "<div class=\"list-action\"><a class=\"removefromclipboard\" rel=\"F".$folderid."\" msg=\"".getMLText('splash_removed_from_clipboard')."\" _href=\"".$this->params['settings']->_httpRoot."op/op.RemoveFromClipboard.php?folderid=".(isset($this->params['folder']) ? $this->params['folder']->getID() : '')."&id=".$folderid."&type=folder\" title=\"".getMLText('rm_from_clipboard')."\"><i class=\"fa fa-remove\"></i></a></div>";
|
2017-03-20 11:41:21 +00:00
|
|
|
$content .= "</td>\n";
|
2019-07-12 14:44:44 +00:00
|
|
|
//$content .= "</tr>\n";
|
|
|
|
$content .= $this->folderListRowEnd($folder);
|
2017-03-20 11:41:21 +00:00
|
|
|
$foldercount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($clipboard['docs']) {
|
|
|
|
foreach($clipboard['docs'] as $docid) {
|
|
|
|
/* FIXME: check for access rights, which could have changed after adding the document to the clipboard */
|
|
|
|
if($document = $dms->getDocument($docid)) {
|
|
|
|
$comment = $document->getComment();
|
|
|
|
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
|
|
|
|
if($latestContent = $document->getLatestContent()) {
|
|
|
|
$previewer->createPreview($latestContent);
|
|
|
|
$version = $latestContent->getVersion();
|
|
|
|
$status = $latestContent->getStatus();
|
|
|
|
|
|
|
|
$content .= "<tr draggable=\"true\" rel=\"document_".$docid."\" class=\"table-row-document\" formtoken=\"".createFormKey('movedocument')."\">";
|
|
|
|
|
|
|
|
if (file_exists($dms->contentDir . $latestContent->getPath())) {
|
2021-07-06 04:13:57 +00:00
|
|
|
$content .= "<td><a draggable=\"false\" href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$docid."&version=".$version."\">";
|
2017-03-20 11:41:21 +00:00
|
|
|
if($previewer->hasPreview($latestContent)) {
|
2021-07-06 04:13:57 +00:00
|
|
|
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"40\"src=\"".$this->params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
|
2017-03-20 11:41:21 +00:00
|
|
|
} else {
|
|
|
|
$content .= "<img draggable=\"false\" class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
|
|
|
|
}
|
|
|
|
$content .= "</a></td>";
|
|
|
|
} else
|
|
|
|
$content .= "<td><img draggable=\"false\" class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\"></td>";
|
|
|
|
|
|
|
|
$content .= "<td><a draggable=\"false\" href=\"out.ViewDocument.php?documentid=".$docid."&showtree=".showtree()."\">" . htmlspecialchars($document->getName()) . "</a>";
|
|
|
|
if($comment) {
|
|
|
|
$content .= "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>";
|
|
|
|
}
|
|
|
|
$content .= "</td>\n";
|
|
|
|
$content .= "<td>\n";
|
2021-07-06 04:13:57 +00:00
|
|
|
$content .= "<div class=\"list-action\"><a class=\"removefromclipboard\" rel=\"D".$docid."\" msg=\"".getMLText('splash_removed_from_clipboard')."\" _href=\"".$this->params['settings']->_httpRoot."op/op.RemoveFromClipboard.php?folderid=".(isset($this->params['folder']) ? $this->params['folder']->getID() : '')."&id=".$docid."&type=document\" title=\"".getMLText('rm_from_clipboard')."\"><i class=\"fa fa-remove\"></i></a></div>";
|
2017-03-20 11:41:21 +00:00
|
|
|
$content .= "</td>\n";
|
|
|
|
$content .= "</tr>";
|
|
|
|
$doccount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* $foldercount or $doccount will only count objects which are
|
|
|
|
* actually available
|
|
|
|
*/
|
|
|
|
if($foldercount || $doccount) {
|
|
|
|
$content = "<table class=\"table\">".$content;
|
|
|
|
$content .= "</table>";
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
$content .= "<div class=\"alert add-clipboard-area\">".getMLText("drag_icon_here")."</div>";
|
|
|
|
echo $content;
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
}
|