Portions created by the Initial Developer are Copyright (C) 2008-2024 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; //check permissions if (!permission_exists('conference_room_view')) { echo "access denied"; exit; } //add multi-lingual support $language = new text; $text = $language->get(); //set additional variables $search = $_GET["search"] ?? null; //set from session variables $list_row_edit_button = $settings->get('theme', 'list_row_edit_button', false); //get the http post data if (!empty($_POST['conference_rooms'])) { $action = $_POST['action']; $toggle_field = $_POST['toggle_field']; $search = $_POST['search'] ?? ''; $conference_rooms = $_POST['conference_rooms']; } //process the http post data by action if (!empty($action) && !empty($conference_rooms)) { switch ($action) { case 'toggle': if (permission_exists('conference_room_edit')) { $obj = new conference_centers; $obj->toggle_field = $toggle_field; $obj->toggle_conference_rooms($conference_rooms); } break; case 'delete': if (permission_exists('conference_room_delete')) { $obj = new conference_centers; $obj->delete_conference_rooms($conference_rooms); } break; } header('Location: conference_rooms.php'.(!empty($search) ? '?search='.urlencode($search) : '')); exit; } /* //if the $_GET array exists then process it if (!empty($_GET) && empty($_GET["search"])) { //get http GET variables and set them as php variables $conference_room_uuid = $_GET["conference_room_uuid"]; $record = $_GET["record"]; $wait_mod = $_GET["wait_mod"]; $announce = $_GET["announce"]; $mute = $_GET["mute"]; $sounds = $_GET["sounds"]; $enabled = $_GET["enabled"]; //record announcement if ($record == "true" && is_uuid($meeting_uuid)) { //prepare the values $default_language = 'en'; $default_dialect = 'us'; $default_voice = 'callie'; $switch_cmd = "conference ".$meeting_uuid."@".$_SESSION['domain_name']." play ".$settings->get('switch', 'sounds')."/".$default_language."/".$default_dialect."/".$default_voice."/ivr/ivr-recording_started.wav"; //connect to event socket $esl = event_socket::create(); if ($esl) { $switch_result = event_socket::api($switch_cmd); } } //build the array $array['conference_rooms'][0]['conference_room_uuid'] = $conference_room_uuid; if (!empty($record)) { $array['conference_rooms'][0]['record'] = $record; } if (!empty($wait_mod)) { $array['conference_rooms'][0]['wait_mod'] = $wait_mod; } if (!empty($announce)) { $array['conference_rooms'][0]['announce'] = $announce; } if (!empty($mute)) { $array['conference_rooms'][0]['mute'] = $mute; } if (!empty($sounds)) { $array['conference_rooms'][0]['sounds'] = $sounds; } if (!empty($enabled)) { $array['conference_rooms'][0]['enabled'] = $enabled; } //save to the data $database->save($array); $message = $database->message; unset($array); } */ //get conference array $switch_cmd = "conference xml_list"; $esl = event_socket::create(); if (!$esl->is_connected()) { trigger_error('Unable to connect to FreeSWITCH', E_USER_WARNING); } else { $xml_str = trim(event_socket::api($switch_cmd)); try { $xml = new SimpleXMLElement($xml_str, true); } catch(Exception $e) { //echo $e->getMessage(); } foreach ($xml->conference as $row) { //convert the xml object to an array $json = json_encode($row); $row = json_decode($json, true); //set the variables $conference_name = $row['@attributes']['name']; $session_uuid = $row['@attributes']['uuid']; $member_count = $row['@attributes']['member-count']; //show the conferences that have a matching domain $tmp_domain = substr($conference_name, -strlen($_SESSION['domain_name'])); if ($tmp_domain == $_SESSION['domain_name']) { $meeting_uuid = substr($conference_name, 0, strlen($conference_name) - strlen('@'.$_SESSION['domain_name'])); $conference[$meeting_uuid]["conference_name"] = $conference_name; $conference[$meeting_uuid]["session_uuid"] = $session_uuid; $conference[$meeting_uuid]["member_count"] = $member_count; } } } //get variables used to control the order $order_by = $_GET["order_by"] ?? ''; $order = $_GET["order"] ?? ''; //get the conference room count $conference_center = new conference_centers; $conference_center->domain_uuid = $_SESSION['domain_uuid']; if (!empty($search)) { $conference_center->search = $search; } $num_rows = $conference_center->room_count(); //prepare to page the results $rows_per_page = $settings->get('domain', 'paging', 50); $param = !empty($search) ? "&search=".$search : null; if (isset($_GET['page'])) { $page = is_numeric($_GET['page']) ? $_GET['page'] : 0; list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); $offset = $rows_per_page * $page; } //get the conference rooms $conference_center->rows_per_page = $rows_per_page; $conference_center->offset = $offset ?? 0; $conference_center->order_by = $order_by; $conference_center->order = $order; if (!empty($search)) { $conference_center->search = $search; } $result = $conference_center->rooms(); //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); //include header $document['title'] = $text['title-conference_rooms']; require_once "resources/header.php"; //javascript for toggle select box echo "\n"; //show the content echo "
\n"; echo "
".$text['title-conference_rooms']."
".number_format($num_rows)."
\n"; echo "
\n"; echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$settings->get('theme', 'button_icon_back'),'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'conference_centers.php']); if (permission_exists('conference_room_add')) { echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$settings->get('theme', 'button_icon_add'),'id'=>'btn_add','link'=>'conference_room_edit.php']); } if (permission_exists('conference_room_edit') && $result) { echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$settings->get('theme', 'button_icon_toggle'),'id'=>'btn_toggle','name'=>'btn_toggle','style'=>'display: none;','onclick'=>"toggle_select(); this.blur();"]); echo ""; } if (permission_exists('conference_room_delete') && $result) { echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$settings->get('theme', 'button_icon_delete'),'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none;','onclick'=>"modal_open('modal-delete','btn_delete');"]); } echo "\n"; echo "
\n"; echo "
\n"; echo "
\n"; if (permission_exists('conference_room_edit') && $result) { echo modal::create(['id'=>'modal-toggle','type'=>'toggle','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_toggle','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); document.getElementById('toggle_field').value = document.getElementById('conference_room_feature').options[document.getElementById('conference_room_feature').selectedIndex].value; list_action_set('toggle'); list_form_submit('form_list');"])]); } if (permission_exists('conference_room_delete') && $result) { echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]); } echo $text['title_description-conference_rooms']."\n"; echo "

\n"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo "\n"; echo "\n"; if (permission_exists('conference_room_add') || permission_exists('conference_room_edit') || permission_exists('conference_room_delete')) { echo " \n"; } //echo th_order_by('conference_center_uuid', 'Conference UUID', $order_by, $order); echo "\n"; echo "\n"; echo "\n"; //echo th_order_by('profile', $text['label-profile'], $order_by, $order); echo th_order_by('record', $text['label-record'], $order_by, $order, null, "class='center'"); //echo th_order_by('max_members', 'Max', $order_by, $order); echo th_order_by('wait_mod', $text['label-wait_moderator'], $order_by, $order, null, "class='center'"); echo th_order_by('announce', $text['label-announce_name'], $order_by, $order, null, "class='center'"); echo th_order_by('announce', $text['label-announce_count'], $order_by, $order, null, "class='center'"); echo th_order_by('announce', $text['label-announce_recording'], $order_by, $order, null, "class='center'"); //echo th_order_by('enter_sound', 'Enter Sound', $order_by, $order); echo th_order_by('mute', $text['label-mute'], $order_by, $order, null, "class='center'"); echo th_order_by('sounds', $text['label-sounds'], $order_by, $order, null, "class='center'"); echo "\n"; echo "\n"; if (permission_exists('conference_room_enabled')) { echo th_order_by('enabled', $text['label-enabled'], $order_by, $order, null, "class='center'"); } echo th_order_by('description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'"); if (permission_exists('conference_room_edit') && $list_row_edit_button) { echo " \n"; } echo "\n"; //show the data if (is_array($result) > 0) { $x = 0; foreach ($result as $row) { $conference_room_name = $row['conference_room_name']; $moderator_pin = $row['moderator_pin']; $participant_pin = $row['participant_pin']; if (strlen($moderator_pin) == 9) { $moderator_pin = substr($moderator_pin, 0, 3) ."-". substr($moderator_pin, 3, 3) ."-". substr($moderator_pin, -3)."\n"; } if (strlen($participant_pin) == 9) { $participant_pin = substr($participant_pin, 0, 3) ."-". substr($participant_pin, 3, 3) ."-". substr($participant_pin, -3)."\n"; } $list_row_url = ''; if (permission_exists('conference_room_edit')) { $list_row_url = "conference_room_edit.php?id=".urlencode($row['conference_room_uuid']); if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) { $list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true'; } } echo "\n"; if (permission_exists('conference_room_add') || permission_exists('conference_room_edit') || permission_exists('conference_room_delete')) { echo " \n"; } echo " \n"; echo " \n"; echo " \n"; //echo " \n"; //echo " \n"; if (permission_exists('conference_room_edit')) { echo " \n"; // echo " \n"; //echo " \n"; if (permission_exists('conference_room_edit')) { echo " \n"; // echo " \n"; if (permission_exists('conference_room_edit') && permission_exists('conference_room_announce_name')) { echo " \n"; if (permission_exists('conference_room_edit') && permission_exists('conference_room_announce_count')) { echo " \n"; if (permission_exists('conference_room_edit') && permission_exists('conference_room_announce_recording')) { echo " \n"; // echo " \n"; if (permission_exists('conference_room_edit')) { echo " \n"; // echo " \n"; if (permission_exists('conference_room_edit')) { echo " \n"; // echo " \n"; if (!empty($conference) && !empty($meeting_uuid) && strlen($conference[$meeting_uuid]["session_uuid"])) { echo " \n"; } else { echo " \n"; } echo " \n"; if (permission_exists('conference_room_enabled')) { if (permission_exists('conference_room_edit')) { echo " \n"; // echo " \n"; } echo " \n"; if (permission_exists('conference_room_edit') && $list_row_edit_button) { echo " \n"; } echo "\n"; $x++; } unset($result); } echo "
\n"; echo " \n"; echo " ".$text['label-name']."".$text['label-moderator-pin']."".$text['label-participant-pin']."".$text['label-members']."".$text['label-tools']." 
\n"; echo " \n"; echo " \n"; echo " ".escape($conference_room_name)." ".$moderator_pin."".$participant_pin."".escape($row['conference_center_uuid'])." ".escape($row['profile'])." \n"; echo $text['label-'.($row['record'] == "true" ? 'true' : 'false')]; } echo " "; // if ($row['record'] == "true") { // echo "".$text['label-true'].""; // } // else { // echo "".$text['label-false'].""; // } // echo " ".$row['max_members']." \n"; echo $text['label-'.($row['wait_mod'] == "true" ? 'true' : 'false')]; } echo " "; // if ($row['wait_mod'] == "true") { // echo "".$text['label-true'].""; // } // else { // echo "".$text['label-false'].""; // } // echo " \n"; echo $text['label-'.($row['announce_name'] == "true" ? 'true' : 'false')]; } echo " \n"; echo $text['label-'.($row['announce_count'] == "true" ? 'true' : 'false')]; } echo " \n"; echo $text['label-'.($row['announce_recording'] == "true" ? 'true' : 'false')]; } echo " "; // if ($row['announce'] == "true") { // echo "".$text['label-true'].""; // } // else { // echo "".$text['label-false'].""; // } // echo " \n"; echo $text['label-'.($row['mute'] == "true" ? 'true' : 'false')]; } echo " "; // if ($row['mute'] == "true") { // echo "".$text['label-true']." "; // } // else { // echo "".$text['label-false']." "; // } // echo " \n"; echo $text['label-'.($row['sounds'] == "true" ? 'true' : 'false')]; } echo " "; // if ($row['sounds'] == "true") { // echo "".$text['label-true'].""; // } // else { // echo "".$text['label-false'].""; // } // echo " ".escape($conference[$meeting_uuid]["member_count"])." 0\n"; echo $text['label-'.($row['enabled'] == "true" ? 'true' : 'false')]; } echo " "; // if ($row['enabled'] == "true") { // echo "".$text['label-true'].""; // } // else { // echo "".$text['label-false'].""; // } // echo " ".escape($row['description'])."\n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$settings->get('theme', 'button_icon_edit'),'link'=>$list_row_url]); echo "
\n"; echo "
\n"; echo "
\n"; echo "
".!empty($paging_controls)."
\n"; echo "\n"; echo "
\n"; //include the footer require_once "resources/footer.php"; ?>