From d590df4b61c82f1322bc40aabbead1cdad31e9a0 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 6 Aug 2015 15:24:42 -0500 Subject: [PATCH] Make time condition use the new destinations class. --- app/time_conditions/time_condition_edit.php | 23 ++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index adefa62822..1925536726 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_edit.php @@ -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']."
\n"; echo "\n"; echo "\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 "\n"; echo "\n"; @@ -845,7 +848,10 @@ function add_custom_condition($group_id, $dialplan_action = '') { echo " "; echo " "; echo " "; - 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 " "; echo " "; echo " "; @@ -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 "