*/
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");
        }
        $starttime = strtotime(substr_replace(substr(substr($starttime, 0, 2) . chunk_split(substr($starttime, 2, 6), 2, "-") . chunk_split(substr($starttime, 8), 2, ":"), 0, 19), " ", 10, 1));
        switch ($timeunit) {
            case "Seconds":
                $maxtime = $starttime + $timelimit;
                break;
            case "Minutes":
                $maxtime = $starttime + $timelimit * 60;
function piworkflowRenderColumn($idcat, $idart, $idartlang, $column)
{
    global $area, $frame, $idtpl, $cfg, $alttitle, $tmp_articletitle;
    $defaultidworkflow = getWorkflowForCat($idcat);
    $idusersequence = getCurrentUserSequence($idartlang, $defaultidworkflow);
    $associatedUserSequence = new WorkflowUserSequence();
    $associatedUserSequence->loadByPrimaryKey($idusersequence);
    $currentEditor = $associatedUserSequence->get("iduser");
    $workflowItem = $associatedUserSequence->getWorkflowItem();
    if (isCurrentEditor($associatedUserSequence->get("iduser"))) {
        $wfRights = $workflowItem->getStepRights();
        $mayEdit = true;
    } else {
        $wfRights = "";
        $mayEdit = false;
    }
    switch ($column) {
        case "wftitle":
            if ($wfRights["articleedit"] == true) {
                $mtitle = $tmp_articletitle;
            } else {
                $mtitle = strip_tags($tmp_articletitle);
            }
            return $mtitle;
        case "wfstep":
            if ($workflowItem === false) {
                return "nobody";
            }
            return $workflowItem->get("position") . ".) " . $workflowItem->get("name");
        case "wfeditor":
            $sEditor = getGroupOrUserName($currentEditor);
            if (!$sEditor) {
                $sEditor = "nobody";
            }
            return $sEditor;
        case "wfaction":
            $defaultidworkflow = getWorkflowForCat($idcat);
            $idusersequence = getCurrentUserSequence($idartlang, $defaultidworkflow);
            $sActionSelect = getActionSelect($idartlang, $idusersequence);
            if (!$sActionSelect) {
                $mayEdit = false;
            }
            $form = new UI_Form("wfaction" . $idartlang, "main.php", "get");
            $form->setVar("area", $area);
            $form->setVar("action", "workflow_do_action");
            $form->setVar("frame", $frame);
            $form->setVar("idcat", $idcat);
            $form->setVar("modidartlang", $idartlang);
            $form->setVar("idtpl", $idtpl);
            $form->add("select", '<table cellspacing="0" border="0"><tr><td>' . $sActionSelect . '</td><td>');
            $form->add("button", '<input type="image" src="' . $cfg["path"]["htmlpath"] . $cfg["path"]["images"] . "submit.gif" . '"></tr></table>');
            if ($mayEdit == true) {
                return $form->render(true);
            } else {
                return '--- ' . i18n("None") . ' ---';
            }
        case "wflaststatus":
            $sStatus = getLastWorkflowStatus($idartlang);
            if (!$sStatus) {
                $sStatus = '--- ' . i18n("None") . ' ---';
            }
            return $sStatus;
    }
}