@@ -85,8 +85,9 @@ discard block |
||
85 | 85 | $bbbsession['voicebridge'] = ($bigbluebuttonbn->voicebridge > 0)? 70000 + $bigbluebuttonbn->voicebridge: $bigbluebuttonbn->voicebridge; |
86 | 86 | $bbbsession['wait'] = $bigbluebuttonbn->wait; |
87 | 87 | $bbbsession['record'] = $bigbluebuttonbn->record; |
88 | -if( $bigbluebuttonbn->record ) |
|
88 | +if( $bigbluebuttonbn->record ) { |
|
89 | 89 | $bbbsession['welcome'] .= '<br><br>'.get_string('bbbrecordwarning', 'bigbluebuttonbn'); |
90 | +} |
|
90 | 91 | $bbbsession['tagging'] = $bigbluebuttonbn->tagging; |
91 | 92 | |
92 | 93 | $bbbsession['openingtime'] = $bigbluebuttonbn->openingtime; |
@@ -118,22 +119,24 @@ discard block |
||
118 | 119 | // Validates if the BigBlueButton server is running |
119 | 120 | $serverVersion = bigbluebuttonbn_getServerVersion($bbbsession['endpoint']); |
120 | 121 | if ( !isset($serverVersion) ) { //Server is not working |
121 | - if ( $bbbsession['administrator'] ) |
|
122 | - print_error( 'view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' ); |
|
123 | - else if ( $bbbsession['moderator'] ) |
|
124 | - print_error( 'view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course ); |
|
125 | - else |
|
126 | - print_error( 'view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course ); |
|
127 | -} else { |
|
128 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingsURL( $bbbsession['endpoint'], $bbbsession['shared_secret'] ) ); |
|
129 | - if ( !isset($xml) || !isset($xml->returncode) || $xml->returncode == 'FAILED' ){ // The shared secret is wrong |
|
130 | - if ( $bbbsession['administrator'] ) |
|
122 | + if ( $bbbsession['administrator'] ) { |
|
131 | 123 | print_error( 'view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' ); |
132 | - else if ( $bbbsession['moderator'] ) |
|
124 | + } else if ( $bbbsession['moderator'] ) { |
|
133 | 125 | print_error( 'view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course ); |
134 | - else |
|
126 | + } else { |
|
135 | 127 | print_error( 'view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course ); |
136 | 128 | } |
129 | + } else { |
|
130 | + $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingsURL( $bbbsession['endpoint'], $bbbsession['shared_secret'] ) ); |
|
131 | + if ( !isset($xml) || !isset($xml->returncode) || $xml->returncode == 'FAILED' ){ // The shared secret is wrong |
|
132 | + if ( $bbbsession['administrator'] ) { |
|
133 | + print_error( 'view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' ); |
|
134 | + } else if ( $bbbsession['moderator'] ) { |
|
135 | + print_error( 'view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course ); |
|
136 | + } else { |
|
137 | + print_error( 'view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course ); |
|
138 | + } |
|
139 | + } |
|
137 | 140 | } |
138 | 141 | |
139 | 142 | // Mark viewed by user (if required) |
@@ -209,10 +212,11 @@ discard block |
||
209 | 212 | } |
210 | 213 | |
211 | 214 | $bbbsession['meetingid'] = $bigbluebuttonbn->meetingid.'-'.$bbbsession['course']->id.'-'.$bbbsession['bigbluebuttonbnid'].'['.$bbbsession['group'].']'; |
212 | - if( $bbbsession['group'] > 0 ) |
|
213 | - $group_name = groups_get_group_name($bbbsession['group']); |
|
214 | - else |
|
215 | - $group_name = get_string('allparticipants'); |
|
215 | + if( $bbbsession['group'] > 0 ) { |
|
216 | + $group_name = groups_get_group_name($bbbsession['group']); |
|
217 | + } else { |
|
218 | + $group_name = get_string('allparticipants'); |
|
219 | + } |
|
216 | 220 | $bbbsession['meetingname'] = $bigbluebuttonbn->name.' ('.$group_name.')'; |
217 | 221 | } |
218 | 222 | // Metadata (contextActivityName updated after meeting name is assigned) |
@@ -353,14 +353,18 @@ discard block |
||
353 | 353 | $bigbluebuttonbn->timemodified = time(); |
354 | 354 | } |
355 | 355 | |
356 | - if (! isset($bigbluebuttonbn->newwindow)) |
|
357 | - $bigbluebuttonbn->newwindow = 0; |
|
358 | - if (! isset($bigbluebuttonbn->wait)) |
|
359 | - $bigbluebuttonbn->wait = 0; |
|
360 | - if (! isset($bigbluebuttonbn->record)) |
|
361 | - $bigbluebuttonbn->record = 0; |
|
362 | - if (! isset($bigbluebuttonbn->tagging)) |
|
363 | - $bigbluebuttonbn->tagging = 0; |
|
356 | + if (! isset($bigbluebuttonbn->newwindow)) { |
|
357 | + $bigbluebuttonbn->newwindow = 0; |
|
358 | + } |
|
359 | + if (! isset($bigbluebuttonbn->wait)) { |
|
360 | + $bigbluebuttonbn->wait = 0; |
|
361 | + } |
|
362 | + if (! isset($bigbluebuttonbn->record)) { |
|
363 | + $bigbluebuttonbn->record = 0; |
|
364 | + } |
|
365 | + if (! isset($bigbluebuttonbn->tagging)) { |
|
366 | + $bigbluebuttonbn->tagging = 0; |
|
367 | + } |
|
364 | 368 | |
365 | 369 | $bigbluebuttonbn->participants = htmlspecialchars_decode($bigbluebuttonbn->participants); |
366 | 370 | } |
@@ -422,16 +426,18 @@ discard block |
||
422 | 426 | /// Build the message_body |
423 | 427 | $msg->action = $action; |
424 | 428 | $msg->activity_type = ""; |
425 | - if( isset($bigbluebuttonbn->type) && $bigbluebuttonbn->type != 0 ) |
|
426 | - $msg->activity_type = bigbluebuttonbn_get_predefinedprofile_name($bigbluebuttonbn->type); |
|
429 | + if( isset($bigbluebuttonbn->type) && $bigbluebuttonbn->type != 0 ) { |
|
430 | + $msg->activity_type = bigbluebuttonbn_get_predefinedprofile_name($bigbluebuttonbn->type); |
|
431 | + } |
|
427 | 432 | $msg->activity_title = $bigbluebuttonbn->name; |
428 | 433 | $message_text = '<p>'.$msg->activity_type.' "'.$msg->activity_title.'" '.get_string('email_body_notification_meeting_has_been', 'bigbluebuttonbn').' '.$msg->action.'.</p>'; |
429 | 434 | |
430 | 435 | /// Add the meeting details to the message_body |
431 | 436 | $msg->action = ucfirst($action); |
432 | 437 | $msg->activity_description = ""; |
433 | - if( !empty($bigbluebuttonbn->intro) ) |
|
434 | - $msg->activity_description = trim($bigbluebuttonbn->intro); |
|
438 | + if( !empty($bigbluebuttonbn->intro) ) { |
|
439 | + $msg->activity_description = trim($bigbluebuttonbn->intro); |
|
440 | + } |
|
435 | 441 | $msg->activity_openingtime = ""; |
436 | 442 | if ($bigbluebuttonbn->openingtime) { |
437 | 443 | $msg->activity_openingtime = calendar_day_representation($bigbluebuttonbn->openingtime).' '.$at.' '.calendar_time_representation($bigbluebuttonbn->openingtime); |
@@ -589,10 +595,11 @@ discard block |
||
589 | 595 | function bigbluebuttonbn_get_db_moodle_roles($rolename='all') { |
590 | 596 | global $DB; |
591 | 597 | |
592 | - if( $rolename != 'all') |
|
593 | - $roles = $DB->get_record('role', array('shortname' => $rolename)); |
|
594 | - else |
|
595 | - $roles = $DB->get_records('role', array()); |
|
598 | + if( $rolename != 'all') { |
|
599 | + $roles = $DB->get_record('role', array('shortname' => $rolename)); |
|
600 | + } else { |
|
601 | + $roles = $DB->get_records('role', array()); |
|
602 | + } |
|
596 | 603 | |
597 | 604 | return $roles; |
598 | 605 | } |
@@ -88,8 +88,9 @@ |
||
88 | 88 | /// Set the duration for the meeting |
89 | 89 | if ( bigbluebuttonbn_get_cfg_scheduled_duration_enabled() ) { |
90 | 90 | $durationtime = bigbluebuttonbn_get_duration($bigbluebuttonbn->openingtime, $bigbluebuttonbn->closingtime); |
91 | - if( $durationtime > 0 ) |
|
92 | - $bbbsession['welcome'] .= '<br><br>'.str_replace("%duration%", ''.$durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn')); |
|
91 | + if( $durationtime > 0 ) { |
|
92 | + $bbbsession['welcome'] .= '<br><br>'.str_replace("%duration%", ''.$durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn')); |
|
93 | + } |
|
93 | 94 | } else { |
94 | 95 | $durationtime = 0; |
95 | 96 | } |
@@ -47,8 +47,9 @@ discard block |
||
47 | 47 | $log->userid = $bbbsession['userID']; |
48 | 48 | $log->timecreated = time(); |
49 | 49 | $log->event = $event; |
50 | - if( $event == BIGBLUEBUTTONBN_LOG_EVENT_CREATE) |
|
51 | - $log->meta = '{"record":'.($bbbsession['record']? 'true': 'false').'}'; |
|
50 | + if( $event == BIGBLUEBUTTONBN_LOG_EVENT_CREATE) { |
|
51 | + $log->meta = '{"record":'.($bbbsession['record']? 'true': 'false').'}'; |
|
52 | + } |
|
52 | 53 | |
53 | 54 | $returnid = $DB->insert_record('bigbluebuttonbn_log', $log); |
54 | 55 | } |
@@ -68,15 +69,18 @@ discard block |
||
68 | 69 | $params = 'name='.urlencode($name).'&meetingID='.urlencode($meetingID).'&attendeePW='.urlencode($attendeePW).'&moderatorPW='.urlencode($moderatorPW).'&logoutURL='.urlencode($logoutURL).'&record='.$record; |
69 | 70 | |
70 | 71 | $voiceBridge = intval($voiceBridge); |
71 | - if ( $voiceBridge > 0 && $voiceBridge < 79999) |
|
72 | - $params .= '&voiceBridge='.$voiceBridge; |
|
72 | + if ( $voiceBridge > 0 && $voiceBridge < 79999) { |
|
73 | + $params .= '&voiceBridge='.$voiceBridge; |
|
74 | + } |
|
73 | 75 | |
74 | 76 | $duration = intval($duration); |
75 | - if( $duration > 0 ) |
|
76 | - $params .= '&duration='.$duration; |
|
77 | + if( $duration > 0 ) { |
|
78 | + $params .= '&duration='.$duration; |
|
79 | + } |
|
77 | 80 | |
78 | - if( trim( $welcome ) ) |
|
79 | - $params .= '&welcome='.urlencode($welcome); |
|
81 | + if( trim( $welcome ) ) { |
|
82 | + $params .= '&welcome='.urlencode($welcome); |
|
83 | + } |
|
80 | 84 | |
81 | 85 | foreach ($metadata as $key => $value) { |
82 | 86 | $params .= '&'.$key.'='.urlencode($value); |
@@ -148,10 +152,12 @@ discard block |
||
148 | 152 | } |
149 | 153 | |
150 | 154 | if( $xml ) { |
151 | - if($xml->meetingID) return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded ); |
|
152 | - else return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey ); |
|
153 | - } |
|
154 | - else { |
|
155 | + if($xml->meetingID) { |
|
156 | + return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded ); |
|
157 | + } else { |
|
158 | + return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey ); |
|
159 | + } |
|
160 | + } else { |
|
155 | 161 | return null; |
156 | 162 | } |
157 | 163 | } |
@@ -223,7 +229,9 @@ discard block |
||
223 | 229 | $metadataArray = array(); |
224 | 230 | $metadata = get_object_vars($recording->metadata); |
225 | 231 | foreach ($metadata as $key => $value) { |
226 | - if(is_object($value)) $value = ''; |
|
232 | + if(is_object($value)) { |
|
233 | + $value = ''; |
|
234 | + } |
|
227 | 235 | $metadataArray['meta_'.$key] = $value; |
228 | 236 | } |
229 | 237 | |
@@ -261,7 +269,9 @@ discard block |
||
261 | 269 | $metadataArray = array(); |
262 | 270 | $metadata = get_object_vars($recording->metadata); |
263 | 271 | foreach ($metadata as $key => $value) { |
264 | - if(is_object($value)) $value = ''; |
|
272 | + if(is_object($value)) { |
|
273 | + $value = ''; |
|
274 | + } |
|
265 | 275 | $metadataArray['meta_'.$key] = $value; |
266 | 276 | } |
267 | 277 | |
@@ -280,17 +290,22 @@ discard block |
||
280 | 290 | } |
281 | 291 | |
282 | 292 | function bigbluebuttonbn_recordingBuildSorter($a, $b){ |
283 | - if( $a['startTime'] < $b['startTime']) return -1; |
|
284 | - else if( $a['startTime'] == $b['startTime']) return 0; |
|
285 | - else return 1; |
|
286 | -} |
|
293 | + if( $a['startTime'] < $b['startTime']) { |
|
294 | + return -1; |
|
295 | + } else if( $a['startTime'] == $b['startTime']) { |
|
296 | + return 0; |
|
297 | + } else { |
|
298 | + return 1; |
|
299 | + } |
|
300 | + } |
|
287 | 301 | |
288 | 302 | function bigbluebuttonbn_doDeleteRecordings( $recordIDs, $URL, $SALT ) { |
289 | 303 | $ids = explode(",", $recordIDs); |
290 | 304 | foreach( $ids as $id){ |
291 | 305 | $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getDeleteRecordingsURL($id, $URL, $SALT) ); |
292 | - if( $xml && $xml->returncode != 'SUCCESS' ) |
|
293 | - return false; |
|
306 | + if( $xml && $xml->returncode != 'SUCCESS' ) { |
|
307 | + return false; |
|
308 | + } |
|
294 | 309 | } |
295 | 310 | return true; |
296 | 311 | } |
@@ -299,8 +314,9 @@ discard block |
||
299 | 314 | $ids = explode(",", $recordIDs); |
300 | 315 | foreach( $ids as $id){ |
301 | 316 | $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getPublishRecordingsURL($id, $set, $URL, $SALT) ); |
302 | - if( $xml && $xml->returncode != 'SUCCESS' ) |
|
303 | - return false; |
|
317 | + if( $xml && $xml->returncode != 'SUCCESS' ) { |
|
318 | + return false; |
|
319 | + } |
|
304 | 320 | } |
305 | 321 | return true; |
306 | 322 | } |
@@ -310,8 +326,7 @@ discard block |
||
310 | 326 | |
311 | 327 | if( $xml ) { //If the xml packet returned failure it displays the message to the user |
312 | 328 | return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); |
313 | - } |
|
314 | - else { //If the server is unreachable, then prompts the user of the necessary action |
|
329 | + } else { //If the server is unreachable, then prompts the user of the necessary action |
|
315 | 330 | return null; |
316 | 331 | } |
317 | 332 | } |
@@ -531,8 +546,9 @@ discard block |
||
531 | 546 | // Iterate looking for all configuration |
532 | 547 | foreach($participant_list as $participant){ |
533 | 548 | if( $participant->selectiontype == 'all' ) { |
534 | - if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) |
|
535 | - return true; |
|
549 | + if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) { |
|
550 | + return true; |
|
551 | + } |
|
536 | 552 | } |
537 | 553 | } |
538 | 554 | |
@@ -543,8 +559,9 @@ discard block |
||
543 | 559 | foreach( $roles as $role ) { |
544 | 560 | $db_moodle_role = bigbluebuttonbn_moodle_db_role_lookup($db_moodle_roles, $role->roleid); |
545 | 561 | if( $participant->selectionid == $db_moodle_role->shortname ) { |
546 | - if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) |
|
547 | - return true; |
|
562 | + if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) { |
|
563 | + return true; |
|
564 | + } |
|
548 | 565 | } |
549 | 566 | } |
550 | 567 | } |
@@ -554,8 +571,9 @@ discard block |
||
554 | 571 | foreach($participant_list as $participant){ |
555 | 572 | if( $participant->selectiontype == 'user' ) { |
556 | 573 | if( $participant->selectionid == $user ) { |
557 | - if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) |
|
558 | - return true; |
|
574 | + if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) { |
|
575 | + return true; |
|
576 | + } |
|
559 | 577 | } |
560 | 578 | } |
561 | 579 | } |
@@ -588,7 +606,9 @@ discard block |
||
588 | 606 | if( $voicebridge != 0 ) { |
589 | 607 | $table = "bigbluebuttonbn"; |
590 | 608 | $select = "voicebridge = ".$voicebridge; |
591 | - if( $id ) $select .= " AND id <> ".$id; |
|
609 | + if( $id ) { |
|
610 | + $select .= " AND id <> ".$id; |
|
611 | + } |
|
592 | 612 | if ( $rooms = $DB->get_records_select($table, $select) ) { |
593 | 613 | $is_unique = false; |
594 | 614 | } |
@@ -887,7 +907,9 @@ discard block |
||
887 | 907 | $error = $org_msg; |
888 | 908 | |
889 | 909 | if( !empty($new_msg) ) { |
890 | - if( !empty($error) ) $error .= ' '; |
|
910 | + if( !empty($error) ) { |
|
911 | + $error .= ' '; |
|
912 | + } |
|
891 | 913 | $error .= $new_msg; |
892 | 914 | } |
893 | 915 | |
@@ -1092,8 +1114,9 @@ discard block |
||
1092 | 1114 | |
1093 | 1115 | /// Build the message_body |
1094 | 1116 | $msg->activity_type = ""; |
1095 | - if( isset($bigbluebuttonbn->type) && $bigbluebuttonbn->type != 0 ) |
|
1096 | - $msg->activity_type = bigbluebuttonbn_get_predefinedprofile_name($bigbluebuttonbn->type); |
|
1117 | + if( isset($bigbluebuttonbn->type) && $bigbluebuttonbn->type != 0 ) { |
|
1118 | + $msg->activity_type = bigbluebuttonbn_get_predefinedprofile_name($bigbluebuttonbn->type); |
|
1119 | + } |
|
1097 | 1120 | $msg->activity_title = $bigbluebuttonbn->name; |
1098 | 1121 | $message_text = '<p>'.get_string('email_body_recording_ready_for', 'bigbluebuttonbn').' '.$msg->activity_type.' "'.$msg->activity_title.'" '.get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn').'.</p>'; |
1099 | 1122 | |
@@ -1119,8 +1142,9 @@ discard block |
||
1119 | 1142 | $capabilities = bigbluebuttonbn_getCapabilitiesArray( $endpoint, $shared_secret ); |
1120 | 1143 | if( $capabilities ) { |
1121 | 1144 | foreach ($capabilities as $capability) { |
1122 | - if( $capability["name"] == $capability_name) |
|
1123 | - $capability_offered = $capability; |
|
1145 | + if( $capability["name"] == $capability_name) { |
|
1146 | + $capability_offered = $capability; |
|
1147 | + } |
|
1124 | 1148 | } |
1125 | 1149 | } |
1126 | 1150 | } |
@@ -119,8 +119,9 @@ |
||
119 | 119 | //Execute the end command |
120 | 120 | $meeting_info = bigbluebuttonbn_bbb_broker_do_end_meeting($params['id'], $bbbsession['modPW']); |
121 | 121 | // Moodle event logger: Create an event for meeting ended |
122 | - if( isset($bigbluebuttonbn) ) |
|
123 | - bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_ENDED, $bigbluebuttonbn, $context, $cm); |
|
122 | + if( isset($bigbluebuttonbn) ) { |
|
123 | + bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_ENDED, $bigbluebuttonbn, $context, $cm); |
|
124 | + } |
|
124 | 125 | /// Update the cache |
125 | 126 | $meeting_info = bigbluebuttonbn_bbb_broker_get_meeting_info($params['id'], $bbbsession['modPW'], true); |
126 | 127 |
@@ -269,8 +269,9 @@ |
||
269 | 269 | // Fourth block starts here |
270 | 270 | //------------------------------------------------------------------------------- |
271 | 271 | $mform->addElement('header', 'schedule', get_string('mod_form_block_schedule', 'bigbluebuttonbn')); |
272 | - if( isset($current_activity->openingtime) && $current_activity->openingtime != 0 || isset($current_activity->closingtime) && $current_activity->closingtime != 0 ) |
|
273 | - $mform->setExpanded('schedule'); |
|
272 | + if( isset($current_activity->openingtime) && $current_activity->openingtime != 0 || isset($current_activity->closingtime) && $current_activity->closingtime != 0 ) { |
|
273 | + $mform->setExpanded('schedule'); |
|
274 | + } |
|
274 | 275 | |
275 | 276 | $mform->addElement('date_time_selector', 'openingtime', get_string('mod_form_field_openingtime', 'bigbluebuttonbn'), array('optional' => true)); |
276 | 277 | $mform->setDefault('openingtime', 0); |