Make time condition use the new destinations class.

This commit is contained in:
markjcrane
2015-08-06 15:24:42 -05:00
parent 8cc1d98598
commit 1f496ef53c

View File

@@ -40,6 +40,9 @@ require_once "resources/header.php";
$language = new text;
$text = $language->get();
//initialize the destinations object
$destination = new destinations;
//load available presets
foreach ($_SESSION['time_conditions']['preset'] as $json) {
$available_presets[] = json_decode($json, true);
@@ -826,7 +829,7 @@ echo " ".$text['description-extension']."<br />\n";
echo "</td>\n";
echo "</tr>\n";
function add_custom_condition($group_id, $dialplan_action = '') {
function add_custom_condition($destination, $group_id, $dialplan_action = '') {
global $text, $v_link_label_add;
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
@@ -845,7 +848,10 @@ function add_custom_condition($group_id, $dialplan_action = '') {
echo " </tr>";
echo " <tr>";
echo " <td colspan='4' style='padding-top: 10px;'>";
switch_select_destination("dialplan", '', "dialplan_action[".$group_id."]", $dialplan_action, 'width: 300px;', '');
// switch_select_destination("dialplan", '', "dialplan_action[".$group_id."]", $dialplan_action, 'width: 300px;', '');
//$destination = new destinations;
echo $destination->select('dialplan', 'dialplan_action['.$group_id.']', $dialplan_action);
echo " </td>";
echo " </tr>";
echo " </table>";
@@ -859,7 +865,7 @@ if ($action == 'update') {
$largest_group_id = 0;
foreach ($current_conditions as $group_id => $conditions) {
if (!is_array($current_presets) || (is_array($current_presets) && !in_array($group_id, $current_presets))) {
add_custom_condition($group_id, $dialplan_actions[$group_id]);
add_custom_condition($destination, $group_id, $dialplan_actions[$group_id]);
foreach ($conditions as $cond_var => $cond_val) {
$range_indicator = ($cond_var == 'date-time') ? '~' : '-';
$tmp = explode($range_indicator, $cond_val);
@@ -905,7 +911,7 @@ if ($action == 'update') {
else {
$group_id = $largest_group_id += 5;
}
add_custom_condition($group_id);
add_custom_condition($destination, $group_id);
echo "<script>";
echo " add_condition(".$group_id.",'custom');";
if ($action == 'add' || ($action == 'update' && $largest_group_id == 0)) {
@@ -945,7 +951,8 @@ if ($action == 'update') {
echo " </tr>";
echo " <tr>";
echo " <td colspan='4' style='padding-top: 10px;'>";
switch_select_destination("dialplan", $text['label-select_destination'], "dialplan_action[".$preset_group_id."]", $dialplan_action, 'width: 300px;', '', 'alternate_destination_required();');
// switch_select_destination("dialplan", $text['label-select_destination'], "dialplan_action[".$preset_group_id."]", $dialplan_action, 'width: 300px;', '', 'alternate_destination_required();');
echo $destination->select('dialplan', 'dialplan_action['.$preset_group_id.']', $dialplan_action);
echo " </td>";
echo " </tr>";
echo " </table>";
@@ -1013,7 +1020,8 @@ if ($action == 'update') {
echo " <td>";
echo " <input type='button' class='btn' name='' alt='".$text['button-advanced']."' onclick=\"$(this).fadeOut(400, function() { $('#default_preset_destination').fadeIn(400); document.getElementById('default_preset_destination_description').innerHTML += '<br>".$text['description-presets_advanced']."'; });\" value='".$text['button-advanced']."'>\n";
echo " <span id='default_preset_destination' style=' display: none;'>";
switch_select_destination("dialplan", $text['label-select_default_destination'], "default_preset_action", $dialplan_action, 'width: 300px;', '', 'alternate_destination_required();');
// switch_select_destination("dialplan", $text['label-select_default_destination'], "default_preset_action", $dialplan_action, 'width: 300px;', '', 'alternate_destination_required();');
echo $destination->select('dialplan', 'default_preset_action', $dialplan_action);
echo " </span>";
echo " </td>";
echo " </tr>";
@@ -1029,7 +1037,8 @@ echo "<td id='td_alt_dest' class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-alternate-destination']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
switch_select_destination("dialplan", ' ', "dialplan_anti_action", $dialplan_anti_action, 'width: 300px;', '');
// switch_select_destination("dialplan", ' ', "dialplan_anti_action", $dialplan_anti_action, 'width: 300px;', '');
echo $destination->select('dialplan', 'dialplan_anti_action', $dialplan_anti_action);
echo "</td>\n";
echo "</tr>\n";