From 8c33d8d493b46ec0768f8ec115aa8645d3869a15 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Mon, 9 Feb 2015 18:20:44 +0000 Subject: [PATCH] More work to get the new time conditions to save to the database. --- app/time_conditions/time_condition_edit.php | 129 ++++++++++---------- 1 file changed, 66 insertions(+), 63 deletions(-) diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index 343463b0b1..b559e1ebbd 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_edit.php @@ -332,7 +332,6 @@ require_once "resources/paging.php"; $sql .= "'".$dialplan_detail_group."', "; $sql .= "'".$dialplan_detail_order."' "; $sql .= ") "; - } //execute query @@ -340,7 +339,6 @@ require_once "resources/paging.php"; unset($sql); } - //increment group number, reset order number $dialplan_detail_group = 100; $dialplan_detail_order = 0; @@ -596,43 +594,43 @@ require_once "resources/paging.php"; } } -//create a is_preset function to determine if the time settings are a preset - function is_preset($presets, $times) { - if ($_GET['debug'] == 'true') { - echo "

\n"; - echo "
\n"; - echo "
\n"; - } - $preset_keys = array(); - foreach ($presets as $row) { - if ($_GET['debug'] == 'true') { - echo "\n"; - } - $match = true; - foreach ($row as $k => $v) { - if ($_GET['debug'] == 'true') { - echo "\n"; - echo ""; - } - if ($row[$k] == $times[$k]) { - if ($_GET['debug'] == 'true') { echo ""; } - } - else { - if ($_GET['debug'] == 'true') { echo ""; } - $match = false; - } - if ($_GET['debug'] == 'true') { - echo "\n"; - } - } - if ($_GET['debug'] == 'true') { - echo "
".$k."".$row[$k]."".$k."".$times[$k]."matchno match
\n"; - echo "
\n"; - } - if ($match) { return true; } - } - return false; + +function is_preset($presets, $times) { + if ($_GET['debug'] == 'true') { + echo "

\n"; + echo "
\n"; + echo "
\n"; } + $preset_keys = array(); + foreach ($presets as $row) { + if ($_GET['debug'] == 'true') { + echo "\n"; + } + $match = true; + foreach ($row as $k => $v) { + if ($_GET['debug'] == 'true') { + echo "\n"; + echo ""; + } + if ($row[$k] == $times[$k]) { + if ($_GET['debug'] == 'true') { echo ""; } + } + else { + if ($_GET['debug'] == 'true') { echo ""; } + $match = false; + } + if ($_GET['debug'] == 'true') { + echo "\n"; + } + } + if ($_GET['debug'] == 'true') { + echo "
".$k."".$row[$k]."".$k."".$times[$k]."matchno match
\n"; + echo "
\n"; + } + if ($match) { return true; } + } + return false; +} //set preset to true or false on dialplan_times array $x = 0; @@ -776,7 +774,7 @@ require_once "resources/paging.php"; echo " \n"; echo " \n"; - $c = 0; + $x = 0; foreach($details as $detail_group) { foreach ($detail_group as $row) { if ($row['dialplan_detail_tag'] == 'condition') { @@ -796,12 +794,17 @@ require_once "resources/paging.php"; $dialplan_detail_group = $row['dialplan_detail_group']; $dialplan_detail_order = $row['dialplan_detail_order']; - //for ($c = 1; $c <= 3; $c++) { + //add the primary key uuid + if (strlen($dialplan_detail_uuid) > 0) { + echo " \n"; + } + + //start a new row echo " \n"; //time condition echo " \n"; - echo " \n"; echo " \n"; foreach ($time_condition_vars as $var_name => $var_label) { if ($var_name == $dialplan_detail_type) { @@ -816,7 +819,7 @@ require_once "resources/paging.php"; //single or range echo " \n"; - echo " \n"; $detail_data = explode("-", $dialplan_detail_data); if (count($detail_data) == 1) { echo " \n"; @@ -837,19 +840,19 @@ require_once "resources/paging.php"; //switch ($var_name) { switch ($dialplan_detail_type) { case "minute-of-day" : - echo "