mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Use the time_format default setting on more pages (#7663)
* Use the time_format default setting on more pages * Update call_recordings.php * Update devices.php * Update email_queue.php * Update emergency.php * Update time formatting based on settings * Update fax_logs.php * Update fax_queue.php * Update time_condition_edit.php * Update xml_cdr_details.php * Update xml_cdr_search.php * Update xml_cdr_statistics_inc.php * Update xml_cdr_statistics.php * Update xml_cdr.php * Update contact_edit.php * Update contact_notes_view.php * Update contact_notes.php * Update contact_timer.php * Update contact_times.php * Update user_logs.php * Update footer.php * Update template.php * Update fax_files.php * Update recent_calls.php * Update missed_calls.php * Update recordings.php * Update xml_cdr_statistics_inc.php * Update xml_cdr_inc.php * Update xml_cdr_inc.php * Update recordings.php * Update missed_calls.php * Update call_block.php * Update user_logs.php * Update xml_cdr_inc.php * Update xml_cdr_details.php * Update recordings.php * Update fax_queue.php * Update fax_logs.php * Update fax_files.php * Update event_guard_logs.php * Update emergency.php * Update email_queue.php * Update devices.php * Update call_recordings.php * Update time_condition_edit.php * Update time_condition_edit.php * Update call_block.php * Update call_recordings.php * Update devices.php * Update email_queue.php * Update emergency.php * Update event_guard_logs.php * Update fax_files.php * Update fax_logs.php * Update fax_queue.php * Update recordings.php * Update xml_cdr_inc.php * Update user_logs.php * Update destination_summary.php * Update xml_cdr_extension_summary.php * Update music_on_hold.php * Update fax_send.php * Update voicemail_greetings.php * Update voicemail_greetings.php * Update xml_cdr_inc.php * Update xml_cdr_inc.php * Update xml_cdr_inc.php * Update xml_cdr_statistics_inc.php * Update xml_cdr_statistics_inc.php * Update xml_cdr_inc.php * Update xml_cdr_extension_summary.php * Update destination_summary.php * Update xml_cdr_statistics_inc.php * Update xml_cdr_inc.php * Update xml_cdr_statistics_inc.php * Update contact_edit.php * Update css.php * Update template.php * Update fax_send.php
This commit is contained in:
@@ -34,17 +34,22 @@
|
||||
//if also viewing system status, show more recent calls (more room avaialble)
|
||||
$missed_limit = !empty($selected_blocks) && (is_array($selected_blocks) && in_array('counts', $selected_blocks)) ? 10 : 5;
|
||||
|
||||
//set the sql time format
|
||||
$sql_time_format = 'DD Mon HH12:MI am';
|
||||
if (!empty($settings->get('domain', 'time_format'))) {
|
||||
$sql_time_format = $settings->get('domain', 'time_format') == '12h' ? "DD Mon HH12:MI am" : "DD Mon HH24:MI";
|
||||
//set the time zone
|
||||
$time_zone = $settings->get('domain', 'time_zone', date_default_timezone_get());
|
||||
|
||||
//set the time format options: 12h, 24h
|
||||
if ($settings->get('domain', 'time_format') == '24h') {
|
||||
$time_format = 'DD Mon HH24:MI';
|
||||
}
|
||||
else {
|
||||
$time_format = 'DD Mon HH12:MI am';
|
||||
}
|
||||
|
||||
//get the missed calls from call detail records
|
||||
$sql = "select \n";
|
||||
$sql .= " status, \n";
|
||||
$sql .= " direction, \n";
|
||||
$sql .= " to_char(timezone(:time_zone, start_stamp), '".$sql_time_format."') as start_date_time, \n";
|
||||
$sql .= " to_char(timezone(:time_zone, start_stamp), '".$time_format."') as start_date_time, \n";
|
||||
$sql .= " caller_id_name, \n";
|
||||
$sql .= " caller_id_number, \n";
|
||||
$sql .= " answer_stamp \n";
|
||||
@@ -82,7 +87,7 @@
|
||||
$sql .= "start_epoch desc \n";
|
||||
$sql .= "limit :missed_limit \n";
|
||||
$parameters['missed_limit'] = $missed_limit;
|
||||
$parameters['time_zone'] = $settings->get('domain', 'time_zone', date_default_timezone_get());
|
||||
$parameters['time_zone'] = $time_zone;
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
$num_rows = !empty($result) ? sizeof($result) : 0;
|
||||
|
||||
@@ -34,10 +34,15 @@
|
||||
//if also viewing system status, show more recent calls (more room avaialble)
|
||||
$recent_limit = isset($selected_blocks) && is_array($selected_blocks) && in_array('counts', $selected_blocks) ? 10 : 5;
|
||||
|
||||
//set the sql time format
|
||||
$sql_time_format = 'DD Mon HH12:MI am';
|
||||
if (!empty($settings->get('domain', 'time_format'))) {
|
||||
$sql_time_format = $settings->get('domain', 'time_format') == '12h' ? "DD Mon HH12:MI am" : "DD Mon HH24:MI";
|
||||
//set the time zone
|
||||
$time_zone = $settings->get('domain', 'time_zone', date_default_timezone_get());
|
||||
|
||||
//set the time format options: 12h, 24h
|
||||
if ($settings->get('domain', 'time_format') == '24h') {
|
||||
$time_format = 'DD Mon HH24:MI';
|
||||
}
|
||||
else {
|
||||
$time_format = 'DD Mon HH12:MI am';
|
||||
}
|
||||
|
||||
//get the recent calls from call detail records
|
||||
@@ -46,7 +51,7 @@
|
||||
status,
|
||||
direction,
|
||||
start_stamp,
|
||||
to_char(timezone(:time_zone, start_stamp), '".$sql_time_format."') as start_date_time,
|
||||
to_char(timezone(:time_zone, start_stamp), '".$time_format."') as start_date_time,
|
||||
caller_id_name,
|
||||
caller_id_number,
|
||||
destination_number,
|
||||
@@ -79,7 +84,7 @@
|
||||
$sql .= "order by start_epoch desc ";
|
||||
$sql .= "limit :recent_limit ";
|
||||
$parameters['recent_limit'] = $recent_limit;
|
||||
$parameters['time_zone'] = $settings->get('domain', 'time_zone', date_default_timezone_get());
|
||||
$parameters['time_zone'] = $time_zone;
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
$num_rows = !empty($result) ? sizeof($result) : 0;
|
||||
|
||||
@@ -425,8 +425,8 @@
|
||||
echo " ".$text['label-start_range']."\n";
|
||||
echo " </div>\n";
|
||||
echo " <div class='field no-wrap'>\n";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#start_stamp_begin' onblur=\"$(this).datetimepicker('hide');\" style='min-width: 115px; width: 115px;' name='start_stamp_begin' id='start_stamp_begin' placeholder='".$text['label-from']."' value='".escape($start_stamp_begin)."' autocomplete='off'>\n";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#start_stamp_end' onblur=\"$(this).datetimepicker('hide');\" style='min-width: 115px; width: 115px;' name='start_stamp_end' id='start_stamp_end' placeholder='".$text['label-to']."' value='".escape($start_stamp_end)."' autocomplete='off'>\n";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#start_stamp_begin' onblur=\"$(this).datetimepicker('hide');\" style='".($settings->get('domain', 'time_format') == '24h' ? 'min-width: 115px; width: 115px;' : 'min-width: 130px; width: 130px;')."' name='start_stamp_begin' id='start_stamp_begin' placeholder='".$text['label-from']."' value='".escape($start_stamp_begin)."' autocomplete='off'>\n";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#start_stamp_end' onblur=\"$(this).datetimepicker('hide');\" style='".($settings->get('domain', 'time_format') == '24h' ? 'min-width: 115px; width: 115px;' : 'min-width: 130px; width: 130px;')."' name='start_stamp_end' id='start_stamp_end' placeholder='".$text['label-to']."' value='".escape($start_stamp_end)."' autocomplete='off'>\n";
|
||||
echo " </div>\n";
|
||||
echo " </div>\n";
|
||||
}
|
||||
|
||||
@@ -272,9 +272,6 @@
|
||||
$outbound_caller_id_name = urldecode($array["variables"]["outbound_caller_id_name"] ?? '');
|
||||
$outbound_caller_id_number = urldecode($array["variables"]["outbound_caller_id_number"] ?? '');
|
||||
|
||||
//set the time zone
|
||||
date_default_timezone_set($settings->get('domain', 'time_zone', 'GMT'));
|
||||
|
||||
//create the destinations object
|
||||
$destinations = new destinations();
|
||||
|
||||
@@ -308,6 +305,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
//set the time zone
|
||||
date_default_timezone_set($settings->get('domain', 'time_zone', date_default_timezone_get()));
|
||||
|
||||
//format the date and time
|
||||
if ($settings->get('domain', 'time_format') == '24h') {
|
||||
$start_time = date("Y-m-d H:i:s", (int) $start_epoch);
|
||||
$end_time= date("Y-m-d H:i:s", (int) $end_epoch);
|
||||
}
|
||||
else {
|
||||
$start_time = date("Y-m-d g:i:s a", (int) $start_epoch);
|
||||
$end_time = date("Y-m-d g:i:s a", (int) $end_epoch);
|
||||
}
|
||||
|
||||
//set the year, month and date
|
||||
$tmp_year = date("Y", strtotime($start_stamp));
|
||||
$tmp_month = date("M", strtotime($start_stamp));
|
||||
@@ -520,8 +530,8 @@
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($destination_number)."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape(date("Y-m-d H:i:s", (int) $start_epoch))."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape(date("Y-m-d H:i:s", (int) $end_epoch))."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($start_time)."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($end_time)."</td>\n";
|
||||
if (permission_exists('xml_cdr_hangup_cause')) {
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($hangup_cause)."</td>\n";
|
||||
}
|
||||
|
||||
@@ -53,12 +53,20 @@
|
||||
$quick_select = 3; //set default
|
||||
}
|
||||
|
||||
//convert time format to 24 hour
|
||||
if (!empty($start_stamp_begin)) {
|
||||
$start_stamp_begin_formatted = ($settings->get('domain', 'time_format') == '24h' ? $start_stamp_begin : DateTime::createFromFormat('Y-m-d h:i a', $start_stamp_begin)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($start_stamp_end)) {
|
||||
$start_stamp_end_formatted = ($settings->get('domain', 'time_format') == '24h' ? $start_stamp_end : DateTime::createFromFormat('Y-m-d h:i a', $start_stamp_end)->format('Y-m-d H:i'));
|
||||
}
|
||||
|
||||
//get the summary
|
||||
$cdr = new xml_cdr;
|
||||
$cdr->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$cdr->quick_select = $quick_select;
|
||||
$cdr->start_stamp_begin = $start_stamp_begin ?? null;
|
||||
$cdr->start_stamp_end = $start_stamp_end ?? null;
|
||||
$cdr->start_stamp_begin = $start_stamp_begin_formatted ?? null;
|
||||
$cdr->start_stamp_end = $start_stamp_end_formatted ?? null;
|
||||
$cdr->include_internal = $include_internal ?? null;
|
||||
$summary = $cdr->user_summary();
|
||||
|
||||
@@ -174,14 +182,14 @@
|
||||
echo " ".$text['label-start_date_time']."\n";
|
||||
echo " </div>\n";
|
||||
echo " <div class='field'>\n";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#start_stamp_begin' onblur=\"$(this).datetimepicker('hide');\" style='min-width: 115px; width: 115px; max-width: 115px;' name='start_stamp_begin' id='start_stamp_begin' placeholder='".$text['label-from']."' value='".escape($start_stamp_begin ?? '')."'>\n";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#start_stamp_begin' onblur=\"$(this).datetimepicker('hide');\" style='".($settings->get('domain', 'time_format') == '24h' ? 'min-width: 115px; width: 115px;' : 'min-width: 130px; width: 130px;')."' name='start_stamp_begin' id='start_stamp_begin' placeholder='".$text['label-from']."' value='".escape($start_stamp_begin ?? '')."'>\n";
|
||||
echo " </div>\n";
|
||||
|
||||
echo " <div class='label'>\n";
|
||||
echo " ".$text['label-end_date_time']."\n";
|
||||
echo " </div>\n";
|
||||
echo " <div class='field'>\n";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#start_stamp_end' onblur=\"$(this).datetimepicker('hide');\" style='min-width: 115px; width: 115px; max-width: 115px;' name='start_stamp_end' id='start_stamp_end' placeholder='".$text['label-to']."' value='".escape($start_stamp_end ?? '')."'>\n";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#start_stamp_end' onblur=\"$(this).datetimepicker('hide');\" style='".($settings->get('domain', 'time_format') == '24h' ? 'min-width: 115px; width: 115px;' : 'min-width: 130px; width: 130px;')."' name='start_stamp_end' id='start_stamp_end' placeholder='".$text['label-to']."' value='".escape($start_stamp_end ?? '')."'>\n";
|
||||
echo " </div>\n";
|
||||
|
||||
echo " </div>\n";
|
||||
|
||||
@@ -296,12 +296,13 @@
|
||||
|
||||
//set the time zone
|
||||
$time_zone = $settings->get('domain', 'time_zone', date_default_timezone_get());
|
||||
$parameters['time_zone'] = $time_zone;
|
||||
|
||||
//set the sql time format
|
||||
$sql_time_format = 'HH12:MI am';
|
||||
if (!empty($settings->get('domain', 'time_format'))) {
|
||||
$sql_time_format = $settings->get('domain', 'time_format') == '12h' ? "HH12:MI am" : "HH24:MI";
|
||||
//set the time format options: 12h, 24h
|
||||
if ($settings->get('domain', 'time_format') == '24h') {
|
||||
$time_format = 'HH24:MI';
|
||||
}
|
||||
else {
|
||||
$time_format = 'HH12:MI am';
|
||||
}
|
||||
|
||||
//get the results from the db
|
||||
@@ -313,7 +314,7 @@
|
||||
$sql .= "c.start_stamp, \n";
|
||||
$sql .= "c.end_stamp, \n";
|
||||
$sql .= "to_char(timezone(:time_zone, start_stamp), 'DD Mon YYYY') as start_date_formatted, \n";
|
||||
$sql .= "to_char(timezone(:time_zone, start_stamp), '".$sql_time_format."') as start_time_formatted, \n";
|
||||
$sql .= "to_char(timezone(:time_zone, start_stamp), '".$time_format."') as start_time_formatted, \n";
|
||||
$sql .= "c.start_epoch, \n";
|
||||
$sql .= "c.hangup_cause, \n";
|
||||
$sql .= "c.billsec as duration, \n";
|
||||
@@ -471,50 +472,67 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($start_stamp_begin) && !empty($start_stamp_end)) {
|
||||
if (!empty($start_stamp_begin)) {
|
||||
$start_stamp_begin_formatted = ($settings->get('domain', 'time_format') == '24h' ? $start_stamp_begin : DateTime::createFromFormat('Y-m-d h:i a', $start_stamp_begin)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($start_stamp_end)) {
|
||||
$start_stamp_end_formatted = ($settings->get('domain', 'time_format') == '24h' ? $start_stamp_end : DateTime::createFromFormat('Y-m-d h:i a', $start_stamp_end)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($start_stamp_begin_formatted) && !empty($start_stamp_end_formatted)) {
|
||||
$sql .= "and start_stamp between :start_stamp_begin::timestamptz and :start_stamp_end::timestamptz \n";
|
||||
$parameters['start_stamp_begin'] = $start_stamp_begin.':00.000 '.$time_zone;
|
||||
$parameters['start_stamp_end'] = $start_stamp_end.':59.999 '.$time_zone;
|
||||
$parameters['start_stamp_begin'] = $start_stamp_begin_formatted.':00.000 '.$time_zone;
|
||||
$parameters['start_stamp_end'] = $start_stamp_end_formatted.':59.999 '.$time_zone;
|
||||
}
|
||||
else {
|
||||
if (!empty($start_stamp_begin)) {
|
||||
if (!empty($start_stamp_begin_formatted)) {
|
||||
$sql .= "and start_stamp >= :start_stamp_begin \n";
|
||||
$parameters['start_stamp_begin'] = $start_stamp_begin.':00.000 '.$time_zone;
|
||||
$parameters['start_stamp_begin'] = $start_stamp_begin_formatted.':00.000 '.$time_zone;
|
||||
}
|
||||
if (!empty($start_stamp_end)) {
|
||||
if (!empty($start_stamp_end_formatted)) {
|
||||
$sql .= "and start_stamp <= :start_stamp_end \n";
|
||||
$parameters['start_stamp_end'] = $start_stamp_end.':59.999 '.$time_zone;
|
||||
$parameters['start_stamp_end'] = $start_stamp_end_formatted.':59.999 '.$time_zone;
|
||||
}
|
||||
}
|
||||
if (!empty($answer_stamp_begin) && !empty($answer_stamp_end)) {
|
||||
if (!empty($answer_stamp_begin)) {
|
||||
$answer_stamp_begin_formatted = ($settings->get('domain', 'time_format') == '24h' ? $answer_stamp_begin : DateTime::createFromFormat('Y-m-d h:i a', $answer_stamp_begin)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($answer_stamp_end)) {
|
||||
$answer_stamp_end_formatted = ($settings->get('domain', 'time_format') == '24h' ? $answer_stamp_end : DateTime::createFromFormat('Y-m-d h:i a', $answer_stamp_end)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($answer_stamp_begin_formatted) && !empty($answer_stamp_end_formatted)) {
|
||||
$sql .= "and answer_stamp between :answer_stamp_begin::timestamptz and :answer_stamp_end::timestamptz \n";
|
||||
$parameters['answer_stamp_begin'] = $answer_stamp_begin.':00.000 '.$time_zone;
|
||||
$parameters['answer_stamp_end'] = $answer_stamp_end.':59.999 '.$time_zone;
|
||||
$parameters['answer_stamp_begin'] = $answer_stamp_begin_formatted.':00.000 '.$time_zone;
|
||||
$parameters['answer_stamp_end'] = $answer_stamp_end_formatted.':59.999 '.$time_zone;
|
||||
}
|
||||
else {
|
||||
if (!empty($answer_stamp_begin)) {
|
||||
if (!empty($answer_stamp_begin_formatted)) {
|
||||
$sql .= "and answer_stamp >= :answer_stamp_begin \n";
|
||||
$parameters['answer_stamp_begin'] = $answer_stamp_begin.':00.000 '.$time_zone;;
|
||||
$parameters['answer_stamp_begin'] = $answer_stamp_begin_formatted.':00.000 '.$time_zone;;
|
||||
}
|
||||
if (!empty($answer_stamp_end)) {
|
||||
if (!empty($answer_stamp_end_formatted)) {
|
||||
$sql .= "and answer_stamp <= :answer_stamp_end \n";
|
||||
$parameters['answer_stamp_end'] = $answer_stamp_end.':59.999 '.$time_zone;
|
||||
$parameters['answer_stamp_end'] = $answer_stamp_end_formatted.':59.999 '.$time_zone;
|
||||
}
|
||||
}
|
||||
if (!empty($end_stamp_begin) && !empty($end_stamp_end)) {
|
||||
if (!empty($end_stamp_begin)) {
|
||||
$end_stamp_begin_formatted = ($settings->get('domain', 'time_format') == '24h' ? $end_stamp_begin : DateTime::createFromFormat('Y-m-d h:i a', $end_stamp_begin)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($end_stamp_end)) {
|
||||
$end_stamp_end_formatted = ($settings->get('domain', 'time_format') == '24h' ? $end_stamp_end : DateTime::createFromFormat('Y-m-d h:i a', $end_stamp_end)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($end_stamp_begin_formatted) && !empty($end_stamp_end_formatted)) {
|
||||
$sql .= "and end_stamp between :end_stamp_begin::timestamptz and :end_stamp_end::timestamptz \n";
|
||||
$parameters['end_stamp_begin'] = $end_stamp_begin.':00.000 '.$time_zone;
|
||||
$parameters['end_stamp_end'] = $end_stamp_end.':59.999 '.$time_zone;
|
||||
$parameters['end_stamp_begin'] = $end_stamp_begin_formatted.':00.000 '.$time_zone;
|
||||
$parameters['end_stamp_end'] = $end_stamp_end_formatted.':59.999 '.$time_zone;
|
||||
}
|
||||
else {
|
||||
if (!empty($end_stamp_begin)) {
|
||||
if (!empty($end_stamp_begin_formatted)) {
|
||||
$sql .= "and end_stamp >= :end_stamp_begin \n";
|
||||
$parameters['end_stamp_begin'] = $end_stamp_begin.':00.000 '.$time_zone;
|
||||
$parameters['end_stamp_begin'] = $end_stamp_begin_formatted.':00.000 '.$time_zone;
|
||||
}
|
||||
if (!empty($end_stamp_end)) {
|
||||
if (!empty($end_stamp_end_formatted)) {
|
||||
$sql .= "and end_stamp <= :end_stamp_end \n";
|
||||
$parameters['end_stamp'] = $end_stamp_end.':59.999 '.$time_zone;
|
||||
$parameters['end_stamp'] = $end_stamp_end_formatted.':59.999 '.$time_zone;
|
||||
}
|
||||
}
|
||||
if (is_numeric($duration_min)) {
|
||||
@@ -652,6 +670,7 @@
|
||||
$database->username = $settings->get('cdr', 'archive_database_username');
|
||||
$database->password = $settings->get('cdr', 'archive_database_password');
|
||||
}
|
||||
$parameters['time_zone'] = $time_zone;
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
$result_count = is_array($result) ? sizeof($result) : 0;
|
||||
unset($sql, $parameters);
|
||||
|
||||
@@ -214,8 +214,8 @@
|
||||
echo " <td class='vtable'>";
|
||||
echo " <div class='row'>\n";
|
||||
echo " <div class='col-sm-12'>";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#start_stamp_begin' onblur=\"$(this).datetimepicker('hide');\" style='min-width: 115px; width: 115px;' name='start_stamp_begin' id='start_stamp_begin' placeholder='".$text['label-from']."' value='".escape($start_stamp_begin)."'>";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#start_stamp_end' onblur=\"$(this).datetimepicker('hide');\" style='min-width: 115px; width: 115px;' name='start_stamp_end' id='start_stamp_end' placeholder='".$text['label-to']."' value='".escape($start_stamp_end)."'>";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#start_stamp_begin' onblur=\"$(this).datetimepicker('hide');\" style='".($settings->get('domain', 'time_format') == '24h' ? 'min-width: 115px; width: 115px;' : 'min-width: 130px; width: 130px;')."' name='start_stamp_begin' id='start_stamp_begin' placeholder='".$text['label-from']."' value='".escape($start_stamp_begin)."'>";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#start_stamp_end' onblur=\"$(this).datetimepicker('hide');\" style='".($settings->get('domain', 'time_format') == '24h' ? 'min-width: 115px; width: 115px;' : 'min-width: 130px; width: 130px;')."' name='start_stamp_end' id='start_stamp_end' placeholder='".$text['label-to']."' value='".escape($start_stamp_end)."'>";
|
||||
echo " </div>\n";
|
||||
echo " </div>\n";
|
||||
echo " </td>";
|
||||
@@ -225,8 +225,8 @@
|
||||
echo " <td class='vtable'>";
|
||||
echo " <div class='row'>\n";
|
||||
echo " <div class='col-sm-12'>";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#answer_stamp_begin' onblur=\"$(this).datetimepicker('hide');\" style='min-width: 115px; width: 115px;' name='answer_stamp_begin' id='answer_stamp_begin' placeholder='".$text['label-from']."' value='".escape($answer_stamp_begin)."'>";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#answer_stamp_end' onblur=\"$(this).datetimepicker('hide');\" style='min-width: 115px; width: 115px;' name='answer_stamp_end' id='answer_stamp_end' placeholder='".$text['label-to']."' value='".escape($answer_stamp_end)."'>";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#answer_stamp_begin' onblur=\"$(this).datetimepicker('hide');\" style='".($settings->get('domain', 'time_format') == '24h' ? 'min-width: 115px; width: 115px;' : 'min-width: 130px; width: 130px;')."' name='answer_stamp_begin' id='answer_stamp_begin' placeholder='".$text['label-from']."' value='".escape($answer_stamp_begin)."'>";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#answer_stamp_end' onblur=\"$(this).datetimepicker('hide');\" style='".($settings->get('domain', 'time_format') == '24h' ? 'min-width: 115px; width: 115px;' : 'min-width: 130px; width: 130px;')."' name='answer_stamp_end' id='answer_stamp_end' placeholder='".$text['label-to']."' value='".escape($answer_stamp_end)."'>";
|
||||
echo " </div>\n";
|
||||
echo " </div>\n";
|
||||
echo " </td>";
|
||||
@@ -236,8 +236,8 @@
|
||||
echo " <td class='vtable'>";
|
||||
echo " <div class='row'>\n";
|
||||
echo " <div class='col-sm-12'>";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#end_stamp_begin' onblur=\"$(this).datetimepicker('hide');\" style='min-width: 115px; width: 115px;' name='end_stamp_begin' id='end_stamp_begin' placeholder='".$text['label-from']."' value='".escape($end_stamp_begin)."'>";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#end_stamp_end' onblur=\"$(this).datetimepicker('hide');\" style='min-width: 115px; width: 115px;' name='end_stamp_end' id='end_stamp_end' placeholder='".$text['label-to']."' value='".escape($end_stamp_end)."'>";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#end_stamp_begin' onblur=\"$(this).datetimepicker('hide');\" style='".($settings->get('domain', 'time_format') == '24h' ? 'min-width: 115px; width: 115px;' : 'min-width: 130px; width: 130px;')."' name='end_stamp_begin' id='end_stamp_begin' placeholder='".$text['label-from']."' value='".escape($end_stamp_begin)."'>";
|
||||
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#end_stamp_end' onblur=\"$(this).datetimepicker('hide');\" style='".($settings->get('domain', 'time_format') == '24h' ? 'min-width: 115px; width: 115px;' : 'min-width: 130px; width: 130px;')."' name='end_stamp_end' id='end_stamp_end' placeholder='".$text['label-to']."' value='".escape($end_stamp_end)."'>";
|
||||
echo " </div>\n";
|
||||
echo " </div>\n";
|
||||
echo " </td>";
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2024
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2025
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -131,6 +131,14 @@
|
||||
$search_url .= '&mos_score='.urlencode($_GET['mos_score']);
|
||||
}
|
||||
|
||||
//set the chart time format
|
||||
if ($settings->get('domain', 'time_format') == '24h') {
|
||||
$chart_time_format = 'H:mm';
|
||||
}
|
||||
else {
|
||||
$chart_time_format = 'h a';
|
||||
}
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title-call-statistics']."</b></div>\n";
|
||||
@@ -234,6 +242,11 @@
|
||||
scales: {
|
||||
x: {
|
||||
type: "time",
|
||||
time: {
|
||||
displayFormats: {
|
||||
hour: '<?php echo $chart_time_format; ?>',
|
||||
}
|
||||
},
|
||||
},
|
||||
y: {
|
||||
min: 0
|
||||
|
||||
@@ -200,45 +200,63 @@
|
||||
$parameters['context'] = '%'.$context.'%';
|
||||
}
|
||||
/*
|
||||
if (!empty($start_stamp_begin) && !empty($start_stamp_end)) {
|
||||
if (!empty($start_stamp_begin)) {
|
||||
$start_stamp_begin_formatted = ($settings->get('domain', 'time_format') == '24h' ? $start_stamp_begin : DateTime::createFromFormat('Y-m-d h:i a', $start_stamp_begin)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($start_stamp_end)) {
|
||||
$start_stamp_end_formatted = ($settings->get('domain', 'time_format') == '24h' ? $start_stamp_end : DateTime::createFromFormat('Y-m-d h:i a', $start_stamp_end)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($start_stamp_begin_formatted) && !empty($start_stamp_end_formatted)) {
|
||||
$sql_where_ands[] = "start_stamp between :start_stamp_begin and :start_stamp_end";
|
||||
$parameters['start_stamp_begin'] = $start_stamp_begin.':00.000';
|
||||
$parameters['start_stamp_end'] = $start_stamp_end.':59.999';
|
||||
$parameters['start_stamp_begin'] = $start_stamp_begin_formatted.':00.000';
|
||||
$parameters['start_stamp_end'] = $start_stamp_end_formatted.':59.999';
|
||||
}
|
||||
else if (!empty($start_stamp_begin)) {
|
||||
else if (!empty($start_stamp_begin_formatted)) {
|
||||
$sql_where_ands[] = "start_stamp >= :start_stamp_begin";
|
||||
$parameters['start_stamp_begin'] = $start_stamp_begin.':00.000';
|
||||
$parameters['start_stamp_begin'] = $start_stamp_begin_formatted.':00.000';
|
||||
}
|
||||
else if (!empty($start_stamp_end)) {
|
||||
else if (!empty($start_stamp_end_formatted)) {
|
||||
$sql_where_ands[] = "start_stamp <= :start_stamp_end";
|
||||
$parameters['start_stamp_end'] = $start_stamp_end.':59.999';
|
||||
$parameters['start_stamp_end'] = $start_stamp_end_formatted.':59.999';
|
||||
}
|
||||
*/
|
||||
if (!empty($answer_stamp_begin) && !empty($answer_stamp_end)) {
|
||||
if (!empty($answer_stamp_begin)) {
|
||||
$answer_stamp_begin_formatted = ($settings->get('domain', 'time_format') == '24h' ? $answer_stamp_begin : DateTime::createFromFormat('Y-m-d h:i a', $answer_stamp_begin)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($answer_stamp_end)) {
|
||||
$answer_stamp_end_formatted = ($settings->get('domain', 'time_format') == '24h' ? $answer_stamp_end : DateTime::createFromFormat('Y-m-d h:i a', $answer_stamp_end)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($answer_stamp_begin_formatted) && !empty($answer_stamp_end_formatted)) {
|
||||
$sql_where_ands[] = "c.answer_stamp between :answer_stamp_begin and :answer_stamp_end";
|
||||
$parameters['answer_stamp_begin'] = $answer_stamp_begin.':00.000';
|
||||
$parameters['answer_stamp_end'] = $answer_stamp_end.':59.999';
|
||||
$parameters['answer_stamp_begin'] = $answer_stamp_begin_formatted.':00.000';
|
||||
$parameters['answer_stamp_end'] = $answer_stamp_end_formatted.':59.999';
|
||||
}
|
||||
else if (!empty($answer_stamp_begin)) {
|
||||
else if (!empty($answer_stamp_begin_formatted)) {
|
||||
$sql_where_ands[] = "c.answer_stamp >= :answer_stamp_begin";
|
||||
$parameters['answer_stamp_begin'] = $answer_stamp_begin.':00.000';
|
||||
$parameters['answer_stamp_begin'] = $answer_stamp_begin_formatted.':00.000';
|
||||
}
|
||||
else if (!empty($answer_stamp_end)) {
|
||||
else if (!empty($answer_stamp_end_formatted)) {
|
||||
$sql_where_ands[] = "c.answer_stamp <= :answer_stamp_end";
|
||||
$parameters['answer_stamp_end'] = $answer_stamp_end.':59.999';
|
||||
$parameters['answer_stamp_end'] = $answer_stamp_end_formatted.':59.999';
|
||||
}
|
||||
if (!empty($end_stamp_begin) && !empty($end_stamp_end)) {
|
||||
if (!empty($end_stamp_begin)) {
|
||||
$end_stamp_begin_formatted = ($settings->get('domain', 'time_format') == '24h' ? $end_stamp_begin : DateTime::createFromFormat('Y-m-d h:i a', $end_stamp_begin)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($end_stamp_end)) {
|
||||
$end_stamp_end_formatted = ($settings->get('domain', 'time_format') == '24h' ? $end_stamp_end : DateTime::createFromFormat('Y-m-d h:i a', $end_stamp_end)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($end_stamp_begin_formatted) && !empty($end_stamp_end_formatted)) {
|
||||
$sql_where_ands[] = "c.end_stamp between :end_stamp_begin and :end_stamp_end";
|
||||
$parameters['end_stamp_begin'] = $end_stamp_begin.':00.000';
|
||||
$parameters['end_stamp_end'] = $end_stamp_end.':59.999';
|
||||
$parameters['end_stamp_begin'] = $end_stamp_begin_formatted.':00.000';
|
||||
$parameters['end_stamp_end'] = $end_stamp_end_formatted.':59.999';
|
||||
}
|
||||
else if (!empty($end_stamp_begin)) {
|
||||
else if (!empty($end_stamp_begin_formatted)) {
|
||||
$sql_where_ands[] = "c.end_stamp >= :end_stamp_begin";
|
||||
$parameters['end_stamp_begin'] = $end_stamp_begin.':00.000';
|
||||
$parameters['end_stamp_begin'] = $end_stamp_begin_formatted.':00.000';
|
||||
}
|
||||
else if (!empty($end_stamp_end)) {
|
||||
else if (!empty($end_stamp_end_formatted)) {
|
||||
$sql_where_ands[] = "c.end_stamp <= :end_stamp_end";
|
||||
$parameters['end_stamp_end'] = $end_stamp_end.':59.999';
|
||||
$parameters['end_stamp_end'] = $end_stamp_end_formatted.':59.999';
|
||||
}
|
||||
if (!empty($duration)) {
|
||||
$sql_where_ands[] = "c.duration like :duration";
|
||||
@@ -355,13 +373,20 @@
|
||||
|
||||
//set the time zone
|
||||
$time_zone = $settings->get('domain', 'time_zone', date_default_timezone_get());
|
||||
$parameters['time_zone'] = $time_zone;
|
||||
|
||||
//set the time format options: 12h, 24h
|
||||
if ($settings->get('domain', 'time_format') == '24h') {
|
||||
$time_format = 'HH24:MI';
|
||||
}
|
||||
else {
|
||||
$time_format = 'HH12:MI am';
|
||||
}
|
||||
|
||||
//build the sql query for xml cdr statistics
|
||||
$sql = "select ";
|
||||
$sql .= "row_number() over() as hours, ";
|
||||
$sql .= "to_char(start_date at time zone :time_zone, 'DD Mon') as date, \n";
|
||||
$sql .= "to_char(start_date at time zone :time_zone, 'HH12:MI am') || ' - ' || to_char(end_date at time zone :time_zone, 'HH12:MI am') as time, \n";
|
||||
$sql .= "to_char(start_date at time zone :time_zone, '".$time_format."') || ' - ' || to_char(end_date at time zone :time_zone, '".$time_format."') as time, \n";
|
||||
$sql .= "extract(epoch from start_date) as start_epoch, ";
|
||||
$sql .= "extract(epoch from end_date) as end_epoch, ";
|
||||
$sql .= "s_hour, start_date, end_date, volume, answered, (round(d.seconds / 60, 1)) as minutes, \n";
|
||||
@@ -575,6 +600,7 @@
|
||||
$sql .= " group by s.s_id, s.start_date, s.end_date, s.s_hour \n";
|
||||
$sql .= " order by s.s_id asc \n";
|
||||
$sql .= ") as d; \n";
|
||||
$parameters['time_zone'] = $time_zone;
|
||||
$stats = $database->select($sql, $parameters, 'all');
|
||||
|
||||
//set the hours
|
||||
@@ -624,4 +650,4 @@
|
||||
$x++;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user