From b17af46313edc57b9cf079423be34094ccca6ba1 Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Sat, 24 Jan 2015 04:10:37 +0000 Subject: [PATCH] Time Conditions: Overhaul (on Add only, so far). --- app/dialplan/dialplan_edit.php | 2 + app/dialplan/dialplans.php | 4 +- app/time_conditions/app_defaults.php | 57 + app/time_conditions/app_languages.php | 319 +++--- app/time_conditions/time_condition_add.php | 1111 ------------------- app/time_conditions/time_condition_edit.php | 815 ++++++++++++++ 6 files changed, 1020 insertions(+), 1288 deletions(-) create mode 100644 app/time_conditions/app_defaults.php delete mode 100644 app/time_conditions/time_condition_add.php create mode 100644 app/time_conditions/time_condition_edit.php diff --git a/app/dialplan/dialplan_edit.php b/app/dialplan/dialplan_edit.php index 81b8a9478c..558e0f3ca8 100644 --- a/app/dialplan/dialplan_edit.php +++ b/app/dialplan/dialplan_edit.php @@ -764,12 +764,14 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } //end if update + echo "
\n"; echo "
\n"; if ($action == "update") { echo " \n"; } echo " \n"; echo "
\n"; + echo "

\n"; echo ""; if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){ diff --git a/app/dialplan/dialplans.php b/app/dialplan/dialplans.php index 1aa2510254..e8a1d4df67 100644 --- a/app/dialplan/dialplans.php +++ b/app/dialplan/dialplans.php @@ -254,7 +254,7 @@ else { echo "$v_link_label_add"; } elseif ($app_uuid == "4b821450-926b-175a-af93-a03c441818b1" && permission_exists('time_condition_add')) { - echo "$v_link_label_add"; + echo "$v_link_label_add"; } elseif (permission_exists('dialplan_add')) { echo "$v_link_label_add"; @@ -358,7 +358,7 @@ else { echo "$v_link_label_add"; } elseif ($app_uuid == "4b821450-926b-175a-af93-a03c441818b1" && permission_exists('time_condition_add')) { - echo "$v_link_label_add"; + echo "$v_link_label_add"; } elseif (permission_exists('dialplan_add')) { echo "$v_link_label_add"; diff --git a/app/time_conditions/app_defaults.php b/app/time_conditions/app_defaults.php new file mode 100644 index 0000000000..ea0b850d60 --- /dev/null +++ b/app/time_conditions/app_defaults.php @@ -0,0 +1,57 @@ + array("variables" => array("mday" => "1", "mon" => "1")))); + $preset[] = json_encode(array("martin_luther_king_jr_day" => array("variables" => array("wday" => "2", "mon" => "1", "mweek" => "3")))); + $preset[] = json_encode(array("presidents_day" => array("variables" => array("wday" => "2", "mon" => "2", "mweek" => "3")))); + $preset[] = json_encode(array("memorial_day" => array("variables" => array("mday" => "25-31", "wday" => "2", "mon" => "5")))); + $preset[] = json_encode(array("independence_day" => array("variables" => array("mday" => "4", "mon" => "7")))); + $preset[] = json_encode(array("labor_day" => array("variables" => array("wday" => "2", "mon" => "9", "mweek" => "1")))); + $preset[] = json_encode(array("columbus_day" => array("variables" => array("wday" => "2", "mon" => "10", "mweek" => "2")))); + $preset[] = json_encode(array("veterans_day" => array("variables" => array("mday" => "11", "mon" => "11")))); + $preset[] = json_encode(array("thanksgiving_day" => array("variables" => array("wday" => "5-6", "mon" => "11", "mweek" => "4")))); + $preset[] = json_encode(array("christmas_day" => array("variables" => array("mday" => "25", "mon" => "12")))); + + //define array of settings + $x = 0; + foreach ($preset as $json) { + $array[$x]['default_setting_category'] = 'time_conditions'; + $array[$x]['default_setting_subcategory'] = 'preset'; + $array[$x]['default_setting_name'] = 'array'; + $array[$x]['default_setting_value'] = $json; + $array[$x]['default_setting_enabled'] = 'true'; + $array[$x]['default_setting_description'] = 'Holiday'; + $x++; + } + + //iterate and add each, if necessary + foreach ($array as $index => $default_settings) { + + //add default settings + $sql = "select count(*) as num_rows from v_default_settings "; + $sql .= "where default_setting_category = '".$default_settings['default_setting_category']."' "; + $sql .= "and default_setting_subcategory = '".$default_settings['default_setting_subcategory']."' "; + $sql .= "and default_setting_name = '".$default_settings['default_setting_name']."' "; + $sql .= "and default_setting_value = '".$default_settings['default_setting_value']."' "; + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + unset($prep_statement); + if ($row['num_rows'] == 0) { + $orm = new orm; + $orm->name('default_settings'); + $orm->save($array[$index]); + $message = $orm->message; + //print_r($message); + } + unset($row); + } + + } + +} + +?> \ No newline at end of file diff --git a/app/time_conditions/app_languages.php b/app/time_conditions/app_languages.php index 19a5190b48..4e4b7a4d12 100644 --- a/app/time_conditions/app_languages.php +++ b/app/time_conditions/app_languages.php @@ -45,187 +45,151 @@ $text['description-template']['pt-pt'] = "Os templates oferecem uma lista condições temporais."; $text['description-template']['fr-fr'] = "Le modèle fourni une liste de présélection."; -//begin: Template options - $text['label-optgroup-office']['en-us'] = "Office"; - $text['label-optgroup-office']['es-cl'] = "Oficina"; - $text['label-optgroup-office']['pt-pt'] = "Escritório"; - $text['label-optgroup-office']['fr-fr'] = "Bureau"; + $text['label-conditions']['en-us'] = "Conditions"; + $text['label-conditions']['es-cl'] = "Condiciones"; + $text['label-conditions']['pt-pt'] = "Condições"; + $text['label-conditions']['fr-fr'] = "Conditions"; - $text['label-option-office-8am-5pm']['en-us'] = "Office Hours Mon-Fri 8am-5pm"; - $text['label-option-office-8am-5pm']['es-cl'] = "Horas de oficina Lun-Vier 8h-17h"; - $text['label-option-office-8am-5pm']['pt-pt'] = "Horas de Trabalho Seg-Sex 8h-17h"; - $text['label-option-office-8am-5pm']['fr-fr'] = "Heures de Bureau Lun-Ven 8h-17h"; + $text['description-conditions']['en-us'] = "Define conditions for the Action."; + $text['description-conditions']['es-cl'] = "Definir condiciones para la Acción."; + $text['description-conditions']['pt-pt'] = "Definir condições para a ação."; + $text['description-conditions']['fr-fr'] = "Définir les conditions pour l'action."; - $text['label-option-office-9am-6pm']['en-us'] = "Office Hours Mon-Fri 9am-6pm"; - $text['label-option-office-9am-6pm']['es-cl'] = "Horario de oficina Lun-Vier 9h-18h"; - $text['label-option-office-9am-6pm']['pt-pt'] = "Horas de Trabalho Seg-Sex 9h-18h"; - $text['label-option-office-9am-6pm']['fr-fr'] = "Heures de Bureau Lun-Ven 9h-18h"; + $text['label-condition_parameter']['en-us'] = "Parameter"; + $text['label-condition_parameter']['es-cl'] = "Parámetro"; + $text['label-condition_parameter']['pt-pt'] = "Parâmetro"; + $text['label-condition_parameter']['fr-fr'] = "Paramètre"; - $text['label-optgroup-us-holidays']['en-us'] = "US Holidays"; - $text['label-optgroup-us-holidays']['es-cl'] = "Feriados US"; - $text['label-optgroup-us-holidays']['pt-pt'] = "Férias US"; - $text['label-optgroup-us-holidays']['fr-fr'] = "Vacances US"; + $text['label-condition_scope']['en-us'] = "Scope"; + $text['label-condition_scope']['es-cl'] = "Alcance"; + $text['label-condition_scope']['pt-pt'] = "Escopo"; + $text['label-condition_scope']['fr-fr'] = "Portée"; - $text['label-option-us-holidays-new-year']['en-us'] = "New Year's Day"; - $text['label-option-us-holidays-new-year']['es-cl'] = "Año Nuevo"; - $text['label-option-us-holidays-new-year']['pt-pt'] = "Dia de Ano Novo"; - $text['label-option-us-holidays-new-year']['fr-fr'] = "Nouvel an"; + $text['label-condition_values']['en-us'] = "Value(s)"; + $text['label-condition_values']['es-cl'] = ""; + $text['label-condition_values']['pt-pt'] = ""; + $text['label-condition_values']['fr-fr'] = ""; - $text['label-option-us-holidays-martin-luther-king']['en-us'] = "Martin Luther King Jr Day"; - $text['label-option-us-holidays-martin-luther-king']['es-cl'] = "Día de Martin Luther King Jr"; - $text['label-option-us-holidays-martin-luther-king']['pt-pt'] = "Dia de Martin Luther King Jr"; - $text['label-option-us-holidays-martin-luther-king']['fr-fr'] = "Martin Luther King Jr Day"; + $text['label-presets']['en-us'] = "Presets"; + $text['label-presets']['es-cl'] = "Valor(s)"; + $text['label-presets']['pt-pt'] = "Preço(s)"; + $text['label-presets']['fr-fr'] = "Valeur (s)"; - $text['label-option-us-holidays-president']['en-us'] = "Presidents Day"; - $text['label-option-us-holidays-president']['es-cl'] = "Día de los Presidentes"; - $text['label-option-us-holidays-president']['pt-pt'] = "Dia dos Presidentes"; - $text['label-option-us-holidays-president']['fr-fr'] = "Presidents Day"; + $text['description-presets']['en-us'] = "Pre-defined conditions."; + $text['description-presets']['es-cl'] = "Las condiciones pre-definida."; + $text['description-presets']['pt-pt'] = "Condições pré-definidas."; + $text['description-presets']['fr-fr'] = "Conditions pré-définies."; - $text['label-option-us-holidays-memorial']['en-us'] = "Memorial Day"; - $text['label-option-us-holidays-memorial']['es-cl'] = "Día del Memorial"; - $text['label-option-us-holidays-memorial']['pt-pt'] = "Dia do Memorial"; - $text['label-option-us-holidays-memorial']['fr-fr'] = "Memorial Day"; + $text['label-preset_new_years_day']['en-us'] = "New Year's Day"; + $text['label-preset_new_years_day']['es-cl'] = "Año Nuevo"; + $text['label-preset_new_years_day']['pt-pt'] = "Dia de Ano Novo"; + $text['label-preset_new_years_day']['fr-fr'] = "Nouvel an"; - $text['label-option-us-holidays-independence']['en-us'] = "Independence Day"; - $text['label-option-us-holidays-independence']['es-cl'] = "Día de la Independencia"; - $text['label-option-us-holidays-independence']['pt-pt'] = "Dia da Independência"; - $text['label-option-us-holidays-independence']['fr-fr'] = "Independence Day"; + $text['label-preset_martin_luther_king_jr_day']['en-us'] = "Martin Luther King Jr. Day"; + $text['label-preset_martin_luther_king_jr_day']['es-cl'] = "Día de Martin Luther King Jr."; + $text['label-preset_martin_luther_king_jr_day']['pt-pt'] = "Dia de Martin Luther King Jr."; + $text['label-preset_martin_luther_king_jr_day']['fr-fr'] = "Martin Luther King Jr. Day"; - $text['label-option-us-holidays-labor']['en-us'] = "Labor Day"; - $text['label-option-us-holidays-labor']['es-cl'] = "Día del Trabajo"; - $text['label-option-us-holidays-labor']['pt-pt'] = "Dia do Trabalho"; - $text['label-option-us-holidays-labor']['fr-fr'] = "Labor Day"; + $text['label-preset_presidents_day']['en-us'] = "Presidents Day"; + $text['label-preset_presidents_day']['es-cl'] = "Día de los Presidentes"; + $text['label-preset_presidents_day']['pt-pt'] = "Dia dos Presidentes"; + $text['label-preset_presidents_day']['fr-fr'] = "Presidents Day"; - $text['label-option-us-holidays-columbus']['en-us'] = "Columbus Day"; - $text['label-option-us-holidays-columbus']['es-cl'] = "Día de Colón"; - $text['label-option-us-holidays-columbus']['pt-pt'] = "Dia de Colombo"; - $text['label-option-us-holidays-columbus']['fr-fr'] = "Columbus Day"; + $text['label-preset_memorial_day']['en-us'] = "Memorial Day"; + $text['label-preset_memorial_day']['es-cl'] = "Día del Memorial"; + $text['label-preset_memorial_day']['pt-pt'] = "Dia do Memorial"; + $text['label-preset_memorial_day']['fr-fr'] = "Memorial Day"; - $text['label-option-us-holidays-veteran']['en-us'] = "Veteran's Day"; - $text['label-option-us-holidays-veteran']['es-cl'] = "Día de los Veteranos"; - $text['label-option-us-holidays-veteran']['pt-pt'] = "Dia dos Veteranos"; - $text['label-option-us-holidays-veteran']['fr-fr'] = "Veteran's Day"; + $text['label-preset_independence_day']['en-us'] = "Independence Day"; + $text['label-preset_independence_day']['es-cl'] = "Día de la Independencia"; + $text['label-preset_independence_day']['pt-pt'] = "Dia da Independência"; + $text['label-preset_independence_day']['fr-fr'] = "Independence Day"; - $text['label-option-us-holidays-thanksgiving']['en-us'] = "Thanksgiving"; - $text['label-option-us-holidays-thanksgiving']['es-cl'] = "Thanksgiving"; - $text['label-option-us-holidays-thanksgiving']['pt-pt'] = "Thanksgiving"; - $text['label-option-us-holidays-thanksgiving']['fr-fr'] = "Thanksgiving"; + $text['label-preset_labor_day']['en-us'] = "Labor Day"; + $text['label-preset_labor_day']['es-cl'] = "Día del Trabajo"; + $text['label-preset_labor_day']['pt-pt'] = "Dia do Trabalho"; + $text['label-preset_labor_day']['fr-fr'] = "Labor Day"; - $text['label-option-us-holidays-christmas']['en-us'] = "Christmas"; - $text['label-option-us-holidays-christmas']['es-cl'] = "Navidad"; - $text['label-option-us-holidays-christmas']['pt-pt'] = "Natal"; - $text['label-option-us-holidays-christmas']['fr-fr'] = "Noël"; + $text['label-preset_columbus_day']['en-us'] = "Columbus Day"; + $text['label-preset_columbus_day']['es-cl'] = "Día de Colón"; + $text['label-preset_columbus_day']['pt-pt'] = "Dia de Colombo"; + $text['label-preset_columbus_day']['fr-fr'] = "Columbus Day"; -//end: TemplateOptions + $text['label-preset_veterans_day']['en-us'] = "Veteran's Day"; + $text['label-preset_veterans_day']['es-cl'] = "Día de los Veteranos"; + $text['label-preset_veterans_day']['pt-pt'] = "Dia dos Veteranos"; + $text['label-preset_veterans_day']['fr-fr'] = "Veteran's Day"; - $text['label-day-of-month']['en-us'] = "Day of Month"; - $text['label-day-of-month']['es-cl'] = "Día del Mes"; - $text['label-day-of-month']['pt-pt'] = "Dia do Mês"; - $text['label-day-of-month']['fr-fr'] = "Jour du Mois"; + $text['label-preset_thanksgiving_day']['en-us'] = "Thanksgiving Day"; + $text['label-preset_thanksgiving_day']['es-cl'] = "Thanksgiving"; + $text['label-preset_thanksgiving_day']['pt-pt'] = "Thanksgiving"; + $text['label-preset_thanksgiving_day']['fr-fr'] = "Thanksgiving"; - $text['description-day-of-month']['en-us'] = "Enter the day of the month."; - $text['description-day-of-month']['es-cl'] = "Introduzca el día del mes."; - $text['description-day-of-month']['pt-pt'] = "Introduza o dia do mês."; - $text['description-day-of-month']['fr-fr'] = "Choisir le jour du mois."; - - $text['label-day-of-week']['en-us'] = "Day of Week"; - $text['label-day-of-week']['es-cl'] = "Día de la Semana"; - $text['label-day-of-week']['pt-pt'] = "Dia da Semana"; - $text['label-day-of-week']['fr-fr'] = "Jour de la semaine"; - - $text['description-day-of-week']['en-us'] = "Enter the day of the week. 1-7 (Sun=1, Mon=2, Tues=3)"; - $text['description-day-of-week']['es-cl'] = "Introduzca un día de semana. 1-7 (Dom=1, Lun=2, Mar=3)"; - $text['description-day-of-week']['pt-pt'] = "Introduza o dia da semana. 1-7 (Dom=1, Seg=2, Ter=3)"; - $text['description-day-of-week']['fr-fr'] = "Choisir le jour de la semaine. 1-7 (Dim=1, Lun=2, Mar=3)."; - - $text['label-minute-of-day']['en-us'] = "Minute of Day"; - $text['label-minute-of-day']['es-cl'] = "Minuto del Día"; - $text['label-minute-of-day']['pt-pt'] = "Minuto do Dia"; - $text['label-minute-of-day']['fr-fr'] = "Minute de la journée"; - - $text['description-minute-of-day']['en-us'] = "Enter the minute of the day. 1-1440 (midnight = 1, 8am=480, 9am=540, 6pm=1080)"; - $text['description-minute-of-day']['es-cl'] = "Introduzca un minuto del día. 1-1440 (Media noche = 1, 8h=480, 9h=540, 18h=1080)"; - $text['description-minute-of-day']['pt-pt'] = "Introduza o minuto do dia. 1-1440 (meia-noite = 1, 8h=480, 9h=540, 18h=1080)"; - $text['description-minute-of-day']['fr-fr'] = "Choisir la minute de la journée. 1-1440 (minuit = 1, 8h=480, 9h=540, 6h=1080)"; - - $text['label-month']['en-us'] = "Month"; - $text['label-month']['es-cl'] = "Més"; - $text['label-month']['pt-pt'] = "Mês"; - $text['label-month']['fr-fr'] = "Mois"; - - $text['description-month']['en-us'] = "Enter the month. 1-12 (Jan=1, Feb=2, Mar=3, April=4, May=5, Jun=6, July=7 etc.)"; - $text['description-month']['es-cl'] = "Introduzca un mes. 1-12 (Ene=1, Feb=2, Mar=3, Abr=4, May=5, Junio=6, Julio=7 etc.)"; - $text['description-month']['pt-pt'] = "Introduza o mês. 1-12 (Jan=1, Fev=2, Mar=3, Abr=4, Maio=5, Junho=6, Julho=7 etc.)"; - $text['description-month']['fr-fr'] = "Choisir le mois. 1-12 (Jan=1, Fev=2, Mar=3, Avr=4, Mai=5, etc.)."; - - $text['label-week-of-month']['en-us'] = "Week of Month"; - $text['label-week-of-month']['es-cl'] = "Semana del Mes"; - $text['label-week-of-month']['pt-pt'] = "Semana do Mês"; - $text['label-week-of-month']['fr-fr'] = "Semaine du Mois"; - - $text['description-week-of-month']['en-us'] = "Enter the week of the month."; - $text['description-week-of-month']['es-cl'] = "Introduzca una semana del mes."; - $text['description-week-of-month']['pt-pt'] = "Introduza a semana do mês."; - $text['description-week-of-month']['fr-fr'] = "Choisir le numéro de la semaine dans le mois"; - -//begin: show_advanced - - $text['button-advanced']['en-us'] = "Advanced"; - $text['button-advanced']['es-cl'] = "Avanzadas"; - $text['button-advanced']['pt-pt'] = "Avançadas"; - $text['button-advanced']['fr-fr'] = "Afficher les paramètres avancés"; - - $text['label-day-of-year']['en-us'] = "Day of Year"; - $text['label-day-of-year']['es-cl'] = "Día del Año"; - $text['label-day-of-year']['pt-pt'] = "Dia do Ano"; - $text['label-day-of-year']['fr-fr'] = "Jour de l'année"; - - $text['description-day-of-year']['en-us'] = "Enter the day of the year."; - $text['description-day-of-year']['es-cl'] = "Introduzca un día del año."; - $text['description-day-of-year']['pt-pt'] = "Introduza o dia do ano."; - $text['description-day-of-year']['fr-fr'] = "Choisir le numéro du jour de l'année."; - - $text['label-hour']['en-us'] = "Hour"; - $text['label-hour']['es-cl'] = "Hora"; - $text['label-hour']['pt-pt'] = "Hora"; - $text['label-hour']['fr-fr'] = "Heure"; - - $text['description-hour']['en-us'] = "Enter the hour."; - $text['description-hour']['es-cl'] = "Introduzca una hora."; - $text['description-hour']['pt-pt'] = "Introduza a hora."; - $text['description-hour']['fr-fr'] = "Choisir l'heure."; - - $text['label-minute']['en-us'] = "Minute"; - $text['label-minute']['es-cl'] = "Minuto"; - $text['label-minute']['pt-pt'] = "Minuto"; - $text['label-minute']['fr-fr'] = "Minute"; - - $text['description-minute']['en-us'] = "Enter the minute."; - $text['description-minute']['es-cl'] = "Introduzca un minuto."; - $text['description-minute']['pt-pt'] = "Introduza o minuto."; - $text['description-minute']['fr-fr'] = "Choisir la minute."; - - $text['label-week']['en-us'] = "Week"; - $text['label-week']['es-cl'] = "Semana"; - $text['label-week']['pt-pt'] = "Semana"; - $text['label-week']['fr-fr'] = "Semaine"; - - $text['description-week']['en-us'] = "Enter the week."; - $text['description-week']['es-cl'] = "Introduzca una semana."; - $text['description-week']['pt-pt'] = "Introduza a semana."; - $text['description-week']['fr-fr'] = "Choisir le numéro de la semaine."; + $text['label-preset_christmas_day']['en-us'] = "Christmas Day"; + $text['label-preset_christmas_day']['es-cl'] = "Navidad"; + $text['label-preset_christmas_day']['pt-pt'] = "Natal"; + $text['label-preset_christmas_day']['fr-fr'] = "Noël"; $text['label-year']['en-us'] = "Year"; $text['label-year']['es-cl'] = "Año"; $text['label-year']['pt-pt'] = "Ano"; $text['label-year']['fr-fr'] = "Année"; - $text['description-year']['en-us'] = "Enter the year."; - $text['description-year']['es-cl'] = "Introduzca un año."; - $text['description-year']['pt-pt'] = "Introduza o ano."; - $text['description-year']['fr-fr'] = "Choisir l'année."; + $text['label-month']['en-us'] = "Month"; + $text['label-month']['es-cl'] = "Més"; + $text['label-month']['pt-pt'] = "Mês"; + $text['label-month']['fr-fr'] = "Mois"; + + $text['label-day-of-month']['en-us'] = "Day of Month"; + $text['label-day-of-month']['es-cl'] = "Día del Mes"; + $text['label-day-of-month']['pt-pt'] = "Dia do Mês"; + $text['label-day-of-month']['fr-fr'] = "Jour du Mois"; + + $text['label-day-of-week']['en-us'] = "Day of Week"; + $text['label-day-of-week']['es-cl'] = "Día de la Semana"; + $text['label-day-of-week']['pt-pt'] = "Dia da Semana"; + $text['label-day-of-week']['fr-fr'] = "Jour de la semaine"; + + $text['label-day-of-year']['en-us'] = "Day of Year"; + $text['label-day-of-year']['es-cl'] = "Día del Año"; + $text['label-day-of-year']['pt-pt'] = "Dia do Ano"; + $text['label-day-of-year']['fr-fr'] = "Jour de l'année"; + + $text['label-week-of-year']['en-us'] = "Week of Year"; + $text['label-week-of-year']['es-cl'] = "Semana del año"; + $text['label-week-of-year']['pt-pt'] = "Semana do ano"; + $text['label-week-of-year']['fr-fr'] = "Semaine de l'année"; + + $text['label-week-of-month']['en-us'] = "Week of Month"; + $text['label-week-of-month']['es-cl'] = "Semana del Mes"; + $text['label-week-of-month']['pt-pt'] = "Semana do Mês"; + $text['label-week-of-month']['fr-fr'] = "Semaine du Mois"; + + $text['label-hour-of-day']['en-us'] = "Hour of Day"; + $text['label-hour-of-day']['es-cl'] = "Hora del día"; + $text['label-hour-of-day']['pt-pt'] = "Hora do dia"; + $text['label-hour-of-day']['fr-fr'] = "Heure du jour"; + + $text['label-minute-of-hour']['en-us'] = "Minute of Hour"; + $text['label-minute-of-hour']['es-cl'] = "Minuto de horas"; + $text['label-minute-of-hour']['pt-pt'] = "Minuto de horas"; + $text['label-minute-of-hour']['fr-fr'] = "Minute Hour"; + + $text['label-minute-of-day']['en-us'] = "Minute of Day"; + $text['label-minute-of-day']['es-cl'] = "Minuto del Día"; + $text['label-minute-of-day']['pt-pt'] = "Minuto do Dia"; + $text['label-minute-of-day']['fr-fr'] = "Minute de la journée"; + + $text['label-time-of-day']['en-us'] = "Time of Day"; + $text['label-time-of-day']['es-cl'] = "Hora del día"; + $text['label-time-of-day']['pt-pt'] = "Hora do Dia"; + $text['label-time-of-day']['fr-fr'] = "Heure de la journée"; + + $text['label-date-and-time']['en-us'] = "Date & Time"; + $text['label-date-and-time']['es-cl'] = "Fecha y hora"; + $text['label-date-and-time']['pt-pt'] = "Data e Hora"; + $text['label-date-and-time']['fr-fr'] = "Date et heure"; -//end: show_advanced $text['label-true']['en-us'] = "True"; $text['label-true']['es-cl'] = "Verdadero"; $text['label-true']['pt-pt'] = "Sim"; @@ -236,15 +200,15 @@ $text['label-false']['pt-pt'] = "Não"; $text['label-false']['fr-fr'] = "Non"; - $text['label-action-when-true']['en-us'] = "Action when True"; - $text['label-action-when-true']['es-cl'] = "Acción cuando sea Verdadeo"; - $text['label-action-when-true']['pt-pt'] = "Acção quando Verdadeiro"; - $text['label-action-when-true']['fr-fr'] = "Action quand Vrai"; + $text['label-action']['en-us'] = "Action"; + $text['label-action']['es-cl'] = "Acción cuando sea Verdadeo"; + $text['label-action']['pt-pt'] = "Acção quando Verdadeiro"; + $text['label-action']['fr-fr'] = "Action quand Vrai"; - $text['label-action-when-false']['en-us'] = "Action when False"; - $text['label-action-when-false']['es-cl'] = "Acción cuando sea Falso"; - $text['label-action-when-false']['pt-pt'] = "Acção quando Falso"; - $text['label-action-when-false']['fr-fr'] = "Action quand Faux"; + $text['label-action-alternate']['en-us'] = "Alternate Action"; + $text['label-action-alternate']['es-cl'] = "Acción cuando sea Falso"; + $text['label-action-alternate']['pt-pt'] = "Acção quando Falso"; + $text['label-action-alternate']['fr-fr'] = "Action quand Faux"; $text['label-order']['en-us'] = "Order"; $text['label-order']['es-cl'] = "Orden"; @@ -266,11 +230,6 @@ $text['button-save']['pt-pt'] = "Guardar"; $text['button-save']['fr-fr'] = "Sauvegarder"; - $text['label-required-domain_uuid']['en-us'] = "Please provide: domain_uuid"; - $text['label-required-domain_uuid']['es-cl'] = "Por favor indique: domain_uuid"; - $text['label-required-domain_uuid']['pt-pt'] = "Por favor indique: domain_uuid"; - $text['label-required-domain_uuid']['fr-fr'] = "Merci d'indiquer: domain_uuid"; - $text['label-required-dialplan_name']['en-us'] = "Please provide: Extension Name"; $text['label-required-dialplan_name']['es-cl'] = "Por favor indique: Nombre de Extensión"; $text['label-required-dialplan_name']['pt-pt'] = "Por favor indique: Nome da Extensão"; @@ -281,9 +240,19 @@ $text['label-required-dialplan_number']['pt-pt'] = "Por favor indique: Número da Extensão"; $text['label-required-dialplan_number']['fr-fr'] = "Merci d'indiquer: Numéro de l'extension"; - $text['confirm-update-complete']['en-us'] = "Update Complete"; - $text['confirm-update-complete']['es-cl'] = "Actualización Completada"; - $text['confirm-update-complete']['pt-pt'] = "Actualização Efectuada"; - $text['confirm-update-complete']['fr-fr'] = "Mis à jour"; + $text['label-required-action']['en-us'] = "Please provide: Action"; + $text['label-required-action']['es-cl'] = "Por favor indique: Acción cuando sea Verdadeo"; + $text['label-required-action']['pt-pt'] = "Por favor indique: Acção quando Verdadeiro"; + $text['label-required-action']['fr-fr'] = "Merci d'indiquer: Action quand Vrai"; + + $text['message-update']['en-us'] = "Update Complete"; + $text['message-update']['es-cl'] = "Actualización Completada"; + $text['message-update']['pt-pt'] = "Actualização Efectuada"; + $text['message-update']['fr-fr'] = "Mis à jour"; + + $text['message-add']['en-us'] = "Add Complete"; + $text['message-add']['es-cl'] = "Agregar Completado"; + $text['message-add']['fr-fr'] = "Ajouté"; + $text['message-add']['pt-pt'] = "Adição Efectuada"; ?> \ No newline at end of file diff --git a/app/time_conditions/time_condition_add.php b/app/time_conditions/time_condition_add.php deleted file mode 100644 index 27dd0cb8df..0000000000 --- a/app/time_conditions/time_condition_add.php +++ /dev/null @@ -1,1111 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2015 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -include "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('time_condition_add')) { - //access granted -} -else { - echo "access denied"; - exit; -} -require_once "resources/header.php"; -require_once "resources/paging.php"; - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -//set the variables - $order_by = check_str($_GET["order_by"]); - $order = check_str($_GET["order"]); - -//get the post form variables and se them to php variables - if (count($_POST)>0) { - $dialplan_name = check_str($_POST["dialplan_name"]); - $dialplan_number = check_str($_POST["dialplan_number"]); - $dialplan_order = check_str($_POST["dialplan_order"]); - $condition_hour = check_str($_POST["condition_hour"]); - $condition_minute = check_str($_POST["condition_minute"]); - $condition_minute_of_day = check_str($_POST["condition_minute_of_day"]); - $condition_mday = check_str($_POST["condition_mday"]); - $condition_mweek = check_str($_POST["condition_mweek"]); - $condition_mon = check_str($_POST["condition_mon"]); - $condition_yday = check_str($_POST["condition_yday"]); - $condition_year = check_str($_POST["condition_year"]); - $condition_wday = check_str($_POST["condition_wday"]); - $condition_week = check_str($_POST["condition_week"]); - - $action_1 = check_str($_POST["action_1"]); - //$action_1 = "transfer:1001 XML default"; - $action_1_array = explode(":", $action_1); - $action_application_1 = array_shift($action_1_array); - $action_data_1 = join(':', $action_1_array); - - $anti_action_1 = check_str($_POST["anti_action_1"]); - //$anti_action_1 = "transfer:1001 XML default"; - $anti_action_1_array = explode(":", $anti_action_1); - $anti_action_application_1 = array_shift($anti_action_1_array); - $anti_action_data_1 = join(':', $anti_action_1_array); - - //$action_application_1 = check_str($_POST["action_application_1"]); - //$action_data_1 = check_str($_POST["action_data_1"]); - //$anti_action_application_1 = check_str($_POST["anti_action_application_1"]); - //$anti_action_data_1 = check_str($_POST["anti_action_data_1"]); - $dialplan_enabled = check_str($_POST["dialplan_enabled"]); - $dialplan_description = check_str($_POST["dialplan_description"]); - if (strlen($dialplan_enabled) == 0) { $dialplan_enabled = "true"; } //set default to enabled - } - -if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { - //check for all required data - if (strlen($domain_uuid) == 0) { $msg .= "".$text['label-required-domain_uuid']."
\n"; } - if (strlen($dialplan_name) == 0) { $msg .= "".$text['label-required-dialplan_name']."
\n"; } - if (strlen($dialplan_number) == 0) { $msg .= "".$text['label-required-dialplan_number']."
\n"; } - //if (strlen($condition_field_1) == 0) { $msg .= "Please provide: Condition Field
\n"; } - //if (strlen($condition_expression_1) == 0) { $msg .= "Please provide: Condition Expression
\n"; } - //if (strlen($action_application_1) == 0) { $msg .= "Please provide: Action Application
\n"; } - //if (strlen($enabled) == 0) { $msg .= "Please provide: Enabled True or False
\n"; } - //if (strlen($dialplan_description) == 0) { $msg .= "Please provide: Description
\n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { - require_once "resources/header.php"; - require_once "resources/persist_form_var.php"; - echo "
\n"; - echo "
\n"; - echo $msg."
"; - echo "
\n"; - persistformvar($_POST); - echo "
\n"; - require_once "resources/footer.php"; - return; - } - - //start the atomic transaction - $count = $db->exec("BEGIN;"); //returns affected rows - - //add the main dialplan include entry - $dialplan_uuid = uuid(); - $sql = "insert into v_dialplans "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "dialplan_uuid, "; - $sql .= "app_uuid, "; - $sql .= "dialplan_name, "; - $sql .= "dialplan_order, "; - $sql .= "dialplan_continue, "; - $sql .= "dialplan_context, "; - $sql .= "dialplan_enabled, "; - $sql .= "dialplan_description "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$dialplan_uuid', "; - $sql .= "'4b821450-926b-175a-af93-a03c441818b1', "; - $sql .= "'$dialplan_name', "; - $sql .= "'$dialplan_order', "; - $sql .= "'true', "; - $sql .= "'".$_SESSION['context']."', "; - $sql .= "'$dialplan_enabled', "; - $sql .= "'$dialplan_description' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - //set the dialplan_order - $dialplan_detail_order = 10; - - //add a destination number - if (strlen($dialplan_number) > 0) { - $dialplan_detail_uuid = uuid(); - $sql = "insert into v_dialplan_details "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "dialplan_uuid, "; - $sql .= "dialplan_detail_uuid, "; - $sql .= "dialplan_detail_tag, "; - $sql .= "dialplan_detail_type, "; - $sql .= "dialplan_detail_data, "; - $sql .= "dialplan_detail_order "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$dialplan_uuid', "; - $sql .= "'$dialplan_detail_uuid', "; - $sql .= "'condition', "; - $sql .= "'destination_number', "; - $sql .= "'^$dialplan_number$', "; - $sql .= "'$dialplan_detail_order' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - //increment the dialplan detail order - $dialplan_detail_order = $dialplan_detail_order + 10; - } - - //add time based conditions - if (strlen($condition_wday) > 0) { - $dialplan_detail_uuid = uuid(); - $sql = "insert into v_dialplan_details "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "dialplan_uuid, "; - $sql .= "dialplan_detail_uuid, "; - $sql .= "dialplan_detail_tag, "; - $sql .= "dialplan_detail_type, "; - $sql .= "dialplan_detail_data, "; - $sql .= "dialplan_detail_order "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$dialplan_uuid', "; - $sql .= "'$dialplan_detail_uuid', "; - $sql .= "'condition', "; - $sql .= "'wday', "; - $sql .= "'$condition_wday', "; - $sql .= "'$dialplan_detail_order' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - //increment the dialplan detail order - $dialplan_detail_order = $dialplan_detail_order + 10; - } - if (strlen($condition_minute_of_day) > 0) { - $dialplan_detail_uuid = uuid(); - $sql = "insert into v_dialplan_details "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "dialplan_uuid, "; - $sql .= "dialplan_detail_uuid, "; - $sql .= "dialplan_detail_tag, "; - $sql .= "dialplan_detail_type, "; - $sql .= "dialplan_detail_data, "; - $sql .= "dialplan_detail_order "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$dialplan_uuid', "; - $sql .= "'$dialplan_detail_uuid', "; - $sql .= "'condition', "; - $sql .= "'minute-of-day', "; - $sql .= "'$condition_minute_of_day', "; - $sql .= "'$dialplan_detail_order' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - //increment the dialplan detail order - $dialplan_detail_order = $dialplan_detail_order + 10; - } - if (strlen($condition_mday) > 0) { - $dialplan_detail_uuid = uuid(); - $sql = "insert into v_dialplan_details "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "dialplan_uuid, "; - $sql .= "dialplan_detail_uuid, "; - $sql .= "dialplan_detail_tag, "; - $sql .= "dialplan_detail_type, "; - $sql .= "dialplan_detail_data, "; - $sql .= "dialplan_detail_order "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$dialplan_uuid', "; - $sql .= "'$dialplan_detail_uuid', "; - $sql .= "'condition', "; - $sql .= "'mday', "; - $sql .= "'$condition_mday', "; - $sql .= "'$dialplan_detail_order' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - //increment the dialplan detail order - $dialplan_detail_order = $dialplan_detail_order + 10; - } - if (strlen($condition_mweek) > 0) { - $dialplan_detail_uuid = uuid(); - $sql = "insert into v_dialplan_details "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "dialplan_uuid, "; - $sql .= "dialplan_detail_uuid, "; - $sql .= "dialplan_detail_tag, "; - $sql .= "dialplan_detail_type, "; - $sql .= "dialplan_detail_data, "; - $sql .= "dialplan_detail_order "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$dialplan_uuid', "; - $sql .= "'$dialplan_detail_uuid', "; - $sql .= "'condition', "; - $sql .= "'mweek', "; - $sql .= "'$condition_mweek', "; - $sql .= "'$dialplan_detail_order' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - //increment the dialplan detail order - $dialplan_detail_order = $dialplan_detail_order + 10; - } - if (strlen($condition_mon) > 0) { - $dialplan_detail_uuid = uuid(); - $sql = "insert into v_dialplan_details "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "dialplan_uuid, "; - $sql .= "dialplan_detail_uuid, "; - $sql .= "dialplan_detail_tag, "; - $sql .= "dialplan_detail_type, "; - $sql .= "dialplan_detail_data, "; - $sql .= "dialplan_detail_order "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$dialplan_uuid', "; - $sql .= "'$dialplan_detail_uuid', "; - $sql .= "'condition', "; - $sql .= "'mon', "; - $sql .= "'$condition_mon', "; - $sql .= "'$dialplan_detail_order' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - //increment the dialplan detail order - $dialplan_detail_order = $dialplan_detail_order + 10; - } - if (strlen($condition_hour) > 0) { - $dialplan_detail_uuid = uuid(); - $sql = "insert into v_dialplan_details "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "dialplan_uuid, "; - $sql .= "dialplan_detail_uuid, "; - $sql .= "dialplan_detail_tag, "; - $sql .= "dialplan_detail_type, "; - $sql .= "dialplan_detail_data, "; - $sql .= "dialplan_detail_order "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$dialplan_uuid', "; - $sql .= "'$dialplan_detail_uuid', "; - $sql .= "'condition', "; - $sql .= "'hour', "; - $sql .= "'$condition_hour', "; - $sql .= "'$dialplan_detail_order' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - //increment the dialplan detail order - $dialplan_detail_order = $dialplan_detail_order + 10; - } - if (strlen($condition_minute) > 0) { - $dialplan_detail_uuid = uuid(); - $sql = "insert into v_dialplan_details "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "dialplan_uuid, "; - $sql .= "dialplan_detail_uuid, "; - $sql .= "dialplan_detail_tag, "; - $sql .= "dialplan_detail_type, "; - $sql .= "dialplan_detail_data, "; - $sql .= "dialplan_detail_order "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$dialplan_uuid', "; - $sql .= "'$dialplan_detail_uuid', "; - $sql .= "'condition', "; - $sql .= "'minute', "; - $sql .= "'$condition_minute', "; - $sql .= "'$dialplan_detail_order' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - //increment the dialplan detail order - $dialplan_detail_order = $dialplan_detail_order + 10; - } - if (strlen($condition_week) > 0) { - $dialplan_detail_uuid = uuid(); - $sql = "insert into v_dialplan_details "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "dialplan_uuid, "; - $sql .= "dialplan_detail_uuid, "; - $sql .= "dialplan_detail_tag, "; - $sql .= "dialplan_detail_type, "; - $sql .= "dialplan_detail_data, "; - $sql .= "dialplan_detail_order "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$dialplan_uuid', "; - $sql .= "'$dialplan_detail_uuid', "; - $sql .= "'condition', "; - $sql .= "'week', "; - $sql .= "'$condition_week', "; - $sql .= "'$dialplan_detail_order' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - //increment the dialplan detail order - $dialplan_detail_order = $dialplan_detail_order + 10; - } - if (strlen($condition_yday) > 0) { - $dialplan_detail_uuid = uuid(); - $sql = "insert into v_dialplan_details "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "dialplan_uuid, "; - $sql .= "dialplan_detail_uuid, "; - $sql .= "dialplan_detail_tag, "; - $sql .= "dialplan_detail_type, "; - $sql .= "dialplan_detail_data, "; - $sql .= "dialplan_detail_order "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$dialplan_uuid', "; - $sql .= "'$dialplan_detail_uuid', "; - $sql .= "'condition', "; - $sql .= "'yday', "; - $sql .= "'$condition_yday', "; - $sql .= "'$dialplan_detail_order' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - //increment the dialplan detail order - $dialplan_detail_order = $dialplan_detail_order + 10; - } - if (strlen($condition_year) > 0) { - $dialplan_detail_uuid = uuid(); - $sql = "insert into v_dialplan_details "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "dialplan_uuid, "; - $sql .= "dialplan_detail_uuid, "; - $sql .= "dialplan_detail_tag, "; - $sql .= "dialplan_detail_type, "; - $sql .= "dialplan_detail_data, "; - $sql .= "dialplan_detail_order "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$dialplan_uuid', "; - $sql .= "'$dialplan_detail_uuid', "; - $sql .= "'condition', "; - $sql .= "'year', "; - $sql .= "'$condition_year', "; - $sql .= "'$dialplan_detail_order' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - //increment the dialplan detail order - $dialplan_detail_order = $dialplan_detail_order + 10; - } - - //add action 1 - $dialplan_detail_uuid = uuid(); - $sql = "insert into v_dialplan_details "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "dialplan_uuid, "; - $sql .= "dialplan_detail_uuid, "; - $sql .= "dialplan_detail_tag, "; - $sql .= "dialplan_detail_type, "; - $sql .= "dialplan_detail_data, "; - $sql .= "dialplan_detail_order "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$dialplan_uuid', "; - $sql .= "'$dialplan_detail_uuid', "; - $sql .= "'action', "; - $sql .= "'$action_application_1', "; - $sql .= "'$action_data_1', "; - $sql .= "'$dialplan_detail_order' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - //increment the dialplan detail order - $dialplan_detail_order = $dialplan_detail_order + 10; - - //add anti-action 1 - if (strlen($anti_action_application_1) > 0) { - $dialplan_detail_uuid = uuid(); - $sql = "insert into v_dialplan_details "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "dialplan_uuid, "; - $sql .= "dialplan_detail_uuid, "; - $sql .= "dialplan_detail_tag, "; - $sql .= "dialplan_detail_type, "; - $sql .= "dialplan_detail_data, "; - $sql .= "dialplan_detail_order "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$dialplan_uuid', "; - $sql .= "'$dialplan_detail_uuid', "; - $sql .= "'anti-action', "; - $sql .= "'$anti_action_application_1', "; - $sql .= "'$anti_action_data_1', "; - $sql .= "'$dialplan_detail_order' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - } - - //commit the atomic transaction - $count = $db->exec("COMMIT;"); //returns affected rows - - //synchronize the xml config - save_dialplan_xml(); - - //clear the cache - $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); - - //redirect the browser - $_SESSION["message"] = $text['confirm-update-complete']; - header("Location: ".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=4b821450-926b-175a-af93-a03c441818b1"); - return; - -} //end if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) - -?> - -"; -echo "\n"; - -echo "\n"; -echo " \n"; -echo ""; -echo "
\n"; - -echo "
\n"; -echo "
\n"; - -echo " \n"; -echo " \n"; -echo " \n"; -echo " \n"; -echo " \n"; -echo " \n"; -echo " \n"; -echo " \n"; -echo "
\n"; -echo " ".$text['title-time-condition-add']."
\n"; -echo "
\n"; -echo " \n"; -echo " \n"; -echo "
\n"; -echo " \n"; -echo " ".$text['description-time-condition-add']."\n"; -echo " \n"; -echo "
"; - -echo "
\n"; -echo "
\n"; - -echo "\n"; - -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; - -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; - -//echo "\n"; -//echo "\n"; -//echo "\n"; -//echo "\n"; - -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; - -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; - -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; - -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; - -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; - -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; - -//begin: show_advanced - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; -//end: show_advanced - -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; - -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; - -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; - -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; - -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; - -echo "\n"; -echo " \n"; -echo ""; - -echo "
\n"; -echo " ".$text['label-name'].":\n"; -echo "\n"; -echo " \n"; -echo "
\n"; -echo " ".$text['description-name']."\n"; -echo "
\n"; -echo "\n"; -echo "
\n"; -echo " ".$text['label-extension'].":\n"; -echo "\n"; -echo " \n"; -echo "
\n"; -echo " ".$text['description-extension']."
\n"; -echo "
\n"; -//echo " Continue:\n"; -//echo "\n"; -//echo " \n"; -//echo "
\n"; -//echo "Extension Continue in most cases this is false. default: false\n"; -//echo "
\n"; -echo " ".$text['label-template'].":\n"; -echo "\n"; -echo " \n"; -echo "
\n"; -echo "".$text['description-template']."\n"; -echo "
\n"; -echo " ".$text['label-day-of-month'].":\n"; -echo "\n"; -echo " \n"; -echo "
\n"; -echo " ".$text['description-day-of-month']." 1-31 mday
\n"; -echo "
\n"; -echo " ".$text['label-day-of-week'].":\n"; -echo "\n"; -echo " \n"; -echo "
\n"; -echo " ".$text['description-day-of-week']." wday\n"; -echo "
\n"; -echo "
\n"; -echo " ".$text['label-minute-of-day'].":\n"; -echo "\n"; -echo " \n"; -echo "
\n"; -echo " ".$text['description-minute-of-day']." minute-of-day
\n"; -echo "
\n"; -echo " ".$text['label-month'].":\n"; -echo "\n"; -echo " \n"; -echo "
\n"; -echo " ".$text['description-month']." mon
\n"; -echo "
\n"; -echo " ".$text['label-week-of-month'].":\n"; -echo "\n"; -echo " \n"; -echo "
\n"; -echo " ".$text['description-week-of-month']." 1-6 mweek
\n"; -echo "
\n"; -echo "
\n"; - - echo "
\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
 \n"; - echo " \n"; - echo "
\n"; - echo "
\n"; - - echo "
\n"; - - echo "
\n"; - echo " \n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "
\n"; - echo " ".$text['label-day-of-year'].":\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo " ".$text['description-day-of-year']." 1-365 yday\n"; - echo "
\n"; - echo "
\n"; - echo " ".$text['label-hour'].":\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo " ".$text['description-hour']." 0-23 hour\n"; - echo "
\n"; - echo "
\n"; - echo " ".$text['label-minute'].":\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo " ".$text['description-minute']." 0-59 minute\n"; - echo "
\n"; - echo "
\n"; - echo " ".$text['label-week'].":\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo " ".$text['description-week']." 1-52 week\n"; - echo "
\n"; - echo "
\n"; - echo " ".$text['label-year'].":\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo " ".$text['description-year']." 0-9999 year\n"; - echo "
\n"; - echo "
\n"; - echo "
"; - - echo "
\n"; -echo " ".$text['label-action-when-true'].":\n"; -echo "\n"; - -//switch_select_destination(select_type, select_label, select_name, select_value, select_style, $action); -switch_select_destination("dialplan", $action_1, "action_1", $action_1, "", ""); - -echo "
\n"; -echo " ".$text['label-action-when-false'].":\n"; -echo "\n"; - -//switch_select_destination(select_type, select_label, select_name, select_value, select_style, $action); -switch_select_destination("dialplan", $anti_action_1, "anti_action_1", $anti_action_1, "", ""); - -echo "
\n"; -echo "
\n"; -echo " ".$text['label-order'].":\n"; -echo "\n"; -echo " \n"; -echo "
\n"; -echo "
\n"; -echo " ".$text['label-enabled'].":\n"; -echo "\n"; -echo " \n"; -echo "
\n"; -echo "\n"; -echo "
\n"; -echo " ".$text['label-description'].":\n"; -echo "\n"; -echo " \n"; -echo "
\n"; -echo "\n"; -echo "
\n"; -if ($action == "update") { - echo " \n"; -} -echo " \n"; -echo "
"; -echo "
"; -echo "
"; - -echo "
"; -echo ""; - -echo "

"; - -//include the footer - require_once "resources/footer.php"; - -?> \ No newline at end of file diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php new file mode 100644 index 0000000000..690694aa7d --- /dev/null +++ b/app/time_conditions/time_condition_edit.php @@ -0,0 +1,815 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2015 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ +include "root.php"; +require_once "resources/require.php"; +require_once "resources/check_auth.php"; +if (permission_exists('time_condition_add') || permission_exists('time_condition_edit')) { + //access granted +} +else { + echo "access denied"; + exit; +} +require_once "resources/header.php"; +require_once "resources/paging.php"; + + +//add multi-lingual support + $language = new text; + $text = $language->get(); + +//set the variables + $order_by = check_str($_GET["order_by"]); + $order = check_str($_GET["order"]); + +//get the post form variables and se them to php variables + $action = 'add'; + if (count($_POST)>0) { + $dialplan_name = check_str($_POST["dialplan_name"]); + $dialplan_number = check_str($_POST["dialplan_number"]); + $dialplan_order = check_str($_POST["dialplan_order"]); + + $action_1 = check_str($_POST["action_1"]); + $action_1_array = explode(":", $action_1); + $action_application_1 = array_shift($action_1_array); + $action_data_1 = join(':', $action_1_array); + + $anti_action_1 = check_str($_POST["anti_action_1"]); + $anti_action_1_array = explode(":", $anti_action_1); + $anti_action_application_1 = array_shift($anti_action_1_array); + $anti_action_data_1 = join(':', $anti_action_1_array); + + $dialplan_enabled = check_str($_POST["dialplan_enabled"]); + $dialplan_description = check_str($_POST["dialplan_description"]); + } + + if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { + //check for all required data + if (strlen($domain_uuid) == 0) { $msg .= $text['label-required-domain_uuid']."
\n"; } + if (strlen($dialplan_name) == 0) { $msg .= $text['label-required-dialplan_name']."
\n"; } + if (strlen($dialplan_number) == 0) { $msg .= $text['label-required-dialplan_number']."
\n"; } + if (strlen($action_1) == 0) { $msg .= $text['label-required-action']."
\n"; } + if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + require_once "resources/header.php"; + require_once "resources/persist_form_var.php"; + echo "
\n"; + echo "
\n"; + echo $msg."
"; + echo "
\n"; + persistformvar($_POST); + echo "
\n"; + require_once "resources/footer.php"; + return; + } + + //start the atomic transaction + $count = $db->exec("BEGIN;"); //returns affected rows + + //add the main dialplan include entry + $dialplan_uuid = uuid(); + $sql = "insert into v_dialplans "; + $sql .= "("; + $sql .= "domain_uuid, "; + $sql .= "dialplan_uuid, "; + $sql .= "app_uuid, "; + $sql .= "dialplan_name, "; + $sql .= "dialplan_number, "; + $sql .= "dialplan_order, "; + $sql .= "dialplan_continue, "; + $sql .= "dialplan_context, "; + $sql .= "dialplan_enabled, "; + $sql .= "dialplan_description "; + $sql .= ") "; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$dialplan_uuid."', "; + $sql .= "'4b821450-926b-175a-af93-a03c441818b1', "; + $sql .= "'".$dialplan_name."', "; + $sql .= "'".$dialplan_number."', "; + $sql .= "'".$dialplan_order."', "; + $sql .= "'true', "; + $sql .= "'".$_SESSION['context']."', "; + $sql .= "'".$dialplan_enabled."', "; + $sql .= "'".$dialplan_description."' "; + $sql .= ")"; + + //execute query + $db->exec(check_sql($sql)); + unset($sql); + + + //initialize dialplan detail group and order numbers + $dialplan_detail_group = 0; + $dialplan_detail_order = 0; + + + //check if custom conditions defined + $custom_conditions_defined = false; + foreach ($_REQUEST['variable'] as $cond_var) { + if ($cond_var != '') { $custom_conditions_defined = true; } + } + + if ($custom_conditions_defined) { + + //build insert query for custom conditions + $sql = "insert into v_dialplan_details "; + $sql .= "( "; + $sql .= "domain_uuid, "; + $sql .= "dialplan_uuid, "; + $sql .= "dialplan_detail_uuid, "; + $sql .= "dialplan_detail_tag, "; + $sql .= "dialplan_detail_type, "; + $sql .= "dialplan_detail_data, "; + $sql .= "dialplan_detail_break, "; + $sql .= "dialplan_detail_inline, "; + $sql .= "dialplan_detail_group, "; + $sql .= "dialplan_detail_order "; + $sql .= ") "; + $sql .= "values "; + + //add destination number condition + $dialplan_detail_group++; + $dialplan_detail_order += 10; + $sql .= "( "; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$dialplan_uuid."', "; + $sql .= "'".uuid()."', "; + $sql .= "'condition', "; + $sql .= "'destination_number', "; + $sql .= "'^".$dialplan_number."$', "; + $sql .= "'never', "; + $sql .= "null, "; + $sql .= "'".$dialplan_detail_group."', "; + $sql .= "'".$dialplan_detail_order."' "; + $sql .= ")"; + + //add custom conditions + foreach ($_REQUEST['variable'] as $cond_num => $cond_var) { + if ($cond_var != '') { + $scope = $_REQUEST['scope'][$cond_num]; + $cond_start = $_REQUEST[$cond_var][$cond_num]['start']; + $cond_stop = $_REQUEST[$cond_var][$cond_num]['stop']; + + //handle time of day + if ($cond_var == 'time-of-day' && $cond_start['hour'] != '') { + //format condition start + if ($cond_start['notation'] == 'PM') { + $cond_start_hour = ($cond_start['hour'] != 12) ? $cond_start['hour'] += 12 : $cond_start['hour']; + } + else if ($cond_start['notation'] == 'AM') { + $cond_start_hour = ($cond_start['hour'] == 12) ? $cond_start['hour'] -= 12 : $cond_start['hour']; + } + $cond_start_hour = number_pad($cond_start_hour,2); + $cond_start_minute = $cond_start['minute']; + $cond_start = $cond_start_hour.':'.$cond_start_minute; + + //format condition stop + if ($cond_start != '' && $scope == 'range') { + if ($cond_stop['notation'] == 'PM') { + $cond_stop_hour = ($cond_stop['hour'] != 12) ? $cond_stop['hour'] += 12 : $cond_stop['hour']; + } + else if ($cond_stop['notation'] == 'AM') { + $cond_stop_hour = ($cond_stop['hour'] == 12) ? $cond_stop['hour'] -= 12 : $cond_stop['hour']; + } + $cond_stop_hour = number_pad($cond_stop_hour,2); + $cond_stop_minute = $cond_stop['minute']; + $cond_stop = $cond_stop_hour.':'.$cond_stop_minute; + } + else { + unset($cond_stop); + } + + $cond_value = $cond_start.(($cond_stop != '') ? '-'.$cond_stop : null); + } + //handle all other variables + else { + if ($cond_start != '') { + $cond_value = $cond_start; + if ($scope == 'range' && $cond_stop != '') { + $range_indicator = ($cond_var == 'date-time') ? '~' : '-'; + $cond_value .= $range_indicator.$cond_stop; + } + } + } + + //add condition to query string + $dialplan_detail_order += 10; + $sql .= ", ( "; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$dialplan_uuid."', "; + $sql .= "'".uuid()."', "; + $sql .= "'condition', "; + $sql .= "'".$cond_var."', "; + $sql .= "'".$cond_value."', "; + $sql .= "'never', "; + $sql .= "null, "; + $sql .= "'".$dialplan_detail_group."', "; + $sql .= "'".$dialplan_detail_order."' "; + $sql .= ") "; + } + } + + //add condition action + $dialplan_detail_order += 10; + $sql .= ", ( "; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$dialplan_uuid."', "; + $sql .= "'".uuid()."', "; + $sql .= "'action', "; + $sql .= "'set', "; + $sql .= "'time_condition=true', "; + $sql .= "null, "; + $sql .= "'true', "; + $sql .= "'".$dialplan_detail_group."', "; + $sql .= "'".$dialplan_detail_order."' "; + $sql .= ") "; + + //execute query + $db->exec(check_sql($sql)); + unset($sql); + + } + + + //add to query for preset conditions (if any) + if (sizeof($_REQUEST['preset']) > 0) { + + //build insert query for preset conditions + $sql = "insert into v_dialplan_details "; + $sql .= "( "; + $sql .= "domain_uuid, "; + $sql .= "dialplan_uuid, "; + $sql .= "dialplan_detail_uuid, "; + $sql .= "dialplan_detail_tag, "; + $sql .= "dialplan_detail_type, "; + $sql .= "dialplan_detail_data, "; + $sql .= "dialplan_detail_break, "; + $sql .= "dialplan_detail_inline, "; + $sql .= "dialplan_detail_group, "; + $sql .= "dialplan_detail_order "; + $sql .= ") "; + $sql .= "values "; + + //get preset condition variables + foreach ($_SESSION['time_conditions']['preset'] as $json) { + $presets[] = json_decode($json, true); + } + + foreach ($_REQUEST['preset'] as $index => $preset_number) { + + //increment group and order number + $dialplan_detail_group++; + $dialplan_detail_order = 0; + + //add destination number condition + $dialplan_detail_order += 10; + $sql .= ($index != 0) ? "," : null; + $sql .= " ( "; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$dialplan_uuid."', "; + $sql .= "'".uuid()."', "; + $sql .= "'condition', "; + $sql .= "'destination_number', "; + $sql .= "'^".$dialplan_number."$', "; + $sql .= "'never', "; + $sql .= "null, "; + $sql .= "'".$dialplan_detail_group."', "; + $sql .= "'".$dialplan_detail_order."' "; + $sql .= ") "; + + foreach ($presets[$preset_number] as $preset_name => $preset) { + foreach ($preset['variables'] as $cond_var => $cond_value) { + //add preset condition to query string + $dialplan_detail_order += 10; + $sql .= ", ( "; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$dialplan_uuid."', "; + $sql .= "'".uuid()."', "; + $sql .= "'condition', "; + $sql .= "'".$cond_var."', "; + $sql .= "'".$cond_value."', "; + $sql .= "'never', "; + $sql .= "null, "; + $sql .= "'".$dialplan_detail_group."', "; + $sql .= "'".$dialplan_detail_order."' "; + $sql .= ") "; + } + } + + //add condition action + $dialplan_detail_order += 10; + $sql .= ", ( "; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$dialplan_uuid."', "; + $sql .= "'".uuid()."', "; + $sql .= "'action', "; + $sql .= "'set', "; + $sql .= "'time_condition=true', "; + $sql .= "null, "; + $sql .= "'true', "; + $sql .= "'".$dialplan_detail_group."', "; + $sql .= "'".$dialplan_detail_order."' "; + $sql .= ") "; + + } + + //execute query + $db->exec(check_sql($sql)); + unset($sql); + + } + + + //increment group number, reset order number + $dialplan_detail_group = 100; + $dialplan_detail_order = 0; + + //add to query for main action and anti-action condition + + //build insert query for custom conditions + $sql = "insert into v_dialplan_details "; + $sql .= "( "; + $sql .= "domain_uuid, "; + $sql .= "dialplan_uuid, "; + $sql .= "dialplan_detail_uuid, "; + $sql .= "dialplan_detail_tag, "; + $sql .= "dialplan_detail_type, "; + $sql .= "dialplan_detail_data, "; + $sql .= "dialplan_detail_break, "; + $sql .= "dialplan_detail_inline, "; + $sql .= "dialplan_detail_group, "; + $sql .= "dialplan_detail_order "; + $sql .= ") "; + $sql .= "values "; + + //add destination number condition + $dialplan_detail_order += 10; + $sql .= "( "; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$dialplan_uuid."', "; + $sql .= "'".uuid()."', "; + $sql .= "'condition', "; + $sql .= "'destination_number', "; + $sql .= "'^".$dialplan_number."$', "; + $sql .= "null, "; + $sql .= "null, "; + $sql .= "'".$dialplan_detail_group."', "; + $sql .= "'".$dialplan_detail_order."' "; + $sql .= ") "; + + //add time condition met check + $dialplan_detail_order += 10; + $sql .= ", ( "; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$dialplan_uuid."', "; + $sql .= "'".uuid()."', "; + $sql .= "'condition', "; + $sql .= "'".'${time_condition}'."', "; + $sql .= "'^true$', "; + $sql .= "null, "; + $sql .= "null, "; + $sql .= "'".$dialplan_detail_group."', "; + $sql .= "'".$dialplan_detail_order."' "; + $sql .= ") "; + + //add main action + $dialplan_detail_order += 10; + $sql .= ", ( "; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$dialplan_uuid."', "; + $sql .= "'".uuid()."', "; + $sql .= "'action', "; + $sql .= "'".$action_application_1."', "; + $sql .= "'".$action_data_1."', "; + $sql .= "null, "; + $sql .= "null, "; + $sql .= "'".$dialplan_detail_group."', "; + $sql .= "'".$dialplan_detail_order."' "; + $sql .= ") "; + + //add anti-action (if defined) + if (strlen($anti_action_application_1) > 0) { + $dialplan_detail_order += 10; + $sql .= ", ( "; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$dialplan_uuid."', "; + $sql .= "'".uuid()."', "; + $sql .= "'anti-action', "; + $sql .= "'".$anti_action_application_1."', "; + $sql .= "'".$anti_action_data_1."', "; + $sql .= "null, "; + $sql .= "null, "; + $sql .= "'".$dialplan_detail_group."', "; + $sql .= "'".$dialplan_detail_order."' "; + $sql .= ") "; + } + + //execute query + $db->exec(check_sql($sql)); + unset($sql); + + + + //commit the atomic transaction + $count = $db->exec("COMMIT;"); //returns affected rows + + //synchronize the xml config + save_dialplan_xml(); + + //clear the cache + $cache = new cache; + $cache->delete("dialplan:".$_SESSION["context"]); + + //redirect the browser + $_SESSION["message"] = $text['message-add']; + header("Location: ".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=4b821450-926b-175a-af93-a03c441818b1"); + return; + +} //end if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) + +?> + + + +\n"; + +echo "\n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo "
\n"; +echo " ".$text['title-time-condition-add']."
\n"; +echo "
\n"; +echo " \n"; +echo " \n"; +echo "
\n"; +echo " \n"; +echo " ".$text['description-time-condition-add']."\n"; +echo " \n"; +echo "
"; + +echo "
\n"; +echo "
\n"; + +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "
\n"; +echo " ".$text['label-name']."\n"; +echo "\n"; +echo " \n"; +echo "
\n"; +echo " ".$text['description-name']."\n"; +echo "
\n"; +echo "\n"; +echo "
\n"; +echo " ".$text['label-extension']."\n"; +echo "\n"; +echo " \n"; +echo "
\n"; +echo " ".$text['description-extension']."
\n"; +echo "
\n"; +echo " ".$text['label-conditions']."\n"; +echo "\n"; +//define select box options for each time condition variable (where appropriate) +for ($y = date('Y'); $y <= (date('Y') + 10); $y++) { $var_option_select['year'][$y] = $y; } //years +for ($m = 1; $m <= 12; $m++) { $var_option_select['mon'][$m] = date('F', strtotime('2015-'.number_pad($m,2).'-01')); } //month names +for ($d = 1; $d <= 366; $d++) { $var_option_select['yday'][$d] = $d; } //days of year +for ($d = 1; $d <= 31; $d++) { $var_option_select['mday'][$d] = $d; } //days of month +for ($d = 1; $d <= 7; $d++) { $var_option_select['wday'][$d] = date('l', strtotime('Sunday +'.($d-1).' days')); } //week days +for ($w = 1; $w <= 53; $w++) { $var_option_select['week'][$w] = $w; } //weeks of year +for ($w = 1; $w <= 5; $w++) { $var_option_select['mweek'][$w] = $w; } //weeks of month +for ($h = 0; $h <= 23; $h++) { $var_option_select['hour'][$h] = (($h) ? (($h >= 12) ? (($h == 12) ? $h : ($h-12)).' PM' : $h.' AM') : '12 AM'); } //hours of day +for ($m = 0; $m <= 59; $m++) { $var_option_select['minute'][$m] = number_pad($m,2); } //minutes of hour +//output condition fields +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +for ($c = 1; $c <= 3; $c++) { + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; +} +echo "
".$text['label-condition_parameter']."".$text['label-condition_scope']."".$text['label-condition_values']."
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + + foreach ($time_condition_vars as $var_name => $var_label) { + switch ($var_name) { + case "minute-of-day" : + echo "\n"; + break; + case "time-of-day" : + echo "\n"; + break; + case "date-time" : + echo "\n"; + break; + default: + echo "\n"; + } + } + + echo "
\n"; +if ($action == 'add') { + echo "\n"; +} +echo " ".$text['description-conditions']."
\n"; +echo "
\n"; +echo " ".$text['label-presets']."\n"; +echo "\n"; +foreach ($_SESSION['time_conditions']['preset'] as $json) { + $presets[] = json_decode($json, true); +} +//echo "
"; print_r($presets); echo "


"; +echo " \n"; +echo " \n"; +echo " "; + echo " \n"; +echo " \n"; +echo "
\n"; +$preset_count = sizeof($presets); +$presets_per_column = ceil($preset_count / 3); +$p = 0; +foreach ($presets as $preset_number => $preset) { + foreach ($preset as $preset_name => $preset_variables) { + echo "
\n"; + $p++; + if ($p == $presets_per_column) { + echo "
\n"; + $p = 0; + } + } +} +echo "
\n"; +echo "
\n"; +echo " ".$text['description-presets']."
\n"; +echo "
\n"; +echo " ".$text['label-action']."\n"; +echo "\n"; +//switch_select_destination(select_type, select_label, select_name, select_value, select_style, $action); +switch_select_destination("dialplan", $action_1, "action_1", $action_1, "", ""); +echo "
\n"; +echo " ".$text['label-action-alternate']."\n"; +echo "\n"; +//switch_select_destination(select_type, select_label, select_name, select_value, select_style, $action); +switch_select_destination("dialplan", $anti_action_1, "anti_action_1", $anti_action_1, "", ""); +echo "
\n"; +echo "
\n"; +echo " ".$text['label-order']."\n"; +echo "\n"; +echo " \n"; +echo "
\n"; +echo "
\n"; +echo " ".$text['label-enabled']."\n"; +echo "\n"; +echo " \n"; +echo "
\n"; +echo "\n"; +echo "
\n"; +echo " ".$text['label-description']."\n"; +echo "\n"; +echo " \n"; +echo "
\n"; +echo "\n"; +echo "
\n"; +echo "

"; + +echo "
\n"; +if ($action == "update") { + echo " \n"; +} +echo " \n"; +echo "
"; + +echo ""; +echo "

"; + +//include the footer + require_once "resources/footer.php"; + +?> \ No newline at end of file