Esempio n. 1
0
         $date = explode("-", $date);
         $timeofnextaction = mktime(8 + $timeoffset, 0, 0, $date[1], $date[2], $date[0]);
         $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)) . " -&gt; <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 .= " -&gt; <b>";
     if ($timeofnextaction < 1) {
Esempio n. 2
0
/**
 * Output html for the 'time to next action' box
 * Used in add incident and update incident
 * @param string $formid. HTML ID of the form containing the controls
 * @return $html string html to output
 * @author Kieran Hogg
 * @TODO populate $id
 */
function show_next_action($formid)
{
    global $now, $strAM, $strPM;
    $html = "{$GLOBALS['strPlaceIncidentInWaitingQueue']}<br />";
    $oldtimeofnextaction = incident_timeofnextaction($id);
    //FIXME $id never populated
    if ($oldtimeofnextaction < 1) {
        $oldtimeofnextaction = $now;
    }
    $wait_time = $oldtimeofnextaction - $now;
    $na_days = floor($wait_time / 86400);
    $na_remainder = $wait_time % 86400;
    $na_hours = floor($na_remainder / 3600);
    $na_remainder = $wait_time % 3600;
    $na_minutes = floor($na_remainder / 60);
    if ($na_days < 0) {
        $na_days = 0;
    }
    if ($na_hours < 0) {
        $na_hours = 0;
    }
    if ($na_minutes < 0) {
        $na_minutes = 0;
    }
    $html .= "<label>";
    $html .= "<input checked='checked' type='radio' name='timetonextaction' ";
    $html .= "id='ttna_none' onchange=\"update_ttna();\" ";
    //     $html .= "onclick=\"$('timetonextaction_days').value = ''; window.document.updateform.";
    //     $html .= "timetonextaction_hours.value = ''; window.document.updateform."; timetonextaction_minutes.value = '';\"
    $html .= " value='None' />{$GLOBALS['strNo']}";
    $html .= "</label><br />";
    $html .= "<label><input type='radio' name='timetonextaction' ";
    $html .= "id='ttna_time' value='time' onchange=\"update_ttna();\" />";
    $html .= "{$GLOBALS['strForXDaysHoursMinutes']}</label><br />\n";
    $html .= "<span id='ttnacountdown'";
    if (empty($na_days) and empty($na_hours) and empty($na_minutes)) {
        $html .= " style='display: none;'";
    }
    $html .= ">";
    $html .= "&nbsp;&nbsp;&nbsp;<input name='timetonextaction_days' ";
    $html .= " id='timetonextaction_days' value='{$na_days}' maxlength='3' ";
    $html .= "onclick=\"\$('ttna_time').checked = true;\" ";
    $html .= "size='3' /> {$GLOBALS['strDays']}&nbsp;";
    $html .= "<input maxlength='2' name='timetonextaction_hours' ";
    $html .= "id='timetonextaction_hours' value='{$na_hours}' ";
    $html .= "onclick=\"\$('ttna_time').checked = true;\" ";
    $html .= "size='3' /> {$GLOBALS['strHours']}&nbsp;";
    $html .= "<input maxlength='2' name='timetonextaction_minutes' id='";
    $html .= "timetonextaction_minutes' value='{$na_minutes}' ";
    $html .= "onclick=\"\$('ttna_time').checked = true;\" ";
    $html .= "size='3' /> {$GLOBALS['strMinutes']}";
    $html .= "<br />\n</span>";
    $html .= "<label><input type='radio' name='timetonextaction' id='ttna_date' ";
    $html .= "value='date' onchange=\"update_ttna();\" />";
    $html .= "{$GLOBALS['strUntilSpecificDateAndTime']}</label><br />\n";
    $html .= "<div id='ttnadate' style='display: none;'>";
    $html .= "<input name='date' id='timetonextaction_date' size='10' value='{$date}' ";
    $html .= "onclick=\"\$('ttna_date').checked = true;\" /> ";
    $html .= date_picker("{$formid}.timetonextaction_date");
    $html .= " <select name='timeoffset' id='timeoffset' ";
    $html .= "onclick=\"\$('ttna_date').checked = true;\" >";
    $html .= "<option value='0'></option>";
    $html .= "<option value='0'>8:00 {$strAM}</option>";
    $html .= "<option value='1'>9:00 {$strAM}</option>";
    $html .= "<option value='2'>10:00 {$strAM}</option>";
    $html .= "<option value='3'>11:00 {$strAM}</option>";
    $html .= "<option value='4'>12:00 {$strPM}</option>";
    $html .= "<option value='5'>1:00 {$strPM}</option>";
    $html .= "<option value='6'>2:00 {$strPM}</option>";
    $html .= "<option value='7'>3:00 {$strPM}</option>";
    $html .= "<option value='8'>4:00 {$strPM}</option>";
    $html .= "<option value='9'>5:00 {$strPM}</option>";
    $html .= "</select>";
    $html .= "<br />\n</div>";
    return $html;
}