function editWorkflowStep($idworkflowitem) { global $area, $idworkflow, $idworkflowitem, $frame, $availableWorkflowActions; global $notification; $workflowitem = new WorkflowItem(); if ($workflowitem->loadByPrimaryKey($idworkflowitem) == false) { return " "; } $workflowactions = new WorkflowActions(); $stepname = $workflowitem->get("name"); $stepdescription = $workflowitem->get("description"); $id = $workflowitem->get("idworkflowitem"); $task = $workflowitem->get("idtask"); $form = new UI_Table_Form("workflow_edit"); $form->setVar("area", $area); $form->setVar("action", "workflow_save_step"); $form->setVar("idworkflow", $idworkflow); $form->setVar("idworkflowitem", $idworkflowitem); $form->setVar("frame", $frame); $form->addHeader(i18n("Edit workflow step", "workflow")); $form->add(i18n("Step name", "workflow"), formGenerateField("text", "wfstepname", $stepname, 40, 255)); $form->add(i18n("Step description", "workflow"), formGenerateField("textbox", "wfstepdescription", $stepdescription, 60, 10)); foreach ($availableWorkflowActions as $key => $value) { $actions .= formGenerateCheckbox("wfactions[" . $key . "]", "1", $workflowactions->get($id, $key)) . '<label for="wfactions[' . $key . ']1">' . $value . '</label>' . "<br>"; } $form->add(i18n("Actions", "workflow"), $actions); $form->add(i18n("Assigned users", "workflow"), getWorkflowUsers($idworkflowitem)); return $form->render(true); }
function getActionSelect($idartlang, $idusersequence) { global $cfg; $workflowActions = new WorkflowActions(); $allActions = $workflowActions->getAvailableWorkflowActions(); $wfSelect = new Template(); $wfSelect->set('s', 'NAME', 'wfselect' . $idartlang); $wfSelect->set('s', 'CLASS', 'text_medium'); $userSequence = new WorkflowUserSequence(); $userSequence->loadByPrimaryKey($idusersequence); $workflowItem = $userSequence->getWorkflowItem(); if ($workflowItem === false) { return; } $wfRights = $workflowItem->getStepRights(); $artAllocation = new WorkflowArtAllocations(); $artAllocation->select("idartlang = '{$idartlang}'"); if ($obj = $artAllocation->next()) { $laststep = $obj->get("lastusersequence"); } $bExistOption = false; if ($laststep != $idusersequence) { $wfSelect->set('d', 'VALUE', 'next'); $wfSelect->set('d', 'CAPTION', i18n("Confirm", "workflow")); $wfSelect->set('d', 'SELECTED', 'SELECTED'); $wfSelect->next(); $bExistOption = true; } if ($wfRights["last"] == true) { $wfSelect->set('d', 'VALUE', 'last'); $wfSelect->set('d', 'CAPTION', i18n("Back to last editor", "workflow")); $wfSelect->set('d', 'SELECTED', ''); $wfSelect->next(); $bExistOption = true; } if ($wfRights["reject"] == true) { $wfSelect->set('d', 'VALUE', 'reject'); $wfSelect->set('d', 'CAPTION', i18n("Reject article", "workflow")); $wfSelect->set('d', 'SELECTED', ''); $wfSelect->next(); $bExistOption = true; } if ($wfRights["revise"] == true) { $wfSelect->set('d', 'VALUE', 'revise'); $wfSelect->set('d', 'CAPTION', i18n("Revise article", "workflow")); $wfSelect->set('d', 'SELECTED', ''); $wfSelect->next(); $bExistOption = true; } if ($bExistOption) { return $wfSelect->generate($cfg['path']['templates'] . $cfg['templates']['generic_select'], true); } else { return false; } }
function getStepRights() { $idwfi = $this->values["idworkflowitem"]; $workflowActions = new WorkflowActions(); $actions = WorkflowActions::getAvailableWorkflowActions(); foreach ($actions as $key => $value) { $rights[$key] = $workflowActions->get($idwfi, $key); } return $rights; }