2012-06-04 16:58:40 +02:00
< ? php
/*
FusionPBX
Version : MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 ( the " License " ); you may not use this file except in compliance with
the License . You may obtain a copy of the License at
http :// www . mozilla . org / MPL /
Software distributed under the License is distributed on an " AS IS " basis ,
WITHOUT WARRANTY OF ANY KIND , either express or implied . See the License
for the specific language governing rights and limitations under the
License .
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane < markjcrane @ fusionpbx . com >
2024-09-06 01:10:04 +02:00
Portions created by the Initial Developer are Copyright ( C ) 2010 - 2024
2012-06-04 16:58:40 +02:00
the Initial Developer . All Rights Reserved .
Contributor ( s ) :
Mark J Crane < markjcrane @ fusionpbx . com >
2012-11-24 08:43:34 +01:00
James Rose < james . o . rose @ gmail . com >
2014-12-21 20:33:54 +01:00
Luis Daniel Lucio Quiroz < dlucio @ okay . com . mx >
2012-06-04 16:58:40 +02:00
*/
2016-09-30 00:31:42 +02:00
2022-10-11 00:35:14 +02:00
//includes files
2023-06-15 19:28:23 +02:00
require_once dirname ( __DIR__ , 2 ) . " /resources/require.php " ;
2016-09-30 00:31:42 +02:00
require_once " resources/check_auth.php " ;
//check permissions
if ( permission_exists ( 'ring_group_add' ) || permission_exists ( 'ring_group_edit' )) {
//access granted
}
else {
echo " access denied " ;
exit ;
}
2012-06-04 16:58:40 +02:00
2024-08-06 21:19:45 +02:00
//connect to database
$database = database :: new ();
2024-11-14 00:23:43 +01:00
//create the settings object
2024-10-04 07:28:36 +02:00
$settings = new settings ([ 'database' => $database , 'domain_uuid' => $_SESSION [ 'domain_uuid' ] ? ? '' , 'user_uuid' => $_SESSION [ 'user_uuid' ] ? ? '' ]);
2024-08-06 21:19:45 +02:00
2012-11-24 08:43:34 +01:00
//add multi-lingual support
2015-01-18 11:06:08 +01:00
$language = new text ;
$text = $language -> get ();
2012-11-24 08:43:34 +01:00
2023-05-31 19:00:55 +02:00
//set the defaults
$ring_group_strategy = '' ;
$ring_group_name = '' ;
$ring_group_extension = '' ;
$ring_group_caller_id_name = '' ;
$ring_group_caller_id_number = '' ;
$ring_group_distinctive_ring = '' ;
$ring_group_missed_call_app = '' ;
$ring_group_missed_call_data = '' ;
$ring_group_forward_destination = '' ;
$ring_group_forward_toll_allow = '' ;
$ring_group_description = '' ;
2024-10-04 07:28:36 +02:00
$ring_group_ringback = $settings -> get ( 'ring_group' , 'default_ringback' , '' );
2023-06-02 22:37:30 +02:00
$onkeyup = '' ;
2023-05-31 19:00:55 +02:00
2020-02-07 20:03:09 +01:00
//initialize the destinations object
$destination = new destinations ;
2020-02-28 17:29:12 +01:00
//get total domain ring group count
$sql = " select count(*) from v_ring_groups " ;
$sql .= " where domain_uuid = :domain_uuid " ;
$parameters [ 'domain_uuid' ] = $domain_uuid ;
2023-05-31 19:00:55 +02:00
$total_ring_groups = $database -> select ( $sql , $parameters ? ? null , 'column' );
2020-02-28 17:29:12 +01:00
unset ( $sql , $parameters );
2024-12-17 02:48:44 +01:00
//get the domain_uuid
$domain_uuid = $_SESSION [ 'domain_uuid' ];
$domain_name = $_SESSION [ 'domain_name' ];
2019-10-26 03:21:54 +02:00
//action add or update
2023-05-31 19:00:55 +02:00
if ( ! empty ( $_REQUEST [ " id " ]) || ! empty ( $_REQUEST [ " ring_group_uuid " ])) {
2019-10-26 03:21:54 +02:00
$action = " update " ;
//get the ring_group_uuid
$ring_group_uuid = $_REQUEST [ " id " ];
2023-06-02 22:37:30 +02:00
if ( ! empty ( $_REQUEST [ " ring_group_uuid " ])) {
2019-10-26 03:21:54 +02:00
$ring_group_uuid = $_REQUEST [ " ring_group_uuid " ];
}
//get the domain_uuid
2019-10-28 18:17:46 +01:00
if ( is_uuid ( $ring_group_uuid ) && permission_exists ( 'ring_group_all' )) {
2024-12-17 02:48:44 +01:00
$sql = " select r.domain_uuid, d.domain_name " ;
$sql .= " from v_ring_groups as r, v_domains as d " ;
2019-10-26 03:21:54 +02:00
$sql .= " where ring_group_uuid = :ring_group_uuid " ;
2024-12-17 02:48:44 +01:00
$sql .= " and r.domain_uuid = d.domain_uuid " ;
2019-10-26 03:21:54 +02:00
$parameters [ 'ring_group_uuid' ] = $ring_group_uuid ;
2024-12-17 02:48:44 +01:00
$row = $database -> select ( $sql , $parameters , 'row' );
$domain_uuid = $row [ 'domain_uuid' ];
$domain_name = $row [ 'domain_name' ];
2019-10-26 03:21:54 +02:00
unset ( $sql , $parameters );
}
}
else {
$action = " add " ;
}
2019-08-13 12:48:28 +02:00
//delete the user from the ring group
2024-03-30 15:41:39 +01:00
if (( ! empty ( $_GET [ " a " ])) == " delete "
2019-08-13 12:48:28 +02:00
&& is_uuid ( $_REQUEST [ " user_uuid " ])
2024-03-30 15:41:39 +01:00
&& permission_exists ( " ring_group_edit " )) {
//set the variables
2019-08-13 12:48:28 +02:00
$user_uuid = $_REQUEST [ " user_uuid " ];
2024-03-30 15:41:39 +01:00
//build array
2019-08-13 12:48:28 +02:00
$array [ 'ring_group_users' ][ 0 ][ 'domain_uuid' ] = $domain_uuid ;
$array [ 'ring_group_users' ][ 0 ][ 'ring_group_uuid' ] = $ring_group_uuid ;
$array [ 'ring_group_users' ][ 0 ][ 'user_uuid' ] = $user_uuid ;
2024-03-30 15:41:39 +01:00
//grant temporary permissions
2024-11-29 21:57:01 +01:00
$p = permissions :: new ();
2019-08-13 12:48:28 +02:00
$p -> add ( 'ring_group_user_delete' , 'temp' );
2024-03-30 15:41:39 +01:00
//execute delete
2019-08-13 12:48:28 +02:00
$database -> app_name = 'ring_groups' ;
$database -> app_uuid = '1d61fb65-1eec-bc73-a6ee-a6203b4fe6f2' ;
$database -> delete ( $array );
unset ( $array );
2024-03-30 15:41:39 +01:00
//revoke temporary permissions
2019-08-13 12:48:28 +02:00
$p -> delete ( 'ring_group_user_delete' , 'temp' );
2024-03-30 15:41:39 +01:00
//save the message to a session variable
2018-08-31 05:09:01 +02:00
message :: add ( $text [ 'message-delete' ]);
2024-03-30 15:41:39 +01:00
//redirect the browser
2014-02-20 08:20:55 +01:00
header ( " Location: ring_group_edit.php?id= $ring_group_uuid " );
exit ;
2012-06-04 16:58:40 +02:00
}
2015-03-22 09:17:04 +01:00
//get total ring group count from the database, check limit, if defined
2024-12-17 02:48:44 +01:00
if ( $action == 'add' && $settings -> get ( 'limit' , 'ring_groups' , '' ) ? ? '' ) {
2024-03-30 15:41:39 +01:00
$sql = " select count(*) from v_ring_groups " ;
$sql .= " where domain_uuid = :domain_uuid " ;
$parameters [ 'domain_uuid' ] = $domain_uuid ;
$total_ring_groups = $database -> select ( $sql , $parameters , 'column' );
unset ( $sql , $parameters );
2019-08-13 12:48:28 +02:00
2024-12-17 02:48:44 +01:00
if ( is_numeric ( $settings -> get ( 'limit' , 'ring_groups' , '' )) && $total_ring_groups >= $settings -> get ( 'limit' , 'ring_groups' , '' )) {
message :: add ( $text [ 'message-maximum_ring_groups' ] . ' ' . $settings -> get ( 'limit' , 'ring_groups' , '' ), 'negative' );
2024-03-30 15:41:39 +01:00
header ( 'Location: ring_groups.php' );
exit ;
2015-03-22 09:17:04 +01:00
}
}
2012-06-04 16:58:40 +02:00
//get http post variables and set them to php variables
2013-05-28 19:53:21 +02:00
if ( count ( $_POST ) > 0 ) {
2020-02-28 17:29:12 +01:00
//process the http post data by submitted action
2023-06-08 22:46:57 +02:00
if ( ! empty ( $_POST [ 'action' ]) && is_uuid ( $ring_group_uuid )) {
2020-02-28 17:29:12 +01:00
$array [ 0 ][ 'checked' ] = 'true' ;
$array [ 0 ][ 'uuid' ] = $ring_group_uuid ;
switch ( $_POST [ 'action' ]) {
case 'copy' :
if ( permission_exists ( 'ring_group_add' )) {
$obj = new ring_groups ;
$obj -> copy ( $array );
}
break ;
case 'delete' :
if ( permission_exists ( 'ring_group_delete' )) {
$obj = new ring_groups ;
$obj -> delete ( $array );
}
break ;
}
header ( 'Location: ring_groups.php' );
exit ;
}
2012-09-15 18:35:08 +02:00
//set variables from http values
2019-08-13 12:48:28 +02:00
$ring_group_name = $_POST [ " ring_group_name " ];
$ring_group_extension = $_POST [ " ring_group_extension " ];
$ring_group_greeting = $_POST [ " ring_group_greeting " ];
$ring_group_strategy = $_POST [ " ring_group_strategy " ];
2020-02-28 17:29:12 +01:00
$ring_group_destinations = $_POST [ " ring_group_destinations " ];
2019-08-13 12:48:28 +02:00
$ring_group_timeout_action = $_POST [ " ring_group_timeout_action " ];
$ring_group_call_timeout = $_POST [ " ring_group_call_timeout " ];
$ring_group_caller_id_name = $_POST [ " ring_group_caller_id_name " ];
$ring_group_caller_id_number = $_POST [ " ring_group_caller_id_number " ];
2023-06-08 22:46:57 +02:00
$ring_group_cid_name_prefix = $_POST [ " ring_group_cid_name_prefix " ] ? ? null ;
$ring_group_cid_number_prefix = $_POST [ " ring_group_cid_number_prefix " ] ? ? null ;
2019-08-13 12:48:28 +02:00
$ring_group_distinctive_ring = $_POST [ " ring_group_distinctive_ring " ];
$ring_group_ringback = $_POST [ " ring_group_ringback " ];
2024-09-16 00:47:53 +02:00
$ring_group_call_screen_enabled = $_POST [ " ring_group_call_screen_enabled " ];
2020-04-11 06:35:08 +02:00
$ring_group_call_forward_enabled = $_POST [ " ring_group_call_forward_enabled " ];
2019-10-02 21:12:04 +02:00
$ring_group_follow_me_enabled = $_POST [ " ring_group_follow_me_enabled " ];
2019-08-13 12:48:28 +02:00
$ring_group_missed_call_app = $_POST [ " ring_group_missed_call_app " ];
$ring_group_missed_call_data = $_POST [ " ring_group_missed_call_data " ];
$ring_group_forward_enabled = $_POST [ " ring_group_forward_enabled " ];
$ring_group_forward_destination = $_POST [ " ring_group_forward_destination " ];
$ring_group_forward_toll_allow = $_POST [ " ring_group_forward_toll_allow " ];
2023-06-07 00:05:05 +02:00
$ring_group_enabled = $_POST [ " ring_group_enabled " ] ? ? 'false' ;
2019-08-13 12:48:28 +02:00
$ring_group_description = $_POST [ " ring_group_description " ];
2023-06-08 22:46:57 +02:00
$dialplan_uuid = $_POST [ " dialplan_uuid " ] ? ? null ;
2012-09-15 18:35:08 +02:00
//$ring_group_timeout_action = "transfer:1001 XML default";
$ring_group_timeout_array = explode ( " : " , $ring_group_timeout_action );
$ring_group_timeout_app = array_shift ( $ring_group_timeout_array );
$ring_group_timeout_data = join ( ':' , $ring_group_timeout_array );
2023-06-08 22:46:57 +02:00
$destination_number = $_POST [ " destination_number " ] ? ? null ;
2024-02-05 18:57:12 +01:00
$destination_description = $_POST [ " destination_description " ] ? ? null ;
2023-06-08 22:46:57 +02:00
$destination_delay = $_POST [ " destination_delay " ] ? ? null ;
$destination_timeout = $_POST [ " destination_timeout " ] ? ? null ;
$destination_prompt = $_POST [ " destination_prompt " ] ? ? null ;
$ring_group_destinations_delete = $_POST [ " ring_group_destinations_delete " ] ? ? null ;
2012-09-15 18:35:08 +02:00
2019-08-07 03:50:44 +02:00
//set the context for users that do not have the permission
if ( permission_exists ( 'ring_group_context' )) {
$ring_group_context = $_POST [ " ring_group_context " ];
}
2019-08-13 12:48:28 +02:00
else if ( $action == 'add' ) {
2024-12-17 02:48:44 +01:00
$ring_group_context = $domain_name ;
2012-09-15 18:35:08 +02:00
}
2023-02-10 17:58:03 +01:00
2024-03-30 15:41:39 +01:00
//if the user doesn't have the correct permission then
//override domain_uuid and ring_group_context values
if ( $action == 'update' && is_uuid ( $ring_group_uuid )) {
$sql = " select * from v_ring_groups " ;
$sql .= " where ring_group_uuid = :ring_group_uuid " ;
$parameters [ 'ring_group_uuid' ] = $ring_group_uuid ;
$row = $database -> select ( $sql , $parameters , 'row' );
if ( ! empty ( $row )) {
//if (!permission_exists(‘ ring_group_domain')) {
// $domain_uuid = $row["domain_uuid"];
//}
if ( ! permission_exists ( 'ring_group_context' )) {
$ring_group_context = $row [ " ring_group_context " ];
}
}
unset ( $sql , $parameters , $row );
}
2012-06-04 16:58:40 +02:00
}
2019-08-13 12:48:28 +02:00
//assign the user to the ring group
2023-05-31 19:00:55 +02:00
if ( ! empty ( $_REQUEST [ " user_uuid " ]) && is_uuid ( $_REQUEST [ " id " ]) && $_GET [ " a " ] != " delete " && permission_exists ( " ring_group_edit " )) {
2013-08-16 06:50:30 +02:00
//set the variables
2024-03-30 15:41:39 +01:00
$user_uuid = $_REQUEST [ " user_uuid " ];
2019-08-13 12:48:28 +02:00
//build array
2024-03-30 15:41:39 +01:00
$array [ 'ring_group_users' ][ 0 ][ 'ring_group_user_uuid' ] = uuid ();
$array [ 'ring_group_users' ][ 0 ][ 'domain_uuid' ] = $domain_uuid ;
$array [ 'ring_group_users' ][ 0 ][ 'ring_group_uuid' ] = $ring_group_uuid ;
$array [ 'ring_group_users' ][ 0 ][ 'user_uuid' ] = $user_uuid ;
2019-08-13 12:48:28 +02:00
//grant temporary permissions
2024-11-29 21:57:01 +01:00
$p = permissions :: new ();
2024-03-30 15:41:39 +01:00
$p -> add ( 'ring_group_user_add' , 'temp' );
2019-08-13 12:48:28 +02:00
//execute delete
2024-03-30 15:41:39 +01:00
$database -> app_name = 'ring_groups' ;
$database -> app_uuid = '1d61fb65-1eec-bc73-a6ee-a6203b4fe6f2' ;
$database -> save ( $array );
unset ( $array );
2019-08-13 12:48:28 +02:00
//revoke temporary permissions
2024-03-30 15:41:39 +01:00
$p -> delete ( 'ring_group_user_add' , 'temp' );
2019-08-13 12:48:28 +02:00
//set message
2024-03-30 15:41:39 +01:00
message :: add ( $text [ 'message-add' ]);
2013-08-16 06:50:30 +02:00
//redirect the browser
2024-03-30 15:41:39 +01:00
header ( " Location: ring_group_edit.php?id= " . urlencode ( $ring_group_uuid ));
exit ;
2013-08-16 06:50:30 +02:00
}
//process the HTTP POST
2023-05-05 18:46:37 +02:00
if ( count ( $_POST ) > 0 && empty ( $_POST [ " persistformvar " ])) {
2013-08-16 06:50:30 +02:00
2019-09-19 15:34:03 +02:00
//validate the token
$token = new token ;
if ( ! $token -> validate ( $_SERVER [ 'PHP_SELF' ])) {
message :: add ( $text [ 'message-invalid_token' ], 'negative' );
header ( 'Location: ring_groups.php' );
exit ;
}
2013-08-16 06:50:30 +02:00
//check for all required data
2014-02-20 08:20:55 +01:00
$msg = '' ;
2023-05-05 18:46:37 +02:00
if ( empty ( $ring_group_name )) { $msg .= $text [ 'message-name' ] . " <br> \n " ; }
if ( empty ( $ring_group_extension )) { $msg .= $text [ 'message-extension' ] . " <br> \n " ; }
//if (empty($ring_group_greeting)) { $msg .= $text['message-greeting']."<br>\n"; }
if ( empty ( $ring_group_strategy )) { $msg .= $text [ 'message-strategy' ] . " <br> \n " ; }
if ( empty ( $ring_group_call_timeout )) { $msg .= $text [ 'message-call_timeout' ] . " <br> \n " ; }
//if (empty($ring_group_timeout_app)) { $msg .= $text['message-timeout_action']."<br>\n"; }
//if (empty($ring_group_cid_name_prefix)) { $msg .= "Please provide: Caller ID Name Prefix<br>\n"; }
//if (empty($ring_group_cid_number_prefix)) { $msg .= "Please provide: Caller ID Number Prefix<br>\n"; }
//if (empty($ring_group_ringback)) { $msg .= "Please provide: Ringback<br>\n"; }
//if (empty($ring_group_description)) { $msg .= "Please provide: Description<br>\n"; }
if ( ! empty ( $msg ) && empty ( $_POST [ " persistformvar " ])) {
2013-08-16 06:50:30 +02:00
require_once " resources/header.php " ;
require_once " resources/persist_form_var.php " ;
echo " <div align='center'> \n " ;
echo " <table><tr><td> \n " ;
echo $msg . " <br /> " ;
echo " </td></tr></table> \n " ;
persistformvar ( $_POST );
echo " </div> \n " ;
require_once " resources/footer.php " ;
return ;
2012-06-04 16:58:40 +02:00
}
2020-02-28 17:29:12 +01:00
//prep missed call values for db insert/update
switch ( $ring_group_missed_call_app ) {
case 'email' :
$ring_group_missed_call_data = str_replace ( ';' , ',' , $ring_group_missed_call_data );
$ring_group_missed_call_data = str_replace ( ' ' , '' , $ring_group_missed_call_data );
if ( substr_count ( $ring_group_missed_call_data , ',' ) > 0 ) {
$ring_group_missed_call_data_array = explode ( ',' , $ring_group_missed_call_data );
foreach ( $ring_group_missed_call_data_array as $array_index => $email_address ) {
if ( ! valid_email ( $email_address )) { unset ( $ring_group_missed_call_data_array [ $array_index ]); }
}
if ( sizeof ( $ring_group_missed_call_data_array ) > 0 ) {
$ring_group_missed_call_data = implode ( ',' , $ring_group_missed_call_data_array );
}
else {
unset ( $ring_group_missed_call_app , $ring_group_missed_call_data );
}
}
else {
if ( ! valid_email ( $ring_group_missed_call_data )) {
unset ( $ring_group_missed_call_app , $ring_group_missed_call_data );
}
2015-06-19 18:33:05 +02:00
}
2020-02-28 17:29:12 +01:00
break ;
case 'text' :
$ring_group_missed_call_data = str_replace ( '-' , '' , $ring_group_missed_call_data );
$ring_group_missed_call_data = str_replace ( '.' , '' , $ring_group_missed_call_data );
$ring_group_missed_call_data = str_replace ( '(' , '' , $ring_group_missed_call_data );
$ring_group_missed_call_data = str_replace ( ')' , '' , $ring_group_missed_call_data );
$ring_group_missed_call_data = str_replace ( ' ' , '' , $ring_group_missed_call_data );
if ( ! is_numeric ( $ring_group_missed_call_data )) { unset ( $ring_group_missed_call_app , $ring_group_missed_call_data ); }
break ;
2020-04-13 18:06:06 +02:00
default :
unset ( $ring_group_missed_call_app , $ring_group_missed_call_data );
2020-02-28 17:29:12 +01:00
}
2015-06-19 18:33:05 +02:00
2020-02-28 17:29:12 +01:00
//set the app and data
$ring_group_timeout_array = explode ( " : " , $ring_group_timeout_action );
$ring_group_timeout_app = array_shift ( $ring_group_timeout_array );
$ring_group_timeout_data = join ( ':' , $ring_group_timeout_array );
2014-02-20 08:20:55 +01:00
2020-02-28 17:29:12 +01:00
//add a uuid to ring_group_uuid if it is empty
if ( $action == 'add' ) {
$ring_group_uuid = uuid ();
}
2019-10-28 18:17:46 +01:00
2020-02-28 17:29:12 +01:00
//add the dialplan_uuid
2023-06-08 22:46:57 +02:00
if ( empty ( $_POST [ " dialplan_uuid " ]) || ! is_uuid ( $_POST [ " dialplan_uuid " ])) {
2020-02-28 17:29:12 +01:00
$dialplan_uuid = uuid ();
}
2013-08-15 21:16:03 +02:00
2020-02-28 17:29:12 +01:00
//build the array
$array [ " ring_groups " ][ 0 ][ " ring_group_uuid " ] = $ring_group_uuid ;
$array [ " ring_groups " ][ 0 ][ " domain_uuid " ] = $domain_uuid ;
$array [ 'ring_groups' ][ 0 ][ " ring_group_name " ] = $ring_group_name ;
$array [ 'ring_groups' ][ 0 ][ " ring_group_extension " ] = $ring_group_extension ;
$array [ 'ring_groups' ][ 0 ][ " ring_group_greeting " ] = $ring_group_greeting ;
$array [ 'ring_groups' ][ 0 ][ " ring_group_strategy " ] = $ring_group_strategy ;
$array [ " ring_groups " ][ 0 ][ " ring_group_call_timeout " ] = $ring_group_call_timeout ;
2020-12-03 03:00:55 +01:00
if ( permission_exists ( 'ring_group_caller_id_name' )) {
$array [ " ring_groups " ][ 0 ][ " ring_group_caller_id_name " ] = $ring_group_caller_id_name ;
}
if ( permission_exists ( 'ring_group_caller_id_number' )) {
$array [ " ring_groups " ][ 0 ][ " ring_group_caller_id_number " ] = $ring_group_caller_id_number ;
}
2020-02-28 17:29:12 +01:00
if ( permission_exists ( 'ring_group_cid_name_prefix' )) {
$array [ " ring_groups " ][ 0 ][ " ring_group_cid_name_prefix " ] = $ring_group_cid_name_prefix ;
}
if ( permission_exists ( 'ring_group_cid_number_prefix' )) {
$array [ " ring_groups " ][ 0 ][ " ring_group_cid_number_prefix " ] = $ring_group_cid_number_prefix ;
}
$array [ " ring_groups " ][ 0 ][ " ring_group_distinctive_ring " ] = $ring_group_distinctive_ring ;
$array [ " ring_groups " ][ 0 ][ " ring_group_ringback " ] = $ring_group_ringback ;
2024-10-29 22:52:40 +01:00
if ( permission_exists ( 'ring_group_call_screen_enabled' )) {
$array [ " ring_groups " ][ 0 ][ " ring_group_call_screen_enabled " ] = $ring_group_call_screen_enabled ;
}
2020-04-11 06:35:08 +02:00
$array [ " ring_groups " ][ 0 ][ " ring_group_call_forward_enabled " ] = $ring_group_call_forward_enabled ;
2020-02-28 17:29:12 +01:00
$array [ " ring_groups " ][ 0 ][ " ring_group_follow_me_enabled " ] = $ring_group_follow_me_enabled ;
2020-04-13 18:06:06 +02:00
if ( permission_exists ( 'ring_group_missed_call' )) {
2023-06-08 22:46:57 +02:00
$array [ " ring_groups " ][ 0 ][ " ring_group_missed_call_app " ] = $ring_group_missed_call_app ? ? null ;
$array [ " ring_groups " ][ 0 ][ " ring_group_missed_call_data " ] = $ring_group_missed_call_data ? ? null ;
2020-02-28 17:29:12 +01:00
}
2020-05-06 19:34:08 +02:00
if ( permission_exists ( 'ring_group_forward' )) {
$array [ " ring_groups " ][ 0 ][ " ring_group_forward_enabled " ] = $ring_group_forward_enabled ;
$array [ " ring_groups " ][ 0 ][ " ring_group_forward_destination " ] = $ring_group_forward_destination ;
}
2020-02-28 17:29:12 +01:00
$array [ " ring_groups " ][ 0 ][ " ring_group_forward_toll_allow " ] = $ring_group_forward_toll_allow ;
if ( isset ( $ring_group_context )) {
$array [ " ring_groups " ][ 0 ][ " ring_group_context " ] = $ring_group_context ;
}
$array [ " ring_groups " ][ 0 ][ " ring_group_enabled " ] = $ring_group_enabled ;
$array [ " ring_groups " ][ 0 ][ " ring_group_description " ] = $ring_group_description ;
$array [ " ring_groups " ][ 0 ][ " dialplan_uuid " ] = $dialplan_uuid ;
if ( $destination -> valid ( $ring_group_timeout_app . ':' . $ring_group_timeout_data )) {
$array [ " ring_groups " ][ 0 ][ " ring_group_timeout_app " ] = $ring_group_timeout_app ;
$array [ " ring_groups " ][ 0 ][ " ring_group_timeout_data " ] = $ring_group_timeout_data ;
}
2017-04-14 10:23:48 +02:00
2020-02-28 17:29:12 +01:00
$y = 0 ;
foreach ( $ring_group_destinations as $row ) {
2023-06-08 22:46:57 +02:00
if ( ! empty ( $row [ 'ring_group_destination_uuid' ]) && is_uuid ( $row [ 'ring_group_destination_uuid' ])) {
2020-02-28 17:29:12 +01:00
$ring_group_destination_uuid = $row [ 'ring_group_destination_uuid' ];
}
else {
$ring_group_destination_uuid = uuid ();
}
2024-12-17 02:48:44 +01:00
if ( ! empty ( $row [ 'destination_number' ]) && $settings -> get ( 'ring_group' , 'destination_range_enabled' , false )) {
2023-11-14 02:50:25 +01:00
// check the range
$output_array = array ();
preg_match ( '/[0-9]{1,}-[0-9]{1,}/' , $row [ 'destination_number' ], $output_array );
}
2023-11-15 06:00:02 +01:00
if ( is_uuid ( $ring_group_uuid ) && ! empty ( $output_array )) {
2023-11-14 02:50:25 +01:00
$ranges = explode ( '-' , $row [ 'destination_number' ]);
$range_first_extension = $ranges [ 0 ];
$range_second_extension = $ranges [ 1 ];
if ( $range_first_extension <= $range_second_extension ) {
// select range extension for ring group destintaions
$sql = " select DISTINCT ext.extension, ext.extension_uuid from v_extensions as ext " ;
$sql .= " where ext.domain_uuid = :domain_uuid " ;
$sql .= " and CAST(coalesce(ext.extension, '0') AS integer) >= :range_first_extension and CAST(coalesce(ext.extension, '0') AS integer) <= :range_second_extension " ;
$sql .= " and ext.extension NOT IN " ;
$sql .= " (select DISTINCT asd.destination_number as exten from v_ring_group_destinations as asd " ;
$sql .= " where asd.ring_group_uuid = :ring_group_uuid " ;
$sql .= " and asd.domain_uuid = :domain_uuid) " ;
$sql .= " order by ext.extension asc " ;
$parameters [ 'domain_uuid' ] = $domain_uuid ;
$parameters [ 'ring_group_uuid' ] = $ring_group_uuid ;
$parameters [ 'range_first_extension' ] = $range_first_extension ;
$parameters [ 'range_second_extension' ] = $range_second_extension ;
$extensions = $database -> select ( $sql , $parameters , 'all' );
2024-08-06 21:19:45 +02:00
unset ( $sql , $parameters );
2023-11-14 02:50:25 +01:00
// echo var_dump($extensions);
foreach ( $extensions as $extension ) {
$array [ " ring_groups " ][ 0 ][ " ring_group_destinations " ][ $y ][ " ring_group_uuid " ] = $ring_group_uuid ;
$array [ 'ring_groups' ][ 0 ][ " ring_group_destinations " ][ $y ][ " ring_group_destination_uuid " ] = uuid ();
$array [ 'ring_groups' ][ 0 ][ " ring_group_destinations " ][ $y ][ " destination_number " ] = $extension [ 'extension' ];
2024-02-05 18:57:12 +01:00
$array [ 'ring_groups' ][ 0 ][ " ring_group_destinations " ][ $y ][ " destination_description " ] = $row [ 'destination_description' ];
2023-11-14 02:50:25 +01:00
$array [ 'ring_groups' ][ 0 ][ " ring_group_destinations " ][ $y ][ " destination_delay " ] = $row [ 'destination_delay' ];
$array [ 'ring_groups' ][ 0 ][ " ring_group_destinations " ][ $y ][ " destination_timeout " ] = $row [ 'destination_timeout' ];
$array [ 'ring_groups' ][ 0 ][ " ring_group_destinations " ][ $y ][ " destination_prompt " ] = $row [ 'destination_prompt' ];
$array [ 'ring_groups' ][ 0 ][ " ring_group_destinations " ][ $y ][ " destination_enabled " ] = $row [ 'destination_enabled' ] ? ? 'false' ;
$array [ 'ring_groups' ][ 0 ][ " ring_group_destinations " ][ $y ][ " domain_uuid " ] = $domain_uuid ;
$y ++ ;
}
}
} elseif ( ! empty ( $row [ 'destination_number' ]) > 0 ) {
2020-02-28 17:29:12 +01:00
$array [ " ring_groups " ][ 0 ][ " ring_group_destinations " ][ $y ][ " ring_group_uuid " ] = $ring_group_uuid ;
$array [ 'ring_groups' ][ 0 ][ " ring_group_destinations " ][ $y ][ " ring_group_destination_uuid " ] = $ring_group_destination_uuid ;
$array [ 'ring_groups' ][ 0 ][ " ring_group_destinations " ][ $y ][ " destination_number " ] = $row [ 'destination_number' ];
2024-02-05 18:57:12 +01:00
$array [ 'ring_groups' ][ 0 ][ " ring_group_destinations " ][ $y ][ " destination_description " ] = $row [ 'destination_description' ];
2020-02-28 17:29:12 +01:00
$array [ 'ring_groups' ][ 0 ][ " ring_group_destinations " ][ $y ][ " destination_delay " ] = $row [ 'destination_delay' ];
$array [ 'ring_groups' ][ 0 ][ " ring_group_destinations " ][ $y ][ " destination_timeout " ] = $row [ 'destination_timeout' ];
2023-01-21 02:30:34 +01:00
$array [ 'ring_groups' ][ 0 ][ " ring_group_destinations " ][ $y ][ " destination_prompt " ] = $row [ 'destination_prompt' ];
2023-06-07 00:05:05 +02:00
$array [ 'ring_groups' ][ 0 ][ " ring_group_destinations " ][ $y ][ " destination_enabled " ] = $row [ 'destination_enabled' ] ? ? 'false' ;
2020-02-28 17:29:12 +01:00
$array [ 'ring_groups' ][ 0 ][ " ring_group_destinations " ][ $y ][ " domain_uuid " ] = $domain_uuid ;
}
$y ++ ;
2023-11-14 02:50:25 +01:00
unset ( $output_array , $range_first_extension , $range_second_extension );
2020-02-28 17:29:12 +01:00
}
2014-02-20 08:20:55 +01:00
2020-02-28 17:29:12 +01:00
//build the xml dialplan
2023-03-30 20:46:36 +02:00
$dialplan_xml = " <extension name= \" " . xml :: sanitize ( $ring_group_name ) . " \" continue= \" \" uuid= \" " . xml :: sanitize ( $dialplan_uuid ) . " \" > \n " ;
$dialplan_xml .= " <condition field= \" destination_number \" expression= \" ^ " . xml :: sanitize ( $ring_group_extension ) . " $\ " > \n " ;
2025-03-22 23:06:18 +01:00
if ( $settings -> get ( 'ring_group' , 'ring_ready' , true )) {
$dialplan_xml .= " <action application= \" ring_ready \" data= \" \" /> \n " ;
}
2023-03-30 20:46:36 +02:00
$dialplan_xml .= " <action application= \" set \" data= \" ring_group_uuid= " . xml :: sanitize ( $ring_group_uuid ) . " \" /> \n " ;
2020-02-28 17:29:12 +01:00
$dialplan_xml .= " <action application= \" lua \" data= \" app.lua ring_groups \" /> \n " ;
$dialplan_xml .= " </condition> \n " ;
$dialplan_xml .= " </extension> \n " ;
//build the dialplan array
$array [ " dialplans " ][ 0 ][ " domain_uuid " ] = $domain_uuid ;
$array [ " dialplans " ][ 0 ][ " dialplan_uuid " ] = $dialplan_uuid ;
$array [ " dialplans " ][ 0 ][ " dialplan_name " ] = $ring_group_name ;
$array [ " dialplans " ][ 0 ][ " dialplan_number " ] = $ring_group_extension ;
if ( isset ( $ring_group_context )) {
$array [ " dialplans " ][ 0 ][ " dialplan_context " ] = $ring_group_context ;
}
$array [ " dialplans " ][ 0 ][ " dialplan_continue " ] = " false " ;
$array [ " dialplans " ][ 0 ][ " dialplan_xml " ] = $dialplan_xml ;
$array [ " dialplans " ][ 0 ][ " dialplan_order " ] = " 101 " ;
$array [ " dialplans " ][ 0 ][ " dialplan_enabled " ] = $ring_group_enabled ;
$array [ " dialplans " ][ 0 ][ " dialplan_description " ] = $ring_group_description ;
$array [ " dialplans " ][ 0 ][ " app_uuid " ] = " 1d61fb65-1eec-bc73-a6ee-a6203b4fe6f2 " ;
//add the dialplan permission
2024-11-29 21:57:01 +01:00
$p = permissions :: new ();
2020-02-28 17:29:12 +01:00
$p -> add ( " dialplan_add " , " temp " );
$p -> add ( " dialplan_edit " , " temp " );
//save to the data
$database -> app_name = 'ring_groups' ;
$database -> app_uuid = '1d61fb65-1eec-bc73-a6ee-a6203b4fe6f2' ;
$database -> save ( $array );
$message = $database -> message ;
//remove the temporary permission
$p -> delete ( " dialplan_add " , " temp " );
$p -> delete ( " dialplan_edit " , " temp " );
//remove checked destinations
if (
$action == 'update'
&& permission_exists ( 'ring_group_destination_delete' )
&& is_array ( $ring_group_destinations_delete )
&& @ sizeof ( $ring_group_destinations_delete ) != 0
) {
$obj = new ring_groups ;
$obj -> ring_group_uuid = $ring_group_uuid ;
$obj -> delete_destinations ( $ring_group_destinations_delete );
2014-02-23 08:48:21 +01:00
}
2014-02-20 08:20:55 +01:00
//apply settings reminder
$_SESSION [ " reload_xml " ] = true ;
2015-01-16 01:21:02 +01:00
//clear the cache
$cache = new cache ;
$cache -> delete ( " dialplan: " . $ring_group_context );
2014-02-20 08:20:55 +01:00
2020-11-30 22:15:57 +01:00
//clear the destinations session array
if ( isset ( $_SESSION [ 'destinations' ][ 'array' ])) {
unset ( $_SESSION [ 'destinations' ][ 'array' ]);
}
2014-02-20 08:20:55 +01:00
//set the message
if ( $action == " add " ) {
//save the message to a session variable
2018-08-31 05:09:01 +02:00
message :: add ( $text [ 'message-add' ]);
2014-02-20 08:20:55 +01:00
}
if ( $action == " update " ) {
//save the message to a session variable
2018-08-31 05:09:01 +02:00
message :: add ( $text [ 'message-update' ]);
2014-02-20 08:20:55 +01:00
}
2020-05-06 19:34:08 +02:00
//redirect the browser
header ( " Location: ring_group_edit.php?id= " . urlencode ( $ring_group_uuid ));
exit ;
2019-08-13 12:48:28 +02:00
}
2012-06-04 16:58:40 +02:00
//pre-populate the form
2023-05-31 19:00:55 +02:00
if ( ! empty ( $ring_group_uuid )) {
2012-06-04 16:58:40 +02:00
$sql = " select * from v_ring_groups " ;
2019-10-26 03:21:54 +02:00
$sql .= " where ring_group_uuid = :ring_group_uuid " ;
2019-08-07 03:50:44 +02:00
$parameters [ 'ring_group_uuid' ] = $ring_group_uuid ;
2019-08-13 12:48:28 +02:00
$row = $database -> select ( $sql , $parameters , 'row' );
if ( is_array ( $row ) && @ sizeof ( $row ) != 0 ) {
2019-10-26 03:21:54 +02:00
$domain_uuid = $row [ " domain_uuid " ];
2012-06-04 16:58:40 +02:00
$ring_group_name = $row [ " ring_group_name " ];
$ring_group_extension = $row [ " ring_group_extension " ];
2018-02-10 21:16:23 +01:00
$ring_group_greeting = $row [ " ring_group_greeting " ];
2012-06-04 16:58:40 +02:00
$ring_group_context = $row [ " ring_group_context " ];
$ring_group_strategy = $row [ " ring_group_strategy " ];
$ring_group_timeout_app = $row [ " ring_group_timeout_app " ];
$ring_group_timeout_data = $row [ " ring_group_timeout_data " ];
2018-05-08 03:46:28 +02:00
$ring_group_call_timeout = $row [ " ring_group_call_timeout " ];
2018-04-05 22:53:36 +02:00
$ring_group_caller_id_name = $row [ " ring_group_caller_id_name " ];
$ring_group_caller_id_number = $row [ " ring_group_caller_id_number " ];
2012-07-31 06:56:18 +02:00
$ring_group_cid_name_prefix = $row [ " ring_group_cid_name_prefix " ];
2014-09-06 09:43:51 +02:00
$ring_group_cid_number_prefix = $row [ " ring_group_cid_number_prefix " ];
2015-06-04 07:26:12 +02:00
$ring_group_distinctive_ring = $row [ " ring_group_distinctive_ring " ];
2012-10-22 22:09:37 +02:00
$ring_group_ringback = $row [ " ring_group_ringback " ];
2024-09-16 00:47:53 +02:00
$ring_group_call_screen_enabled = $row [ " ring_group_call_screen_enabled " ];
2020-04-11 06:35:08 +02:00
$ring_group_call_forward_enabled = $row [ " ring_group_call_forward_enabled " ];
2019-10-02 21:12:04 +02:00
$ring_group_follow_me_enabled = $row [ " ring_group_follow_me_enabled " ];
2015-06-19 18:33:05 +02:00
$ring_group_missed_call_app = $row [ " ring_group_missed_call_app " ];
$ring_group_missed_call_data = $row [ " ring_group_missed_call_data " ];
2016-03-29 22:15:01 +02:00
$ring_group_forward_enabled = $row [ " ring_group_forward_enabled " ];
$ring_group_forward_destination = $row [ " ring_group_forward_destination " ];
2017-04-19 22:12:14 +02:00
$ring_group_forward_toll_allow = $row [ " ring_group_forward_toll_allow " ];
2012-06-04 16:58:40 +02:00
$ring_group_enabled = $row [ " ring_group_enabled " ];
$ring_group_description = $row [ " ring_group_description " ];
$dialplan_uuid = $row [ " dialplan_uuid " ];
}
2019-08-13 12:48:28 +02:00
unset ( $sql , $parameters , $row );
2023-05-05 18:46:37 +02:00
if ( ! empty ( $ring_group_timeout_app )) {
2012-06-04 16:58:40 +02:00
$ring_group_timeout_action = $ring_group_timeout_app . " : " . $ring_group_timeout_data ;
}
2016-06-19 17:35:21 +02:00
}
2023-02-17 22:21:41 +01:00
//set the defaults
2024-12-17 02:48:44 +01:00
$destination_delay_max = $settings -> get ( 'ring_group' , 'destination_delay_max' , '' );
$destination_timeout_max = $settings -> get ( 'ring_group' , 'destination_timeout_max' , '' );;
2023-05-05 18:46:37 +02:00
if ( empty ( $ring_group_call_timeout )) {
2020-06-15 21:38:53 +02:00
$ring_group_call_timeout = '30' ;
}
2023-05-05 18:46:37 +02:00
if ( empty ( $ring_group_enabled )) { $ring_group_enabled = 'true' ; }
2012-06-04 16:58:40 +02:00
2014-02-20 08:20:55 +01:00
//get the ring group destination array
2019-08-13 12:48:28 +02:00
if ( $action == " add " ) {
$x = 0 ;
$limit = 5 ;
}
2023-05-31 19:00:55 +02:00
if ( ! empty ( $ring_group_uuid )) {
2016-03-29 22:15:01 +02:00
$sql = " select * from v_ring_group_destinations " ;
2019-08-13 12:48:28 +02:00
$sql .= " where domain_uuid = :domain_uuid " ;
$sql .= " and ring_group_uuid = :ring_group_uuid " ;
2014-02-20 08:20:55 +01:00
$sql .= " order by destination_delay, destination_number asc " ;
2019-10-26 03:21:54 +02:00
$parameters [ 'domain_uuid' ] = $domain_uuid ;
2019-08-13 12:48:28 +02:00
$parameters [ 'ring_group_uuid' ] = $ring_group_uuid ;
$ring_group_destinations = $database -> select ( $sql , $parameters , 'all' );
unset ( $sql , $parameters );
2014-02-20 08:20:55 +01:00
}
2017-01-12 11:19:38 +01:00
//add an empty row to the options array
2023-05-31 19:00:55 +02:00
if ( ! isset ( $ring_group_destinations ) || count ( $ring_group_destinations ) == 0 ) {
2024-12-17 02:48:44 +01:00
$rows = $settings -> get ( 'ring_group' , 'destination_add_rows' , 5 );
2017-01-12 11:19:38 +01:00
$id = 0 ;
2020-02-28 17:29:12 +01:00
$show_destination_delete = false ;
2017-01-12 11:19:38 +01:00
}
2023-05-31 19:00:55 +02:00
if ( isset ( $ring_group_destinations ) && count ( $ring_group_destinations ) > 0 ) {
2024-12-17 02:48:44 +01:00
$rows = $settings -> get ( 'ring_group' , 'destination_edit_rows' , 1 );
2017-01-12 11:19:38 +01:00
$id = count ( $ring_group_destinations ) + 1 ;
2020-02-28 17:29:12 +01:00
$show_destination_delete = true ;
2017-01-12 11:19:38 +01:00
}
for ( $x = 0 ; $x < $rows ; $x ++ ) {
$ring_group_destinations [ $id ][ 'destination_number' ] = '' ;
$ring_group_destinations [ $id ][ 'destination_delay' ] = '' ;
$ring_group_destinations [ $id ][ 'destination_timeout' ] = '' ;
$ring_group_destinations [ $id ][ 'destination_prompt' ] = '' ;
$id ++ ;
2014-02-20 08:20:55 +01:00
}
//get the ring group users
2023-05-31 19:00:55 +02:00
if ( ! empty ( $ring_group_uuid )) {
2019-08-13 12:48:28 +02:00
$sql = " select u.username, r.user_uuid, r.ring_group_uuid " ;
$sql .= " from v_ring_group_users as r, v_users as u " ;
2014-02-20 08:20:55 +01:00
$sql .= " where r.user_uuid = u.user_uuid " ;
$sql .= " and u.user_enabled = 'true' " ;
2019-08-13 12:48:28 +02:00
$sql .= " and r.domain_uuid = :domain_uuid " ;
$sql .= " and r.ring_group_uuid = :ring_group_uuid " ;
2014-02-20 08:20:55 +01:00
$sql .= " order by u.username asc " ;
2019-10-26 03:21:54 +02:00
$parameters [ 'domain_uuid' ] = $domain_uuid ;
2019-08-13 12:48:28 +02:00
$parameters [ 'ring_group_uuid' ] = $ring_group_uuid ;
$ring_group_users = $database -> select ( $sql , $parameters , 'all' );
unset ( $sql , $parameters );
2014-02-20 08:20:55 +01:00
}
2016-09-30 00:31:42 +02:00
//get the users
2019-08-13 12:48:28 +02:00
$sql = " select * from v_users " ;
$sql .= " where domain_uuid = :domain_uuid " ;
2016-09-30 00:31:42 +02:00
$sql .= " and user_enabled = 'true' " ;
$sql .= " order by username asc " ;
2019-10-26 03:21:54 +02:00
$parameters [ 'domain_uuid' ] = $domain_uuid ;
2019-08-13 12:48:28 +02:00
$users = $database -> select ( $sql , $parameters , 'all' );
unset ( $sql , $parameters );
2016-09-30 00:31:42 +02:00
2012-06-04 16:58:40 +02:00
//set defaults
2023-05-05 18:46:37 +02:00
if ( empty ( $ring_group_enabled )) { $ring_group_enabled = 'true' ; }
2012-09-15 18:23:23 +02:00
2018-11-14 07:25:14 +01:00
//set the default ring group context
2023-05-05 18:46:37 +02:00
if ( empty ( $ring_group_context )) {
2024-12-17 02:48:44 +01:00
$ring_group_context = $domain_name ;
2012-06-04 16:58:40 +02:00
}
2016-09-30 00:31:42 +02:00
//get the ring backs
$ringbacks = new ringbacks ;
$ringbacks = $ringbacks -> select ( 'ring_group_ringback' , $ring_group_ringback );
2018-02-10 21:16:23 +01:00
//get the sounds
$sounds = new sounds ;
2023-11-06 20:43:35 +01:00
$audio_files = $sounds -> get ();
2018-02-10 21:16:23 +01:00
2019-09-19 15:34:03 +02:00
//create token
$object = new token ;
$token = $object -> create ( $_SERVER [ 'PHP_SELF' ]);
2012-06-04 16:58:40 +02:00
//show the header
2020-01-06 19:55:40 +01:00
$document [ 'title' ] = $text [ 'title-ring_group' ];
2013-07-06 08:29:50 +02:00
require_once " resources/header.php " ;
2012-06-04 16:58:40 +02:00
2023-11-03 21:33:02 +01:00
//show the content
if ( permission_exists ( 'recording_play' ) || permission_exists ( 'recording_download' )) {
echo " <script type='text/javascript' language='JavaScript'> \n " ;
2023-11-06 20:43:35 +01:00
echo " function set_playable(id, audio_selected, audio_type) { \n " ;
echo " file_ext = audio_selected.split('.').pop(); \n " ;
echo " var mime_type = ''; \n " ;
2023-11-03 21:33:02 +01:00
echo " switch (file_ext) { \n " ;
2023-11-06 20:43:35 +01:00
echo " case 'wav': mime_type = 'audio/wav'; break; \n " ;
echo " case 'mp3': mime_type = 'audio/mpeg'; break; \n " ;
echo " case 'ogg': mime_type = 'audio/ogg'; break; \n " ;
2023-11-03 21:33:02 +01:00
echo " } \n " ;
2023-11-06 20:43:35 +01:00
echo " if (mime_type != '' && (audio_type == 'recordings' || audio_type == 'sounds')) { \n " ;
echo " if (audio_type == 'recordings') { \n " ;
echo " $ ('#recording_audio_' + id).attr('src', '../recordings/recordings.php?action=download&type=rec&filename=' + audio_selected); \n " ;
2023-11-03 21:33:02 +01:00
echo " } \n " ;
2023-11-06 20:43:35 +01:00
echo " else if (audio_type == 'sounds') { \n " ;
echo " $ ('#recording_audio_' + id).attr('src', '../switch/sounds.php?action=download&filename=' + audio_selected); \n " ;
2023-11-03 21:33:02 +01:00
echo " } \n " ;
2023-11-06 20:43:35 +01:00
echo " $ ('#recording_audio_' + id).attr('type', mime_type); \n " ;
2023-11-03 21:33:02 +01:00
echo " $ ('#recording_button_' + id).show(); \n " ;
echo " } \n " ;
echo " else { \n " ;
echo " $ ('#recording_button_' + id).hide(); \n " ;
echo " $ ('#recording_audio_' + id).attr('src','').attr('type',''); \n " ;
echo " } \n " ;
echo " } \n " ;
2018-02-10 21:16:23 +01:00
echo " </script> \n " ;
}
2023-11-06 20:43:35 +01:00
if ( if_group ( " superadmin " )) {
echo " <script type='text/javascript' language='JavaScript'> \n " ;
echo " var objs; \n " ;
echo " function toggle_select_input(obj, instance_id) { \n " ;
echo " tb=document.createElement('INPUT'); \n " ;
echo " tb.type='text'; \n " ;
echo " tb.name=obj.name; \n " ;
echo " tb.className='formfld'; \n " ;
echo " tb.setAttribute('id', instance_id); \n " ;
echo " tb.setAttribute('style', 'width: ' + obj.offsetWidth + 'px;'); \n " ;
if ( ! empty ( $on_change )) {
echo " tb.setAttribute('onchange', \" " . $on_change . " \" ); \n " ;
echo " tb.setAttribute('onkeyup', \" " . $on_change . " \" ); \n " ;
}
echo " tb.value=obj.options[obj.selectedIndex].value; \n " ;
echo " document.getElementById('btn_select_to_input_' + instance_id).style.display = 'none'; \n " ;
echo " tbb=document.createElement('INPUT'); \n " ;
echo " tbb.setAttribute('class', 'btn'); \n " ;
echo " tbb.setAttribute('style', 'margin-left: 4px;'); \n " ;
echo " tbb.type='button'; \n " ;
echo " tbb.value= $ ('<div />').html('◁').text(); \n " ;
echo " tbb.objs=[obj,tb,tbb]; \n " ;
echo " tbb.onclick=function() { replace_element(this.objs, instance_id); } \n " ;
echo " obj.parentNode.insertBefore(tb,obj); \n " ;
echo " obj.parentNode.insertBefore(tbb,obj); \n " ;
echo " obj.parentNode.removeChild(obj); \n " ;
echo " replace_element(this.objs, instance_id); \n " ;
echo " } \n " ;
echo " function replace_element(obj, instance_id) { \n " ;
echo " obj[2].parentNode.insertBefore(obj[0],obj[2]); \n " ;
echo " obj[0].parentNode.removeChild(obj[1]); \n " ;
echo " obj[0].parentNode.removeChild(obj[2]); \n " ;
echo " document.getElementById('btn_select_to_input_' + instance_id).style.display = 'inline'; \n " ;
if ( ! empty ( $on_change )) {
echo " " . $on_change . " ; \n " ;
}
echo " } \n " ;
echo " </script> \n " ;
}
2018-02-10 21:16:23 +01:00
2020-03-05 08:05:45 +01:00
echo " <form method='post' name='frm' id='frm'> \n " ;
2020-02-06 04:18:32 +01:00
echo " <div class='action_bar' id='action_bar'> \n " ;
echo " <div class='heading'><b> " . $text [ 'title-ring_group' ] . " </b></div> \n " ;
echo " <div class='actions'> \n " ;
2020-03-05 08:05:45 +01:00
echo button :: create ([ 'type' => 'button' , 'label' => $text [ 'button-back' ], 'icon' => $_SESSION [ 'theme' ][ 'button_icon_back' ], 'id' => 'btn_back' , 'link' => 'ring_groups.php' ]);
2020-02-28 17:29:12 +01:00
if ( $action == 'update' ) {
$button_margin = 'margin-left: 15px;' ;
2024-12-17 02:48:44 +01:00
if ( permission_exists ( 'ring_group_add' ) && ( empty ( $settings -> get ( 'limit' , 'ring_groups' , '' )) || ( $total_ring_groups < $settings -> get ( 'limit' , 'ring_groups' , '' )))) {
2020-03-26 21:12:07 +01:00
echo button :: create ([ 'type' => 'button' , 'label' => $text [ 'button-copy' ], 'icon' => $_SESSION [ 'theme' ][ 'button_icon_copy' ], 'name' => 'btn_copy' , 'style' => $button_margin , 'onclick' => " modal_open('modal-copy','btn_copy'); " ]);
2020-02-28 17:29:12 +01:00
unset ( $button_margin );
}
if ( permission_exists ( 'ring_group_delete' ) || permission_exists ( 'ring_group_destination_delete' )) {
2023-06-02 22:37:30 +02:00
echo button :: create ([ 'type' => 'button' , 'label' => $text [ 'button-delete' ], 'icon' => $_SESSION [ 'theme' ][ 'button_icon_delete' ], 'name' => 'btn_delete' , 'style' => $button_margin ? ? '' , 'onclick' => " modal_open('modal-delete','btn_delete'); " ]);
2020-02-28 17:29:12 +01:00
unset ( $button_margin );
}
}
2020-03-05 08:05:45 +01:00
echo button :: create ([ 'type' => 'submit' , 'label' => $text [ 'button-save' ], 'icon' => $_SESSION [ 'theme' ][ 'button_icon_save' ], 'id' => 'btn_save' , 'style' => 'margin-left: 15px;' ]);
2020-02-06 04:18:32 +01:00
echo " </div> \n " ;
echo " <div style='clear: both;'></div> \n " ;
echo " </div> \n " ;
2020-03-26 21:12:07 +01:00
if ( $action == " update " ) {
2024-12-17 02:48:44 +01:00
if ( permission_exists ( 'ring_group_add' ) && ( empty ( $settings -> get ( 'limit' , 'ring_groups' , '' )) || ( $total_ring_groups < $settings -> get ( 'limit' , 'ring_groups' , '' )))) {
2020-03-26 21:12:07 +01:00
echo modal :: create ([ 'id' => 'modal-copy' , 'type' => 'copy' , 'actions' => button :: create ([ 'type' => 'submit' , 'label' => $text [ 'button-continue' ], 'icon' => 'check' , 'id' => 'btn_copy' , 'style' => 'float: right; margin-left: 15px;' , 'collapse' => 'never' , 'name' => 'action' , 'value' => 'copy' , 'onclick' => " modal_close(); " ])]);
}
if ( permission_exists ( 'ring_group_delete' ) || permission_exists ( 'ring_group_destination_delete' )) {
echo modal :: create ([ 'id' => 'modal-delete' , 'type' => 'delete' , 'actions' => button :: create ([ 'type' => 'submit' , 'label' => $text [ 'button-continue' ], 'icon' => 'check' , 'id' => 'btn_delete' , 'style' => 'float: right; margin-left: 15px;' , 'collapse' => 'never' , 'name' => 'action' , 'value' => 'delete' , 'onclick' => " modal_close(); " ])]);
}
}
2020-02-06 04:18:32 +01:00
echo $text [ 'description' ] . " \n " ;
echo " <br /><br /> \n " ;
2024-09-06 01:10:04 +02:00
echo " <div class='card'> \n " ;
2015-02-15 08:59:02 +01:00
echo " <table width='100%' border='0' cellpadding='0' cellspacing='0'> \n " ;
2012-06-04 16:58:40 +02:00
echo " <tr> \n " ;
echo " <td class='vncellreq' valign='top' align='left' nowrap='nowrap'> \n " ;
2015-02-15 07:50:00 +01:00
echo " " . $text [ 'label-name' ] . " \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2018-06-09 19:56:07 +02:00
echo " <input class='formfld' type='text' name='ring_group_name' maxlength='255' value= \" " . escape ( $ring_group_name ) . " \" required='required'> \n " ;
2012-06-04 16:58:40 +02:00
echo " <br /> \n " ;
2012-11-24 08:43:34 +01:00
echo $text [ 'description-name' ] . " \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " </tr> \n " ;
echo " <tr> \n " ;
echo " <td class='vncellreq' valign='top' align='left' nowrap='nowrap'> \n " ;
2015-02-15 07:50:00 +01:00
echo " " . $text [ 'label-extension' ] . " \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2024-12-17 02:48:44 +01:00
echo " <input class='formfld' type='text' name='ring_group_extension' maxlength='255' value= \" " . escape ( $ring_group_extension ) . " \" required='required' placeholder= \" " . ( $settings -> get ( 'ring_group' , 'extension_range' , '' ) ? ? '' ) . " \" > \n " ;
2012-06-04 16:58:40 +02:00
echo " <br /> \n " ;
2012-11-24 08:43:34 +01:00
echo $text [ 'description-extension' ] . " \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " </tr> \n " ;
2023-11-06 20:43:35 +01:00
$instance_id = 'ring_group_greeting' ;
$instance_label = 'greeting' ;
$instance_value = $ring_group_greeting ;
2018-02-10 21:16:23 +01:00
echo " <tr> \n " ;
2023-11-03 21:33:02 +01:00
echo " <td class='vncell' rowspan='2' valign='top' align='left' nowrap='nowrap'> \n " ;
2023-11-06 20:43:35 +01:00
echo " " . $text [ 'label-' . $instance_label ] . " \n " ;
2018-02-10 21:16:23 +01:00
echo " </td> \n " ;
2024-02-09 21:12:14 +01:00
echo " <td class='vtable playback_progress_bar_background' id='recording_progress_bar_ " . $instance_id . " ' onclick= \" recording_play(' " . $instance_id . " ', document.getElementById(' " . $instance_id . " ').value, document.getElementById(' " . $instance_id . " ').options[document.getElementById(' " . $instance_id . " ').selectedIndex].parentNode.getAttribute('data-type')); \" style='display: none; border-bottom: none; padding-top: 0 !important; padding-bottom: 0 !important;' align='left'><span class='playback_progress_bar' id='recording_progress_ " . $instance_id . " '></span></td> \n " ;
2023-11-03 21:33:02 +01:00
echo " </tr> \n " ;
echo " <tr> \n " ;
2018-02-10 21:16:23 +01:00
echo " <td class='vtable' align='left'> \n " ;
2023-11-06 20:43:35 +01:00
echo " <select name=' " . $instance_id . " ' id=' " . $instance_id . " ' class='formfld' " . ( permission_exists ( 'recording_play' ) || permission_exists ( 'recording_download' ) ? " onchange= \" recording_reset(' " . $instance_id . " '); set_playable(' " . $instance_id . " ', this.value, this.options[this.selectedIndex].parentNode.getAttribute('data-type')); \" " : null ) . " > \n " ;
2018-02-10 21:16:23 +01:00
echo " <option value=''></option> \n " ;
2023-11-06 20:43:35 +01:00
$found = $playable = false ;
if ( ! empty ( $audio_files ) && is_array ( $audio_files ) && @ sizeof ( $audio_files ) != 0 ) {
foreach ( $audio_files as $key => $value ) {
2023-11-04 02:05:01 +01:00
echo " <optgroup label= " . $text [ 'label-' . $key ] . " data-type=' " . $key . " '> \n " ;
foreach ( $value as $row ) {
2023-11-07 03:22:33 +01:00
if ( $key == 'recordings' ) {
if (
! empty ( $instance_value ) &&
2024-12-17 02:48:44 +01:00
( $instance_value == $row [ " value " ] || $instance_value == $settings -> get ( 'switch' , 'recordings' , '' ) . " / " . $domain_name . '/' . $row [ " value " ]) &&
file_exists ( $settings -> get ( 'switch' , 'recordings' , '' ) . " / " . $domain_name . '/' . pathinfo ( $row [ " value " ], PATHINFO_BASENAME ))
2023-11-07 03:22:33 +01:00
) {
$selected = " selected='selected' " ;
$playable = '../recordings/recordings.php?action=download&type=rec&filename=' . pathinfo ( $row [ " value " ], PATHINFO_BASENAME );
$found = true ;
2023-11-04 02:05:01 +01:00
}
2023-11-07 03:22:33 +01:00
else {
unset ( $selected );
}
}
else if ( $key == 'sounds' ) {
if ( ! empty ( $instance_value ) && $instance_value == $row [ " value " ]) {
$selected = " selected='selected' " ;
2023-11-06 20:43:35 +01:00
$playable = '../switch/sounds.php?action=download&filename=' . $row [ " value " ];
2023-11-07 03:22:33 +01:00
$found = true ;
}
else {
unset ( $selected );
2023-11-04 02:05:01 +01:00
}
2023-11-03 21:33:02 +01:00
}
2024-12-23 20:22:44 +01:00
else if ( $key == 'phrases' ) {
if ( ! empty ( $instance_value ) && $instance_value == $row [ " value " ]) {
$selected = " selected='selected' " ;
$playable = '' ;
$found = true ;
}
else {
unset ( $selected );
}
}
2023-11-03 21:33:02 +01:00
else {
2023-11-04 02:05:01 +01:00
unset ( $selected );
2023-11-03 21:33:02 +01:00
}
2023-11-04 02:05:01 +01:00
echo " <option value=' " . escape ( $row [ " value " ]) . " ' " . ( $selected ? ? '' ) . " > " . escape ( $row [ " name " ]) . " </option> \n " ;
2018-02-10 21:16:23 +01:00
}
2023-11-04 02:05:01 +01:00
echo " </optgroup> \n " ;
2018-02-10 21:16:23 +01:00
}
}
2023-11-06 20:43:35 +01:00
if ( if_group ( " superadmin " ) && ! empty ( $instance_value ) && ! $found ) {
echo " <option value=' " . escape ( $instance_value ) . " ' selected='selected'> " . escape ( $instance_value ) . " </option> \n " ;
2023-11-03 21:33:02 +01:00
}
unset ( $selected );
echo " </select> \n " ;
2018-02-10 21:16:23 +01:00
if ( if_group ( " superadmin " )) {
2023-11-06 20:43:35 +01:00
echo " <input type='button' id='btn_select_to_input_ " . $instance_id . " ' class='btn' name='' alt='back' onclick='toggle_select_input(document.getElementById( \" " . $instance_id . " \" ), \" " . $instance_id . " \" ); this.style.visibility= \" hidden \" ;' value='◁'> " ;
2023-11-03 21:33:02 +01:00
}
2023-11-07 03:22:33 +01:00
if (( permission_exists ( 'recording_play' ) || permission_exists ( 'recording_download' )) && ( ! empty ( $playable ) || empty ( $instance_value ))) {
2023-11-06 20:43:35 +01:00
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 ;
2018-02-10 21:16:23 +01:00
}
2023-11-06 20:51:56 +01:00
echo " <audio id='recording_audio_ " . $instance_id . " ' style='display: none;' preload='none' ontimeupdate= \" update_progress(' " . $instance_id . " ') \" onended= \" recording_reset(' " . $instance_id . " '); \" src=' " . ( $playable ? ? '' ) . " ' type=' " . ( $mime_type ? ? '' ) . " '></audio> " ;
2024-02-09 21:12:14 +01:00
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 . " ', document.getElementById(' " . $instance_id . " ').value, document.getElementById(' " . $instance_id . " ').options[document.getElementById(' " . $instance_id . " ').selectedIndex].parentNode.getAttribute('data-type')) " ]);
2023-11-06 20:51:56 +01:00
unset ( $playable , $mime_type );
2018-02-10 21:16:23 +01:00
}
echo " <br /> \n " ;
2023-11-06 20:43:35 +01:00
echo $text [ 'description-' . $instance_label ] . " \n " ;
2018-02-10 21:16:23 +01:00
echo " </td> \n " ;
echo " </tr> \n " ;
2012-06-04 16:58:40 +02:00
echo " <tr> \n " ;
echo " <td class='vncellreq' valign='top' align='left' nowrap='nowrap'> \n " ;
2015-02-15 07:50:00 +01:00
echo " " . $text [ 'label-strategy' ] . " \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2014-10-31 06:12:21 +01:00
echo " <select class='formfld' name='ring_group_strategy' onchange= \" getElementById('destination_delayorder').innerHTML = (this.selectedIndex == 1 || this.selectedIndex == 3) ? ' " . $text [ 'label-destination_order' ] . " ' : ' " . $text [ 'label-destination_delay' ] . " '; \" > \n " ;
2020-03-04 03:59:41 +01:00
echo " <option value='enterprise' " . (( $ring_group_strategy == " enterprise " ) ? " selected='selected' " : null ) . " > " . $text [ 'option-enterprise' ] . " </option> \n " ;
2023-06-08 19:10:12 +02:00
echo " <option value='sequence' " . (( $ring_group_strategy == " sequence " ) ? " selected='selected' " : null ) . " > " . $text [ 'option-sequence' ] . " </option> \n " ;
echo " <option value='simultaneous' " . (( $ring_group_strategy == " simultaneous " ) ? " selected='selected' " : null ) . " > " . $text [ 'option-simultaneous' ] . " </option> \n " ;
2020-03-04 03:59:41 +01:00
echo " <option value='random' " . (( $ring_group_strategy == " random " ) ? " selected='selected' " : null ) . " > " . $text [ 'option-random' ] . " </option> \n " ;
2023-06-08 19:10:12 +02:00
echo " <option value='rollover' " . (( $ring_group_strategy == " rollover " ) ? " selected='selected' " : null ) . " > " . $text [ 'option-rollover' ] . " </option> \n " ;
2012-06-04 16:58:40 +02:00
echo " </select> \n " ;
echo " <br /> \n " ;
2013-05-19 01:43:11 +02:00
echo $text [ 'description-strategy' ] . " \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " </tr> \n " ;
2013-02-12 03:49:49 +01:00
2013-07-24 21:37:59 +02:00
echo " <tr> " ;
2015-02-15 07:50:00 +01:00
echo " <td class='vncellreq' valign='top'> " . $text [ 'label-destinations' ] . " </td> " ;
2013-07-24 21:37:59 +02:00
echo " <td class='vtable' align='left'> " ;
2014-02-20 08:20:55 +01:00
2020-03-04 03:59:41 +01:00
echo " <table border='0' cellpadding='0' cellspacing='0'> \n " ;
2013-08-16 01:30:35 +02:00
echo " <tr> \n " ;
echo " <td class='vtable'> " . $text [ 'label-destination_number' ] . " </td> \n " ;
2024-03-30 15:41:39 +01:00
2014-10-31 06:06:46 +01:00
echo " <td class='vtable' id='destination_delayorder'> " ;
2014-10-31 06:12:21 +01:00
echo ( $ring_group_strategy == 'sequence' || $ring_group_strategy == 'rollover' ) ? $text [ 'label-destination_order' ] : $text [ 'label-destination_delay' ];
2014-10-31 06:06:46 +01:00
echo " </td> \n " ;
2013-08-16 01:30:35 +02:00
echo " <td class='vtable'> " . $text [ 'label-destination_timeout' ] . " </td> \n " ;
2013-08-16 06:50:30 +02:00
if ( permission_exists ( 'ring_group_prompt' )) {
2014-06-25 02:09:30 +02:00
echo " <td class='vtable'> " . $text [ 'label-destination_prompt' ] . " </td> \n " ;
2013-08-16 06:50:30 +02:00
}
2024-03-02 23:31:03 +01:00
echo " <td class='vtable'> " . $text [ 'label-destination_description' ] . " </td> \n " ;
2023-01-21 02:30:34 +01:00
echo " <td class='vtable'> " . $text [ 'label-destination_enabled' ] . " </td> \n " ;
2020-02-28 17:29:12 +01:00
if ( $show_destination_delete && permission_exists ( 'ring_group_destination_delete' )) {
echo " <td class='vtable edit_delete_checkbox_all' onmouseover= \" swap_display('delete_label_destinations', 'delete_toggle_destinations'); \" onmouseout= \" swap_display('delete_label_destinations', 'delete_toggle_destinations'); \" > \n " ;
echo " <span id='delete_label_destinations'> " . $text [ 'label-delete' ] . " </span> \n " ;
echo " <span id='delete_toggle_destinations'><input type='checkbox' id='checkbox_all_destinations' name='checkbox_all' onclick= \" edit_all_toggle('destinations'); \" ></span> \n " ;
echo " </td> \n " ;
}
2013-08-16 01:30:35 +02:00
echo " </tr> \n " ;
2014-02-20 08:20:55 +01:00
$x = 0 ;
2019-08-13 12:48:28 +02:00
foreach ( $ring_group_destinations as $row ) {
2024-02-05 18:57:12 +01:00
if ( empty ( $row [ 'destination_description' ])) { $row [ 'destination_description' ] = " " ; }
2023-05-05 18:46:37 +02:00
if ( empty ( $row [ 'destination_delay' ])) { $row [ 'destination_delay' ] = " 0 " ; }
if ( empty ( $row [ 'destination_timeout' ])) { $row [ 'destination_timeout' ] = " 30 " ; }
2014-02-20 08:20:55 +01:00
2023-06-02 22:37:30 +02:00
if ( ! empty ( $row [ 'ring_group_destination_uuid' ]) && is_uuid ( $row [ 'ring_group_destination_uuid' ])) {
2018-06-09 19:56:07 +02:00
echo " <input name='ring_group_destinations[ " . $x . " ][ring_group_destination_uuid]' type='hidden' value= \" " . escape ( $row [ 'ring_group_destination_uuid' ]) . " \" > \n " ;
2023-01-21 02:30:34 +01:00
}
2014-02-20 08:20:55 +01:00
2014-06-25 02:09:30 +02:00
echo " <tr> \n " ;
2020-03-04 03:59:41 +01:00
echo " <td class='formfld'> \n " ;
2023-05-31 19:00:55 +02:00
if ( ! isset ( $row [ 'ring_group_destination_uuid' ])) { // new record
2024-12-17 02:48:44 +01:00
if ( substr ( $settings -> get ( 'theme' , 'input_toggle_style' , '' ), 0 , 6 ) == 'switch' ) {
2023-01-21 02:30:34 +01:00
$onkeyup = " onkeyup= \" document.getElementById('ring_group_destinations_ " . $x . " _destination_enabled').checked = (this.value != '' ? true : false); \" " ; // switch
}
else {
$onkeyup = " onkeyup= \" document.getElementById('ring_group_destinations_ " . $x . " _destination_enabled').value = (this.value != '' ? true : false); \" " ; // select
}
}
echo " <input type= \" text \" name= \" ring_group_destinations[ " . $x . " ][destination_number] \" class= \" formfld \" value= \" " . escape ( $row [ 'destination_number' ]) . " \" " . $onkeyup . " > \n " ;
2014-06-25 02:09:30 +02:00
echo " </td> \n " ;
2020-03-04 03:59:41 +01:00
echo " <td class='formfld'> \n " ;
2014-06-25 02:09:30 +02:00
echo " <select name='ring_group_destinations[ " . $x . " ][destination_delay]' class='formfld' style='width:55px'> \n " ;
2014-02-20 08:20:55 +01:00
$i = 0 ;
2022-01-31 23:25:50 +01:00
while ( $i <= $destination_delay_max ) {
2014-02-20 08:20:55 +01:00
if ( $i == $row [ 'destination_delay' ]) {
2014-06-25 02:09:30 +02:00
echo " <option value=' $i ' selected='selected'> $i </option> \n " ;
2013-07-24 21:37:59 +02:00
}
2014-02-20 08:20:55 +01:00
else {
2014-06-25 02:09:30 +02:00
echo " <option value=' $i '> $i </option> \n " ;
2014-02-20 08:20:55 +01:00
}
$i = $i + 5 ;
2013-07-24 21:37:59 +02:00
}
2014-06-25 02:09:30 +02:00
echo " </select> \n " ;
echo " </td> \n " ;
2020-03-04 03:59:41 +01:00
echo " <td class='formfld'> \n " ;
2014-06-25 02:09:30 +02:00
echo " <select name='ring_group_destinations[ " . $x . " ][destination_timeout]' class='formfld' style='width:55px'> \n " ;
2022-01-31 23:25:50 +01:00
2019-08-13 12:48:28 +02:00
$i = 5 ;
2022-01-31 23:25:50 +01:00
while ( $i <= $destination_timeout_max ) {
2014-02-20 08:20:55 +01:00
if ( $i == $row [ 'destination_timeout' ]) {
2014-06-25 02:09:30 +02:00
echo " <option value=' $i ' selected='selected'> $i </option> \n " ;
2014-02-20 08:20:55 +01:00
}
else {
2014-06-25 02:09:30 +02:00
echo " <option value=' $i '> $i </option> \n " ;
2014-02-20 08:20:55 +01:00
}
$i = $i + 5 ;
}
2014-06-25 02:09:30 +02:00
echo " </select> \n " ;
echo " </td> \n " ;
2014-02-20 08:20:55 +01:00
if ( permission_exists ( 'ring_group_prompt' )) {
2020-03-04 03:59:41 +01:00
echo " <td class='formfld'> \n " ;
2014-06-25 02:09:30 +02:00
echo " <select class='formfld' style='width: 90px;' name='ring_group_destinations[ " . $x . " ][destination_prompt]'> \n " ;
echo " <option value=''></option> \n " ;
2014-08-14 03:21:55 +02:00
echo " <option value='1' " . (( $row [ 'destination_prompt' ]) ? " selected='selected' " : null ) . " > " . $text [ 'label-destination_prompt_confirm' ] . " </option> \n " ;
2014-06-25 02:09:30 +02:00
//echo " <option value='2'>".$text['label-destination_prompt_announce]."</option>\n";
echo " </select> \n " ;
echo " </td> \n " ;
2014-02-20 08:20:55 +01:00
}
2023-01-21 02:30:34 +01:00
echo " <td class='formfld'> \n " ;
2024-03-02 23:31:03 +01:00
echo " <input type= \" text \" name= \" ring_group_destinations[ " . $x . " ][destination_description] \" class= \" formfld \" value= \" " . escape ( $row [ 'destination_description' ]) . " \" > \n " ;
echo " </td> \n " ;
echo " <td class='formfld'> \n " ;
2023-01-21 02:30:34 +01:00
// switch
2024-12-17 02:48:44 +01:00
if ( substr ( $settings -> get ( 'theme' , 'input_toggle_style' , '' ), 0 , 6 ) == 'switch' ) {
2023-01-21 02:30:34 +01:00
echo " <label class='switch'> \n " ;
2023-05-31 19:00:55 +02:00
echo " <input type='checkbox' id='ring_group_destinations_ " . $x . " _destination_enabled' name='ring_group_destinations[ " . $x . " ][destination_enabled]' value='true' " . ( ! empty ( $row [ 'destination_enabled' ]) && $row [ 'destination_enabled' ] == 'true' ? " checked='checked' " : null ) . " > \n " ;
2023-01-21 02:30:34 +01:00
echo " <span class='slider'></span> \n " ;
echo " </label> \n " ;
}
// select
else {
echo " <select class='formfld' id='ring_group_destinations_ " . $x . " _destination_enabled' name='ring_group_destinations[ " . $x . " ][destination_enabled]'> \n " ;
echo " <option value='false'> " . $text [ 'option-false' ] . " </option> \n " ;
echo " <option value='true' " . ( $row [ 'destination_enabled' ] == 'true' ? " selected='selected' " : null ) . " > " . $text [ 'option-true' ] . " </option> \n " ;
echo " </select> \n " ;
}
echo " </td> \n " ;
2020-02-28 17:29:12 +01:00
if ( $show_destination_delete && permission_exists ( 'ring_group_destination_delete' )) {
2023-06-02 22:37:30 +02:00
if ( ! empty ( $row [ 'ring_group_destination_uuid' ]) && is_uuid ( $row [ 'ring_group_destination_uuid' ])) {
2020-03-04 03:59:41 +01:00
echo " <td class='vtable' style='text-align: center; padding-bottom: 3px;'> " ;
2020-02-28 17:29:12 +01:00
echo " <input type='checkbox' name='ring_group_destinations_delete[ " . $x . " ][checked]' value='true' class='chk_delete checkbox_destinations' onclick= \" edit_delete_action('destinations'); \" > \n " ;
echo " <input type='hidden' name='ring_group_destinations_delete[ " . $x . " ][uuid]' value=' " . escape ( $row [ 'ring_group_destination_uuid' ]) . " ' /> \n " ;
}
2020-03-04 03:59:41 +01:00
else {
echo " <td> \n " ;
}
2020-02-28 17:29:12 +01:00
echo " </td> \n " ;
2014-02-20 08:20:55 +01:00
}
2014-06-25 02:09:30 +02:00
echo " </tr> \n " ;
2014-02-20 08:20:55 +01:00
$x ++ ;
2013-08-16 06:50:30 +02:00
}
2013-08-16 01:30:35 +02:00
echo " </table> \n " ;
2013-07-24 21:37:59 +02:00
echo " " . $text [ 'description-destinations' ] . " \n " ;
echo " <br /> \n " ;
echo " </td> " ;
echo " </tr> " ;
2012-06-04 16:58:40 +02:00
echo " <tr> \n " ;
2014-02-20 08:20:55 +01:00
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2015-02-15 07:50:00 +01:00
echo " " . $text [ 'label-timeout_destination' ] . " \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2023-05-31 19:00:55 +02:00
echo $destination -> select ( 'dialplan' , 'ring_group_timeout_action' , $ring_group_timeout_action ? ? '' );
2012-06-04 16:58:40 +02:00
echo " <br /> \n " ;
2013-07-24 21:37:59 +02:00
echo " " . $text [ 'description-timeout_destination' ] . " \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " </tr> \n " ;
2018-05-08 03:46:28 +02:00
echo " <tr> \n " ;
2020-06-15 21:20:55 +02:00
echo " <td class='vncellreq' valign='top' align='left' nowrap='nowrap'> \n " ;
2018-05-08 03:52:55 +02:00
echo " " . $text [ 'label-call_timeout' ] . " \n " ;
2018-05-08 03:46:28 +02:00
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2018-06-09 19:56:07 +02:00
echo " <input class='formfld' type='text' name='ring_group_call_timeout' maxlength='255' value=' " . escape ( $ring_group_call_timeout ) . " '> \n " ;
2018-05-08 03:46:28 +02:00
echo " <br /> \n " ;
2023-05-31 19:00:55 +02:00
echo ( ! empty ( $text [ 'description-ring_group_call_timeout' ])) . " \n " ;
2018-05-08 03:46:28 +02:00
echo " </td> \n " ;
echo " </tr> \n " ;
2018-04-05 23:48:38 +02:00
if ( permission_exists ( 'ring_group_caller_id_name' )) {
echo " <tr> \n " ;
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
echo " " . $text [ 'label-caller_id_name' ] . " \n " ;
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2018-06-09 19:56:07 +02:00
echo " <input class='formfld' type='text' name='ring_group_caller_id_name' maxlength='255' value=' " . escape ( $ring_group_caller_id_name ) . " '> \n " ;
2018-04-05 23:48:38 +02:00
echo " <br /> \n " ;
echo $text [ 'description-caller_id_name' ] . " \n " ;
echo " </td> \n " ;
echo " </tr> \n " ;
}
2018-04-05 22:53:36 +02:00
2018-04-05 23:48:38 +02:00
if ( permission_exists ( 'ring_group_caller_id_number' )) {
echo " <tr> \n " ;
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
echo " " . $text [ 'label-caller_id_number' ] . " \n " ;
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2018-06-09 19:56:07 +02:00
echo " <input class='formfld' type='number' name='ring_group_caller_id_number' maxlength='255' min='0' step='1' value=' " . escape ( $ring_group_caller_id_number ) . " '> \n " ;
2018-04-05 23:48:38 +02:00
echo " <br /> \n " ;
echo $text [ 'description-caller_id_number' ] . " \n " ;
echo " </td> \n " ;
echo " </tr> \n " ;
}
2018-04-05 22:53:36 +02:00
2018-04-05 23:48:38 +02:00
if ( permission_exists ( 'ring_group_cid_name_prefix' )) {
echo " <tr> \n " ;
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
echo " " . $text [ 'label-cid-name-prefix' ] . " \n " ;
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2018-06-09 19:56:07 +02:00
echo " <input class='formfld' type='text' name='ring_group_cid_name_prefix' maxlength='255' value=' " . escape ( $ring_group_cid_name_prefix ) . " '> \n " ;
2018-04-05 23:48:38 +02:00
echo " <br /> \n " ;
echo $text [ 'description-cid-name-prefix' ] . " \n " ;
echo " </td> \n " ;
echo " </tr> \n " ;
}
2014-09-06 09:43:51 +02:00
2018-04-05 23:48:38 +02:00
if ( permission_exists ( 'ring_group_cid_number_prefix' )) {
echo " <tr> \n " ;
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
echo " " . $text [ 'label-cid-number-prefix' ] . " \n " ;
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2018-06-09 19:56:07 +02:00
echo " <input class='formfld' type='number' name='ring_group_cid_number_prefix' maxlength='255' min='0' step='1' value=' " . escape ( $ring_group_cid_number_prefix ) . " '> \n " ;
2018-04-05 23:48:38 +02:00
echo " <br /> \n " ;
echo $text [ 'description-cid-number-prefix' ] . " \n " ;
echo " </td> \n " ;
echo " </tr> \n " ;
}
2012-07-31 06:56:18 +02:00
2015-06-04 07:26:12 +02:00
echo " <tr> \n " ;
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
echo " " . $text [ 'label-distinctive_ring' ] . " \n " ;
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2018-06-09 19:56:07 +02:00
echo " <input class='formfld' type='text' name='ring_group_distinctive_ring' maxlength='255' value=' " . escape ( $ring_group_distinctive_ring ) . " '> \n " ;
2015-06-04 07:26:12 +02:00
echo " <br /> \n " ;
echo $text [ 'description-distinctive_ring' ] . " \n " ;
echo " </td> \n " ;
echo " </tr> \n " ;
2012-10-22 22:09:37 +02:00
echo " <tr> \n " ;
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2015-02-15 07:50:00 +01:00
echo " " . $text [ 'label-ringback' ] . " \n " ;
2012-10-22 22:09:37 +02:00
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2016-09-30 00:31:42 +02:00
echo " " . $ringbacks ;
2012-10-22 22:09:37 +02:00
echo " <br /> \n " ;
2012-11-24 08:43:34 +01:00
echo $text [ 'description-ringback' ] . " \n " ;
2012-10-22 22:09:37 +02:00
echo " </td> \n " ;
echo " </tr> \n " ;
2013-08-16 06:50:30 +02:00
echo " <tr> " ;
2015-02-15 07:50:00 +01:00
echo " <td class='vncell' valign='top'> " . $text [ 'label-user_list' ] . " </td> " ;
2013-08-16 06:50:30 +02:00
echo " <td class='vtable'> " ;
2023-05-31 19:00:55 +02:00
if ( ! empty ( $ring_group_users )) {
2020-02-06 04:18:32 +01:00
echo " <table width='300px'> \n " ;
foreach ( $ring_group_users as $field ) {
2019-08-13 12:48:28 +02:00
echo " <tr> \n " ;
echo " <td class='vtable'> " . escape ( $field [ 'username' ]) . " </td> \n " ;
echo " <td> \n " ;
2019-10-28 18:17:46 +01:00
echo " <a href='ring_group_edit.php?id= " . urlencode ( $ring_group_uuid ) . " &user_uuid= " . urlencode ( $field [ 'user_uuid' ]) . " &a=delete' alt=' " . $text [ 'button-delete' ] . " ' onclick= \" return confirm(' " . $text [ 'confirm-delete' ] . " ') \" > " . $v_link_label_delete . " </a> \n " ;
2019-08-13 12:48:28 +02:00
echo " </td> \n " ;
echo " </tr> \n " ;
}
2020-02-06 04:18:32 +01:00
echo " </table> \n " ;
echo " <br /> \n " ;
2013-08-16 06:50:30 +02:00
}
2014-02-26 06:39:02 +01:00
echo " <select name= \" user_uuid \" class='formfld' style='width: auto;'> \n " ;
2013-08-16 06:50:30 +02:00
echo " <option value= \" \" ></option> \n " ;
2019-08-13 12:48:28 +02:00
if ( is_array ( $users ) && @ sizeof ( $users ) != 0 ) {
2020-02-06 04:18:32 +01:00
foreach ( $users as $field ) {
2023-06-08 22:46:57 +02:00
if ( ! empty ( $ring_group_users ) && is_array ( $ring_group_users ) && @ sizeof ( $ring_group_users ) != 0 ) {
foreach ( $ring_group_users as $user ) {
if ( $user [ 'user_uuid' ] == $field [ 'user_uuid' ]) { continue 2 ; } //skip already assigned
}
2020-02-06 04:18:32 +01:00
}
2019-08-13 12:48:28 +02:00
echo " <option value=' " . escape ( $field [ 'user_uuid' ]) . " '> " . escape ( $field [ 'username' ]) . " </option> \n " ;
}
2013-08-16 06:50:30 +02:00
}
echo " </select> " ;
2020-02-06 04:18:32 +01:00
echo button :: create ([ 'type' => 'submit' , 'label' => $text [ 'button-add' ], 'icon' => $_SESSION [ 'theme' ][ 'button_icon_add' ], 'collapse' => 'never' ]);
2013-08-16 06:50:30 +02:00
echo " <br> \n " ;
echo " " . $text [ 'description-user_list' ] . " \n " ;
echo " <br /> \n " ;
echo " </td> " ;
echo " </tr> " ;
2024-09-16 00:47:53 +02:00
if ( permission_exists ( 'ring_group_call_screen_enabled' )) {
echo " <tr> \n " ;
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
echo " " . $text [ 'label-ring_group_call_screen_enabled' ] . " \n " ;
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
echo " <select class='formfld' name='ring_group_call_screen_enabled'> \n " ;
echo " <option value=''></option> \n " ;
if ( $ring_group_call_screen_enabled == " true " ) {
echo " <option value='true' selected='selected'> " . $text [ 'label-true' ] . " </option> \n " ;
}
else {
echo " <option value='true'> " . $text [ 'label-true' ] . " </option> \n " ;
}
if ( $ring_group_call_screen_enabled == " false " ) {
echo " <option value='false' selected='selected'> " . $text [ 'label-false' ] . " </option> \n " ;
}
else {
echo " <option value='false'> " . $text [ 'label-false' ] . " </option> \n " ;
}
echo " </select> \n " ;
echo " <br /> \n " ;
echo $text [ 'description-ring_group_call_screen_enabled' ] . " \n " ;
echo " </td> \n " ;
echo " </tr> \n " ;
}
2020-04-11 06:35:08 +02:00
echo " <tr> \n " ;
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
echo " " . $text [ 'label-ring_group_call_forward_enabled' ] . " \n " ;
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
echo " <select class='formfld' name='ring_group_call_forward_enabled'> \n " ;
echo " <option value=''></option> \n " ;
2023-06-08 22:46:57 +02:00
if ( ! empty ( $ring_group_call_forward_enabled ) && $ring_group_call_forward_enabled == " true " ) {
2020-04-11 06:35:08 +02:00
echo " <option value='true' selected='selected'> " . $text [ 'option-true' ] . " </option> \n " ;
}
else {
echo " <option value='true'> " . $text [ 'option-true' ] . " </option> \n " ;
}
2023-06-08 22:46:57 +02:00
if ( ! empty ( $ring_group_call_forward_enabled ) && $ring_group_call_forward_enabled == " false " ) {
2020-04-11 06:35:08 +02:00
echo " <option value='false' selected='selected'> " . $text [ 'option-false' ] . " </option> \n " ;
}
else {
echo " <option value='false'> " . $text [ 'option-false' ] . " </option> \n " ;
}
echo " </select> \n " ;
echo " <br /> \n " ;
echo $text [ 'description-ring_group_call_forward_enabled' ] . " \n " ;
echo " </td> \n " ;
echo " </tr> \n " ;
2019-10-02 21:12:04 +02:00
echo " <tr> \n " ;
2019-10-02 21:56:35 +02:00
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2019-10-02 21:12:04 +02:00
echo " " . $text [ 'label-ring_group_follow_me_enabled' ] . " \n " ;
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
echo " <select class='formfld' name='ring_group_follow_me_enabled'> \n " ;
2019-10-02 21:56:35 +02:00
echo " <option value=''></option> \n " ;
2023-06-08 22:46:57 +02:00
if ( ! empty ( $ring_group_follow_me_enabled ) && $ring_group_follow_me_enabled == " true " ) {
2019-10-02 21:12:04 +02:00
echo " <option value='true' selected='selected'> " . $text [ 'option-true' ] . " </option> \n " ;
}
else {
echo " <option value='true'> " . $text [ 'option-true' ] . " </option> \n " ;
}
2023-06-08 22:46:57 +02:00
if ( ! empty ( $ring_group_follow_me_enabled ) && $ring_group_follow_me_enabled == " false " ) {
2019-10-02 21:12:04 +02:00
echo " <option value='false' selected='selected'> " . $text [ 'option-false' ] . " </option> \n " ;
}
else {
echo " <option value='false'> " . $text [ 'option-false' ] . " </option> \n " ;
}
echo " </select> \n " ;
echo " <br /> \n " ;
echo $text [ 'description-ring_group_follow_me_enabled' ] . " \n " ;
echo " </td> \n " ;
echo " </tr> \n " ;
2015-06-19 18:33:05 +02:00
if ( permission_exists ( 'ring_group_missed_call' )) {
echo " <tr> \n " ;
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
echo " " . $text [ 'label-missed_call' ] . " \n " ;
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
echo " <select class='formfld' name='ring_group_missed_call_app' id='ring_group_missed_call_app' onchange= \" if (this.selectedIndex != 0) { document.getElementById('ring_group_missed_call_data').style.display = ''; document.getElementById('ring_group_missed_call_data').focus(); } else { document.getElementById('ring_group_missed_call_data').style.display='none'; } \" > \n " ;
echo " <option value=''></option> \n " ;
echo " <option value='email' " . (( $ring_group_missed_call_app == " email " && $ring_group_missed_call_data != '' ) ? " selected='selected' " : null ) . " > " . $text [ 'label-email' ] . " </option> \n " ;
//echo " <option value='text' ".(($ring_group_missed_call_app == "text" && $ring_group_missed_call_data != '') ? "selected='selected'" : null).">".$text['label-text']."</option>\n";
//echo " <option value='url' ".(($ring_group_missed_call_app == "url" && $ring_group_missed_call_data != '') ? "selected='selected'" : null).">".$text['label-url']."</option>\n";
echo " </select> \n " ;
$ring_group_missed_call_data = ( $ring_group_missed_call_app == 'text' ) ? format_phone ( $ring_group_missed_call_data ) : $ring_group_missed_call_data ;
2018-06-09 19:56:07 +02:00
echo " <input class='formfld' type='text' name='ring_group_missed_call_data' id='ring_group_missed_call_data' maxlength='255' value= \" " . escape ( $ring_group_missed_call_data ) . " \" style='min-width: 200px; width: 200px; " . (( $ring_group_missed_call_app == '' || $ring_group_missed_call_data == '' ) ? " display: none; " : null ) . " '> \n " ;
2015-06-19 18:33:05 +02:00
echo " <br /> \n " ;
echo $text [ 'description-missed_call' ] . " \n " ;
echo " </td> \n " ;
echo " </tr> \n " ;
}
2020-05-06 19:34:08 +02:00
if ( permission_exists ( 'ring_group_forward' )) {
echo " <tr> \n " ;
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
echo " " . $text [ 'label-ring_group_forward' ] . " \n " ;
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
echo " <select class='formfld' name='ring_group_forward_enabled' id='ring_group_forward_enabled' onchange= \" (this.selectedIndex == 1) ? document.getElementById('ring_group_forward_destination').focus() : null; \" > " ;
echo " <option value='false'> " . $text [ 'option-disabled' ] . " </option> " ;
2023-06-08 22:46:57 +02:00
echo " <option value='true' " . ( ! empty ( $ring_group_forward_enabled ) && $ring_group_forward_enabled == 'true' ? " selected='selected' " : null ) . " > " . $text [ 'option-enabled' ] . " </option> " ;
2020-05-06 19:34:08 +02:00
echo " </select> " ;
echo " <input class='formfld' type='text' name='ring_group_forward_destination' id='ring_group_forward_destination' placeholder= \" " . $text [ 'label-forward_destination' ] . " \" maxlength='255' value= \" " . escape ( $ring_group_forward_destination ) . " \" > " ;
echo " <br /> \n " ;
echo $text [ 'description-ring-group-forward' ] . " \n " ;
echo " </td> \n " ;
echo " </tr> \n " ;
}
2016-03-29 22:15:01 +02:00
2017-04-19 22:12:14 +02:00
if ( permission_exists ( 'ring_group_forward_toll_allow' )) {
echo " <tr> \n " ;
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
echo " " . $text [ 'label-ring_group_forward_toll_allow' ] . " \n " ;
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2018-06-09 19:56:07 +02:00
echo " <input class='formfld' type='text' name='ring_group_forward_toll_allow' maxlength='255' value= " . escape ( $ring_group_forward_toll_allow ) . " > \n " ;
2017-04-19 22:12:14 +02:00
echo " <br /> \n " ;
echo $text [ 'description-ring_group_forward_toll_allow' ] . " \n " ;
echo " </td> \n " ;
echo " </tr> \n " ;
}
2022-01-31 23:25:50 +01:00
2018-11-03 18:28:41 +01:00
if ( permission_exists ( " ring_group_context " )) {
2015-04-21 20:15:51 +02:00
echo " <tr> \n " ;
echo " <td class='vncellreq' valign='top' align='left' nowrap='nowrap'> \n " ;
echo " " . $text [ 'label-context' ] . " \n " ;
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2018-06-09 19:56:07 +02:00
echo " <input class='formfld' type='text' name='ring_group_context' maxlength='255' value= \" " . escape ( $ring_group_context ) . " \" required='required'> \n " ;
2015-04-21 20:15:51 +02:00
echo " <br /> \n " ;
echo $text [ 'description-enter-context' ] . " \n " ;
echo " </td> \n " ;
echo " </tr> \n " ;
}
2012-06-04 16:58:40 +02:00
echo " <tr> \n " ;
echo " <td class='vncellreq' valign='top' align='left' nowrap='nowrap'> \n " ;
2015-02-15 07:50:00 +01:00
echo " " . $text [ 'label-enabled' ] . " \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2024-12-17 02:48:44 +01:00
if ( substr ( $settings -> get ( 'theme' , 'input_toggle_style' , '' ), 0 , 6 ) == 'switch' ) {
2023-02-10 17:43:14 +01:00
echo " <label class='switch'> \n " ;
echo " <input type='checkbox' id='ring_group_enabled' name='ring_group_enabled' value='true' " . ( $ring_group_enabled == 'true' ? " checked='checked' " : null ) . " > \n " ;
echo " <span class='slider'></span> \n " ;
echo " </label> \n " ;
2012-06-04 16:58:40 +02:00
}
else {
2023-02-10 17:43:14 +01:00
echo " <select class='formfld' id='ring_group_enabled' name='ring_group_enabled'> \n " ;
2023-02-14 19:19:02 +01:00
echo " <option value='true' " . ( $ring_group_enabled == 'true' ? " selected='selected' " : null ) . " > " . $text [ 'option-true' ] . " </option> \n " ;
echo " <option value='false' " . ( $ring_group_enabled == 'false' ? " selected='selected' " : null ) . " > " . $text [ 'option-false' ] . " </option> \n " ;
2023-02-10 17:43:14 +01:00
echo " </select> \n " ;
2012-06-04 16:58:40 +02:00
}
echo " <br /> \n " ;
2012-11-24 08:43:34 +01:00
echo $text [ 'description-enabled' ] . " \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " </tr> \n " ;
echo " <tr> \n " ;
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2015-02-15 07:50:00 +01:00
echo " " . $text [ 'label-description' ] . " \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2018-06-09 19:56:07 +02:00
echo " <input class='formfld' type='text' name='ring_group_description' maxlength='255' value= \" " . escape ( $ring_group_description ) . " \" > \n " ;
2012-06-04 16:58:40 +02:00
echo " <br /> \n " ;
2012-11-24 08:43:34 +01:00
echo $text [ 'description-description' ] . " \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " </tr> \n " ;
2020-02-06 04:18:32 +01:00
echo " </table> " ;
2024-09-06 01:10:04 +02:00
echo " </div> \n " ;
2020-02-06 04:18:32 +01:00
echo " <br><br> " ;
2023-05-31 19:00:55 +02:00
if ( ! empty ( $dialplan_uuid )) {
2020-02-06 04:18:32 +01:00
echo " <input type='hidden' name='dialplan_uuid' value=' " . escape ( $dialplan_uuid ) . " '> \n " ;
2014-02-20 08:20:55 +01:00
}
2023-05-31 19:00:55 +02:00
if ( ! empty ( $ring_group_uuid )) {
2020-02-06 04:18:32 +01:00
echo " <input type='hidden' name='ring_group_uuid' value=' " . escape ( $ring_group_uuid ) . " '> \n " ;
2012-06-04 16:58:40 +02:00
}
2020-02-06 04:18:32 +01:00
echo " <input type='hidden' name=' " . $token [ 'name' ] . " ' value=' " . $token [ 'hash' ] . " '> \n " ;
2012-06-04 16:58:40 +02:00
echo " </form> " ;
//include the footer
2013-07-06 08:29:50 +02:00
require_once " resources/footer.php " ;
2016-09-30 00:31:42 +02:00
2024-06-11 18:27:37 +02:00
?>