From 25715dd290eccaaf901b6c1278e6a28a31a5990f Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Fri, 17 Apr 2015 18:41:31 +0000 Subject: [PATCH] Conference Center: Add ability to use a Phrase for the Greeting, resolving Issue 921 and Issue 818. --- .../conference_center_edit.php | 74 +++--- app/ivr_menu/ivr_menu_edit.php | 235 ++++++++++-------- app/phrases/phrase_edit.php | 30 +-- resources/functions.php | 1 + 4 files changed, 189 insertions(+), 151 deletions(-) diff --git a/app/conference_centers/conference_center_edit.php b/app/conference_centers/conference_center_edit.php index 17bf8dfa16..639310a56d 100644 --- a/app/conference_centers/conference_center_edit.php +++ b/app/conference_centers/conference_center_edit.php @@ -385,55 +385,57 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; } - if (if_group("superadmin")) { - echo " \n"; - } + echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-greeting']."\n"; echo "\n"; diff --git a/app/ivr_menu/ivr_menu_edit.php b/app/ivr_menu/ivr_menu_edit.php index f12d71fc3a..c80ec5d788 100644 --- a/app/ivr_menu/ivr_menu_edit.php +++ b/app/ivr_menu/ivr_menu_edit.php @@ -424,72 +424,83 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; //misc optgroup if (if_group("superadmin")) { - echo "\n"; + echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; } //recordings - if($dh = opendir($_SESSION['switch']['recordings']['dir']."/")) { + if ($dh = opendir($_SESSION['switch']['recordings']['dir']."/")) { $tmp_selected = false; $files = Array(); - echo "\n"; + echo "\n"; while($file = readdir($dh)) { if($file != "." && $file != ".." && $file[0] != '.') { if(is_dir($_SESSION['switch']['recordings']['dir'] . "/" . $file)) { @@ -869,46 +893,53 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; } //phrases - echo "\n"; $sql = "select * from v_phrases where domain_uuid = '".$domain_uuid."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($result as &$row) { - if ($ivr_menu_invalid_sound == "phrase:".$row["phrase_name"].".".$domain_uuid) { - $tmp_selected = true; - echo " \n"; - } else { - echo " \n"; + if (count($result) > 0) { + echo "\n"; + foreach ($result as &$row) { + if ($ivr_menu_invalid_sound == "phrase:".$row["phrase_name"].".".$domain_uuid) { + $tmp_selected = true; + echo " \n"; + } + else { + echo " \n"; + } } + unset ($prep_statement); + echo "\n"; } - unset ($prep_statement); - echo "\n"; //sounds $dir_path = $_SESSION['switch']['sounds']['dir']; recur_sounds_dir($_SESSION['switch']['sounds']['dir']); - echo "\n"; - foreach ($dir_array as $key => $value) { - if (strlen($value) > 0) { - if (substr($ivr_menu_invalid_sound, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { - $ivr_menu_invalid_sound = substr($ivr_menu_invalid_sound, 71); - } - if ($ivr_menu_invalid_sound == $key) { - $tmp_selected = true; - echo " \n"; - } else { - echo " \n"; + if (count($dir_array) > 0) { + echo "\n"; + foreach ($dir_array as $key => $value) { + if (strlen($value) > 0) { + if (substr($ivr_menu_invalid_sound, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { + $ivr_menu_invalid_sound = substr($ivr_menu_invalid_sound, 71); + } + if ($ivr_menu_invalid_sound == $key) { + $tmp_selected = true; + echo " \n"; + } + else { + echo " \n"; + } } } + echo "\n"; } - echo "\n"; //select if (if_group("superadmin")) { if (!$tmp_selected) { - echo "\n"; + echo "\n"; if (file_exists($_SESSION['switch']['recordings']['dir']."/".$ivr_menu_invalid_sound)) { echo " \n"; - } elseif (substr($ivr_menu_invalid_sound, -3) == "wav" || substr($ivr_menu_invalid_sound, -3) == "mp3") { + } + else if (substr($ivr_menu_invalid_sound, -3) == "wav" || substr($ivr_menu_invalid_sound, -3) == "mp3") { echo " \n"; } echo "\n"; diff --git a/app/phrases/phrase_edit.php b/app/phrases/phrase_edit.php index 5c957fa867..84e108d527 100644 --- a/app/phrases/phrase_edit.php +++ b/app/phrases/phrase_edit.php @@ -382,7 +382,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if($dh = opendir($_SESSION['switch']['recordings']['dir']."/")) { $tmp_selected = false; $files = Array(); - echo " \n"; + echo " \n"; while($file = readdir($dh)) { if($file != "." && $file != ".." && $file[0] != '.') { if(is_dir($_SESSION['switch']['recordings']['dir'] . "/" . $file)) { @@ -405,22 +405,24 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //sounds $dir_path = $_SESSION['switch']['sounds']['dir']; recur_sounds_dir($_SESSION['switch']['sounds']['dir']); - echo " \n"; - foreach ($dir_array as $key => $value) { - if (strlen($value) > 0) { - if (substr($ivr_menu_greet_long, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { - $ivr_menu_greet_long = substr($ivr_menu_greet_long, 71); - } - if ($ivr_menu_greet_long == $key) { - $tmp_selected = true; - echo "\n"; - } - else { - echo "\n"; + if (count($dir_array) > 0) { + echo " \n"; + foreach ($dir_array as $key => $value) { + if (strlen($value) > 0) { + if (substr($ivr_menu_greet_long, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { + $ivr_menu_greet_long = substr($ivr_menu_greet_long, 71); + } + if ($ivr_menu_greet_long == $key) { + $tmp_selected = true; + echo "\n"; + } + else { + echo "\n"; + } } } + echo " \n"; } - echo " \n"; echo " \n"; echo " \n"; echo " \n"; diff --git a/resources/functions.php b/resources/functions.php index 294463260f..d909917162 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -1074,6 +1074,7 @@ function number_pad($number,$n) { } } } + ksort($dir_array, SORT_STRING); closedir($dir_list); } }