2019-11-04 15:22:11 +00:00
|
|
|
<?php
|
2020-08-20 16:30:16 +00:00
|
|
|
|
2019-11-04 15:22:11 +00:00
|
|
|
/**
|
|
|
|
* Project:
|
|
|
|
* Contenido Content Management System
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Workflow task overview mask
|
|
|
|
*
|
|
|
|
* Requirements:
|
|
|
|
* @con_php_req 5.0
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @package Contenido Backend classes
|
|
|
|
* @version 1.4
|
|
|
|
* @author Timo Hummel
|
|
|
|
* @copyright four for business AG <www.4fb.de>
|
|
|
|
* @license http://www.contenido.org/license/LIZENZ.txt
|
|
|
|
* @link http://www.4fb.de
|
|
|
|
* @link http://www.contenido.org
|
|
|
|
*
|
|
|
|
* {@internal
|
|
|
|
* created 2003-07-30
|
|
|
|
*
|
|
|
|
* $Id: include.workflow_tasks.php 128 2019-07-03 11:58:28Z oldperl $
|
|
|
|
* }}
|
|
|
|
*
|
|
|
|
*/
|
2020-08-20 16:30:16 +00:00
|
|
|
if (!defined('CON_FRAMEWORK')) {
|
|
|
|
die('Illegal call');
|
2019-11-04 15:22:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
plugin_include('workflow', 'includes/functions.workflow.php');
|
|
|
|
|
|
|
|
global $sess;
|
|
|
|
$sSession = $sess->id;
|
|
|
|
|
|
|
|
$wfa = new WorkflowArtAllocations;
|
|
|
|
$wfu = new WorkflowUserSequences;
|
|
|
|
$users = new User;
|
|
|
|
$db2 = new DB_ConLite;
|
|
|
|
|
|
|
|
ob_start();
|
|
|
|
|
2020-08-20 16:30:16 +00:00
|
|
|
if ($usershow == "") {
|
|
|
|
$usershow = $auth->auth["uid"];
|
2019-11-04 15:22:11 +00:00
|
|
|
}
|
|
|
|
|
2020-08-20 16:30:16 +00:00
|
|
|
if (!$perm->have_perm_area_action($area, "workflow_task_user_select")) {
|
|
|
|
$usershow = $auth->auth["uid"];
|
2019-11-04 15:22:11 +00:00
|
|
|
}
|
|
|
|
|
2020-08-20 16:30:16 +00:00
|
|
|
if ($action == "workflow_do_action") {
|
|
|
|
$selectedAction = "wfselect" . $modidartlang;
|
2019-11-04 15:22:11 +00:00
|
|
|
doWorkflowAction($modidartlang, $GLOBALS[$selectedAction]);
|
|
|
|
}
|
|
|
|
|
|
|
|
$wfa->select();
|
|
|
|
|
2020-08-20 16:30:16 +00:00
|
|
|
while ($wfaitem = $wfa->next()) {
|
|
|
|
$wfaid = $wfaitem->get("idartallocation");
|
|
|
|
$usersequence[$wfaid] = $wfaitem->get("idusersequence");
|
|
|
|
$lastusersequence[$wfaid] = $wfaitem->get("lastusersequence");
|
|
|
|
$article[$wfaid] = $wfaitem->get("idartlang");
|
2019-11-04 15:22:11 +00:00
|
|
|
}
|
|
|
|
|
2020-08-20 16:30:16 +00:00
|
|
|
|
|
|
|
if (is_array($usersequence)) {
|
|
|
|
foreach ($usersequence as $key => $value) {
|
|
|
|
$wfu->select("idusersequence = '$value'");
|
|
|
|
if ($obj = $wfu->next()) {
|
|
|
|
$userids[$key] = $obj->get("iduser");
|
2019-11-04 15:22:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-08-20 16:30:16 +00:00
|
|
|
|
|
|
|
if (is_array($userids)) {
|
|
|
|
foreach ($userids as $key => $value) {
|
|
|
|
$isCurrent[$key] = false;
|
|
|
|
|
|
|
|
if ($usershow == $value) {
|
|
|
|
$isCurrent[$key] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($users->loadUserByUserID($value) == false) {
|
|
|
|
/* Yes, it's a group. Let's try to load the group members! */
|
|
|
|
$sql = "SELECT user_id FROM "
|
|
|
|
. $cfg["tab"]["groupmembers"] . "
|
|
|
|
WHERE group_id = '" . $value . "'";
|
|
|
|
$db2->query(Contenido_Security::escapeDB($sql, $db2));
|
|
|
|
|
|
|
|
while ($db2->next_record()) {
|
|
|
|
if ($db2->f("user_id") == $usershow) {
|
|
|
|
$isCurrent[$key] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ($value == $usershow) {
|
|
|
|
$isCurrent[$key] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($lastusersequence[$key] == $usersequence[$key]) {
|
|
|
|
$isCurrent[$key] = false;
|
|
|
|
}
|
|
|
|
}
|
2019-11-04 15:22:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$tpl->reset();
|
|
|
|
$tpl->setEncoding('iso-8859-1');
|
|
|
|
$tpl->set('s', 'SESSID', $sSession);
|
|
|
|
$tpl->set('s', 'SESSNAME', $sess->name);
|
|
|
|
$iIDCat = 0;
|
|
|
|
$iIDTpl = 0;
|
|
|
|
|
2020-08-20 16:30:16 +00:00
|
|
|
if ($perm->have_perm_area_action($area, "workflow_task_user_select")) {
|
2019-11-04 15:22:11 +00:00
|
|
|
$form = new UI_Form("showusers", $sess->url("main.php?area=$area&frame=$frame"));
|
2020-08-20 16:30:16 +00:00
|
|
|
$form->setVar("area", $area);
|
2019-11-04 15:22:11 +00:00
|
|
|
$form->setEvent("submit", "setUsershow();");
|
|
|
|
$form->setVar("frame", $frame);
|
|
|
|
$form->setVar("action", "workflow_task_user_select");
|
2020-08-20 16:30:16 +00:00
|
|
|
$form->add("select", i18n("Show users", 'cl-workflow') . ": " . getUsers("show", $usershow));
|
|
|
|
$form->add("button", '<input style="vertical-align:middle;" type="image" src="' . $cfg["path"]["htmlpath"] . $cfg["path"]["images"] . "submit.gif" . '">');
|
|
|
|
|
2019-11-04 15:22:11 +00:00
|
|
|
$tpl->set('s', 'USERSELECT', $form->render(true));
|
|
|
|
} else {
|
|
|
|
$tpl->set('s', 'USERSELECT', '');
|
|
|
|
}
|
|
|
|
|
2020-08-20 16:30:16 +00:00
|
|
|
$pageTitle = i18n('Search results', 'cl-workflow') . ' - ' . i18n('Workflow tasks', 'cl-workflow');
|
2019-11-04 15:22:11 +00:00
|
|
|
$tpl->set('s', 'PAGE_TITLE', $pageTitle);
|
|
|
|
|
2020-08-20 16:30:16 +00:00
|
|
|
$tpl->set('s', 'TH_START', i18n("Article", 'cl-workflow'));
|
|
|
|
$tpl->set('s', 'TH_TEMPLATE', i18n("Template", 'cl-workflow'));
|
|
|
|
$tpl->set('s', 'TH_ACTIONS', i18n("Actions", 'cl-workflow'));
|
|
|
|
$tpl->set('s', 'TH_TITLE', i18n("Title", 'cl-workflow'));
|
|
|
|
$tpl->set('s', 'TH_CHANGED', i18n("Changed", 'cl-workflow'));
|
|
|
|
$tpl->set('s', 'TH_PUBLISHED', i18n("Published", 'cl-workflow'));
|
|
|
|
$tpl->set('s', 'TH_WORKFLOW_STEP', i18n("Workflow Step", 'cl-workflow'));
|
|
|
|
$tpl->set('s', 'TH_WORKFLOW_ACTION', i18n("Workflow Action", 'cl-workflow'));
|
|
|
|
$tpl->set('s', 'TH_WORKFLOW_EDITOR', i18n("Workflow Editor", 'cl-workflow'));
|
|
|
|
$tpl->set('s', 'TH_LAST_STATUS', i18n("Last status", 'cl-workflow'));
|
2019-11-04 15:22:11 +00:00
|
|
|
|
|
|
|
$currentUserSequence = new WorkflowUserSequence;
|
2020-08-20 16:30:16 +00:00
|
|
|
|
|
|
|
if (is_array($isCurrent)) {
|
|
|
|
|
|
|
|
foreach ($isCurrent as $key => $value) {
|
|
|
|
if ($value == true) {
|
|
|
|
$idartlang = Contenido_Security::toInteger($article[$key]);
|
|
|
|
$lang = Contenido_Security::toInteger($lang);
|
|
|
|
$client = Contenido_Security::toInteger($client);
|
|
|
|
|
|
|
|
$sql = "SELECT B.idcat AS idcat, A.title AS title, A.created AS created, A.lastmodified AS changed,
|
2019-11-04 15:22:11 +00:00
|
|
|
A.idart as idart, E.name as tpl_name, A.idartlang as idartlang, F.idcatlang as idcatlang,
|
|
|
|
B.idcatart as idcatart, A.idlang as art_lang, F.startidartlang as startidartlang
|
2020-08-20 16:30:16 +00:00
|
|
|
FROM (" . $cfg["tab"]["art_lang"] . " AS A,
|
|
|
|
" . $cfg["tab"]["cat_art"] . " AS B,
|
|
|
|
" . $cfg["tab"]["art"] . " AS C)
|
|
|
|
LEFT JOIN " . $cfg['tab']['tpl_conf'] . " as D ON A.idtplcfg = D.idtplcfg
|
|
|
|
LEFT JOIN " . $cfg['tab']['tpl'] . " as E ON D.idtpl = E.`idtpl`
|
|
|
|
LEFT JOIN " . $cfg['tab']['cat_lang'] . " as F ON B.idcat = F.`idcat`
|
2019-11-04 15:22:11 +00:00
|
|
|
WHERE A.idartlang = '$idartlang' AND
|
|
|
|
A.idart = B.idart AND
|
|
|
|
A.idart = C.idart AND
|
|
|
|
A.idlang = '$lang' AND
|
|
|
|
C.idclient = '$client';";
|
2020-08-20 16:30:16 +00:00
|
|
|
|
|
|
|
$db->query($sql);
|
|
|
|
|
|
|
|
if ($db->next_record()) {
|
|
|
|
global $area;
|
|
|
|
//$area = "con";
|
|
|
|
$idcat = $db->f("idcat");
|
|
|
|
$idart = $db->f("idart");
|
|
|
|
|
|
|
|
# create javascript multilink
|
|
|
|
$tmp_mstr = '<a href="javascript://" onclick="javascript:conMultiLink(\'%s\', \'%s\', \'%s\', \'%s\')" title="idart: ' . $db->f('idart') . ' idcatart: ' . $db->f('idcatart') . '" alt="idart: ' . $db->f('idart') . ' idcatart: ' . $db->f('idcatart') . '">%s</a>';
|
|
|
|
|
|
|
|
$mstr = sprintf($tmp_mstr, 'right_top',
|
|
|
|
$sess->url("main.php?area=con&frame=3&idcat=$idcat&idtpl=$idtpl"),
|
|
|
|
'right_bottom',
|
|
|
|
$sess->url("main.php?area=con_editart&action=con_edit&frame=4&idcat=$idcat&idtpl=$idtpl&idart=$idart"),
|
|
|
|
$db->f("title"));
|
|
|
|
|
|
|
|
$laststatus = getLastWorkflowStatus($idartlang);
|
|
|
|
$username = getGroupOrUserName($userids[$key]);
|
|
|
|
$actionSelect = piworkflowRenderColumn($idcat, $idart, $db->f('idartlang'), 'wfaction');
|
|
|
|
|
|
|
|
$currentUserSequence->loadByPrimaryKey($usersequence[$key]);
|
|
|
|
$workflowItem = $currentUserSequence->getWorkflowItem();
|
|
|
|
$step = $workflowItem->get("name");
|
|
|
|
$description = $workflowItem->get("description");
|
|
|
|
|
|
|
|
$sRowId = $db->f('idart') . '-' . $db->f('idartlang') . '-' . $db->f('idcat') . '-' . $db->f('idcatlang') . '-' . $db->f('idcatart') . '-' . $db->f('art_lang');
|
|
|
|
|
|
|
|
if ($db->f('startidartlang') == $db->f('idartlang')) {
|
|
|
|
$makeStartarticle = "<img src=\"images/isstart1.gif\" border=\"0\" title=\"{$sFlagTitle}\" alt=\"{$sFlagTitle}\">";
|
|
|
|
} else {
|
|
|
|
$makeStartarticle = "<img src=\"images/isstart0.gif\" border=\"0\" title=\"{$sFlagTitle}\" alt=\"{$sFlagTitle}\">";
|
|
|
|
}
|
|
|
|
|
|
|
|
$todoListeSubject = i18n("Reminder", 'cl-workflow');
|
|
|
|
$sReminder = i18n("Set reminder / add to todo list", 'cl-workflow');
|
|
|
|
$sReminderHtml = "<a id=\"m1\" onclick=\"javascript:window.open('main.php?subject=$todoListeSubject&area=todo&frame=1&itemtype=idart&itemid=$idart&contenido=$sSession', 'todo', 'scrollbars=yes, height=300, width=550');\" alt=\"$sReminder\" title=\"$sReminder\" href=\"#\"><img id=\"m2\" style=\"padding-left: 2px; padding-right: 2px;\" alt=\"$sReminder\" src=\"images/but_setreminder.gif\" border=\"0\"></a>";
|
|
|
|
|
|
|
|
$templatename = $db->f('tpl_name');
|
|
|
|
if (!empty($templatename)) {
|
|
|
|
$templatename = clHtmlEntities($templatename);
|
|
|
|
} else {
|
|
|
|
$templatename = '--- ' . i18n("None", 'cl-workflow') . ' ---';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($i == 0) {
|
|
|
|
$iIDCat = $db->f("idcat");
|
|
|
|
$iIDTpl = $idtpl;
|
|
|
|
$tpl->set('s', 'FIRST_ROWID', $sRowId);
|
|
|
|
}
|
|
|
|
|
|
|
|
$tpl->set('d', 'START', $makeStartarticle);
|
|
|
|
$tpl->set('d', 'TITLE', $mstr);
|
|
|
|
$tpl->set('d', 'LAST_STATUS', $laststatus);
|
|
|
|
$tpl->set('d', 'WORKFLOW_EDITOR', $username);
|
|
|
|
$tpl->set('d', 'WORKFLOW_STEP', $step);
|
|
|
|
$tpl->set('d', 'WORKFLOW_ACTION', $actionSelect);
|
|
|
|
$tpl->set('d', 'TEMPLATE', $templatename);
|
|
|
|
$tpl->set('d', 'BGCOLOR', $cfg['color']['table_dark_offline']);
|
|
|
|
$tpl->set('d', 'ROWID', $sRowId);
|
|
|
|
$tpl->set('d', 'ACTIONS', $sReminderHtml);
|
|
|
|
$tpl->next();
|
|
|
|
$i++;
|
2019-11-04 15:22:11 +00:00
|
|
|
}
|
2020-08-20 16:30:16 +00:00
|
|
|
}
|
|
|
|
}
|
2019-11-04 15:22:11 +00:00
|
|
|
}
|
|
|
|
|
2020-08-20 16:30:16 +00:00
|
|
|
if ($i > 0) {
|
2019-11-04 15:22:11 +00:00
|
|
|
$tpl->set('s', 'NO_ARTICLES_ROW');
|
|
|
|
} else {
|
2020-08-20 16:30:16 +00:00
|
|
|
$sRow = '<tr><td colspan="8" class="bordercell">' . i18n("No article found.", 'cl-workflow') . '</td></tr>';
|
2019-11-04 15:22:11 +00:00
|
|
|
$tpl->set('s', 'NO_ARTICLES_ROW', $sRow);
|
|
|
|
}
|
|
|
|
|
|
|
|
$sLoadSubnavi = 'parent.parent.frames["right"].frames["right_top"].location.href = \'main.php?area=con&frame=3&idcat=' . $iIDCat . '&idtpl=' . $iIDTpl . '&contenido=' . $sSession . "';";
|
|
|
|
$tpl->set('s', 'SUBNAVI', $sLoadSubnavi);
|
|
|
|
|
|
|
|
$frame = ob_get_contents();
|
|
|
|
ob_end_clean();
|
|
|
|
|
|
|
|
$tpl->generate($cfg["path"]['contenido'] . $cfg["path"]["plugins"] . "workflow/templates/template.workflow_tasks.html");
|