\n";
@@ -729,30 +758,76 @@
echo "\n";
echo "\n";
+ $instance_id = 'queue_greeting';
+ $instance_label = 'greeting';
+ $instance_value = $queue_greeting;
echo "
\n";
- echo "| \n";
- echo " ".$text['label-greeting']."\n";
+ echo " | \n";
+ echo " ".$text['label-'.$instance_label]."\n";
echo " | \n";
+ echo " | \n";
+ echo "
\n";
+ echo "
\n";
echo "| \n";
- echo " | \n";
echo "
\n";
@@ -1184,103 +1259,76 @@
}
if (permission_exists('call_center_announce_sound')) {
+ $instance_id = 'queue_announce_sound';
+ $instance_label = 'caller_announce_sound';
+ $instance_value = $queue_announce_sound;
echo "
\n";
- echo "| \n";
- echo " ".$text['label-caller_announce_sound']."\n";
+ echo " | \n";
+ echo " ".$text['label-'.$instance_label]."\n";
echo " | \n";
+ echo " | \n";
+ echo "
\n";
+ echo "
\n";
echo "\n";
-
- $destination_id = "queue_announce_sound";
- $script = "\n";
- $script .= "\n";
- echo $script;
-
- echo "\n";
- echo " \n";
-
- //recordings
- $tmp_selected = false;
- if (!empty($recordings)) {
- echo "\n";
- foreach ($recordings as &$row) {
- $recording_name = $row["recording_name"];
- $recording_filename = $row["recording_filename"];
- if (!empty($queue_announce_sound) && $queue_announce_sound == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename) {
- $tmp_selected = true;
- echo " \n";
- }
- else if (!empty($queue_announce_sound) && $queue_announce_sound == $recording_filename) {
- $tmp_selected = true;
- echo " \n";
- }
- else {
- echo " \n";
+ echo "\n";
+ echo " \n";
+ $found = $playable = false;
+ if (!empty($audio_files[1]) && is_array($audio_files[1]) && @sizeof($audio_files[1]) != 0) {
+ foreach ($audio_files[1] as $key => $value) {
+ echo "\n";
+ foreach ($value as $row) {
+ if ($key == 'recordings') {
+ if (
+ !empty($instance_value) &&
+ ($instance_value == $row["value"] || $instance_value == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].'/'.$row["value"]) &&
+ file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].'/'.pathinfo($row["value"], PATHINFO_BASENAME))
+ ) {
+ $selected = "selected='selected'";
+ $playable = '../recordings/recordings.php?action=download&type=rec&filename='.pathinfo($row["value"], PATHINFO_BASENAME);
+ $found = true;
+ }
+ else {
+ unset($selected);
+ }
+ }
+ else if ($key == 'sounds') {
+ if (!empty($instance_value) && $instance_value == $row["value"]) {
+ $selected = "selected='selected'";
+ $playable = '../switch/sounds.php?action=download&filename='.$row["value"];
+ $found = true;
+ }
+ else {
+ unset($selected);
+ }
+ }
+ else {
+ unset($selected);
+ }
+ echo " \n";
}
+ echo "\n";
}
- echo "\n";
}
-
- if (!$tmp_selected && !empty($queue_announce_sound)) {
- echo "\n";
- if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$queue_announce_sound)) {
- echo " \n";
- }
- else if (substr($queue_announce_sound, -3) == "wav" || substr($queue_announce_sound, -3) == "mp3") {
- echo " \n";
- }
- else {
- echo " \n";
- }
- echo "\n";
+ if (if_group("superadmin") && !empty($instance_value) && !$found) {
+ echo " \n";
}
-
- unset($tmp_selected);
-
+ unset($selected);
echo " \n";
- echo "";
-
- unset($destination_id);
-
- echo " \n";
- echo $text['description-caller_announce_sound']."\n";
+ if (if_group("superadmin")) {
+ echo "";
+ }
+ if ((permission_exists('recording_play') || permission_exists('recording_download')) && (!empty($playable) || empty($instance_value))) {
+ switch (pathinfo($playable, PATHINFO_EXTENSION)) {
+ case 'wav' : $mime_type = 'audio/wav'; break;
+ case 'mp3' : $mime_type = 'audio/mpeg'; break;
+ case 'ogg' : $mime_type = 'audio/ogg'; break;
+ }
+ echo "";
+ echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'],'icon'=>$_SESSION['theme']['button_icon_play'],'id'=>'recording_button_'.$instance_id,'style'=>'display: '.(!empty($mime_type) ? 'inline' : 'none'),'onclick'=>"recording_play('".$instance_id."')"]);
+ unset($playable, $mime_type);
+ }
+ echo " \n";
+ echo $text['description-'.$instance_label]."\n";
echo " | \n";
echo "
\n";
}