Sounds [Class]: Update to support use on Conference Center Greeting.

This commit is contained in:
fusionate 2023-11-06 19:42:02 +00:00
parent e5f2a697bf
commit 145025946a
No known key found for this signature in database
1 changed files with 16 additions and 11 deletions

View File

@ -11,6 +11,8 @@ class sounds {
* Called when the object is created * Called when the object is created
*/ */
public $domain_uuid; public $domain_uuid;
public $sound_types;
public $full_path;
/** /**
* Class constructor * Class constructor
@ -27,16 +29,18 @@ class sounds {
public function get() { public function get() {
//miscellaneous //miscellaneous
$x = 0; if (empty($this->sound_types) || (is_array($this->sound_types) && in_array('miscellaneous', $this->sound_types))) {
if (if_group("superadmin")) { $x = 0;
$array['miscellaneous'][$x]['name'] = "say"; if (if_group("superadmin")) {
$array['miscellaneous'][$x]['value'] = "say:"; $array['miscellaneous'][$x]['name'] = "say";
$x++; $array['miscellaneous'][$x]['value'] = "say:";
$array['miscellaneous'][$x]['name'] = "tone_stream"; $x++;
$array['miscellaneous'][$x]['value'] = "tone_stream:"; $array['miscellaneous'][$x]['name'] = "tone_stream";
$array['miscellaneous'][$x]['value'] = "tone_stream:";
}
} }
//recordings //recordings
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/phrases/app_config.php")) { if ((empty($this->sound_types) || (is_array($this->sound_types) && in_array('recordings', $this->sound_types))) && file_exists($_SERVER["PROJECT_ROOT"]."/app/recordings/app_config.php")) {
$sql = "select recording_name, recording_filename from v_recordings "; $sql = "select recording_name, recording_filename from v_recordings ";
$sql .= "where domain_uuid = :domain_uuid "; $sql .= "where domain_uuid = :domain_uuid ";
$sql .= "order by recording_name asc "; $sql .= "order by recording_name asc ";
@ -47,15 +51,16 @@ class sounds {
foreach ($recordings as &$row) { foreach ($recordings as &$row) {
$recording_name = $row["recording_name"]; $recording_name = $row["recording_name"];
$recording_filename = $row["recording_filename"]; $recording_filename = $row["recording_filename"];
$recording_path = !empty($this->full_path) && is_array($this->full_path) && in_array('recordings', $this->full_path) ? $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/' : null;
$array['recordings'][$x]['name'] = $recording_name; $array['recordings'][$x]['name'] = $recording_name;
$array['recordings'][$x]['value'] = $recording_filename; $array['recordings'][$x]['value'] = $recording_path.$recording_filename;
$x++; $x++;
} }
} }
unset($sql, $parameters, $recordings, $row); unset($sql, $parameters, $recordings, $row);
} }
//phrases //phrases
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/phrases/app_config.php")) { if ((empty($this->sound_types) || (is_array($this->sound_types) && in_array('phrases', $this->sound_types))) && file_exists($_SERVER["PROJECT_ROOT"]."/app/phrases/app_config.php")) {
$sql = "select * from v_phrases "; $sql = "select * from v_phrases ";
$sql .= "where domain_uuid = :domain_uuid "; $sql .= "where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $_SESSION["domain_uuid"]; $parameters['domain_uuid'] = $_SESSION["domain_uuid"];
@ -71,7 +76,7 @@ class sounds {
unset($sql, $parameters, $phrases, $row); unset($sql, $parameters, $phrases, $row);
} }
//sounds //sounds
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/phrases/app_config.php")) { if ((empty($this->sound_types) || (is_array($this->sound_types) && in_array('sounds', $this->sound_types))) && file_exists($_SERVER["PROJECT_ROOT"]."/app/phrases/app_config.php")) {
$file = new file; $file = new file;
$sound_files = $file->sounds(); $sound_files = $file->sounds();
if (is_array($sound_files) && @sizeof($sound_files) != 0) { if (is_array($sound_files) && @sizeof($sound_files) != 0) {