function portal_incident_table($sql) { global $CONFIG, $showclosed; $result = mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } $numincidents = mysql_num_rows($result); if ($numincidents >= 1) { $shade = 'shade1'; $html .= "<table align='center' width='70%'>"; $html .= "<tr>"; $html .= colheader('id', $GLOBALS['strID']); $html .= colheader('title', $GLOBALS['strTitle']); $html .= colheader('owner', $GLOBALS['strOwner']); $html .= colheader('lastupdated', $GLOBALS['strLastUpdated']); $html .= colheader('contact', $GLOBALS['strContact']); $html .= colheader('status', $GLOBALS['strStatus']); if ($showclosed != "true") { $html .= colheader('actions', $GLOBALS['strOperation']); } $html .= "</tr>\n"; while ($incident = mysql_fetch_object($result)) { $html .= "<tr class='{$shade}'><td align='center'>"; $html .= "<a href='incident.php?id={$incident->id}'>{$incident->id}</a></td>"; $html .= "<td>"; if (!empty($incident->softwareid)) { $html .= software_name($incident->softwareid) . "<br />"; } $html .= "<strong><a href='incident.php?id={$incident->id}'>{$incident->title}</a></strong></td>"; $html .= "<td align='center'>" . user_realname($incident->owner) . "</td>"; $html .= "<td align='center'>" . ldate($CONFIG['dateformat_datetime'], $incident->lastupdated) . "</td>"; $html .= "<td align='center'><a href='contactdetails.php?id={$incident->contactid}'>"; $html .= "{$incident->forenames} {$incident->surname}</a></td>"; $html .= "<td align='center'>" . incidentstatus_name($incident->status, external) . "</td>"; if ($showclosed != "true") { $html .= "<td align='center'><a href='update.php?id={$incident->id}'>{$GLOBALS['strUpdate']}</a> | "; //check if the customer has requested a closure $lastupdate = list($update_userid, $update_type, $update_currentowner, $update_currentstatus, $update_body, $update_timestamp, $update_nextaction, $update_id) = incident_lastupdate($incident->id); if ($lastupdate[1] == "customerclosurerequest") { $html .= "{$GLOBALS['strClosureRequested']}</td>"; } else { $html .= "<a href='close.php?id={$incident->id}'>{$GLOBALS['strRequestClosure']}</a></td>"; } } $html .= "</tr>"; if ($shade == 'shade1') { $shade = 'shade2'; } else { $shade = 'shade1'; } } $html .= "</table>"; } else { $html .= "<p class='info'>{$GLOBALS['strNoIncidents']}</p>"; } return $html; }
?> </td> <td align='center' width='150'><?php echo ldate($CONFIG['dateformat_datetime'], $results["opened"]); ?> </td> <td align='center' width='150'><?php echo ldate($CONFIG['dateformat_datetime'], $results["lastupdated"]); ?> </td> <td align='center' width='50'><?php echo $results["type"]; ?> </td> <td align='center' width='50'><?php echo incidentstatus_name($results["status"]); ?> </td> </tr> <?php // invert shade if ($shade == 1) { $shade = 0; } else { $shade = 1; } } } echo "</table>"; echo "<br />"; echo "<p align='center'><a href=\"search_incidents_advanced.php\">{$strSearchAgain}</a></p>";
$now = time(); if ($timeofnextaction < 0) { $timeofnextaction = 0; } break; default: $timeofnextaction = 0; break; } // Put text into body of update for field changes (reverse order) // delim first $bodytext = "<hr>" . $bodytext; $oldstatus = incident_status($id); $oldtimeofnextaction = incident_timeofnextaction($id); if ($newstatus != $oldstatus) { $bodytext = "Status: " . mysql_real_escape_string(incidentstatus_name($oldstatus)) . " -> <b>" . mysql_real_escape_string(incidentstatus_name($newstatus)) . "</b>\n\n" . $bodytext; } if ($newpriority != incident_priority($id)) { $bodytext = "New Priority: <b>" . mysql_real_escape_string(priority_name($newpriority)) . "</b>\n\n" . $bodytext; } if ($timeofnextaction > $oldtimeofnextaction + 60) { $timetext = "Next Action Time: "; if ($oldtimeofnextaction - $now < 1) { $timetext .= "None"; } else { $timetext .= date("D jS M Y @ g:i A", $oldtimeofnextaction); } $timetext .= " -> <b>"; if ($timeofnextaction < 1) { $timetext .= "None"; } else {
mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_ERROR); } $sql = "SELECT status FROM `{$dbIncidents}` WHERE id = {$incident}"; $result = mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_ERROR); } if ($obj = mysql_fetch_object($result) and $obj->status != 1 and $obj->status != 3) { $sql = "UPDATE `{$dbIncidents}` SET status = 1, lastupdated = {$now} WHERE id = {$incident}"; mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_ERROR); } $bodytext = "Status: " . incidentstatus_name($obj->status) . " -> <b>" . incidentstatus_name(1) . "</b>\n\n" . $srtrTaskStarted; $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, currentowner, currentstatus, bodytext, timestamp) VALUES "; $sql .= "({$incident}, {$sit[2]}, 'research', {$sit[2]}, 1, '{$bodytext}', {$now})"; mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_ERROR); } } html_redirect("tasks.php?incident={$incident}", TRUE, $strActivityAdded); } else { switch ($action) { case 'addtask': // External variables $name = cleanvar($_POST['name']); $description = cleanvar($_POST['description']); $priority = cleanvar($_POST['priority']);
$newstatus = cleanvar($_REQUEST['newstatus']); $userid = cleanvar($_REQUEST['userid']); $temporary = cleanvar($_REQUEST['temporary']); $id = cleanvar($_REQUEST['id']); if ($tempnewowner == 'yes') { $temporary = 'yes'; } // Retrieve current incident details $sql = "SELECT * FROM `{$dbIncidents}` WHERE id='{$id}' LIMIT 1"; $result = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); } $incident = mysql_fetch_object($result); if ($newstatus != $incident->status) { $bodytext = "Status: " . incidentstatus_name($incident->status) . " -> <b>" . incidentstatus_name($newstatus) . "</b>\n\n" . $bodytext; } // Update incident $sql = "UPDATE `{$dbIncidents}` SET "; if ($fullreassign == 'yes') { //full reassign with temp owner, fixes http://bugs.sitracker.org/view.php?id=141 $sql .= "owner='{$userid}', towner=0, "; $triggeruserid = $userid; } elseif ($temporary != 'yes' and $incident->towner > 0 and $sit[2] == $incident->owner) { $sql .= "owner='{$sit[2]}', towner=0, "; // make current user = owner $triggeruserid = $sit[2]; } elseif ($temporary != 'yes' and $sit[2] == $incident->towner) { $sql .= "towner=0, "; // temp owner removing temp ownership $triggeruserid = $incident->owner;
function dashboard_watch_incidents_display($dashletid) { global $CONFIG, $sit; $html = "<script type='text/javascript'>\n //<![CDATA[\n function statusform_submit(user)\n {\n URL = \"incidents.php?status=\" + window.document.statusform.status.options[window.document.statusform.status.selectedIndex].value + \"&user=\" + user;\n window.confirm(URL);\n window.location.href = URL;\n }\n //]]>\n </script>"; // FIXME, commented out the queue selector, needs recoding to work with one-file dashboards - Ivan 22May08 // $html .= "<form action='{$_SERVER['PHP_SELF']}' style='text-align: center;'>"; // $html .= "{$GLOBALS['strQueue']}: <select class='dropdown' name='queue' onchange='window.location.href=this.options[this.selectedIndex].value'>\n"; // $html .= "<option "; // if ($queue == 5) // { // $html .= "selected='selected' "; // } // $html .= "value=\"javascript:get_and_display('display_watch_incidents.inc.php?queue=5','watch_incidents_windows');\">{$GLOBALS['strAll']}</option>\n"; // $html .= "<option "; // if ($queue == 1) // { // $html .= "selected='selected' "; // } // $html .= "value=\"javascript:get_and_display('display_watch_incidents.inc.php?queue=1','watch_incidents_windows');\">{$GLOBALS['strActionNeeded']}</option>\n"; // $html .= "<option "; // if ($queue == 3) // { // $html .= "selected='selected' "; // } // $html .= "value=\"javascript:get_and_display('display_watch_incidents.inc.php?queue=3','watch_incidents_windows');\">{$GLOBALS['strAllOpen']}</option>\n"; // $html .= "</select>\n"; // $html .= "</form>"; $sql = "SELECT type, id FROM `{$CONFIG['db_tableprefix']}dashboard_watch_incidents` WHERE userid = {$sit[2]} ORDER BY type"; $result = mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error() . $sql, E_USER_WARNING); } if (mysql_num_rows($result) > 0) { $header_printed = FALSE; $previous = 0; while ($obj = mysql_fetch_object($result)) { if ($obj->type != 3 and $previous == 3) { $html .= "</table>"; } if ($obj->type == 3 and !$header_printed) { $html .= "<table>"; } else { if ($obj->type != 3) { $html .= "<table>"; } } switch ($obj->type) { case '0': //Site $sql = "SELECT i.id, i.title, i.status, i.servicelevel, i.maintenanceid, i.priority, c.forenames, c.surname, c.siteid "; $sql .= "FROM `{$GLOBALS['dbIncidents']}` AS i, `{$GLOBALS['dbContacts']}` AS c "; $sql .= "WHERE i.contact = c.id AND c.siteid = {$obj->id} "; $sql .= "AND i.status != " . STATUS_CLOSED . " AND i.status != " . STATUS_CLOSING . " "; $lsql = "SELECT name FROM `{$GLOBALS['dbSites']}` WHERE id = {$obj->id}"; $lresult = mysql_query($lsql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } $lobj = mysql_fetch_object($lresult); $html .= "<tr><th colspan='3'>{$lobj->name} ({$GLOBALS['strSite']})</th></tr>"; break; case '1': //contact $sql = "SELECT i.id, i.title, i.status, i.servicelevel, i.maintenanceid, i.priority, c.forenames, c.surname, c.siteid "; $sql .= "FROM `{$GLOBALS['dbIncidents']}` AS i, `{$GLOBALS['dbContacts']}` AS c "; $sql .= "WHERE i.contact = c.id AND i.contact = {$obj->id} "; $sql .= "AND i.status != " . STATUS_CLOSED . " AND i.status != " . STATUS_CLOSING . " "; $lsql = "SELECT forenames, surname FROM `{$GLOBALS['dbContacts']}` WHERE id = {$obj->id} "; $lresult = mysql_query($lsql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } $lobj = mysql_fetch_object($lresult); $html .= "<tr><th colspan='3'>{$lobj->forenames} {$lobj->surname} ({$GLOBALS['strContact']})</th></tr>"; break; case '2': //engineer $sql = "SELECT i.id, i.title, i.status, i.servicelevel, i.maintenanceid, i.priority, c.forenames, c.surname, c.siteid "; $sql .= "FROM `{$GLOBALS['dbIncidents']}` AS i, `{$GLOBALS['dbContacts']}` AS c "; $sql .= "WHERE i.contact = c.id AND (i.owner = {$obj->id} OR i.towner = {$obj->id}) "; $sql .= "AND i.status != " . STATUS_CLOSED . " AND i.status != " . STATUS_CLOSING . " "; $lsql = "SELECT realname FROM `{$GLOBALS['dbUsers']}` WHERE id = {$obj->id}"; $lresult = mysql_query($lsql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } $lobj = mysql_fetch_object($lresult); $html .= "<tr><th colspan='3'>"; $html .= sprintf($GLOBALS['strIncidentsForEngineer'], $lobj->realname); $html .= "</th></tr>"; break; case '3': //incident $sql = "SELECT i.id, i.title, i.status, i.servicelevel, i.maintenanceid, i.priority "; $sql .= "FROM `{$GLOBALS['dbIncidents']}` AS i "; $sql .= "WHERE i.id = {$obj->id} "; //$sql .= "AND incidents.status != 2 AND incidents.status != 7"; break; default: $sql = ''; } if (!empty($sql)) { switch ($queue) { case 1: // awaiting action $sql .= "AND ((timeofnextaction > 0 AND timeofnextaction < {$now}) OR "; $sql .= "(IF ((status >= 5 AND status <=8), ({$now} - lastupdated) > ({$CONFIG['regular_contact_days']} * 86400), 1=2 ) "; // awaiting $sql .= "OR IF (status='1' OR status='3' OR status='4', 1=1 , 1=2) "; // active, research, left message - show all $sql .= ") AND timeofnextaction < {$now} ) "; break; case 3: // All Open $sql .= "AND status!='2' "; break; case 5: // ALL // ALL default: break; } $iresult = mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } if (mysql_num_rows($iresult) > 0) { if ($obj->type == 3 and !$header_printed) { $html .= "<tr><th colspan='4'>{$GLOBALS['strIncidents']}</th></tr>"; $html .= "<tr>"; $html .= colheader('id', $GLOBALS['strID']); $html .= colheader('title', $GLOBALS['strTitle']); //$html .= colheader('customer', $GLOBALS['strCustomer']); $html .= colheader('status', $GLOBALS['strStatus']); $html .= "</tr>\n"; $header_printed = TRUE; } else { if ($obj->type != 3) { $html .= "<tr>"; $html .= colheader('id', $GLOBALS['strID']); $html .= colheader('title', $GLOBALS['strTitle']); //$html .= colheader('customer', $GLOBALS['strCustomer']); $html .= colheader('status', $GLOBALS['strStatus']); $html .= "</tr>\n"; } } $shade = 'shade1'; while ($incident = mysql_fetch_object($iresult)) { $html .= "<tr class='{$shade}'>"; $html .= "<td>{$incident->id}</td>"; $html .= "<td><a href='javascript:incident_details_window({$incident->id}) ' class='info'>" . $incident->title; $html .= "<span><strong>{$GLOBALS['strCustomer']}:</strong> " . sprintf($GLOBALS['strXofX'], "{$incident->forenames} {$incident->surname}", site_name($incident->siteid)); list($update_userid, $update_type, $update_currentowner, $update_currentstatus, $update_body, $update_timestamp, $update_nextaction, $update_id) = incident_lastupdate($incident->id); $update_body = parse_updatebody($update_body); if (!empty($update_body) and $update_body != '...') { $html .= "<br />{$update_body}"; } $html .= "</span></a></td>"; $html .= "<td>" . incidentstatus_name($incident->status) . "</td>"; $html .= "</tr>\n"; if ($shade == 'shade1') { $shade = 'shade2'; } else { $shade = 'shade1'; } } } else { if ($obj->type == 3 and !$header_printed) { $html .= "<tr><th colspan='3'>{$GLOBALS['strIncidents']}</th></tr>"; $html .= "<tr><td colspan='3'>{$GLOBALS['strNoIncidents']}</td></tr>\n"; $header_printed = TRUE; } else { if ($obj->type != 3) { $html .= "<tr><td colspan='3'>{$GLOBALS['strNoIncidents']}</td></tr>\n"; } } } } if ($obj->type == 3 and !$header_printed) { $html .= "</table>\n"; } $previous = $obj->type; } } else { $html .= "<p align='center'>{$GLOBALS['strNoRecords']}</p>"; } return $html; }
} else { $lang = $CONFIG['default_i18n']; } $count = 0; $pubdate = $now; $items = array(); while ($incident = mysql_fetch_object($result)) { // Get Last Update list($update_userid, $update_type, $update_currentowner, $update_currentstatus, $update_body, $update_timestamp, $update_nextaction, $update_id) = incident_lastupdate($incident->id); if ($count == 0) { $update_timestamp; } $authorname = user_realname($update_userid); $author = user_email($update_userid) . " (" . $authorname . ")"; $fi = new FeedItem(); $fi->title = "[{$incident->id}] - {$incident->title} ({$update_type})"; $fi->author = $author; $fi->link = "{$CONFIG['application_uriprefix']}{$CONFIG['application_webpath']}incident_details.php?id={$incident->id}"; $fi->description = "{$strUpdated} " . date($CONFIG['dateformat_datetime'], $update_timestamp) . " {$strby} <strong>{$authorname}</strong>. \n{$strStatus}: " . incidentstatus_name($update_currentstatus) . ". <br />\n\n" . strip_tags($update_body); $fi->pubdate = $update_timestamp; $fi->guid = "{$CONFIG['application_uriprefix']}{$CONFIG['application_webpath']}incident_details.php?id={$incident->id}#{$update_id}"; $count++; $items[] = $fi; } $feed = new Feed(); $feed->title = "{$CONFIG['application_shortname']} {$strIncidents}"; $feed->feedurl = "{$CONFIG['application_uriprefix']}{$CONFIG['application_webpath']}incident_details.php?id={$incident->id}"; $feed->description = "{$CONFIG['application_name']}: {$strIncidents} {$strFor} " . user_realname($userid) . " ({$strActionNeeded})"; $feed->pubdate = $pubdate; $feed->items = $items; $feed->generate_feed();
echo "</a> "; } // Product Info if (!empty($incident->product)) { $pisql = "SELECT pi.information AS label, ipi.information AS information "; $pisql .= "FROM `{$dbIncidentProductInfo}` AS ipi, `{$dbProductInfo}` AS pi "; $pisql .= "WHERE pi.id = ipi.productinfoid AND ipi.incidentid = {$incidentid}"; $piresult = mysql_query($pisql); if (mysql_num_rows($piresult) > 0) { while ($pi = mysql_fetch_object($piresult)) { echo "{$pi->label}: {$pi->information} <br />\n"; } } } echo sprintf($strOpenForX, $opened_for) . " "; echo incidentstatus_name($incident->status); if ($incident->status == 2) { echo " (" . closingstatus_name($incident->closingstatus) . ")"; } echo "<br />\n"; // Show sla target/review target if incident is still open if ($incident->status != 2 and $incident->status != 7) { if ($targettype != '') { if ($slaremain > 0) { echo sprintf($strSLAInX, $targettype, format_workday_minutes($slaremain)); } elseif ($slaremain < 0) { echo " " . sprintf($strSLAXLate, $targettype, format_workday_minutes(0 - $slaremain)); } else { echo " " . sprintf($strSLAXDueNow, $targettype); } }
if ($timeofnextaction < 0) { $timeofnextaction = 0; } break; default: $timeofnextaction = 0; break; } $oldtimeofnextaction = incident_timeofnextaction($id); if ($newincidentstatus != incident_status($id)) { $sql = "UPDATE `{$dbIncidents}` SET status='{$newincidentstatus}', lastupdated='{$now}', timeofnextaction='{$timeofnextaction}' WHERE id='{$id}'"; mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); } $updateheader = "New Status: <b>" . incidentstatus_name($newincidentstatus) . "</b>\n\n"; } else { mysql_query("UPDATE `{$dbIncidents}` SET lastupdated='{$now}', timeofnextaction='{$timeofnextaction}' WHERE id='{$id}'"); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); } } $timetext = ''; if ($timeofnextaction != 0) { $timetext = "Next Action Time: "; if ($oldtimeofnextaction - $now < 1) { $timetext .= "None"; } else { $timetext .= date("D jS M Y @ g:i A", $oldtimeofnextaction); } $timetext .= " -> <b>";
$html .= "<td class='shade1'>" . $engineer['count'] . "</td>"; $html .= "<td class='shade1'>" . $engineer['4'] . "</td>"; $html .= "<td class='shade1'>" . $engineer['3'] . "</td>"; $html .= "<td class='shade1'>" . $engineer['2'] . "</td>"; $html .= "<td class='shade1'>" . $engineer['1'] . "</td>"; $html .= "<td class='shade1' >"; $html .= "<table width='100%'>"; foreach ($engineer['calls'] as $call) { $replace = array("Response", "Action"); $html .= "<tr><td width='50%'>{$call['text']}</td>"; $html .= "<td width='12%'>" . user_realname($call['localowner']); if (!empty($call['salfordtowner'])) { $html .= "<br />T: " . user_realname($call['salfordtowner']); } $html .= "</td><td width='25%'>" . $call['software'] . "</td>"; $html .= "<td>" . str_replace($replace, "", incidentstatus_name($call['status'])) . "</td></tr>"; } $html .= "</table>\n\n"; $html .= "</td>"; $total += $engineer['count']; $c['4'] += $engineer['4']; $c['3'] += $engineer['3']; $c['2'] += $engineer['2']; $c['1'] += $engineer['1']; $html .= "</tr>\n"; } $html .= "<tr><td>{$strTotal}:</td><td>{$total}</td>"; if (empty($c['4'])) { $c['4'] = 0; } if (empty($c['3'])) {
} else { echo "{$strUnknownServiceLevel}<br />"; } } $blinktime = time() - $servicelevel->initial_response_mins * 60; if ($incidents['priority'] == 4 and $incidents['lastupdated'] <= $blinktime) { echo "<strong class='critical'>" . priority_name($incidents["priority"]) . "</strong>"; } else { echo priority_name($incidents['priority']); } echo "</td>\n"; echo "<td align='center'>"; if ($incidents['status'] == 5 and $incidents['towner'] == $sit[2]) { echo "<strong>{$strAwaitingYourResponse}</strong>"; } else { echo incidentstatus_name($incidents["status"]); } if ($incidents['status'] == 2) { echo "<br />" . closingstatus_name($incidents['closingstatus']); } echo "</td>\n"; echo "<td align='center'>"; echo "{$updated}"; echo " {$strby} {$update_user}"; if ($incidents['towner'] > 0 and $incidents['towner'] != $user) { if ($incidents['owner'] != $user or $user == 'all') { echo "<br />{$strOwner}: <strong>" . user_realname($incidents['owner'], TRUE) . "</strong>"; } echo "<br />{$strTemp}: <strong>" . user_realname($incidents['towner'], TRUE) . "</strong>"; } elseif ($incidents['owner'] != $user) { echo "<br />{$strOwner}: <strong>" . user_realname($incidents['owner'], TRUE) . "</strong>";
if ($mode == 'site') { $contactrealname = contact_realname($row->contact); echo "<td>{$contactrealname}</td>"; if ($mode == 'site') { if (!array_key_exists($contactrealname, $contactlist)) { $contactlist[$contactrealname] = 1; } else { $contactlist[$contactrealname]++; } } } echo "<td>" . product_name($row->product) . "</td>"; if ($row->status == 2) { echo "<td>Closed, " . closingstatus_name($row->closingstatus) . "</td>"; } else { echo "<td>" . incidentstatus_name($row->status) . "</td>"; } echo "<td>" . user_realname($row->owner, TRUE) . "</td>"; echo "<td>" . ldate($CONFIG['dateformat_date'], $row->opened) . "</td>"; if ($row->closed > 0) { echo "<td>" . ldate($CONFIG['dateformat_date'], $row->closed) . "</td>"; echo "<td>" . format_seconds($row->duration_closed) . "</td>"; } else { echo "<td colspan='2'>-</td>"; } echo "<td>"; $slahistory = incident_sla_history($row->incidentid); if (is_array($slahistory)) { foreach ($slahistory as $history) { if ($history['targetmet'] == FALSE) { $targetmet = FALSE;
$isql .= "WHERE c.siteid = s.id AND s.id={$site->id} AND i.opened >" . strtotime($startdate) . " AND i.closed < " . strtotime($enddate) . " AND i.contact = c.id "; $iresult = mysql_query($isql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } if (mysql_num_rows($iresult) > 0) { $csv .= "<tr><td colspan='{$colspan}'>"; $csv .= "<table width='100%'><th>{$strID}</th><th>{$strTitle}</th><th>{$strContact}</th><th>{$strSkill}</th><th>{$strStatus}</th>"; $csv .= "<th>{$strEngineer}</th><th>{$strOpened}</th><th>{$strClosed}</th><th>{$strDuration}</th><th>{$strSLA}</th></tr>"; $shade1 = 'shade1'; while ($obj = mysql_fetch_object($iresult)) { $csv .= "<tr class='{$shade1}'>"; $csv .= "<td>{$obj->id}</td><td>{$obj->title}</td>"; $csv .= "<td>{$obj->forenames} {$obj->surname}</td>"; $csv .= "<td>" . software_name($obj->softwareid) . "</td>"; $csv .= "<td>" . incidentstatus_name($obj->status) . "</td>"; $csv .= "<td>" . user_realname($obj->owner) . "</td>"; $csv .= "<td>" . format_date_friendly($obj->opened) . "</td>"; $csv .= "<td>"; if ($obj->closed > 0) { $csv .= format_date_friendly($obj->closed); } else { $csv .= $strCurrentlyOpen; } $csv .= "</td>"; $csv .= "<td>"; if ($obj->closed > 0) { $csv .= format_workday_minutes($obj->closed - $obj->opened); } $csv .= "</td>"; $csv .= "<td>{$obj->servicelevel}</td>";