add new function countTasks()

This commit is contained in:
Uwe Steinmann 2017-12-15 13:53:33 +01:00
parent a4a1100abe
commit fe6d00b6e1

View File

@ -82,6 +82,34 @@ class SeedDMS_View_Tasks extends SeedDMS_Bootstrap_Style {
return $tasks;
} /* }}} */
/**
* 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'];
$startts = microtime(true);
$tasks['review'] = 0;
$tasks['approval'] = 0;
$tasks['receipt'] = 0;
$tasks['revision'] = 0;
$tasks['review'] = $dms->countTasks('ReviewByMe', $user);
$tasks['approval'] = $dms->countTasks('ApproveByMe', $user);
$tasks['receipt'] = $dms->countTasks('ReceiptByMe', $user);
$tasks['revision'] = $dms->countTasks('ReviseByMe', $user);
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
*