diff --git a/app/call_centers/call_center_queue_edit.php b/app/call_centers/call_center_queue_edit.php index f9e5168856..0522598dd8 100644 --- a/app/call_centers/call_center_queue_edit.php +++ b/app/call_centers/call_center_queue_edit.php @@ -724,10 +724,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; $moh= new switch_music_on_hold; - $moh->select_name = "queue_moh_sound"; - $moh->select_value = $queue_moh_sound; - $moh->select_options = $select_options; - echo $moh->select(); + echo $moh->select("queue_moh_sound", $queue_moh_sound, $select_options); echo "
\n"; echo $text['description-music_on_hold']."\n"; diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index 62f4ff45f6..632fce45c5 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -1786,10 +1786,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; - $moh= new switch_music_on_hold; - $moh->select_name = "hold_music"; - $moh->select_value = $hold_music; - echo $moh->select(); + $moh = new switch_music_on_hold; + echo $moh->select('hold_music', $hold_music); echo "
\n"; echo $text['description-hold_music']."\n"; echo "\n"; diff --git a/app/music_on_hold/resources/classes/switch_music_on_hold.php b/app/music_on_hold/resources/classes/switch_music_on_hold.php index 30381ffef2..4895bea87d 100644 --- a/app/music_on_hold/resources/classes/switch_music_on_hold.php +++ b/app/music_on_hold/resources/classes/switch_music_on_hold.php @@ -31,9 +31,6 @@ include "root.php"; class switch_music_on_hold { public $domain_uuid; - public $select_name; - public $select_value; - public $select_options; private $xml; private $db; @@ -53,31 +50,24 @@ include "root.php"; } } - //it is NOT recommended to use this function anymore you should be using the ringback class + //it is NOT recommended to use this function if you want to include ringback you should be using the ringback class //see app/ring_groups/ring_group_edit.php for example - public function select() { - $trace = debug_backtrace(); - $caller = $trace[1]; - $what = $caller['function']; - if (isset($caller['class'])) { - $what .= " in {$caller['class']}"; - } - trigger_error("Legacy call to select in switch_music_on_hold class by $what", E_USER_WARNING); + public function select($name, $selected, $options) { //add multi-lingual support $language = new text; $text = $language->get(); //start the select - $select = " \n"; //moh $options = $this->list_moh(); if (sizeof($options) > 0) { - $select .= ""; + $select .= " "; foreach($options as $moh_value => $moh_name) { - $select .= "\n"; + $select .= " \n"; } - $select .= "\n"; + $select .= " \n"; } //recordings if (is_dir($_SERVER["PROJECT_ROOT"].'/app/recordings')) { @@ -85,21 +75,21 @@ include "root.php"; $recordings_c = new switch_recordings; $recordings = $recordings_c->list_recordings(); if (sizeof($recordings) > 0) { - $select .= ""; + $select .= " "; foreach($recordings as $recording_value => $recording_name){ - $select .= "\n"; + $select .= " \n"; } - $select .= "\n"; + $select .= " \n"; } } //add additional options - if (sizeof($this->select_options) > 0) { - $select .= ""; - $select .= $this->select_options; - $select .= "\n"; + if (sizeof($options) > 0) { + $select .= " "; + $select .= $options; + $select .= " \n"; } //end the select and return it - $select .= " \n"; + $select .= "\n"; return $select; }