echo COM_startBlock("Outstanding Tasks"); echo taskconsoleShowNavbar('Outstanding Tasks'); $p = new Template($_CONF['path_layout'] . 'nexflow/admin'); $p->set_file(array('report' => 'view_outstandingtasks.thtml', 'tasks' => 'view_outstandingtask_record.thtml')); $imgset = $_CONF['layout_url'] . '/nexflow/images'; $actionurl = $_CONF['site_admin_url'] . '/plugins/nexflow/outstanding.php'; $p->set_var('layout_url', $_CONF['layout_url']); $p->set_var('site_url', $_CONF['site_url']); $p->set_var('imgset', $imgset); $p->set_var('actionurl', $actionurl); $p->set_var('heading1', 'Assigned'); $p->set_var('heading2', 'Owner'); $p->set_var('heading3', 'Request'); $p->set_var('heading4', 'Task Description'); $p->set_var('heading5', 'Actions'); $p->set_var('user_options', nf_listUsers()); $p->set_var('public_url', $_CONF['site_admin_url'] . '/plugins/nexflow'); $options = array(15, 25, 50, 75, 150); foreach ($options as $size) { if ($pagesize == $size) { $pagesize_options .= '<option value="' . $size . '" SELECTED>' . $size . '</option>'; } else { $pagesize_options .= '<option value="' . $size . '">' . $size . '</option>'; } } $p->set_var('pagesize_options', $pagesize_options); $sql = "SELECT distinct a.id, a.nf_processID, a.nf_templateDataID, b.nf_templateID, b.taskname, a.createdDate, "; $sql .= "b.assignedByVariable, e.id as assignment_rec, e.uid as assigned_uid, e.assignBack_uid, e.nf_processVariable, "; $sql .= "f.fullname, a.status, g.AppGroup "; $sql .= "FROM {$_TABLES['nf_queue']} a "; $sql .= "LEFT JOIN {$_TABLES['nf_templatedata']} b on a.nf_templateDataID = b.id ";
function processDetailGetOutstandingTasks($project_id, &$template) { global $_TABLES, $CONF_NF, $usermodeUID; // Retrieve any Outstanding Tasks // Determine the unique process id's for this project $sql = "SELECT wf_process_id,related_processes FROM {$_TABLES['nf_projects']} WHERE id='{$project_id}'"; $query = DB_QUERY($sql); $A = DB_fetchArray($query); if ($A['related_processes'] != '') { $projectProcesses = explode(',', $A['related_processes']); } else { $projectProcesses = array(); } array_push($projectProcesses, $A['wf_process_id']); // Check and see if there are any child process of this parent process - will if this is a regenerated process $A['wf_process_id'] = NXCOM_filterInt($A['wf_process_id']); $query = DB_query("SELECT id FROM {$_TABLES['nf_process']} WHERE pid={$A['wf_process_id']}"); while ($P = DB_fetchArray($query)) { array_push($projectProcesses, $P['id']); } $cid = 1; if (count($projectProcesses > 0)) { foreach ($projectProcesses as $process_id) { // Get tasks that have assignment by variable $template->set_var('taskuser', $usermodeUID); $template->set_var('user_options', nf_listUsers()); if ($process_id > 0) { $sql = "SELECT distinct a.id, a.nf_processID,d.taskname, d.nf_templateID, a.status, a.archived, "; $sql .= "a.createdDate, c.uid, c.nf_processVariable, a.nf_templateDataID FROM {$_TABLES['nf_queue']} a "; $sql .= "LEFT JOIN {$_TABLES['nf_templateassignment']} b ON a.nf_templateDataID = b.nf_templateDataID "; $sql .= "LEFT JOIN {$_TABLES['nf_productionassignments']} c ON c.task_id = a.id "; $sql .= "LEFT JOIN {$_TABLES['nf_templatedata']} d on a.nf_templateDataID = d.id "; $sql .= "WHERE a.nf_processID = '{$process_id}' AND (a.archived IS NULL OR a.archived = 0)"; $sql .= "ORDER BY a.id"; $q2 = DB_query($sql); while ($B = DB_fetchArray($q2, false)) { if ($B['nf_processVariable'] == '') { continue; } $template->set_var('taskassign_mode', 'variable'); $template->set_var('otaskid', $B['id']); if (SEC_hasRights('nexflow.edit')) { $template->set_var('otask_span', 1); $template->set_var('show_otaskaction', ''); } else { $template->set_var('otask_span', 2); $template->set_var('show_otaskaction', 'none'); } $template->set_var('otask_user', COM_getDisplayName($B['uid'])); $template->set_var('otask_name', $B['taskname']); $template->set_var('otask_date', $B['createdDate']); $template->set_var('otask_id', $B['id']); $template->set_var('variable_id', $B['nf_processVariable']); if ($cid == 1) { $template->parse('outstandingtask_records', 'outstandingtasks'); } else { $template->parse('outstandingtask_records', 'outstandingtasks', true); } $cid++; } // while } } } }
function nf_formatOutstandingTasks($process_id, $projectProcesses, &$tmplt) { global $_TABLES, $_USER, $action_url, $usermodeUID; $projectProcesses[] = $process_id; $timesThru = 1; if (count($projectProcesses > 0)) { foreach ($projectProcesses as $process_id) { // Get tasks that have assignment by variable $tmplt->set_var('taskuser', $usermodeUID); $tmplt->set_var('user_options', nf_listUsers()); if ($process_id > 0) { $sql = "SELECT distinct a.id, a.nf_processID,d.taskname, d.nf_templateID, a.status, a.archived, "; $sql .= "a.createdDate, c.uid, c.nf_processVariable, a.nf_templateDataID FROM {$_TABLES['nf_queue']} a "; $sql .= "LEFT JOIN {$_TABLES['nf_templateassignment']} b ON a.nf_templateDataID = b.nf_templateDataID "; $sql .= "LEFT JOIN {$_TABLES['nf_productionassignments']} c ON c.task_id = a.id "; $sql .= "LEFT JOIN {$_TABLES['nf_templatedata']} d on a.nf_templateDataID = d.id "; $sql .= "WHERE a.nf_processID = '{$process_id}' AND (a.archived IS NULL OR a.archived = 0)"; $sql .= "ORDER BY a.id"; $q2 = DB_query($sql); while ($B = DB_fetchArray($q2, false)) { if ($B['nf_processVariable'] == '') { continue; } $tmplt->set_var('taskassign_mode', 'variable'); $tmplt->set_var('otaskid', $B['id']); if (SEC_hasRights('nexflow.edit')) { $tmplt->set_var('otask_span', 1); $tmplt->set_var('show_otaskaction', ''); } else { $tmplt->set_var('otask_span', 2); $tmplt->set_var('show_otaskaction', 'none'); } $tmplt->set_var('otask_user', COM_getDisplayName($B['uid'])); $tmplt->set_var('otask_name', $B['taskname']); $tmplt->set_var('otask_date', $B['createdDate']); $tmplt->set_var('otask_id', $B['id']); $tmplt->set_var('variable_id', $B['nf_processVariable']); if ($timesThru == 1) { $tmplt->parse('record_outstandingtasks', 'outstandingtasks'); } else { $tmplt->parse('record_outstandingtasks', 'outstandingtasks', true); } $timesThru++; } // while } } } if ($timesThru == 0) { $tmplt->set_var('record_outstandingtasks', '<tr><td colspan="4" style="padding-left:10px">No outstanding user tasks</td></tr>'); } else { if ($tmplt->get_var('record_outstandingtasks') == '') { $tmplt->set_var('record_outstandingtasks', '<tr><td colspan="4" style="padding-left:10px">No outstanding user tasks</td></tr>'); } } }