function delete($idallocation) { global $cfg, $lang; $obj = new WorkflowAllocation(); $obj->loadByPrimaryKey($idallocation); $idcatlang = $obj->get("idcatlang"); $db = new DB_Contenido(); $sql = "SELECT idcat FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcatlang = '" . Contenido_Security::toInteger($idcatlang) . "'"; $db->query($sql); $db->next_record(); $idcat = $db->f("idcat"); $sql = "SELECT idart FROM " . $cfg["tab"]["cat_art"] . " WHERE idcat = '" . Contenido_Security::toInteger($idcat) . "'"; $db->query($sql); while ($db->next_record()) { $idarts[] = $db->f("idart"); } $idartlangs = array(); if (is_array($idarts)) { foreach ($idarts as $idart) { $sql = "SELECT idartlang FROM " . $cfg["tab"]["art_lang"] . " WHERE idart = '" . Contenido_Security::toInteger($idart) . "' and idlang = '" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); if ($db->next_record()) { $idartlangs[] = $db->f("idartlang"); } } } $workflowArtAllocation = new WorkflowArtAllocation(); $workflowArtAllocations = new WorkflowArtAllocations(); foreach ($idartlangs as $idartlang) { $workflowArtAllocation->loadBy("idartlang", $idartlang); $workflowArtAllocations->delete($workflowArtAllocation->get("idartallocation")); } parent::delete($idallocation); }
* {@internal * created 2003-05-26 * modified 2010-05-20, Murat Purc, removed request check during processing ticket [#CON-307] * * $Id$ * }} * */ define('CON_FRAMEWORK', true); // Contenido startup process include_once '../../../includes/startup.php'; cInclude("includes", "cfg_language_de.inc.php"); cInclude("includes", "functions.con.php"); plugin_include('workflow', 'classes/class.workflow.php'); plugin_include('workflow', 'includes/functions.workflow.php'); $workflowartallocations = new WorkflowArtAllocations(); $workflowusersequences = new WorkflowUserSequences(); $workflowartallocations->select(); while ($obj = $workflowartallocations->next()) { $starttime = $obj->get("starttime"); $idartlang = $obj->get("idartlang"); $lastidusersequence = $obj->get("lastusersequence"); $usersequence = getCurrentUserSequence($idartlang, 0); if ($usersequence != $lastidusersequence) { $workflowusersequences->select("idusersequence = '{$usersequence}'"); if ($wfobj = $workflowusersequences->next()) { $wfitem = $wfobj->get("idworkflowitem"); $pos = $wfobj->get("position"); $timeunit = $wfobj->get("timeunit"); $timelimit = $wfobj->get("timelimit"); }
function doWorkflowAction($idartlang, $action) { global $cfg, $idcat; switch ($action) { case "last": $artAllocations = new WorkflowArtAllocations(); $artAllocations->select("idartlang = '{$idartlang}'"); if ($obj = $artAllocations->next()) { $usersequence = new WorkflowUserSequence(); $usersequence->loadByPrimaryKey($obj->get("idusersequence")); $workflowitem = $usersequence->getWorkflowItem(); $idworkflow = $workflowitem->get("idworkflow"); $newpos = $workflowitem->get("position") - 1; if ($newpos < 1) { $newpos = 1; } $workflowitems = new WorkflowItems(); $workflowitems->select("idworkflow = '{$idworkflow}' AND position = '" . Contenido_Security::escapeDB($newpos, NULL) . "'"); if ($nextObj = $workflowitems->next()) { $userSequences = new WorkflowUserSequences(); $idworkflowitem = $nextObj->get("idworkflowitem"); $userSequences->select("idworkflowitem = '{$idworkflowitem}'"); if ($nextSeqObj = $userSequences->next()) { $obj->set("lastusersequence", $obj->get("idusersequence")); $obj->set("idusersequence", $nextSeqObj->get("idusersequence")); $obj->set("laststatus", "last"); $obj->store(); } } } break; case "next": $artAllocations = new WorkflowArtAllocations(); $artAllocations->select("idartlang = '{$idartlang}'"); if ($obj = $artAllocations->next()) { $usersequence = new WorkflowUserSequence(); $usersequence->loadByPrimaryKey($obj->get("idusersequence")); $workflowitem = $usersequence->getWorkflowItem(); $idworkflow = $workflowitem->get("idworkflow"); $newpos = $workflowitem->get("position") + 1; $workflowitems = new WorkflowItems(); $workflowitems->select("idworkflow = '{$idworkflow}' AND position = '" . Contenido_Security::escapeDB($newpos, NULL) . "'"); if ($nextObj = $workflowitems->next()) { $userSequences = new WorkflowUserSequences(); $idworkflowitem = $nextObj->get("idworkflowitem"); $userSequences->select("idworkflowitem = '{$idworkflowitem}'"); if ($nextSeqObj = $userSequences->next()) { $obj->set("lastusersequence", '10'); $obj->set("idusersequence", $nextSeqObj->get("idusersequence")); $obj->set("laststatus", "confirm"); $obj->store(); } } else { $workflowitems->select("idworkflow = '{$idworkflow}' AND position = '" . Contenido_Security::escapeDB($workflowitem->get("position"), NULL) . "'"); if ($nextObj = $workflowitems->next()) { $userSequences = new WorkflowUserSequences(); $idworkflowitem = $nextObj->get("idworkflowitem"); $userSequences->select("idworkflowitem = '{$idworkflowitem}'"); if ($nextSeqObj = $userSequences->next()) { $obj->set("lastusersequence", $obj->get("idusersequence")); $obj->set("idusersequence", $nextSeqObj->get("idusersequence")); $obj->set("laststatus", "confirm"); $obj->store(); } } } } break; case "reject": $artAllocations = new WorkflowArtAllocations(); $artAllocations->select("idartlang = '{$idartlang}'"); if ($obj = $artAllocations->next()) { $usersequence = new WorkflowUserSequence(); $usersequence->loadByPrimaryKey($obj->get("idusersequence")); $workflowitem = $usersequence->getWorkflowItem(); $idworkflow = $workflowitem->get("idworkflow"); $newpos = 1; $workflowitems = new WorkflowItems(); $workflowitems->select("idworkflow = '{$idworkflow}' AND position = '" . Contenido_Security::escapeDB($newpos, NULL) . "'"); if ($nextObj = $workflowitems->next()) { $userSequences = new WorkflowUserSequences(); $idworkflowitem = $nextObj->get("idworkflowitem"); $userSequences->select("idworkflowitem = '{$idworkflowitem}'"); if ($nextSeqObj = $userSequences->next()) { $obj->set("lastusersequence", $obj->get("idusersequence")); $obj->set("idusersequence", $nextSeqObj->get("idusersequence")); $obj->set("laststatus", "reject"); $obj->store(); } } } break; case "revise": $db = new DB_Contenido(); $sql = "SELECT idart, idlang FROM " . $cfg["tab"]["art_lang"] . " WHERE idartlang = '" . Contenido_Security::escapeDB($idartlang, $db) . "'"; $db->query($sql); $db->next_record(); $idart = $db->f("idart"); $idlang = $db->f("idlang"); $newidart = conCopyArticle($idart, $idcat, "foo"); break; default: } }
* * {@internal * created 2003-07-30 * * $Id$ * }} * */ if (!defined('CON_FRAMEWORK')) { die('Illegal call'); } plugin_include('workflow', 'classes/class.workflow.php'); plugin_include('workflow', 'includes/functions.workflow.php'); global $sess; $sSession = $sess->id; $wfa = new WorkflowArtAllocations(); $wfu = new WorkflowUserSequences(); $users = new User(); $db2 = new DB_Contenido(); ob_start(); if ($usershow == "") { $usershow = $auth->auth["uid"]; } if (!$perm->have_perm_area_action($area, "workflow_task_user_select")) { $usershow = $auth->auth["uid"]; } if ($action == "workflow_do_action") { $selectedAction = "wfselect" . $modidartlang; doWorkflowAction($modidartlang, $GLOBALS[$selectedAction]); } $wfa->select();