function getWorkflowForUserSequence($usersequence) { $usersequences = new WorkflowUserSequences(); $workflowitems = new WorkflowItems(); $usersequences->select("idusersequence = '{$usersequence}'"); if ($obj = $usersequences->next()) { $idworkflowitem = $obj->get("idworkflowitem"); } else { return false; } $workflowitems->select("idworkflowitem = '{$idworkflowitem}'"); if ($obj = $workflowitems->next()) { return $obj->get("idworkflow"); } else { return false; } }
/** * init initializes a new wf_items entry. Should * only be called by the create function. * @param int $idworkflow The workflow to set the item to */ function init($idworkflow, $idposition) { global $cfg; $workflows = new Workflows(); $workflows->select("idworkflow = '{$idworkflow}'"); if ($workflows->next() === false) { $this->lasterror = i18n("Workflow doesn't exist", "workflow"); return false; } $workflowItems = new WorkflowItems(); $workflowItems->select("position = '{$idposition}' AND idworkflow = '{$idworkflow}'"); if ($workflowItems->next()) { $this->lasterror = i18n("Position in this workflow already exists.", "workflow"); return false; } parent::setField("idworkflow", $idworkflow); parent::setField("position", $idposition); parent::store(); return true; }
function getWorkflowList() { global $idworkflow, $cfg; $ui = new UI_Menu(); $workflowitems = new WorkflowItems(); $workflowitems->select("idworkflow = '{$idworkflow}'", "", "position ASC"); while ($workflowitem = $workflowitems->next()) { $pos = $workflowitem->get("position"); $name = $workflowitem->get("name"); $id = $workflowitem->get("idworkflowitem"); $edititem = new Link(); $edititem->setCLink("workflow_steps", 4, "workflow_step_edit"); $edititem->setCustom("idworkflowitem", $id); $edititem->setCustom("idworkflow", $idworkflow); $moveup = new Link(); $moveup->setCLink("workflow_steps", 4, "workflow_step_up"); $moveup->setCustom("idworkflowitem", $id); $moveup->setCustom("idworkflow", $idworkflow); $moveup->setCustom("position", $pos); $moveup->setAlt(i18n("Move step up", "workflow")); $moveup->setContent('<img style="padding-left: 2px" border="0" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/no_verschieben.gif" . '">'); $movedown = new Link(); $movedown->setCLink("workflow_steps", 4, "workflow_step_down"); $movedown->setCustom("idworkflowitem", $id); $movedown->setCustom("idworkflow", $idworkflow); $movedown->setCustom("position", $pos); $movedown->setAlt(i18n("Move step down", "workflow")); $movedown->setContent('<img style="padding-left: 2px" border="0" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/nu_verschieben.gif" . '">'); $deletestep = new Link(); $deletestep->setCLink("workflow_steps", 4, "workflow_step_delete"); $deletestep->setCustom("idworkflowitem", $id); $deletestep->setCustom("idworkflow", $idworkflow); $deletestep->setCustom("position", $pos); $deletestep->setAlt(i18n("Delete step", "workflow")); $deletestep->setContent('<img style="padding-left: 2px" border="0" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/workflow_step_delete.gif" . '">'); $ui->setTitle($id, "{$pos}. {$name}"); $ui->setLink($id, $edititem); if ($pos > 1) { $ui->setActions($id, "moveup", $moveup->render()); } else { $ui->setActions($id, "moveup", '<img style="padding-left: 2px" src="images/spacer.gif" width="15" height="1">'); } if ($pos < $workflowitems->count()) { $ui->setActions($id, "movedown", $movedown->render()); } else { $ui->setActions($id, "movedown", '<img style="padding-left: 2px" src="images/spacer.gif" width="15" height="1">'); } $ui->setActions($id, "delete", $deletestep->render()); if ($_GET['idworkflowitem'] == $id) { $ui->setExtra($id, 'id="marked" '); } } $content = $ui->render(false); return $content; }
/** * Returns the current item position * @param string $field Void field since we override the usual setField function * @param string $value Void field since we override the usual setField function */ function currentItemPosition() { $idworkflowitem = $this->get("idworkflowitem"); $workflowItems = new WorkflowItems(); $workflowItems->select("idworkflowitem = '{$idworkflowitem}'"); if ($item = $workflowItems->next()) { return $item->get("position"); } }