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
*/
public $domain_uuid;
public $sound_types;
public $full_path;
/**
* Class constructor
@ -27,16 +29,18 @@ class sounds {
public function get() {
//miscellaneous
$x = 0;
if (if_group("superadmin")) {
$array['miscellaneous'][$x]['name'] = "say";
$array['miscellaneous'][$x]['value'] = "say:";
$x++;
$array['miscellaneous'][$x]['name'] = "tone_stream";
$array['miscellaneous'][$x]['value'] = "tone_stream:";
if (empty($this->sound_types) || (is_array($this->sound_types) && in_array('miscellaneous', $this->sound_types))) {
$x = 0;
if (if_group("superadmin")) {
$array['miscellaneous'][$x]['name'] = "say";
$array['miscellaneous'][$x]['value'] = "say:";
$x++;
$array['miscellaneous'][$x]['name'] = "tone_stream";
$array['miscellaneous'][$x]['value'] = "tone_stream:";
}
}
//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 .= "where domain_uuid = :domain_uuid ";
$sql .= "order by recording_name asc ";
@ -47,15 +51,16 @@ class sounds {
foreach ($recordings as &$row) {
$recording_name = $row["recording_name"];
$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]['value'] = $recording_filename;
$array['recordings'][$x]['value'] = $recording_path.$recording_filename;
$x++;
}
}
unset($sql, $parameters, $recordings, $row);
}
//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 .= "where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $_SESSION["domain_uuid"];
@ -71,7 +76,7 @@ class sounds {
unset($sql, $parameters, $phrases, $row);
}
//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;
$sound_files = $file->sounds();
if (is_array($sound_files) && @sizeof($sound_files) != 0) {