$navbar->add_menuitem('Outstanding Tasks', $_CONF['site_url'] . '/nexflow/outstanding.php'); $navbar->add_menuitem('WF Trace', $_CONF['site_admin_url'] . '/plugins/nexflow/wftrace.php'); $navbar->set_selected('WF Trace'); echo $navbar->generate(); echo '</div>'; } $p = new Template($_CONF['path_layout'] . 'nexflow/admin'); $p->set_file('page', 'traceview.thtml'); $p->set_var('action_url', $actionURL); $p->set_var('singleuse', $singleuse); $p->set_var('sprocessid', $process); $p->set_var('queue_totalsize', DB_count($_TABLES['nf_queue'])); $p->set_var('start_link', $_CONF['site_admin_url'] . '/plugins/nexflow/wftrace.php?op=start&singleuse=' . $singleuse); $p->set_var('end_link', $_CONF['site_admin_url'] . '/plugins/nexflow/wftrace.php?op=end&singleuse=' . $singleuse); while ($A = DB_fetchArray($query)) { $assigned_uids = nf_getAssignedUID($A['id']); if (count($assigned_uids) > 0) { foreach ($assigned_uids as $uid) { $assignedNames[] = COM_getDisplayName($uid); } $assigned = implode(',', $assignedNames); } else { $assigned = 'Un-Assigned'; } // Check if there is another task in the same direction as this task and same process $nsql = wfBuildSQLstatement($A['id'], $A['nf_processID'], 1, 0, ''); $nquery = DB_query($nsql); if (DB_numRows($nquery) == 0) { $p->set_var('sameprocess_prevtask_link', 'Previous Task'); } else { $link = '<a href="' . $actionURL . "?process={$A['nf_processID']}&task={$A['id']}&rev=1&singleuse={$singleuse}\">Previous Task</a>";
function nf_formatEmailMessage($type, $tid, $qid, $user) { global $CONF_NF, $_TABLES, $_CONF; $sql = "SELECT taskname,prenotify_message,postnotify_message,reminder_message,prenotify_subject,postnotify_subject,reminder_subject FROM {$_TABLES['nf_templatedata']} WHERE id='{$tid}'"; list($taskname, $premessage, $postmessage, $remindermessage, $presubject, $postsubject, $remindersubject) = DB_fetchArray(DB_query($sql)); $message = ''; $subject = ''; switch ($type) { case 'prenotify': $message = trim($premessage) == '' ? $CONF_NF['prenotify_default_message'] : $premessage; $subject = trim($presubject) == '' ? $CONF_NF['prenotify_default_subject'] : $presubject; break; case 'postnotify': $message = trim($postmessage) == '' ? $CONF_NF['postnotify_default_message'] : $postmessage; $subject = trim($postsubject) == '' ? $CONF_NF['postnotify_default_subject'] : $postsubject; break; case 'reminder': $message = trim($remindermessage) == '' ? $CONF_NF['reminder_default_message'] : $remindermessage; $subject = trim($remindersubject) == '' ? $CONF_NF['reminder_default_subject'] : $remindersubject; break; case 'escalation': $message = $CONF_NF['escalation_message']; $subject = $CONF_NF['escalation_subject']; break; } $dateassigned = DB_getItem($_TABLES['nf_queue'], 'createdDate', "id='{$qid}'"); $processid = DB_getItem($_TABLES['nf_queue'], 'nf_processID', "id='{$qid}'"); if ($processid > 0) { $nfclass = new nexflow($processid); $pid = $nfclass->get_ProcessVariable('PID'); } if (!isset($pid) or $pid < 1) { $projectName = 'unknown'; $projectlink = 'N/A'; $pid = 0; } else { $projectName = DB_getItem($_TABLES['nf_projects'], 'description', "id={$pid}"); $projectlink = $CONF_NF['RequestDetailLink_URL'] . '?id=' . $pid . '?appmode='; } $taskowner_uids = nf_getAssignedUID($qid); $taskowner = ''; foreach ($taskowner_uids as $taskowner_uid) { $taskowner .= $taskowner == '' ? COM_getDisplayName($taskowner_uid) : ', ' . COM_getDisplayName($taskowner_uid); } $link = $CONF_NF['TaskConsole_URL']; $search = array('[taskname]', '[taskowner]', '[user]', '[dateassigned]', '[newline]', '[here]', '[project]', '[projectname]', '[projectlink]', '[siteurl]'); $replace = array($taskname, $taskowner, $user, $dateassigned, "\n", $link, $pid, $projectName, $projectlink, $_CONF['site_url']); $message = str_replace($search, $replace, $message); $subject = str_replace($search, $replace, $subject); // Make API call to add any workflow customized notification formatting if (function_exists('PLG_Nexflow_tasknotification')) { $parms = array('type' => $type, 'tid' => $tid, 'qid' => $qid, 'user' => $user); $apiRetval = PLG_Nexflow_tasknotification($parms, $subject, $message); if (!empty($apiRetval['subject'])) { $subject = $apiRetval['subject']; } if (!empty($apiRetval['message'])) { $message = $apiRetval['message']; } } if ($CONF_NF['debug']) { COM_errorLog("nf_formatEmailMessage => Type:{$type}, Subject:{$subject}, Message:{$message}"); } return array($subject, $message); }
case 'canceltask': if ($taskid != NULL) { $nfclass = new nexflow(); $nfclass->set_debug(false); $nfclass->cancel_task($taskid); } echo taskconsoleShowNavbar('My Tasks'); echo display_mytasks(); break; case 'Re-Assign': if (SEC_hasRights('nexflow.admin')) { $variable_id = COM_applyFilter($_POST['variable_id'], true); $reassign_uid = COM_applyFilter($_POST['task_reassign_uid']); $assignmentRecId = COM_applyFilter($_REQUEST['id'], true); $taskid = COM_applyFilter($_REQUEST['id'], true); $currentlyAssignedUID = nf_getAssignedUID($taskid); nf_reassign_task($taskid, $reassign_uid, $fromFromTaskUser, $variable_id); } echo taskconsoleShowNavbar('My Tasks'); echo display_mytasks($prj_id); break; case 'function': // Intertactive WorkFlow action - Execute CallBack Function $function_handler = COM_applyFilter($_POST['function_handler']); $prj_id = COM_applyFilter($_POST['projectid']); $taskid = COM_applyFilter($_POST['taskid']); $processid = COM_applyFilter($_POST['processid']); if (function_exists($function_handler)) { $errmsg = $function_handler($processid, $taskid, $usermodeUID, $prj_id); } echo taskconsoleShowNavbar('My Tasks');