@@ -137,7 +137,7 @@ |
||
137 | 137 | * Sign a string with a given key and algorithm. |
138 | 138 | * |
139 | 139 | * @param string $msg The message to sign |
140 | - * @param string|resource $key The secret key |
|
140 | + * @param string $key The secret key |
|
141 | 141 | * @param string $alg The signing algorithm. Supported algorithms |
142 | 142 | * are 'HS256', 'HS384', 'HS512' and 'RS256' |
143 | 143 | * |
@@ -66,7 +66,6 @@ discard block |
||
66 | 66 | * will create a new instance and return the id number |
67 | 67 | * of the new instance. |
68 | 68 | * |
69 | - * @param object $bigbluebuttonbn An object from the form in mod_form.php |
|
70 | 69 | * @return int The id of the newly inserted bigbluebuttonbn record |
71 | 70 | */ |
72 | 71 | function bigbluebuttonbn_add_instance($data, $mform) { |
@@ -93,7 +92,6 @@ discard block |
||
93 | 92 | * (defined by the form in mod_form.php) this function |
94 | 93 | * will update an existing instance with new data. |
95 | 94 | * |
96 | - * @param object $bigbluebuttonbn An object from the form in mod_form.php |
|
97 | 95 | * @return boolean Success/Fail |
98 | 96 | */ |
99 | 97 | function bigbluebuttonbn_update_instance($data, $mform) { |
@@ -162,7 +160,7 @@ discard block |
||
162 | 160 | * $return->time = the time they did it |
163 | 161 | * $return->info = a short text description |
164 | 162 | * |
165 | - * @return null |
|
163 | + * @return boolean |
|
166 | 164 | */ |
167 | 165 | function bigbluebuttonbn_user_outline($course, $user, $mod, $bigbluebuttonbn) { |
168 | 166 | return true; |
@@ -230,7 +228,7 @@ discard block |
||
230 | 228 | * See other modules as example. |
231 | 229 | * |
232 | 230 | * @param int $bigbluebuttonbnid ID of an instance of this module |
233 | - * @return mixed boolean/array of students |
|
231 | + * @return boolean boolean/array of students |
|
234 | 232 | */ |
235 | 233 | function bigbluebuttonbn_get_participants($bigbluebuttonbnid) { |
236 | 234 | return false; |
@@ -238,7 +236,7 @@ discard block |
||
238 | 236 | |
239 | 237 | /** |
240 | 238 | * Returns all other caps used in module |
241 | - * @return array |
|
239 | + * @return string[] |
|
242 | 240 | */ |
243 | 241 | function bigbluebuttonbn_get_extra_capabilities() { |
244 | 242 | return array('moodle/site:accessallgroups'); |
@@ -255,7 +253,7 @@ discard block |
||
255 | 253 | * as reference. |
256 | 254 | * |
257 | 255 | * @param int $bigbluebuttonbnid ID of an instance of this module |
258 | - * @return mixed |
|
256 | + * @return boolean |
|
259 | 257 | */ |
260 | 258 | function bigbluebuttonbn_scale_used($bigbluebuttonbnid, $scaleid) { |
261 | 259 | $return = false; |
@@ -288,7 +286,7 @@ discard block |
||
288 | 286 | |
289 | 287 | /** |
290 | 288 | * List of view style log actions |
291 | - * @return array |
|
289 | + * @return string[] |
|
292 | 290 | */ |
293 | 291 | function bigbluebuttonbn_get_view_actions() { |
294 | 292 | return array('view', 'view all'); |
@@ -296,7 +294,7 @@ discard block |
||
296 | 294 | |
297 | 295 | /** |
298 | 296 | * List of update style log actions |
299 | - * @return array |
|
297 | + * @return string[] |
|
300 | 298 | */ |
301 | 299 | function bigbluebuttonbn_get_post_actions() { |
302 | 300 | return array('update', 'add', 'create', 'join', 'end', 'left', 'publish', 'unpublish', 'delete'); |
@@ -310,7 +308,7 @@ discard block |
||
310 | 308 | * |
311 | 309 | * @global object |
312 | 310 | * @param object $coursemodule |
313 | - * @return object|null |
|
311 | + * @return null|cached_cm_info |
|
314 | 312 | */ |
315 | 313 | function bigbluebuttonbn_get_coursemodule_info($coursemodule) { |
316 | 314 | global $CFG, $DB; |
@@ -502,7 +500,7 @@ discard block |
||
502 | 500 | * @param array $args extra arguments |
503 | 501 | * @param bool $forcedownload whether or not force download |
504 | 502 | * @param array $options additional options affecting the file serving |
505 | - * @return bool false if file not found, does not return if found - justsend the file |
|
503 | + * @return false|null false if file not found, does not return if found - justsend the file |
|
506 | 504 | */ |
507 | 505 | function bigbluebuttonbn_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) { |
508 | 506 | global $CFG, $DB; |
@@ -241,7 +241,6 @@ discard block |
||
241 | 241 | |
242 | 242 | /** |
243 | 243 | * Prints single activity item prepared by {@see recordingsbn_get_recent_mod_activity()} |
244 | - |
|
245 | 244 | * @return void |
246 | 245 | */ |
247 | 246 | function bigbluebuttonbn_print_recent_mod_activity($activity, $courseid, $detail, $modnames, $viewfullnames) { |
@@ -359,9 +358,9 @@ discard block |
||
359 | 358 | $now = time(); |
360 | 359 | if ( $bigbluebuttonbn->openingtime and (!$bigbluebuttonbn->closingtime or $bigbluebuttonbn->closingtime > $now)) { // A bigbluebuttonbn is scheduled. |
361 | 360 | $str = '<div class="bigbluebuttonbn overview"><div class="name">'. |
362 | - get_string('modulename', 'bigbluebuttonbn').': <a '.($bigbluebuttonbn->visible ? '' : ' class="dimmed"'). |
|
363 | - ' href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.'">'. |
|
364 | - $bigbluebuttonbn->name.'</a></div>'; |
|
361 | + get_string('modulename', 'bigbluebuttonbn').': <a '.($bigbluebuttonbn->visible ? '' : ' class="dimmed"'). |
|
362 | + ' href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.'">'. |
|
363 | + $bigbluebuttonbn->name.'</a></div>'; |
|
365 | 364 | if ( $bigbluebuttonbn->openingtime > $now ) { |
366 | 365 | $str .= '<div class="info">'.get_string('starts_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime).'</div>'; |
367 | 366 | } else { |
@@ -13,23 +13,23 @@ discard block |
||
13 | 13 | |
14 | 14 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
15 | 15 | |
16 | -require_once($CFG->dirroot.'/calendar/lib.php'); |
|
17 | -require_once($CFG->dirroot.'/message/lib.php'); |
|
18 | -require_once($CFG->dirroot.'/mod/lti/OAuth.php'); |
|
19 | -require_once($CFG->libdir.'/accesslib.php'); |
|
20 | -require_once($CFG->libdir.'/completionlib.php'); |
|
21 | -require_once($CFG->libdir.'/datalib.php'); |
|
22 | -require_once($CFG->libdir.'/coursecatlib.php'); |
|
23 | -require_once($CFG->libdir.'/enrollib.php'); |
|
24 | -require_once($CFG->libdir.'/filelib.php'); |
|
25 | -require_once($CFG->libdir.'/formslib.php'); |
|
26 | - |
|
27 | -require_once(dirname(__FILE__).'/JWT.php'); |
|
28 | - |
|
29 | -if( file_exists(dirname(__FILE__).'/config.php') ) { |
|
30 | - require_once(dirname(__FILE__).'/config.php'); |
|
31 | - if( isset($BIGBLUEBUTTONBN_CFG) ) { |
|
32 | - $CFG = (object) array_merge((array)$CFG, (array)$BIGBLUEBUTTONBN_CFG); |
|
16 | +require_once($CFG->dirroot . '/calendar/lib.php'); |
|
17 | +require_once($CFG->dirroot . '/message/lib.php'); |
|
18 | +require_once($CFG->dirroot . '/mod/lti/OAuth.php'); |
|
19 | +require_once($CFG->libdir . '/accesslib.php'); |
|
20 | +require_once($CFG->libdir . '/completionlib.php'); |
|
21 | +require_once($CFG->libdir . '/datalib.php'); |
|
22 | +require_once($CFG->libdir . '/coursecatlib.php'); |
|
23 | +require_once($CFG->libdir . '/enrollib.php'); |
|
24 | +require_once($CFG->libdir . '/filelib.php'); |
|
25 | +require_once($CFG->libdir . '/formslib.php'); |
|
26 | + |
|
27 | +require_once(dirname(__FILE__) . '/JWT.php'); |
|
28 | + |
|
29 | +if (file_exists(dirname(__FILE__) . '/config.php')) { |
|
30 | + require_once(dirname(__FILE__) . '/config.php'); |
|
31 | + if (isset($BIGBLUEBUTTONBN_CFG)) { |
|
32 | + $CFG = (object)array_merge((array)$CFG, (array)$BIGBLUEBUTTONBN_CFG); |
|
33 | 33 | } |
34 | 34 | } else { |
35 | 35 | $BIGBLUEBUTTONBN_CFG = new stdClass(); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | const BIGBLUEBUTTONBN_LOG_EVENT_DELETE = "Delete"; |
54 | 54 | |
55 | 55 | function bigbluebuttonbn_supports($feature) { |
56 | - switch($feature) { |
|
56 | + switch ($feature) { |
|
57 | 57 | case FEATURE_IDNUMBER: return true; |
58 | 58 | case FEATURE_GROUPS: return true; |
59 | 59 | case FEATURE_GROUPINGS: return true; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | function bigbluebuttonbn_add_instance($data, $mform) { |
83 | 83 | global $DB, $CFG; |
84 | 84 | |
85 | - $draftitemid = isset($data->presentation)? $data->presentation: null; |
|
85 | + $draftitemid = isset($data->presentation) ? $data->presentation : null; |
|
86 | 86 | $context = bigbluebuttonbn_get_context_module($data->coursemodule); |
87 | 87 | |
88 | 88 | bigbluebuttonbn_process_pre_save($data); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | global $DB, $CFG; |
111 | 111 | |
112 | 112 | $data->id = $data->instance; |
113 | - $draftitemid = isset($data->presentation)? $data->presentation: null; |
|
113 | + $draftitemid = isset($data->presentation) ? $data->presentation : null; |
|
114 | 114 | $context = bigbluebuttonbn_get_context_module($data->coursemodule); |
115 | 115 | |
116 | 116 | bigbluebuttonbn_process_pre_save($data); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | function bigbluebuttonbn_delete_instance($id) { |
137 | 137 | global $CFG, $DB, $USER; |
138 | 138 | |
139 | - if (! $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $id))) { |
|
139 | + if (!$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $id))) { |
|
140 | 140 | return false; |
141 | 141 | } |
142 | 142 | |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | //if( bigbluebuttonbn_isMeetingRunning($meetingID, $url, $shared_secret) ) |
155 | 155 | // $getArray = bigbluebuttonbn_doEndMeeting( $meetingID, $modPW, $url, $shared_secret ); |
156 | 156 | |
157 | - if (! $DB->delete_records('bigbluebuttonbn', array('id' => $bigbluebuttonbn->id))) { |
|
157 | + if (!$DB->delete_records('bigbluebuttonbn', array('id' => $bigbluebuttonbn->id))) { |
|
158 | 158 | $result = false; |
159 | 159 | } |
160 | 160 | |
161 | - if (! $DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) { |
|
161 | + if (!$DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) { |
|
162 | 162 | $result = false; |
163 | 163 | } |
164 | 164 | |
@@ -174,19 +174,19 @@ discard block |
||
174 | 174 | $logs = $DB->get_records('bigbluebuttonbn_logs', array('bigbluebuttonbnid' => $bigbluebuttonbn->id, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_CREATE)); |
175 | 175 | error_log(json_encode($logs)); |
176 | 176 | $has_recordings = 'false'; |
177 | - if (! empty($logs) ) { |
|
177 | + if (!empty($logs)) { |
|
178 | 178 | error_log("IS not empty"); |
179 | - foreach ( $logs as $l ) { |
|
179 | + foreach ($logs as $l) { |
|
180 | 180 | error_log(json_encode($l)); |
181 | 181 | $meta = json_decode($l->meta); |
182 | - if ( $meta->record ) { |
|
182 | + if ($meta->record) { |
|
183 | 183 | $has_recordings = 'true'; |
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
187 | 187 | $log->meta = "{\"has_recordings\":{$has_recordings}}"; |
188 | 188 | |
189 | - if (! $returnid = $DB->insert_record('bigbluebuttonbn_logs', $log)) { |
|
189 | + if (!$returnid = $DB->insert_record('bigbluebuttonbn_logs', $log)) { |
|
190 | 190 | $result = false; |
191 | 191 | } |
192 | 192 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * @return boolean |
225 | 225 | */ |
226 | 226 | function bigbluebuttonbn_print_recent_activity($course, $isteacher, $timestart) { |
227 | - return false; // True if anything was printed, otherwise false |
|
227 | + return false; // True if anything was printed, otherwise false |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * @param int $groupid defaults to 0 |
240 | 240 | * @return void adds items into $activities and increases $index |
241 | 241 | */ |
242 | -function bigbluebuttonbn_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0) { |
|
242 | +function bigbluebuttonbn_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid = 0, $groupid = 0) { |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * |
258 | 258 | * @return boolean |
259 | 259 | **/ |
260 | -function bigbluebuttonbn_cron () { |
|
260 | +function bigbluebuttonbn_cron() { |
|
261 | 261 | return true; |
262 | 262 | } |
263 | 263 | |
@@ -360,17 +360,17 @@ discard block |
||
360 | 360 | |
361 | 361 | foreach ($bigbluebuttonbns as $bigbluebuttonbn) { |
362 | 362 | $now = time(); |
363 | - if ( $bigbluebuttonbn->openingtime and (!$bigbluebuttonbn->closingtime or $bigbluebuttonbn->closingtime > $now)) { // A bigbluebuttonbn is scheduled. |
|
364 | - $str = '<div class="bigbluebuttonbn overview"><div class="name">'. |
|
365 | - get_string('modulename', 'bigbluebuttonbn').': <a '.($bigbluebuttonbn->visible ? '' : ' class="dimmed"'). |
|
366 | - ' href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.'">'. |
|
367 | - $bigbluebuttonbn->name.'</a></div>'; |
|
368 | - if ( $bigbluebuttonbn->openingtime > $now ) { |
|
369 | - $str .= '<div class="info">'.get_string('starts_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime).'</div>'; |
|
363 | + if ($bigbluebuttonbn->openingtime and (!$bigbluebuttonbn->closingtime or $bigbluebuttonbn->closingtime > $now)) { // A bigbluebuttonbn is scheduled. |
|
364 | + $str = '<div class="bigbluebuttonbn overview"><div class="name">' . |
|
365 | + get_string('modulename', 'bigbluebuttonbn') . ': <a ' . ($bigbluebuttonbn->visible ? '' : ' class="dimmed"') . |
|
366 | + ' href="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bigbluebuttonbn->coursemodule . '">' . |
|
367 | + $bigbluebuttonbn->name . '</a></div>'; |
|
368 | + if ($bigbluebuttonbn->openingtime > $now) { |
|
369 | + $str .= '<div class="info">' . get_string('starts_at', 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->openingtime) . '</div>'; |
|
370 | 370 | } else { |
371 | - $str .= '<div class="info">'.get_string('started_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime).'</div>'; |
|
371 | + $str .= '<div class="info">' . get_string('started_at', 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->openingtime) . '</div>'; |
|
372 | 372 | } |
373 | - $str .= '<div class="info">'.get_string('ends_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->closingtime).'</div></div>'; |
|
373 | + $str .= '<div class="info">' . get_string('ends_at', 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->closingtime) . '</div></div>'; |
|
374 | 374 | |
375 | 375 | if (empty($htmlarray[$bigbluebuttonbn->course]['bigbluebuttonbn'])) { |
376 | 376 | $htmlarray[$bigbluebuttonbn->course]['bigbluebuttonbn'] = $str; |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | function bigbluebuttonbn_get_coursemodule_info($coursemodule) { |
396 | 396 | global $CFG, $DB; |
397 | 397 | |
398 | - if ( !$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id'=>$coursemodule->instance), 'id, name, intro, introformat')) { |
|
398 | + if (!$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id'=>$coursemodule->instance), 'id, name, intro, introformat')) { |
|
399 | 399 | return NULL; |
400 | 400 | } |
401 | 401 | |
@@ -421,10 +421,10 @@ discard block |
||
421 | 421 | function bigbluebuttonbn_process_pre_save(&$bigbluebuttonbn) { |
422 | 422 | global $DB, $CFG; |
423 | 423 | |
424 | - if ( !isset($bigbluebuttonbn->timecreated) || !$bigbluebuttonbn->timecreated ) { |
|
424 | + if (!isset($bigbluebuttonbn->timecreated) || !$bigbluebuttonbn->timecreated) { |
|
425 | 425 | $bigbluebuttonbn->timecreated = time(); |
426 | 426 | //Assign password only if it is a new activity |
427 | - if( isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add) ) { |
|
427 | + if (isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add)) { |
|
428 | 428 | $bigbluebuttonbn->moderatorpass = bigbluebuttonbn_random_password(12); |
429 | 429 | $bigbluebuttonbn->viewerpass = bigbluebuttonbn_random_password(12); |
430 | 430 | } |
@@ -433,11 +433,11 @@ discard block |
||
433 | 433 | $bigbluebuttonbn->timemodified = time(); |
434 | 434 | } |
435 | 435 | |
436 | - if (! isset($bigbluebuttonbn->wait)) |
|
436 | + if (!isset($bigbluebuttonbn->wait)) |
|
437 | 437 | $bigbluebuttonbn->wait = 0; |
438 | - if (! isset($bigbluebuttonbn->record)) |
|
438 | + if (!isset($bigbluebuttonbn->record)) |
|
439 | 439 | $bigbluebuttonbn->record = 0; |
440 | - if (! isset($bigbluebuttonbn->tagging)) |
|
440 | + if (!isset($bigbluebuttonbn->tagging)) |
|
441 | 441 | $bigbluebuttonbn->tagging = 0; |
442 | 442 | |
443 | 443 | $bigbluebuttonbn->participants = htmlspecialchars_decode($bigbluebuttonbn->participants); |
@@ -456,8 +456,8 @@ discard block |
||
456 | 456 | |
457 | 457 | // Now that an id was assigned, generate and set the meetingid property based on |
458 | 458 | // [Moodle Instance + Activity ID + BBB Secret] (but only for new activities) |
459 | - if( isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add) ) { |
|
460 | - $bigbluebuttonbn_meetingid = sha1($CFG->wwwroot.$bigbluebuttonbn->id.bigbluebuttonbn_get_cfg_shared_secret()); |
|
459 | + if (isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add)) { |
|
460 | + $bigbluebuttonbn_meetingid = sha1($CFG->wwwroot . $bigbluebuttonbn->id . bigbluebuttonbn_get_cfg_shared_secret()); |
|
461 | 461 | $DB->set_field('bigbluebuttonbn', 'meetingid', $bigbluebuttonbn_meetingid, array('id' => $bigbluebuttonbn->id)); |
462 | 462 | $action = get_string('mod_form_field_notification_msg_created', 'bigbluebuttonbn'); |
463 | 463 | } else { |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | $at = get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn'); |
467 | 467 | |
468 | 468 | // Add evento to the calendar when if openingtime is set |
469 | - if ( isset($bigbluebuttonbn->openingtime) && $bigbluebuttonbn->openingtime ){ |
|
469 | + if (isset($bigbluebuttonbn->openingtime) && $bigbluebuttonbn->openingtime) { |
|
470 | 470 | $event = new stdClass(); |
471 | 471 | $event->name = $bigbluebuttonbn->name; |
472 | 472 | $event->courseid = $bigbluebuttonbn->course; |
@@ -476,13 +476,13 @@ discard block |
||
476 | 476 | $event->instance = $bigbluebuttonbn->id; |
477 | 477 | $event->timestart = $bigbluebuttonbn->openingtime; |
478 | 478 | |
479 | - if ( $bigbluebuttonbn->closingtime ){ |
|
479 | + if ($bigbluebuttonbn->closingtime) { |
|
480 | 480 | $event->durationtime = $bigbluebuttonbn->closingtime - $bigbluebuttonbn->openingtime; |
481 | 481 | } else { |
482 | 482 | $event->durationtime = 0; |
483 | 483 | } |
484 | 484 | |
485 | - if ( $event->id = $DB->get_field('event', 'id', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id)) ) { |
|
485 | + if ($event->id = $DB->get_field('event', 'id', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) { |
|
486 | 486 | $calendarevent = calendar_event::load($event->id); |
487 | 487 | $calendarevent->update($event); |
488 | 488 | } else { |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | $DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id)); |
494 | 494 | } |
495 | 495 | |
496 | - if( isset($bigbluebuttonbn->notification) && $bigbluebuttonbn->notification ) { |
|
496 | + if (isset($bigbluebuttonbn->notification) && $bigbluebuttonbn->notification) { |
|
497 | 497 | // Prepare message |
498 | 498 | $msg = new stdClass(); |
499 | 499 | |
@@ -501,35 +501,35 @@ discard block |
||
501 | 501 | $msg->action = $action; |
502 | 502 | $msg->activity_type = ""; |
503 | 503 | $msg->activity_title = $bigbluebuttonbn->name; |
504 | - $message_text = '<p>'.$msg->activity_type.' "'.$msg->activity_title.'" '.get_string('email_body_notification_meeting_has_been', 'bigbluebuttonbn').' '.$msg->action.'.</p>'; |
|
504 | + $message_text = '<p>' . $msg->activity_type . ' "' . $msg->activity_title . '" ' . get_string('email_body_notification_meeting_has_been', 'bigbluebuttonbn') . ' ' . $msg->action . '.</p>'; |
|
505 | 505 | |
506 | 506 | /// Add the meeting details to the message_body |
507 | 507 | $msg->action = ucfirst($action); |
508 | 508 | $msg->activity_description = ""; |
509 | - if( !empty($bigbluebuttonbn->intro) ) |
|
509 | + if (!empty($bigbluebuttonbn->intro)) |
|
510 | 510 | $msg->activity_description = trim($bigbluebuttonbn->intro); |
511 | 511 | $msg->activity_openingtime = ""; |
512 | 512 | if ($bigbluebuttonbn->openingtime) { |
513 | - $msg->activity_openingtime = calendar_day_representation($bigbluebuttonbn->openingtime).' '.$at.' '.calendar_time_representation($bigbluebuttonbn->openingtime); |
|
513 | + $msg->activity_openingtime = calendar_day_representation($bigbluebuttonbn->openingtime) . ' ' . $at . ' ' . calendar_time_representation($bigbluebuttonbn->openingtime); |
|
514 | 514 | } |
515 | 515 | $msg->activity_closingtime = ""; |
516 | - if ($bigbluebuttonbn->closingtime ) { |
|
517 | - $msg->activity_closingtime = calendar_day_representation($bigbluebuttonbn->closingtime).' '.$at.' '.calendar_time_representation($bigbluebuttonbn->closingtime); |
|
516 | + if ($bigbluebuttonbn->closingtime) { |
|
517 | + $msg->activity_closingtime = calendar_day_representation($bigbluebuttonbn->closingtime) . ' ' . $at . ' ' . calendar_time_representation($bigbluebuttonbn->closingtime); |
|
518 | 518 | } |
519 | 519 | $msg->activity_owner = fullname($USER); |
520 | 520 | |
521 | - $message_text .= '<p><b>'.$msg->activity_title.'</b> '.get_string('email_body_notification_meeting_details', 'bigbluebuttonbn').':'; |
|
521 | + $message_text .= '<p><b>' . $msg->activity_title . '</b> ' . get_string('email_body_notification_meeting_details', 'bigbluebuttonbn') . ':'; |
|
522 | 522 | $message_text .= '<table border="0" style="margin: 5px 0 0 20px"><tbody>'; |
523 | - $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_title', 'bigbluebuttonbn').': </td><td>'; |
|
524 | - $message_text .= $msg->activity_title.'</td></tr>'; |
|
525 | - $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_description', 'bigbluebuttonbn').': </td><td>'; |
|
526 | - $message_text .= $msg->activity_description.'</td></tr>'; |
|
527 | - $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_start_date', 'bigbluebuttonbn').': </td><td>'; |
|
528 | - $message_text .= $msg->activity_openingtime.'</td></tr>'; |
|
529 | - $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_end_date', 'bigbluebuttonbn').': </td><td>'; |
|
530 | - $message_text .= $msg->activity_closingtime.'</td></tr>'; |
|
531 | - $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.$msg->action.' '.get_string('email_body_notification_meeting_by', 'bigbluebuttonbn').': </td><td>'; |
|
532 | - $message_text .= $msg->activity_owner.'</td></tr></tbody></table></p>'; |
|
523 | + $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_title', 'bigbluebuttonbn') . ': </td><td>'; |
|
524 | + $message_text .= $msg->activity_title . '</td></tr>'; |
|
525 | + $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_description', 'bigbluebuttonbn') . ': </td><td>'; |
|
526 | + $message_text .= $msg->activity_description . '</td></tr>'; |
|
527 | + $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_start_date', 'bigbluebuttonbn') . ': </td><td>'; |
|
528 | + $message_text .= $msg->activity_openingtime . '</td></tr>'; |
|
529 | + $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_end_date', 'bigbluebuttonbn') . ': </td><td>'; |
|
530 | + $message_text .= $msg->activity_closingtime . '</td></tr>'; |
|
531 | + $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . $msg->action . ' ' . get_string('email_body_notification_meeting_by', 'bigbluebuttonbn') . ': </td><td>'; |
|
532 | + $message_text .= $msg->activity_owner . '</td></tr></tbody></table></p>'; |
|
533 | 533 | |
534 | 534 | // Send notification to all users enrolled |
535 | 535 | bigbluebuttonbn_send_notification($USER, $bigbluebuttonbn, $message_text); |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | * @param array $options additional options affecting the file serving |
581 | 581 | * @return bool false if file not found, does not return if found - justsend the file |
582 | 582 | */ |
583 | -function bigbluebuttonbn_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) { |
|
583 | +function bigbluebuttonbn_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) { |
|
584 | 584 | global $CFG, $DB; |
585 | 585 | |
586 | 586 | if ($context->contextlevel != CONTEXT_MODULE) { |
@@ -596,21 +596,21 @@ discard block |
||
596 | 596 | return false; |
597 | 597 | } |
598 | 598 | |
599 | - if( sizeof($args) > 1 ) { |
|
599 | + if (sizeof($args) > 1) { |
|
600 | 600 | $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'presentation_cache'); |
601 | 601 | $presentation_nonce_key = sha1($bigbluebuttonbn->id); |
602 | 602 | $presentation_nonce = $cache->get($presentation_nonce_key); |
603 | 603 | $presentation_nonce_value = $presentation_nonce['value']; |
604 | 604 | $presentation_nonce_counter = $presentation_nonce['counter']; |
605 | 605 | |
606 | - if( $args["0"] != $presentation_nonce_value ) { |
|
606 | + if ($args["0"] != $presentation_nonce_value) { |
|
607 | 607 | return false; |
608 | 608 | } |
609 | 609 | |
610 | 610 | //The nonce value is actually used twice because BigBlueButton reads the file two times |
611 | 611 | $presentation_nonce_counter += 1; |
612 | - if( $presentation_nonce_counter < 2 ) { |
|
613 | - $cache->set($presentation_nonce_key, array( "value" => $presentation_nonce_value, "counter" => $presentation_nonce_counter )); |
|
612 | + if ($presentation_nonce_counter < 2) { |
|
613 | + $cache->set($presentation_nonce_key, array("value" => $presentation_nonce_value, "counter" => $presentation_nonce_counter)); |
|
614 | 614 | } else { |
615 | 615 | $cache->delete($presentation_nonce_key); |
616 | 616 | } |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | } |
629 | 629 | |
630 | 630 | if ($filearea === 'presentation') { |
631 | - $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename; |
|
631 | + $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename; |
|
632 | 632 | } else { |
633 | 633 | return false; |
634 | 634 | } |
@@ -662,10 +662,10 @@ discard block |
||
662 | 662 | * @package mod_bigbluebuttonbn |
663 | 663 | * @return array a list of available roles |
664 | 664 | */ |
665 | -function bigbluebuttonbn_get_db_moodle_roles($rolename='all') { |
|
665 | +function bigbluebuttonbn_get_db_moodle_roles($rolename = 'all') { |
|
666 | 666 | global $DB; |
667 | 667 | |
668 | - if( $rolename != 'all') |
|
668 | + if ($rolename != 'all') |
|
669 | 669 | $roles = $DB->get_record('role', array('shortname' => $rolename)); |
670 | 670 | else |
671 | 671 | $roles = $DB->get_records('role', array()); |
@@ -684,22 +684,22 @@ discard block |
||
684 | 684 | |
685 | 685 | $roles = bigbluebuttonbn_get_db_moodle_roles(); |
686 | 686 | $sqluserids = array(); |
687 | - foreach($roles as $role){ |
|
687 | + foreach ($roles as $role) { |
|
688 | 688 | $users = get_role_users($role->id, $context); |
689 | - foreach($users as $user) { |
|
689 | + foreach ($users as $user) { |
|
690 | 690 | array_push($sqluserids, $user->id); |
691 | 691 | } |
692 | 692 | } |
693 | 693 | |
694 | 694 | $users_array = array(); |
695 | - if( !empty($sqluserids) ) { |
|
695 | + if (!empty($sqluserids)) { |
|
696 | 696 | $users_array = $DB->get_records_select("user", "id IN (" . implode(', ', $sqluserids) . ") AND deleted = 0"); |
697 | 697 | } |
698 | 698 | |
699 | 699 | return $users_array; |
700 | 700 | } |
701 | 701 | |
702 | -function bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message="") { |
|
702 | +function bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message = "") { |
|
703 | 703 | global $CFG, $DB; |
704 | 704 | |
705 | 705 | $context = bigbluebuttonbn_get_context_course($bigbluebuttonbn->course); |
@@ -710,17 +710,17 @@ discard block |
||
710 | 710 | $msg->user_name = fullname($sender); |
711 | 711 | $msg->user_email = $sender->email; |
712 | 712 | $msg->course_name = "$course->fullname"; |
713 | - $message .= '<p><hr/><br/>'.get_string('email_footer_sent_by', 'bigbluebuttonbn').' '.$msg->user_name.'('.$msg->user_email.') '; |
|
714 | - $message .= get_string('email_footer_sent_from', 'bigbluebuttonbn').' '.$msg->course_name.'.</p>'; |
|
713 | + $message .= '<p><hr/><br/>' . get_string('email_footer_sent_by', 'bigbluebuttonbn') . ' ' . $msg->user_name . '(' . $msg->user_email . ') '; |
|
714 | + $message .= get_string('email_footer_sent_from', 'bigbluebuttonbn') . ' ' . $msg->course_name . '.</p>'; |
|
715 | 715 | |
716 | 716 | $users = bigbluebuttonbn_get_users($context); |
717 | - foreach( $users as $user ) { |
|
718 | - if( $user->id != $sender->id ){ |
|
717 | + foreach ($users as $user) { |
|
718 | + if ($user->id != $sender->id) { |
|
719 | 719 | $messageid = message_post_message($sender, $user, $message, FORMAT_HTML); |
720 | 720 | if (!empty($messageid)) { |
721 | - error_log("Msg to ".$msg->user_name." was sent."); |
|
721 | + error_log("Msg to " . $msg->user_name . " was sent."); |
|
722 | 722 | } else { |
723 | - error_log("Msg to ".$msg->user_name." was NOT sent."); |
|
723 | + error_log("Msg to " . $msg->user_name . " was NOT sent."); |
|
724 | 724 | } |
725 | 725 | } |
726 | 726 | } |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | global $CFG; |
731 | 731 | |
732 | 732 | $version_major = bigbluebuttonbn_get_moodle_version_major(); |
733 | - if ( $version_major < '2013111800' ) { |
|
733 | + if ($version_major < '2013111800') { |
|
734 | 734 | //This is valid before v2.6 |
735 | 735 | $context = get_context_instance(CONTEXT_MODULE, $id); |
736 | 736 | } else { |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | global $CFG; |
746 | 746 | |
747 | 747 | $version_major = bigbluebuttonbn_get_moodle_version_major(); |
748 | - if ( $version_major < '2013111800' ) { |
|
748 | + if ($version_major < '2013111800') { |
|
749 | 749 | //This is valid before v2.6 |
750 | 750 | $context = get_context_instance(CONTEXT_COURSE, $id); |
751 | 751 | } else { |
@@ -758,10 +758,10 @@ discard block |
||
758 | 758 | |
759 | 759 | function bigbluebuttonbn_get_cfg_server_url() { |
760 | 760 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
761 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url)? trim(trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url),'/').'/': (isset($CFG->bigbluebuttonbn_server_url)? trim(trim($CFG->bigbluebuttonbn_server_url),'/').'/': 'http://test-install.blindsidenetworks.com/bigbluebutton/')); |
|
761 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url) ? trim(trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url), '/') . '/' : (isset($CFG->bigbluebuttonbn_server_url) ? trim(trim($CFG->bigbluebuttonbn_server_url), '/') . '/' : 'http://test-install.blindsidenetworks.com/bigbluebutton/')); |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | function bigbluebuttonbn_get_cfg_shared_secret() { |
765 | 765 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
766 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret)? trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret): (isset($CFG->bigbluebuttonbn_shared_secret)? trim($CFG->bigbluebuttonbn_shared_secret): '8cd8ef52e8e101574e400365b55e11a6')); |
|
766 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) ? trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) : (isset($CFG->bigbluebuttonbn_shared_secret) ? trim($CFG->bigbluebuttonbn_shared_secret) : '8cd8ef52e8e101574e400365b55e11a6')); |
|
767 | 767 | } |
@@ -433,12 +433,15 @@ discard block |
||
433 | 433 | $bigbluebuttonbn->timemodified = time(); |
434 | 434 | } |
435 | 435 | |
436 | - if (! isset($bigbluebuttonbn->wait)) |
|
437 | - $bigbluebuttonbn->wait = 0; |
|
438 | - if (! isset($bigbluebuttonbn->record)) |
|
439 | - $bigbluebuttonbn->record = 0; |
|
440 | - if (! isset($bigbluebuttonbn->tagging)) |
|
441 | - $bigbluebuttonbn->tagging = 0; |
|
436 | + if (! isset($bigbluebuttonbn->wait)) { |
|
437 | + $bigbluebuttonbn->wait = 0; |
|
438 | + } |
|
439 | + if (! isset($bigbluebuttonbn->record)) { |
|
440 | + $bigbluebuttonbn->record = 0; |
|
441 | + } |
|
442 | + if (! isset($bigbluebuttonbn->tagging)) { |
|
443 | + $bigbluebuttonbn->tagging = 0; |
|
444 | + } |
|
442 | 445 | |
443 | 446 | $bigbluebuttonbn->participants = htmlspecialchars_decode($bigbluebuttonbn->participants); |
444 | 447 | } |
@@ -506,8 +509,9 @@ discard block |
||
506 | 509 | /// Add the meeting details to the message_body |
507 | 510 | $msg->action = ucfirst($action); |
508 | 511 | $msg->activity_description = ""; |
509 | - if( !empty($bigbluebuttonbn->intro) ) |
|
510 | - $msg->activity_description = trim($bigbluebuttonbn->intro); |
|
512 | + if( !empty($bigbluebuttonbn->intro) ) { |
|
513 | + $msg->activity_description = trim($bigbluebuttonbn->intro); |
|
514 | + } |
|
511 | 515 | $msg->activity_openingtime = ""; |
512 | 516 | if ($bigbluebuttonbn->openingtime) { |
513 | 517 | $msg->activity_openingtime = calendar_day_representation($bigbluebuttonbn->openingtime).' '.$at.' '.calendar_time_representation($bigbluebuttonbn->openingtime); |
@@ -665,10 +669,11 @@ discard block |
||
665 | 669 | function bigbluebuttonbn_get_db_moodle_roles($rolename='all') { |
666 | 670 | global $DB; |
667 | 671 | |
668 | - if( $rolename != 'all') |
|
669 | - $roles = $DB->get_record('role', array('shortname' => $rolename)); |
|
670 | - else |
|
671 | - $roles = $DB->get_records('role', array()); |
|
672 | + if( $rolename != 'all') { |
|
673 | + $roles = $DB->get_record('role', array('shortname' => $rolename)); |
|
674 | + } else { |
|
675 | + $roles = $DB->get_records('role', array()); |
|
676 | + } |
|
672 | 677 | |
673 | 678 | return $roles; |
674 | 679 | } |
@@ -190,27 +190,27 @@ |
||
190 | 190 | |
191 | 191 | //// Configuration for "scheduled duration" feature |
192 | 192 | if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled) ) { |
193 | - $settings->add( new admin_setting_heading('config_scheduled', |
|
194 | - get_string('config_scheduled', 'bigbluebuttonbn'), |
|
195 | - get_string('config_scheduled_description', 'bigbluebuttonbn'))); |
|
193 | + $settings->add( new admin_setting_heading('config_scheduled', |
|
194 | + get_string('config_scheduled', 'bigbluebuttonbn'), |
|
195 | + get_string('config_scheduled_description', 'bigbluebuttonbn'))); |
|
196 | 196 | |
197 | - // calculated duration for 'scheduled session' feature |
|
198 | - $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_scheduled_duration_enabled', |
|
199 | - get_string('config_scheduled_duration_enabled', 'bigbluebuttonbn'), |
|
200 | - get_string('config_scheduled_duration_enabled_description', 'bigbluebuttonbn'), |
|
201 | - 1)); |
|
197 | + // calculated duration for 'scheduled session' feature |
|
198 | + $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_scheduled_duration_enabled', |
|
199 | + get_string('config_scheduled_duration_enabled', 'bigbluebuttonbn'), |
|
200 | + get_string('config_scheduled_duration_enabled_description', 'bigbluebuttonbn'), |
|
201 | + 1)); |
|
202 | 202 | |
203 | - // compensatory time for 'scheduled session' feature |
|
204 | - $settings->add(new admin_setting_configtext('bigbluebuttonbn_scheduled_duration_compensation', |
|
205 | - get_string('config_scheduled_duration_compensation', 'bigbluebuttonbn'), |
|
206 | - get_string('config_scheduled_duration_compensation_description', 'bigbluebuttonbn'), |
|
207 | - 10, PARAM_INT)); |
|
203 | + // compensatory time for 'scheduled session' feature |
|
204 | + $settings->add(new admin_setting_configtext('bigbluebuttonbn_scheduled_duration_compensation', |
|
205 | + get_string('config_scheduled_duration_compensation', 'bigbluebuttonbn'), |
|
206 | + get_string('config_scheduled_duration_compensation_description', 'bigbluebuttonbn'), |
|
207 | + 10, PARAM_INT)); |
|
208 | 208 | |
209 | - // pre-opening time for 'scheduled session' feature |
|
210 | - $settings->add(new admin_setting_configtext('bigbluebuttonbn_scheduled_pre_opening', |
|
211 | - get_string('config_scheduled_pre_opening', 'bigbluebuttonbn'), |
|
212 | - get_string('config_scheduled_pre_opening_description', 'bigbluebuttonbn'), |
|
213 | - 10, PARAM_INT)); |
|
209 | + // pre-opening time for 'scheduled session' feature |
|
210 | + $settings->add(new admin_setting_configtext('bigbluebuttonbn_scheduled_pre_opening', |
|
211 | + get_string('config_scheduled_pre_opening', 'bigbluebuttonbn'), |
|
212 | + get_string('config_scheduled_pre_opening_description', 'bigbluebuttonbn'), |
|
213 | + 10, PARAM_INT)); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | //// Configuration for defining the default role/user that will be moderator on new activities |
@@ -13,52 +13,52 @@ discard block |
||
13 | 13 | |
14 | 14 | global $BIGBLUEBUTTONBN_CFG; |
15 | 15 | |
16 | -require_once(dirname(__FILE__).'/locallib.php'); |
|
16 | +require_once(dirname(__FILE__) . '/locallib.php'); |
|
17 | 17 | |
18 | 18 | if ($ADMIN->fulltree) { |
19 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url) || |
|
20 | - !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) ) { |
|
21 | - $settings->add( new admin_setting_heading('bigbluebuttonbn_config_general', |
|
19 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url) || |
|
20 | + !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret)) { |
|
21 | + $settings->add(new admin_setting_heading('bigbluebuttonbn_config_general', |
|
22 | 22 | get_string('config_general', 'bigbluebuttonbn'), |
23 | 23 | get_string('config_general_description', 'bigbluebuttonbn'))); |
24 | 24 | |
25 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url) ) { |
|
26 | - $settings->add( new admin_setting_configtext( 'bigbluebuttonbn_server_url', |
|
27 | - get_string( 'config_server_url', 'bigbluebuttonbn' ), |
|
28 | - get_string( 'config_server_url_description', 'bigbluebuttonbn' ), |
|
25 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url)) { |
|
26 | + $settings->add(new admin_setting_configtext('bigbluebuttonbn_server_url', |
|
27 | + get_string('config_server_url', 'bigbluebuttonbn'), |
|
28 | + get_string('config_server_url_description', 'bigbluebuttonbn'), |
|
29 | 29 | BIGBLUEBUTTONBN_DEFAULT_SERVER_URL)); |
30 | 30 | } |
31 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) ) { |
|
32 | - $settings->add( new admin_setting_configtext( 'bigbluebuttonbn_shared_secret', |
|
33 | - get_string( 'config_shared_secret', 'bigbluebuttonbn' ), |
|
34 | - get_string( 'config_shared_secret_description', 'bigbluebuttonbn' ), |
|
31 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret)) { |
|
32 | + $settings->add(new admin_setting_configtext('bigbluebuttonbn_shared_secret', |
|
33 | + get_string('config_shared_secret', 'bigbluebuttonbn'), |
|
34 | + get_string('config_shared_secret_description', 'bigbluebuttonbn'), |
|
35 | 35 | BIGBLUEBUTTONBN_DEFAULT_SHARED_SECRET)); |
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | 39 | //// Configuration for 'recording' feature |
40 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default) || |
|
40 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default) || |
|
41 | 41 | !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable) || |
42 | - !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled) ) { |
|
43 | - $settings->add( new admin_setting_heading('bigbluebuttonbn_recording', |
|
42 | + !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled)) { |
|
43 | + $settings->add(new admin_setting_heading('bigbluebuttonbn_recording', |
|
44 | 44 | get_string('config_feature_recording', 'bigbluebuttonbn'), |
45 | 45 | get_string('config_feature_recording_description', 'bigbluebuttonbn'))); |
46 | 46 | |
47 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default) ) { |
|
47 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default)) { |
|
48 | 48 | // default value for 'recording' feature |
49 | 49 | $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_recording_default', |
50 | 50 | get_string('config_feature_recording_default', 'bigbluebuttonbn'), |
51 | 51 | get_string('config_feature_recording_default_description', 'bigbluebuttonbn'), |
52 | 52 | 1)); |
53 | 53 | } |
54 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable) ) { |
|
54 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable)) { |
|
55 | 55 | // UI for 'recording' feature |
56 | 56 | $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_recording_editable', |
57 | 57 | get_string('config_feature_recording_editable', 'bigbluebuttonbn'), |
58 | 58 | get_string('config_feature_recording_editable_description', 'bigbluebuttonbn'), |
59 | 59 | 1)); |
60 | 60 | } |
61 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled) ) { |
|
61 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled)) { |
|
62 | 62 | // Front panel for 'recording' managment feature |
63 | 63 | $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_recording_icons_enabled', |
64 | 64 | get_string('config_feature_recording_icons_enabled', 'bigbluebuttonbn'), |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | //// Configuration for 'recording tagging' feature |
71 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default) || |
|
72 | - !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable) ) { |
|
73 | - $settings->add( new admin_setting_heading('bigbluebuttonbn_recordingtagging', |
|
71 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default) || |
|
72 | + !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable)) { |
|
73 | + $settings->add(new admin_setting_heading('bigbluebuttonbn_recordingtagging', |
|
74 | 74 | get_string('config_feature_recordingtagging', 'bigbluebuttonbn'), |
75 | 75 | get_string('config_feature_recordingtagging_description', 'bigbluebuttonbn'))); |
76 | 76 | |
77 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default) ) { |
|
77 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default)) { |
|
78 | 78 | // default value for 'recording tagging' feature |
79 | 79 | $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_recordingtagging_default', |
80 | 80 | get_string('config_feature_recordingtagging_default', 'bigbluebuttonbn'), |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | 0)); |
83 | 83 | } |
84 | 84 | // UI for 'recording tagging' feature |
85 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable) ) { |
|
85 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable)) { |
|
86 | 86 | $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_recordingtagging_editable', |
87 | 87 | get_string('config_feature_recordingtagging_editable', 'bigbluebuttonbn'), |
88 | 88 | get_string('config_feature_recordingtagging_editable_description', 'bigbluebuttonbn'), |
@@ -91,20 +91,20 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | //// Configuration for 'import recordings' feature |
94 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled) || |
|
95 | - !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled) ) { |
|
96 | - $settings->add( new admin_setting_heading('bigbluebuttonbn_importrecordings', |
|
94 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled) || |
|
95 | + !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled)) { |
|
96 | + $settings->add(new admin_setting_heading('bigbluebuttonbn_importrecordings', |
|
97 | 97 | get_string('config_feature_importrecordings', 'bigbluebuttonbn'), |
98 | 98 | get_string('config_feature_importrecordings_description', 'bigbluebuttonbn'))); |
99 | 99 | |
100 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled) ) { |
|
100 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled)) { |
|
101 | 101 | // default value for 'import recordings' feature |
102 | 102 | $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_importrecordings_enabled', |
103 | 103 | get_string('config_feature_importrecordings_enabled', 'bigbluebuttonbn'), |
104 | 104 | get_string('config_feature_importrecordings_enabled_description', 'bigbluebuttonbn'), |
105 | 105 | 0)); |
106 | 106 | } |
107 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled) ) { |
|
107 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled)) { |
|
108 | 108 | // consider deleted activities for 'import recordings' feature |
109 | 109 | $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_importrecordings_from_deleted_activities_enabled', |
110 | 110 | get_string('config_feature_importrecordings_from_deleted_activities_enabled', 'bigbluebuttonbn'), |
@@ -114,36 +114,36 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | //// Configuration for wait for moderator feature |
117 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default) || |
|
117 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default) || |
|
118 | 118 | !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable) || |
119 | 119 | !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval) || |
120 | - !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl) ) { |
|
121 | - $settings->add( new admin_setting_heading('bigbluebuttonbn_feature_waitformoderator', |
|
120 | + !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl)) { |
|
121 | + $settings->add(new admin_setting_heading('bigbluebuttonbn_feature_waitformoderator', |
|
122 | 122 | get_string('config_feature_waitformoderator', 'bigbluebuttonbn'), |
123 | 123 | get_string('config_feature_waitformoderator_description', 'bigbluebuttonbn'))); |
124 | 124 | |
125 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default) ) { |
|
125 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default)) { |
|
126 | 126 | //default value for 'wait for moderator' feature |
127 | 127 | $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_waitformoderator_default', |
128 | 128 | get_string('config_feature_waitformoderator_default', 'bigbluebuttonbn'), |
129 | 129 | get_string('config_feature_waitformoderator_default_description', 'bigbluebuttonbn'), |
130 | 130 | 0)); |
131 | 131 | } |
132 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable) ) { |
|
132 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable)) { |
|
133 | 133 | // UI for 'wait for moderator' feature |
134 | 134 | $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_waitformoderator_editable', |
135 | 135 | get_string('config_feature_waitformoderator_editable', 'bigbluebuttonbn'), |
136 | 136 | get_string('config_feature_waitformoderator_editable_description', 'bigbluebuttonbn'), |
137 | 137 | 1)); |
138 | 138 | } |
139 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval) ) { |
|
139 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval)) { |
|
140 | 140 | //ping interval value for 'wait for moderator' feature |
141 | 141 | $settings->add(new admin_setting_configtext('bigbluebuttonbn_waitformoderator_ping_interval', |
142 | 142 | get_string('config_feature_waitformoderator_ping_interval', 'bigbluebuttonbn'), |
143 | 143 | get_string('config_feature_waitformoderator_ping_interval_description', 'bigbluebuttonbn'), |
144 | 144 | 10, PARAM_INT)); |
145 | 145 | } |
146 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl) ) { |
|
146 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl)) { |
|
147 | 147 | //cache TTL value for 'wait for moderator' feature |
148 | 148 | $settings->add(new admin_setting_configtext('bigbluebuttonbn_waitformoderator_cache_ttl', |
149 | 149 | get_string('config_feature_waitformoderator_cache_ttl', 'bigbluebuttonbn'), |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | //// Configuration for "static voice bridge" feature |
156 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable) ) { |
|
157 | - $settings->add( new admin_setting_heading('bigbluebuttonbn_feature_voicebridge', |
|
156 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable)) { |
|
157 | + $settings->add(new admin_setting_heading('bigbluebuttonbn_feature_voicebridge', |
|
158 | 158 | get_string('config_feature_voicebridge', 'bigbluebuttonbn'), |
159 | 159 | get_string('config_feature_voicebridge_description', 'bigbluebuttonbn'))); |
160 | 160 | |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | //// Configuration for "preupload presentation" feature |
169 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled) ) { |
|
169 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled)) { |
|
170 | 170 | // This feature only works if curl is installed |
171 | 171 | if (extension_loaded('curl')) { |
172 | - $settings->add( new admin_setting_heading('bigbluebuttonbn_feature_preuploadpresentation', |
|
172 | + $settings->add(new admin_setting_heading('bigbluebuttonbn_feature_preuploadpresentation', |
|
173 | 173 | get_string('config_feature_preuploadpresentation', 'bigbluebuttonbn'), |
174 | 174 | get_string('config_feature_preuploadpresentation_description', 'bigbluebuttonbn') |
175 | 175 | )); |
@@ -180,29 +180,29 @@ discard block |
||
180 | 180 | get_string('config_feature_preuploadpresentation_enabled_description', 'bigbluebuttonbn'), |
181 | 181 | 0)); |
182 | 182 | } else { |
183 | - $settings->add( new admin_setting_heading('bigbluebuttonbn_feature_preuploadpresentation', |
|
183 | + $settings->add(new admin_setting_heading('bigbluebuttonbn_feature_preuploadpresentation', |
|
184 | 184 | get_string('config_feature_preuploadpresentation', 'bigbluebuttonbn'), |
185 | - get_string('config_feature_preuploadpresentation_description', 'bigbluebuttonbn').'<br><br>'. |
|
186 | - '<div class="form-defaultinfo">'.get_string('config_warning_curl_not_installed', 'bigbluebuttonbn').'</div><br>' |
|
185 | + get_string('config_feature_preuploadpresentation_description', 'bigbluebuttonbn') . '<br><br>' . |
|
186 | + '<div class="form-defaultinfo">' . get_string('config_warning_curl_not_installed', 'bigbluebuttonbn') . '</div><br>' |
|
187 | 187 | )); |
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
191 | 191 | //// Configuration for "user limit" feature |
192 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default) || |
|
193 | - !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable) ) { |
|
194 | - $settings->add( new admin_setting_heading('config_userlimit', |
|
192 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default) || |
|
193 | + !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable)) { |
|
194 | + $settings->add(new admin_setting_heading('config_userlimit', |
|
195 | 195 | get_string('config_feature_userlimit', 'bigbluebuttonbn'), |
196 | 196 | get_string('config_feature_userlimit_description', 'bigbluebuttonbn'))); |
197 | 197 | |
198 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default) ) { |
|
198 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default)) { |
|
199 | 199 | //default value for 'user limit' feature |
200 | 200 | $settings->add(new admin_setting_configtext('bigbluebuttonbn_userlimit_default', |
201 | 201 | get_string('config_feature_userlimit_default', 'bigbluebuttonbn'), |
202 | 202 | get_string('config_feature_userlimit_default_description', 'bigbluebuttonbn'), |
203 | 203 | 0, PARAM_INT)); |
204 | 204 | } |
205 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable) ) { |
|
205 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable)) { |
|
206 | 206 | // UI for 'user limit' feature |
207 | 207 | $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_userlimit_editable', |
208 | 208 | get_string('config_feature_userlimit_editable', 'bigbluebuttonbn'), |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | } |
213 | 213 | |
214 | 214 | //// Configuration for "scheduled duration" feature |
215 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled) ) { |
|
216 | - $settings->add( new admin_setting_heading('config_scheduled', |
|
215 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled)) { |
|
216 | + $settings->add(new admin_setting_heading('config_scheduled', |
|
217 | 217 | get_string('config_scheduled', 'bigbluebuttonbn'), |
218 | 218 | get_string('config_scheduled_description', 'bigbluebuttonbn'))); |
219 | 219 | |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | } |
238 | 238 | |
239 | 239 | //// Configuration for defining the default role/user that will be moderator on new activities |
240 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default) ) { |
|
241 | - $settings->add( new admin_setting_heading('bigbluebuttonbn_permission', |
|
240 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default)) { |
|
241 | + $settings->add(new admin_setting_heading('bigbluebuttonbn_permission', |
|
242 | 242 | get_string('config_permission', 'bigbluebuttonbn'), |
243 | 243 | get_string('config_permission_description', 'bigbluebuttonbn'))); |
244 | 244 | |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | } |
253 | 253 | |
254 | 254 | //// Configuration for "send notifications" feature |
255 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled) ) { |
|
256 | - $settings->add( new admin_setting_heading('bigbluebuttonbn_feature_sendnotifications', |
|
255 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled)) { |
|
256 | + $settings->add(new admin_setting_heading('bigbluebuttonbn_feature_sendnotifications', |
|
257 | 257 | get_string('config_feature_sendnotifications', 'bigbluebuttonbn'), |
258 | 258 | get_string('config_feature_sendnotifications_description', 'bigbluebuttonbn'))); |
259 | 259 | |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | } |
266 | 266 | |
267 | 267 | //// Configuration for extended BN capabilities |
268 | - if( bigbluebuttonbn_server_offers_bn_capabilities() ) { |
|
268 | + if (bigbluebuttonbn_server_offers_bn_capabilities()) { |
|
269 | 269 | //// Configuration for 'notify users when recording ready' feature |
270 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled) ) { |
|
271 | - $settings->add( new admin_setting_heading('bigbluebuttonbn_extended_capabilities', |
|
270 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled)) { |
|
271 | + $settings->add(new admin_setting_heading('bigbluebuttonbn_extended_capabilities', |
|
272 | 272 | get_string('config_extended_capabilities', 'bigbluebuttonbn'), |
273 | 273 | get_string('config_extended_capabilities_description', 'bigbluebuttonbn'))); |
274 | 274 |
@@ -183,30 +183,30 @@ discard block |
||
183 | 183 | $mform->setType('participants', PARAM_TEXT); |
184 | 184 | |
185 | 185 | $html_participant_selection = ''. |
186 | - '<div id="fitem_bigbluebuttonbn_participant_selection" class="fitem fitem_fselect">'."\n". |
|
187 | - ' <div class="fitemtitle">'."\n". |
|
188 | - ' <label for="bigbluebuttonbn_participant_selectiontype">'.get_string('mod_form_field_participant_add', 'bigbluebuttonbn').' </label>'."\n". |
|
189 | - ' </div>'."\n". |
|
190 | - ' <div class="felement fselect">'."\n". |
|
191 | - ' <select id="bigbluebuttonbn_participant_selection_type" onchange="bigbluebuttonbn_participant_selection_set(); return 0;">'."\n". |
|
192 | - ' <option value="all" selected="selected">'.get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn').'</option>'."\n". |
|
193 | - ' <option value="role">'.get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn').'</option>'."\n". |
|
194 | - ' <option value="user">'.get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn').'</option>'."\n". |
|
195 | - ' </select>'."\n". |
|
196 | - ' '."\n". |
|
197 | - ' <select id="bigbluebuttonbn_participant_selection" disabled="disabled">'."\n". |
|
198 | - ' <option value="all" selected="selected">---------------</option>'."\n". |
|
199 | - ' </select>'."\n". |
|
200 | - ' '."\n". |
|
201 | - ' <input value="'.get_string('mod_form_field_participant_list_action_add', 'bigbluebuttonbn').'" type="button" id="id_addselectionid" onclick="bigbluebuttonbn_participant_add(); return 0;" />'."\n". |
|
202 | - ' </div>'."\n". |
|
203 | - '</div>'."\n". |
|
204 | - '<div id="fitem_bigbluebuttonbn_participant_list" class="fitem">'."\n". |
|
205 | - ' <div class="fitemtitle">'."\n". |
|
206 | - ' <label for="bigbluebuttonbn_participant_list">'.get_string('mod_form_field_participant_list', 'bigbluebuttonbn').' </label>'."\n". |
|
207 | - ' </div>'."\n". |
|
208 | - ' <div class="felement fselect">'."\n". |
|
209 | - ' <table id="participant_list_table">'."\n"; |
|
186 | + '<div id="fitem_bigbluebuttonbn_participant_selection" class="fitem fitem_fselect">'."\n". |
|
187 | + ' <div class="fitemtitle">'."\n". |
|
188 | + ' <label for="bigbluebuttonbn_participant_selectiontype">'.get_string('mod_form_field_participant_add', 'bigbluebuttonbn').' </label>'."\n". |
|
189 | + ' </div>'."\n". |
|
190 | + ' <div class="felement fselect">'."\n". |
|
191 | + ' <select id="bigbluebuttonbn_participant_selection_type" onchange="bigbluebuttonbn_participant_selection_set(); return 0;">'."\n". |
|
192 | + ' <option value="all" selected="selected">'.get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn').'</option>'."\n". |
|
193 | + ' <option value="role">'.get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn').'</option>'."\n". |
|
194 | + ' <option value="user">'.get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn').'</option>'."\n". |
|
195 | + ' </select>'."\n". |
|
196 | + ' '."\n". |
|
197 | + ' <select id="bigbluebuttonbn_participant_selection" disabled="disabled">'."\n". |
|
198 | + ' <option value="all" selected="selected">---------------</option>'."\n". |
|
199 | + ' </select>'."\n". |
|
200 | + ' '."\n". |
|
201 | + ' <input value="'.get_string('mod_form_field_participant_list_action_add', 'bigbluebuttonbn').'" type="button" id="id_addselectionid" onclick="bigbluebuttonbn_participant_add(); return 0;" />'."\n". |
|
202 | + ' </div>'."\n". |
|
203 | + '</div>'."\n". |
|
204 | + '<div id="fitem_bigbluebuttonbn_participant_list" class="fitem">'."\n". |
|
205 | + ' <div class="fitemtitle">'."\n". |
|
206 | + ' <label for="bigbluebuttonbn_participant_list">'.get_string('mod_form_field_participant_list', 'bigbluebuttonbn').' </label>'."\n". |
|
207 | + ' </div>'."\n". |
|
208 | + ' <div class="felement fselect">'."\n". |
|
209 | + ' <table id="participant_list_table">'."\n"; |
|
210 | 210 | |
211 | 211 | // Add participant list |
212 | 212 | foreach($participant_list as $participant){ |
@@ -243,11 +243,11 @@ discard block |
||
243 | 243 | } |
244 | 244 | |
245 | 245 | $html_participant_selection .= ''. |
246 | - ' </table>'."\n". |
|
247 | - ' </div>'."\n". |
|
248 | - '</div>'."\n". |
|
249 | - '<script type="text/javascript" src="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/mod_form.js">'."\n". |
|
250 | - '</script>'."\n"; |
|
246 | + ' </table>'."\n". |
|
247 | + ' </div>'."\n". |
|
248 | + '</div>'."\n". |
|
249 | + '<script type="text/javascript" src="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/mod_form.js">'."\n". |
|
250 | + '</script>'."\n"; |
|
251 | 251 | |
252 | 252 | $mform->addElement('html', $html_participant_selection); |
253 | 253 | |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_selection = {"all": [], "role": '.json_encode($roles).', "user": '.bigbluebuttonbn_get_users_json($users).'}; </script>'); |
256 | 256 | $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_list = '.json_encode($participant_list).'; </script>'); |
257 | 257 | $bigbluebuttonbn_strings = Array( "as" => get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn'), |
258 | - "viewer" => get_string('mod_form_field_participant_bbb_role_viewer', 'bigbluebuttonbn'), |
|
259 | - "moderator" => get_string('mod_form_field_participant_bbb_role_moderator', 'bigbluebuttonbn'), |
|
260 | - "remove" => get_string('mod_form_field_participant_list_action_remove', 'bigbluebuttonbn'), |
|
258 | + "viewer" => get_string('mod_form_field_participant_bbb_role_viewer', 'bigbluebuttonbn'), |
|
259 | + "moderator" => get_string('mod_form_field_participant_bbb_role_moderator', 'bigbluebuttonbn'), |
|
260 | + "remove" => get_string('mod_form_field_participant_list_action_remove', 'bigbluebuttonbn'), |
|
261 | 261 | ); |
262 | 262 | $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_strings = '.json_encode($bigbluebuttonbn_strings).'; </script>'); |
263 | 263 | //------------------------------------------------------------------------------- |
@@ -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); |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | |
12 | 12 | defined('MOODLE_INTERNAL') || die(); |
13 | 13 | |
14 | -require_once(dirname(__FILE__).'/locallib.php'); |
|
15 | -require_once($CFG->dirroot.'/course/moodleform_mod.php'); |
|
14 | +require_once(dirname(__FILE__) . '/locallib.php'); |
|
15 | +require_once($CFG->dirroot . '/course/moodleform_mod.php'); |
|
16 | 16 | |
17 | 17 | class mod_bigbluebuttonbn_mod_form extends moodleform_mod { |
18 | 18 | |
@@ -50,24 +50,24 @@ discard block |
||
50 | 50 | |
51 | 51 | //Validates if the BigBlueButton server is running |
52 | 52 | $serverVersion = bigbluebuttonbn_getServerVersion($endpoint); |
53 | - if ( !isset($serverVersion) ) { |
|
54 | - print_error( 'general_error_unable_connect', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' ); |
|
53 | + if (!isset($serverVersion)) { |
|
54 | + print_error('general_error_unable_connect', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
55 | 55 | } |
56 | 56 | |
57 | - $mform =& $this->_form; |
|
58 | - $current_activity =& $this->current; |
|
57 | + $mform = & $this->_form; |
|
58 | + $current_activity = & $this->current; |
|
59 | 59 | |
60 | 60 | //------------------------------------------------------------------------------- |
61 | 61 | // First block starts here |
62 | 62 | //------------------------------------------------------------------------------- |
63 | 63 | $mform->addElement('header', 'general', get_string('mod_form_block_general', 'bigbluebuttonbn')); |
64 | 64 | |
65 | - $mform->addElement('text', 'name', get_string('mod_form_field_name','bigbluebuttonbn'), 'maxlength="64" size="32"'); |
|
65 | + $mform->addElement('text', 'name', get_string('mod_form_field_name', 'bigbluebuttonbn'), 'maxlength="64" size="32"'); |
|
66 | 66 | $mform->setType('name', PARAM_TEXT); |
67 | 67 | $mform->addRule('name', null, 'required', null, 'client'); |
68 | 68 | |
69 | 69 | $version_major = bigbluebuttonbn_get_moodle_version_major(); |
70 | - if ( $version_major < '2015051100' ) { |
|
70 | + if ($version_major < '2015051100') { |
|
71 | 71 | //This is valid before v2.9 |
72 | 72 | $this->add_intro_editor(false, get_string('mod_form_field_intro', 'bigbluebuttonbn')); |
73 | 73 | } else { |
@@ -77,60 +77,60 @@ discard block |
||
77 | 77 | $mform->setAdvanced('introeditor'); |
78 | 78 | $mform->setAdvanced('showdescription'); |
79 | 79 | |
80 | - $mform->addElement('textarea', 'welcome', get_string('mod_form_field_welcome','bigbluebuttonbn'), 'wrap="virtual" rows="5" cols="60"'); |
|
80 | + $mform->addElement('textarea', 'welcome', get_string('mod_form_field_welcome', 'bigbluebuttonbn'), 'wrap="virtual" rows="5" cols="60"'); |
|
81 | 81 | $mform->addHelpButton('welcome', 'mod_form_field_welcome', 'bigbluebuttonbn'); |
82 | 82 | $mform->setType('welcome', PARAM_TEXT); |
83 | 83 | $mform->setAdvanced('welcome'); |
84 | 84 | |
85 | - if ( $voicebridge_editable ) { |
|
86 | - $mform->addElement('text', 'voicebridge', get_string('mod_form_field_voicebridge','bigbluebuttonbn'), array('maxlength'=>4, 'size'=>6)); |
|
85 | + if ($voicebridge_editable) { |
|
86 | + $mform->addElement('text', 'voicebridge', get_string('mod_form_field_voicebridge', 'bigbluebuttonbn'), array('maxlength'=>4, 'size'=>6)); |
|
87 | 87 | $mform->addRule('voicebridge', get_string('mod_form_field_voicebridge_format_error', 'bigbluebuttonbn'), 'numeric', '####', 'server'); |
88 | - $mform->setDefault( 'voicebridge', 0 ); |
|
88 | + $mform->setDefault('voicebridge', 0); |
|
89 | 89 | $mform->addHelpButton('voicebridge', 'mod_form_field_voicebridge', 'bigbluebuttonbn'); |
90 | 90 | $mform->setAdvanced('voicebridge'); |
91 | 91 | } |
92 | 92 | $mform->setType('voicebridge', PARAM_INT); |
93 | 93 | |
94 | - if ( $waitformoderator_editable ) { |
|
94 | + if ($waitformoderator_editable) { |
|
95 | 95 | $mform->addElement('checkbox', 'wait', get_string('mod_form_field_wait', 'bigbluebuttonbn')); |
96 | 96 | $mform->addHelpButton('wait', 'mod_form_field_wait', 'bigbluebuttonbn'); |
97 | - $mform->setDefault( 'wait', $waitformoderator_default ); |
|
97 | + $mform->setDefault('wait', $waitformoderator_default); |
|
98 | 98 | $mform->setAdvanced('wait'); |
99 | 99 | } else { |
100 | - $mform->addElement('hidden', 'wait', $waitformoderator_default ); |
|
100 | + $mform->addElement('hidden', 'wait', $waitformoderator_default); |
|
101 | 101 | } |
102 | 102 | $mform->setType('wait', PARAM_INT); |
103 | 103 | |
104 | - if ( $userlimit_editable ) { |
|
105 | - $mform->addElement('text', 'userlimit', get_string('mod_form_field_userlimit','bigbluebuttonbn'), 'maxlength="3" size="5"' ); |
|
104 | + if ($userlimit_editable) { |
|
105 | + $mform->addElement('text', 'userlimit', get_string('mod_form_field_userlimit', 'bigbluebuttonbn'), 'maxlength="3" size="5"'); |
|
106 | 106 | $mform->addHelpButton('userlimit', 'mod_form_field_userlimit', 'bigbluebuttonbn'); |
107 | - $mform->setDefault( 'userlimit', $userlimit_default ); |
|
107 | + $mform->setDefault('userlimit', $userlimit_default); |
|
108 | 108 | } else { |
109 | - $mform->addElement('hidden', 'userlimit', $userlimit_default ); |
|
109 | + $mform->addElement('hidden', 'userlimit', $userlimit_default); |
|
110 | 110 | } |
111 | 111 | $mform->setType('userlimit', PARAM_TEXT); |
112 | 112 | |
113 | - if ( floatval($serverVersion) >= 0.8 ) { |
|
114 | - if ( $recording_editable ) { |
|
113 | + if (floatval($serverVersion) >= 0.8) { |
|
114 | + if ($recording_editable) { |
|
115 | 115 | $mform->addElement('checkbox', 'record', get_string('mod_form_field_record', 'bigbluebuttonbn')); |
116 | - $mform->setDefault( 'record', $recording_default ); |
|
116 | + $mform->setDefault('record', $recording_default); |
|
117 | 117 | $mform->setAdvanced('record'); |
118 | 118 | } else { |
119 | 119 | $mform->addElement('hidden', 'record', $recording_default); |
120 | 120 | } |
121 | 121 | $mform->setType('record', PARAM_INT); |
122 | 122 | |
123 | - if ( $recording_tagging_editable ) { |
|
123 | + if ($recording_tagging_editable) { |
|
124 | 124 | $mform->addElement('checkbox', 'tagging', get_string('mod_form_field_recordingtagging', 'bigbluebuttonbn')); |
125 | 125 | $mform->setDefault('tagging', $recording_tagging_default); |
126 | 126 | $mform->setAdvanced('tagging'); |
127 | 127 | } else { |
128 | - $mform->addElement('hidden', 'tagging', $recording_tagging_default ); |
|
128 | + $mform->addElement('hidden', 'tagging', $recording_tagging_default); |
|
129 | 129 | } |
130 | 130 | $mform->setType('tagging', PARAM_INT); |
131 | 131 | } |
132 | 132 | |
133 | - if ( $sendnotifications_enabled ) { |
|
133 | + if ($sendnotifications_enabled) { |
|
134 | 134 | $mform->addElement('checkbox', 'notification', get_string('mod_form_field_notification', 'bigbluebuttonbn')); |
135 | 135 | if ($this->current->instance) { |
136 | 136 | $mform->addHelpButton('notification', 'mod_form_field_notification', 'bigbluebuttonbn'); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | //------------------------------------------------------------------------------- |
149 | 149 | // Second block starts here |
150 | 150 | //------------------------------------------------------------------------------- |
151 | - if ( $preuploadpresentation_enabled ) { |
|
151 | + if ($preuploadpresentation_enabled) { |
|
152 | 152 | $mform->addElement('header', 'preupload', get_string('mod_form_block_presentation', 'bigbluebuttonbn')); |
153 | 153 | $mform->setExpanded('preupload'); |
154 | 154 | |
@@ -179,83 +179,83 @@ discard block |
||
179 | 179 | $mform->addElement('hidden', 'participants', json_encode($participant_list)); |
180 | 180 | $mform->setType('participants', PARAM_TEXT); |
181 | 181 | |
182 | - $html_participant_selection = ''. |
|
183 | - '<div id="fitem_bigbluebuttonbn_participant_selection" class="fitem fitem_fselect">'."\n". |
|
184 | - ' <div class="fitemtitle">'."\n". |
|
185 | - ' <label for="bigbluebuttonbn_participant_selectiontype">'.get_string('mod_form_field_participant_add', 'bigbluebuttonbn').' </label>'."\n". |
|
186 | - ' </div>'."\n". |
|
187 | - ' <div class="felement fselect">'."\n". |
|
188 | - ' <select id="bigbluebuttonbn_participant_selection_type" onchange="bigbluebuttonbn_participant_selection_set(); return 0;">'."\n". |
|
189 | - ' <option value="all" selected="selected">'.get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn').'</option>'."\n". |
|
190 | - ' <option value="role">'.get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn').'</option>'."\n". |
|
191 | - ' <option value="user">'.get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn').'</option>'."\n". |
|
192 | - ' </select>'."\n". |
|
193 | - ' '."\n". |
|
194 | - ' <select id="bigbluebuttonbn_participant_selection" disabled="disabled">'."\n". |
|
195 | - ' <option value="all" selected="selected">---------------</option>'."\n". |
|
196 | - ' </select>'."\n". |
|
197 | - ' '."\n". |
|
198 | - ' <input value="'.get_string('mod_form_field_participant_list_action_add', 'bigbluebuttonbn').'" type="button" id="id_addselectionid" onclick="bigbluebuttonbn_participant_add(); return 0;" />'."\n". |
|
199 | - ' </div>'."\n". |
|
200 | - '</div>'."\n". |
|
201 | - '<div id="fitem_bigbluebuttonbn_participant_list" class="fitem">'."\n". |
|
202 | - ' <div class="fitemtitle">'."\n". |
|
203 | - ' <label for="bigbluebuttonbn_participant_list">'.get_string('mod_form_field_participant_list', 'bigbluebuttonbn').' </label>'."\n". |
|
204 | - ' </div>'."\n". |
|
205 | - ' <div class="felement fselect">'."\n". |
|
206 | - ' <table id="participant_list_table">'."\n"; |
|
182 | + $html_participant_selection = '' . |
|
183 | + '<div id="fitem_bigbluebuttonbn_participant_selection" class="fitem fitem_fselect">' . "\n" . |
|
184 | + ' <div class="fitemtitle">' . "\n" . |
|
185 | + ' <label for="bigbluebuttonbn_participant_selectiontype">' . get_string('mod_form_field_participant_add', 'bigbluebuttonbn') . ' </label>' . "\n" . |
|
186 | + ' </div>' . "\n" . |
|
187 | + ' <div class="felement fselect">' . "\n" . |
|
188 | + ' <select id="bigbluebuttonbn_participant_selection_type" onchange="bigbluebuttonbn_participant_selection_set(); return 0;">' . "\n" . |
|
189 | + ' <option value="all" selected="selected">' . get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn') . '</option>' . "\n" . |
|
190 | + ' <option value="role">' . get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn') . '</option>' . "\n" . |
|
191 | + ' <option value="user">' . get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn') . '</option>' . "\n" . |
|
192 | + ' </select>' . "\n" . |
|
193 | + ' ' . "\n" . |
|
194 | + ' <select id="bigbluebuttonbn_participant_selection" disabled="disabled">' . "\n" . |
|
195 | + ' <option value="all" selected="selected">---------------</option>' . "\n" . |
|
196 | + ' </select>' . "\n" . |
|
197 | + ' ' . "\n" . |
|
198 | + ' <input value="' . get_string('mod_form_field_participant_list_action_add', 'bigbluebuttonbn') . '" type="button" id="id_addselectionid" onclick="bigbluebuttonbn_participant_add(); return 0;" />' . "\n" . |
|
199 | + ' </div>' . "\n" . |
|
200 | + '</div>' . "\n" . |
|
201 | + '<div id="fitem_bigbluebuttonbn_participant_list" class="fitem">' . "\n" . |
|
202 | + ' <div class="fitemtitle">' . "\n" . |
|
203 | + ' <label for="bigbluebuttonbn_participant_list">' . get_string('mod_form_field_participant_list', 'bigbluebuttonbn') . ' </label>' . "\n" . |
|
204 | + ' </div>' . "\n" . |
|
205 | + ' <div class="felement fselect">' . "\n" . |
|
206 | + ' <table id="participant_list_table">' . "\n"; |
|
207 | 207 | |
208 | 208 | // Add participant list |
209 | - foreach($participant_list as $participant){ |
|
209 | + foreach ($participant_list as $participant) { |
|
210 | 210 | $participant_selectionid = ''; |
211 | 211 | $participant_selectiontype = $participant['selectiontype']; |
212 | - if( $participant_selectiontype == 'all') { |
|
213 | - $participant_selectiontype = '<b><i>'.get_string('mod_form_field_participant_list_type_'.$participant_selectiontype, 'bigbluebuttonbn').'</i></b>'; |
|
212 | + if ($participant_selectiontype == 'all') { |
|
213 | + $participant_selectiontype = '<b><i>' . get_string('mod_form_field_participant_list_type_' . $participant_selectiontype, 'bigbluebuttonbn') . '</i></b>'; |
|
214 | 214 | } else { |
215 | - if ( $participant_selectiontype == 'role') { |
|
215 | + if ($participant_selectiontype == 'role') { |
|
216 | 216 | $participant_selectionid = bigbluebuttonbn_get_role_name($participant['selectionid']); |
217 | 217 | } else { |
218 | - foreach($users as $user){ |
|
219 | - if( $user->id == $participant['selectionid']) { |
|
220 | - $participant_selectionid = $user->firstname.' '.$user->lastname; |
|
218 | + foreach ($users as $user) { |
|
219 | + if ($user->id == $participant['selectionid']) { |
|
220 | + $participant_selectionid = $user->firstname . ' ' . $user->lastname; |
|
221 | 221 | break; |
222 | 222 | } |
223 | 223 | } |
224 | 224 | } |
225 | - $participant_selectiontype = '<b><i>'.get_string('mod_form_field_participant_list_type_'.$participant_selectiontype, 'bigbluebuttonbn').':</i></b> '; |
|
225 | + $participant_selectiontype = '<b><i>' . get_string('mod_form_field_participant_list_type_' . $participant_selectiontype, 'bigbluebuttonbn') . ':</i></b> '; |
|
226 | 226 | } |
227 | 227 | |
228 | - $html_participant_selection .= ''. |
|
229 | - ' <tr id="participant_list_tr_'.$participant['selectiontype'].'-'.$participant['selectionid'].'">'."\n". |
|
230 | - ' <td width="20px"><a onclick="bigbluebuttonbn_participant_remove(\''.$participant['selectiontype'].'\', \''.$participant['selectionid'].'\'); return 0;" title="'.get_string('mod_form_field_participant_list_action_remove', 'bigbluebuttonbn').'">x</a></td>'."\n". |
|
231 | - ' <td width="125px">'.$participant_selectiontype.'</td>'."\n". |
|
232 | - ' <td>'.$participant_selectionid.'</td>'."\n". |
|
233 | - ' <td><i> '.get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn').' </i>'."\n". |
|
234 | - ' <select id="participant_list_role_'.$participant['selectiontype'].'-'.$participant['selectionid'].'" onchange="bigbluebuttonbn_participant_list_role_update(\''.$participant['selectiontype'].'\', \''.$participant['selectionid'].'\'); return 0;">'."\n". |
|
235 | - ' <option value="'.BIGBLUEBUTTONBN_ROLE_VIEWER.'" '.($participant['role'] == BIGBLUEBUTTONBN_ROLE_VIEWER? 'selected="selected" ': '').'>'.get_string('mod_form_field_participant_bbb_role_'.BIGBLUEBUTTONBN_ROLE_VIEWER, 'bigbluebuttonbn').'</option>'."\n". |
|
236 | - ' <option value="'.BIGBLUEBUTTONBN_ROLE_MODERATOR.'" '.($participant['role'] == BIGBLUEBUTTONBN_ROLE_MODERATOR? 'selected="selected" ': '').'>'.get_string('mod_form_field_participant_bbb_role_'.BIGBLUEBUTTONBN_ROLE_MODERATOR, 'bigbluebuttonbn').'</option><select>'."\n". |
|
237 | - ' </td>'."\n". |
|
238 | - ' </tr>'."\n"; |
|
228 | + $html_participant_selection .= '' . |
|
229 | + ' <tr id="participant_list_tr_' . $participant['selectiontype'] . '-' . $participant['selectionid'] . '">' . "\n" . |
|
230 | + ' <td width="20px"><a onclick="bigbluebuttonbn_participant_remove(\'' . $participant['selectiontype'] . '\', \'' . $participant['selectionid'] . '\'); return 0;" title="' . get_string('mod_form_field_participant_list_action_remove', 'bigbluebuttonbn') . '">x</a></td>' . "\n" . |
|
231 | + ' <td width="125px">' . $participant_selectiontype . '</td>' . "\n" . |
|
232 | + ' <td>' . $participant_selectionid . '</td>' . "\n" . |
|
233 | + ' <td><i> ' . get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn') . ' </i>' . "\n" . |
|
234 | + ' <select id="participant_list_role_' . $participant['selectiontype'] . '-' . $participant['selectionid'] . '" onchange="bigbluebuttonbn_participant_list_role_update(\'' . $participant['selectiontype'] . '\', \'' . $participant['selectionid'] . '\'); return 0;">' . "\n" . |
|
235 | + ' <option value="' . BIGBLUEBUTTONBN_ROLE_VIEWER . '" ' . ($participant['role'] == BIGBLUEBUTTONBN_ROLE_VIEWER ? 'selected="selected" ' : '') . '>' . get_string('mod_form_field_participant_bbb_role_' . BIGBLUEBUTTONBN_ROLE_VIEWER, 'bigbluebuttonbn') . '</option>' . "\n" . |
|
236 | + ' <option value="' . BIGBLUEBUTTONBN_ROLE_MODERATOR . '" ' . ($participant['role'] == BIGBLUEBUTTONBN_ROLE_MODERATOR ? 'selected="selected" ' : '') . '>' . get_string('mod_form_field_participant_bbb_role_' . BIGBLUEBUTTONBN_ROLE_MODERATOR, 'bigbluebuttonbn') . '</option><select>' . "\n" . |
|
237 | + ' </td>' . "\n" . |
|
238 | + ' </tr>' . "\n"; |
|
239 | 239 | } |
240 | 240 | |
241 | - $html_participant_selection .= ''. |
|
242 | - ' </table>'."\n". |
|
243 | - ' </div>'."\n". |
|
244 | - '</div>'."\n". |
|
245 | - '<script type="text/javascript" src="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/mod_form.js">'."\n". |
|
246 | - '</script>'."\n"; |
|
241 | + $html_participant_selection .= '' . |
|
242 | + ' </table>' . "\n" . |
|
243 | + ' </div>' . "\n" . |
|
244 | + '</div>' . "\n" . |
|
245 | + '<script type="text/javascript" src="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/mod_form.js">' . "\n" . |
|
246 | + '</script>' . "\n"; |
|
247 | 247 | |
248 | 248 | $mform->addElement('html', $html_participant_selection); |
249 | 249 | |
250 | 250 | // Add data |
251 | - $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_selection = {"all": [], "role": '.json_encode($roles).', "user": '.bigbluebuttonbn_get_users_json($users).'}; </script>'); |
|
252 | - $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_list = '.json_encode($participant_list).'; </script>'); |
|
253 | - $bigbluebuttonbn_strings = Array( "as" => get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn'), |
|
251 | + $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_selection = {"all": [], "role": ' . json_encode($roles) . ', "user": ' . bigbluebuttonbn_get_users_json($users) . '}; </script>'); |
|
252 | + $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_list = ' . json_encode($participant_list) . '; </script>'); |
|
253 | + $bigbluebuttonbn_strings = Array("as" => get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn'), |
|
254 | 254 | "viewer" => get_string('mod_form_field_participant_bbb_role_viewer', 'bigbluebuttonbn'), |
255 | 255 | "moderator" => get_string('mod_form_field_participant_bbb_role_moderator', 'bigbluebuttonbn'), |
256 | 256 | "remove" => get_string('mod_form_field_participant_list_action_remove', 'bigbluebuttonbn'), |
257 | 257 | ); |
258 | - $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_strings = '.json_encode($bigbluebuttonbn_strings).'; </script>'); |
|
258 | + $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_strings = ' . json_encode($bigbluebuttonbn_strings) . '; </script>'); |
|
259 | 259 | //------------------------------------------------------------------------------- |
260 | 260 | // Third block ends here |
261 | 261 | //------------------------------------------------------------------------------- |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | // Fourth block starts here |
266 | 266 | //------------------------------------------------------------------------------- |
267 | 267 | $mform->addElement('header', 'schedule', get_string('mod_form_block_schedule', 'bigbluebuttonbn')); |
268 | - if( isset($current_activity->openingtime) && $current_activity->openingtime != 0 || isset($current_activity->closingtime) && $current_activity->closingtime != 0 ) |
|
268 | + if (isset($current_activity->openingtime) && $current_activity->openingtime != 0 || isset($current_activity->closingtime) && $current_activity->closingtime != 0) |
|
269 | 269 | $mform->setExpanded('schedule'); |
270 | 270 | |
271 | 271 | $mform->addElement('date_time_selector', 'openingtime', get_string('mod_form_field_openingtime', 'bigbluebuttonbn'), array('optional' => true)); |
@@ -293,8 +293,8 @@ discard block |
||
293 | 293 | $draftitemid = file_get_submitted_draft_itemid('presentation'); |
294 | 294 | file_prepare_draft_area($draftitemid, $this->context->id, 'mod_bigbluebuttonbn', 'presentation', 0, array('subdirs'=>0, 'maxbytes' => 0, 'maxfiles' => 1, 'mainfile' => true)); |
295 | 295 | $default_values['presentation'] = $draftitemid; |
296 | - } catch (Exception $e){ |
|
297 | - error_log("Presentation could not be loaded: ".$e->getMessage()); |
|
296 | + } catch (Exception $e) { |
|
297 | + error_log("Presentation could not be loaded: " . $e->getMessage()); |
|
298 | 298 | return NULL; |
299 | 299 | } |
300 | 300 | } |
@@ -303,14 +303,14 @@ discard block |
||
303 | 303 | function validation($data, $files) { |
304 | 304 | $errors = parent::validation($data, $files); |
305 | 305 | |
306 | - if ( isset($data['openingtime']) && isset($data['closingtime']) ) { |
|
307 | - if ( $data['openingtime'] != 0 && $data['closingtime'] != 0 && $data['closingtime'] < $data['openingtime']) { |
|
306 | + if (isset($data['openingtime']) && isset($data['closingtime'])) { |
|
307 | + if ($data['openingtime'] != 0 && $data['closingtime'] != 0 && $data['closingtime'] < $data['openingtime']) { |
|
308 | 308 | $errors['closingtime'] = get_string('bbbduetimeoverstartingtime', 'bigbluebuttonbn'); |
309 | 309 | } |
310 | 310 | } |
311 | 311 | |
312 | - if ( isset($data['voicebridge']) ) { |
|
313 | - if ( !bigbluebuttonbn_voicebridge_unique($data['voicebridge'], $data['instance'])) { |
|
312 | + if (isset($data['voicebridge'])) { |
|
313 | + if (!bigbluebuttonbn_voicebridge_unique($data['voicebridge'], $data['instance'])) { |
|
314 | 314 | $errors['voicebridge'] = get_string('mod_form_field_voicebridge_notunique_error', 'bigbluebuttonbn'); |
315 | 315 | } |
316 | 316 | } |
@@ -36,11 +36,11 @@ |
||
36 | 36 | |
37 | 37 | // Define each element separated |
38 | 38 | $bigbluebuttonbn = new backup_nested_element('bigbluebuttonbn', array('id'), array( |
39 | - 'course', 'name', 'intro', 'introformat', 'meetingid', |
|
40 | - 'moderatorpass', 'viewerpass', 'wait', 'record', 'tagging', |
|
41 | - 'welcome', 'voicebridge', 'openingtime', 'closingtime', |
|
42 | - 'timecreated', 'timemodified', 'presentation', 'participants', |
|
43 | - 'userlimit')); |
|
39 | + 'course', 'name', 'intro', 'introformat', 'meetingid', |
|
40 | + 'moderatorpass', 'viewerpass', 'wait', 'record', 'tagging', |
|
41 | + 'welcome', 'voicebridge', 'openingtime', 'closingtime', |
|
42 | + 'timecreated', 'timemodified', 'presentation', 'participants', |
|
43 | + 'userlimit')); |
|
44 | 44 | |
45 | 45 | $logs = new backup_nested_element('logs'); |
46 | 46 |
@@ -320,8 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | if( $xml ) { //If the xml packet returned failure it displays the message to the user |
322 | 322 | return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); |
323 | - } |
|
324 | - else { //If the server is unreachable, then prompts the user of the necessary action |
|
323 | + } else { //If the server is unreachable, then prompts the user of the necessary action |
|
325 | 324 | return null; |
326 | 325 | } |
327 | 326 | } |
@@ -355,7 +354,9 @@ discard block |
||
355 | 354 | } |
356 | 355 | |
357 | 356 | function bigbluebuttonbn_wrap_xml_load_file($url, $method=BIGBLUEBUTTONBN_METHOD_GET, $data=null) { |
358 | - if ( bigbluebuttonbn_debugdisplay() ) error_log("Request to: ".$url); |
|
357 | + if ( bigbluebuttonbn_debugdisplay() ) { |
|
358 | + error_log("Request to: ".$url); |
|
359 | + } |
|
359 | 360 | |
360 | 361 | if (extension_loaded('curl')) { |
361 | 362 | $c = new curl(); |
@@ -942,7 +943,9 @@ discard block |
||
942 | 943 | $error = $org_msg; |
943 | 944 | |
944 | 945 | if( !empty($new_msg) ) { |
945 | - if( !empty($error) ) $error .= ' '; |
|
946 | + if( !empty($error) ) { |
|
947 | + $error .= ' '; |
|
948 | + } |
|
946 | 949 | $error .= $new_msg; |
947 | 950 | } |
948 | 951 |
@@ -194,6 +194,9 @@ discard block |
||
194 | 194 | return $xml; |
195 | 195 | } |
196 | 196 | |
197 | +/** |
|
198 | + * @param string $meetingID |
|
199 | + */ |
|
197 | 200 | function bigbluebuttonbn_getMeetingInfoArray( $meetingID, $modPW, $URL, $SALT ) { |
198 | 201 | $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) ); |
199 | 202 | |
@@ -211,6 +214,9 @@ discard block |
||
211 | 214 | } |
212 | 215 | } |
213 | 216 | |
217 | +/** |
|
218 | + * @param string $meetingIDs |
|
219 | + */ |
|
214 | 220 | function bigbluebuttonbn_getRecordingsArray( $meetingIDs, $URL, $SALT ) { |
215 | 221 | $recordings = array(); |
216 | 222 | |
@@ -292,6 +298,10 @@ discard block |
||
292 | 298 | } |
293 | 299 | } |
294 | 300 | |
301 | +/** |
|
302 | + * @param string $URL |
|
303 | + * @param string $SALT |
|
304 | + */ |
|
295 | 305 | function bigbluebuttonbn_doDeleteRecordings( $recordIDs, $URL, $SALT ) { |
296 | 306 | $ids = explode(",", $recordIDs); |
297 | 307 | foreach( $ids as $id){ |
@@ -303,6 +313,11 @@ discard block |
||
303 | 313 | return true; |
304 | 314 | } |
305 | 315 | |
316 | +/** |
|
317 | + * @param string $set |
|
318 | + * @param string $URL |
|
319 | + * @param string $SALT |
|
320 | + */ |
|
306 | 321 | function bigbluebuttonbn_doPublishRecordings( $recordIDs, $set, $URL, $SALT ) { |
307 | 322 | $ids = explode(",", $recordIDs); |
308 | 323 | foreach( $ids as $id){ |
@@ -314,6 +329,10 @@ discard block |
||
314 | 329 | return true; |
315 | 330 | } |
316 | 331 | |
332 | +/** |
|
333 | + * @param string $URL |
|
334 | + * @param string $SALT |
|
335 | + */ |
|
317 | 336 | function bigbluebuttonbn_doEndMeeting( $meetingID, $modPW, $URL, $SALT ) { |
318 | 337 | $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getEndMeetingURL( $meetingID, $modPW, $URL, $SALT ) ); |
319 | 338 | |
@@ -335,6 +354,9 @@ discard block |
||
335 | 354 | } |
336 | 355 | |
337 | 356 | |
357 | +/** |
|
358 | + * @param string $URL |
|
359 | + */ |
|
338 | 360 | function bigbluebuttonbn_getServerVersion( $URL ){ |
339 | 361 | $xml = bigbluebuttonbn_wrap_xml_load_file( $URL."api" ); |
340 | 362 | if ( $xml && $xml->returncode == 'SUCCESS' ) { |
@@ -353,6 +375,9 @@ discard block |
||
353 | 375 | } |
354 | 376 | } |
355 | 377 | |
378 | +/** |
|
379 | + * @param string $url |
|
380 | + */ |
|
356 | 381 | function bigbluebuttonbn_wrap_xml_load_file($url, $method=BIGBLUEBUTTONBN_METHOD_GET, $data=null) { |
357 | 382 | if ( bigbluebuttonbn_debugdisplay() ) error_log("Request to: ".$url); |
358 | 383 | |
@@ -813,6 +838,9 @@ discard block |
||
813 | 838 | $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'meetings_cache'); |
814 | 839 | } |
815 | 840 | |
841 | +/** |
|
842 | + * @param boolean $is_moderator |
|
843 | + */ |
|
816 | 844 | function bigbluebuttonbn_bbb_broker_participant_joined($meetingid, $is_moderator) { |
817 | 845 | $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'meetings_cache'); |
818 | 846 | $result = $cache->get($meetingid); |
@@ -1402,6 +1430,9 @@ discard block |
||
1402 | 1430 | return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled: (isset($CFG->bigbluebuttonbn_recordingready_enabled)? $CFG->bigbluebuttonbn_recordingready_enabled: false)); |
1403 | 1431 | } |
1404 | 1432 | |
1433 | +/** |
|
1434 | + * @return string |
|
1435 | + */ |
|
1405 | 1436 | function bigbluebuttonbn_get_cfg_moderator_default() { |
1406 | 1437 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1407 | 1438 | return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default: (isset($CFG->bigbluebuttonbn_moderator_default)? $CFG->bigbluebuttonbn_moderator_default: 'owner')); |
@@ -53,9 +53,9 @@ |
||
53 | 53 | $returnid = $DB->insert_record('bigbluebuttonbn_logs', $log); |
54 | 54 | } |
55 | 55 | |
56 | - //////////////////////////// |
|
56 | + //////////////////////////// |
|
57 | 57 | // BigBlueButton API Calls // |
58 | - //////////////////////////// |
|
58 | + //////////////////////////// |
|
59 | 59 | function bigbluebuttonbn_getJoinURL( $meetingID, $userName, $PW, $SALT, $URL, $logoutURL ) { |
60 | 60 | $url_join = $URL."api/join?"; |
61 | 61 | $params = 'meetingID='.urlencode($meetingID).'&fullName='.urlencode($userName).'&password='.urlencode($PW).'&logoutURL='.urlencode($logoutURL); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
16 | 16 | |
17 | -require_once(dirname(__FILE__).'/lib.php'); |
|
17 | +require_once(dirname(__FILE__) . '/lib.php'); |
|
18 | 18 | |
19 | 19 | const BIGBLUEBUTTONBN_FORCED = true; |
20 | 20 | |
@@ -33,21 +33,21 @@ discard block |
||
33 | 33 | const BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED = 'recording_published'; |
34 | 34 | const BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED = 'recording_unpublished'; |
35 | 35 | |
36 | -function bigbluebuttonbn_logs(array $bbbsession, $event, array $overrides = [], $meta = NULL ) { |
|
36 | +function bigbluebuttonbn_logs(array $bbbsession, $event, array $overrides = [], $meta = NULL) { |
|
37 | 37 | global $DB; |
38 | 38 | |
39 | 39 | $log = new stdClass(); |
40 | 40 | |
41 | - $log->courseid = isset($overrides['courseid'])? $overrides['courseid']: $bbbsession['course']->id; |
|
42 | - $log->bigbluebuttonbnid = isset($overrides['bigbluebuttonbnid'])? $overrides['bigbluebuttonbnid']: $bbbsession['bigbluebuttonbn']->id; |
|
43 | - $log->userid = isset($overrides['userid'])? $overrides['userid']: $bbbsession['userID']; |
|
44 | - $log->meetingid = isset($overrides['meetingid'])? $overrides['meetingid']: $bbbsession['meetingid']; |
|
45 | - $log->timecreated = isset($overrides['timecreated'])? $overrides['timecreated']: time(); |
|
41 | + $log->courseid = isset($overrides['courseid']) ? $overrides['courseid'] : $bbbsession['course']->id; |
|
42 | + $log->bigbluebuttonbnid = isset($overrides['bigbluebuttonbnid']) ? $overrides['bigbluebuttonbnid'] : $bbbsession['bigbluebuttonbn']->id; |
|
43 | + $log->userid = isset($overrides['userid']) ? $overrides['userid'] : $bbbsession['userID']; |
|
44 | + $log->meetingid = isset($overrides['meetingid']) ? $overrides['meetingid'] : $bbbsession['meetingid']; |
|
45 | + $log->timecreated = isset($overrides['timecreated']) ? $overrides['timecreated'] : time(); |
|
46 | 46 | $log->log = $event; |
47 | - if ( isset($meta) ) { |
|
47 | + if (isset($meta)) { |
|
48 | 48 | $log->meta = $meta; |
49 | - } else if( $event == BIGBLUEBUTTONBN_LOG_EVENT_CREATE) { |
|
50 | - $log->meta = '{"record":'.($bbbsession['record']? 'true': 'false').'}'; |
|
49 | + } else if ($event == BIGBLUEBUTTONBN_LOG_EVENT_CREATE) { |
|
50 | + $log->meta = '{"record":' . ($bbbsession['record'] ? 'true' : 'false') . '}'; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $returnid = $DB->insert_record('bigbluebuttonbn_logs', $log); |
@@ -56,132 +56,132 @@ discard block |
||
56 | 56 | //////////////////////////// |
57 | 57 | // BigBlueButton API Calls // |
58 | 58 | //////////////////////////// |
59 | -function bigbluebuttonbn_getJoinURL( $meetingID, $userName, $PW, $SALT, $URL, $logoutURL ) { |
|
60 | - $url_join = $URL."api/join?"; |
|
61 | - $params = 'meetingID='.urlencode($meetingID).'&fullName='.urlencode($userName).'&password='.urlencode($PW).'&logoutURL='.urlencode($logoutURL); |
|
62 | - $url = $url_join.$params.'&checksum='.sha1("join".$params.$SALT); |
|
59 | +function bigbluebuttonbn_getJoinURL($meetingID, $userName, $PW, $SALT, $URL, $logoutURL) { |
|
60 | + $url_join = $URL . "api/join?"; |
|
61 | + $params = 'meetingID=' . urlencode($meetingID) . '&fullName=' . urlencode($userName) . '&password=' . urlencode($PW) . '&logoutURL=' . urlencode($logoutURL); |
|
62 | + $url = $url_join . $params . '&checksum=' . sha1("join" . $params . $SALT); |
|
63 | 63 | return $url; |
64 | 64 | } |
65 | 65 | |
66 | -function bigbluebuttonbn_getCreateMeetingURL($name, $meetingID, $attendeePW, $moderatorPW, $welcome, $logoutURL, $SALT, $URL, $record = 'false', $duration=0, $voiceBridge=0, $maxParticipants=0, $metadata=array() ) { |
|
67 | - $url_create = $URL."api/create?"; |
|
66 | +function bigbluebuttonbn_getCreateMeetingURL($name, $meetingID, $attendeePW, $moderatorPW, $welcome, $logoutURL, $SALT, $URL, $record = 'false', $duration = 0, $voiceBridge = 0, $maxParticipants = 0, $metadata = array()) { |
|
67 | + $url_create = $URL . "api/create?"; |
|
68 | 68 | |
69 | - $params = 'name='.urlencode($name).'&meetingID='.urlencode($meetingID).'&attendeePW='.urlencode($attendeePW).'&moderatorPW='.urlencode($moderatorPW).'&logoutURL='.urlencode($logoutURL).'&record='.$record; |
|
69 | + $params = 'name=' . urlencode($name) . '&meetingID=' . urlencode($meetingID) . '&attendeePW=' . urlencode($attendeePW) . '&moderatorPW=' . urlencode($moderatorPW) . '&logoutURL=' . urlencode($logoutURL) . '&record=' . $record; |
|
70 | 70 | |
71 | 71 | $voiceBridge = intval($voiceBridge); |
72 | - if ( $voiceBridge > 0 && $voiceBridge < 79999) { |
|
73 | - $params .= '&voiceBridge='.$voiceBridge; |
|
72 | + if ($voiceBridge > 0 && $voiceBridge < 79999) { |
|
73 | + $params .= '&voiceBridge=' . $voiceBridge; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $duration = intval($duration); |
77 | - if( $duration > 0 ) { |
|
78 | - $params .= '&duration='.$duration; |
|
77 | + if ($duration > 0) { |
|
78 | + $params .= '&duration=' . $duration; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | $maxParticipants = intval($maxParticipants); |
82 | - if( $maxParticipants > 0 ) { |
|
83 | - $params .= '&maxParticipants='.$maxParticipants; |
|
82 | + if ($maxParticipants > 0) { |
|
83 | + $params .= '&maxParticipants=' . $maxParticipants; |
|
84 | 84 | } |
85 | 85 | |
86 | - if( trim( $welcome ) ) { |
|
87 | - $params .= '&welcome='.urlencode($welcome); |
|
86 | + if (trim($welcome)) { |
|
87 | + $params .= '&welcome=' . urlencode($welcome); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | foreach ($metadata as $key => $value) { |
91 | - $params .= '&'.$key.'='.urlencode($value); |
|
91 | + $params .= '&' . $key . '=' . urlencode($value); |
|
92 | 92 | } |
93 | 93 | |
94 | - $url = $url_create.$params.'&checksum='.sha1("create".$params.$SALT); |
|
94 | + $url = $url_create . $params . '&checksum=' . sha1("create" . $params . $SALT); |
|
95 | 95 | return $url; |
96 | 96 | } |
97 | 97 | |
98 | -function bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) { |
|
99 | - $base_url = $URL."api/isMeetingRunning?"; |
|
100 | - $params = 'meetingID='.urlencode($meetingID); |
|
101 | - $url = $base_url.$params.'&checksum='.sha1("isMeetingRunning".$params.$SALT); |
|
98 | +function bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT) { |
|
99 | + $base_url = $URL . "api/isMeetingRunning?"; |
|
100 | + $params = 'meetingID=' . urlencode($meetingID); |
|
101 | + $url = $base_url . $params . '&checksum=' . sha1("isMeetingRunning" . $params . $SALT); |
|
102 | 102 | return $url; |
103 | 103 | } |
104 | 104 | |
105 | -function bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) { |
|
106 | - $base_url = $URL."api/getMeetingInfo?"; |
|
107 | - $params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW); |
|
108 | - $url = $base_url.$params.'&checksum='.sha1("getMeetingInfo".$params.$SALT); |
|
105 | +function bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT) { |
|
106 | + $base_url = $URL . "api/getMeetingInfo?"; |
|
107 | + $params = 'meetingID=' . urlencode($meetingID) . '&password=' . urlencode($modPW); |
|
108 | + $url = $base_url . $params . '&checksum=' . sha1("getMeetingInfo" . $params . $SALT); |
|
109 | 109 | return $url; |
110 | 110 | } |
111 | 111 | |
112 | -function bigbluebuttonbn_getMeetingsURL( $URL, $SALT ) { |
|
113 | - $base_url = $URL."api/getMeetings?"; |
|
114 | - $url = $base_url.'&checksum='.sha1("getMeetings".$SALT); |
|
112 | +function bigbluebuttonbn_getMeetingsURL($URL, $SALT) { |
|
113 | + $base_url = $URL . "api/getMeetings?"; |
|
114 | + $url = $base_url . '&checksum=' . sha1("getMeetings" . $SALT); |
|
115 | 115 | return $url; |
116 | 116 | } |
117 | 117 | |
118 | -function bigbluebuttonbn_getEndMeetingURL( $meetingID, $modPW, $URL, $SALT ) { |
|
119 | - $base_url = $URL."api/end?"; |
|
120 | - $params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW); |
|
121 | - $url = $base_url.$params.'&checksum='.sha1("end".$params.$SALT); |
|
118 | +function bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $URL, $SALT) { |
|
119 | + $base_url = $URL . "api/end?"; |
|
120 | + $params = 'meetingID=' . urlencode($meetingID) . '&password=' . urlencode($modPW); |
|
121 | + $url = $base_url . $params . '&checksum=' . sha1("end" . $params . $SALT); |
|
122 | 122 | return $url; |
123 | 123 | } |
124 | 124 | |
125 | -function bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingID=null ) { |
|
126 | - $base_url_record = $URL."api/getRecordings?"; |
|
127 | - if( $meetingID == null ) { |
|
125 | +function bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingID = null) { |
|
126 | + $base_url_record = $URL . "api/getRecordings?"; |
|
127 | + if ($meetingID == null) { |
|
128 | 128 | $params = ""; |
129 | 129 | } else { |
130 | - $params = "meetingID=".urlencode($meetingID); |
|
130 | + $params = "meetingID=" . urlencode($meetingID); |
|
131 | 131 | } |
132 | - $url = $base_url_record.$params."&checksum=".sha1("getRecordings".$params.$SALT); |
|
132 | + $url = $base_url_record . $params . "&checksum=" . sha1("getRecordings" . $params . $SALT); |
|
133 | 133 | return $url; |
134 | 134 | } |
135 | 135 | |
136 | -function bigbluebuttonbn_getDeleteRecordingsURL( $recordID, $URL, $SALT ) { |
|
137 | - $url_delete = $URL."api/deleteRecordings?"; |
|
138 | - $params = 'recordID='.urlencode($recordID); |
|
139 | - $url = $url_delete.$params.'&checksum='.sha1("deleteRecordings".$params.$SALT); |
|
136 | +function bigbluebuttonbn_getDeleteRecordingsURL($recordID, $URL, $SALT) { |
|
137 | + $url_delete = $URL . "api/deleteRecordings?"; |
|
138 | + $params = 'recordID=' . urlencode($recordID); |
|
139 | + $url = $url_delete . $params . '&checksum=' . sha1("deleteRecordings" . $params . $SALT); |
|
140 | 140 | return $url; |
141 | 141 | } |
142 | 142 | |
143 | -function bigbluebuttonbn_getPublishRecordingsURL( $recordID, $set, $URL, $SALT ) { |
|
144 | - $url_publish = $URL."api/publishRecordings?"; |
|
145 | - $params = 'recordID='.$recordID."&publish=".$set; |
|
146 | - $url = $url_publish.$params.'&checksum='.sha1("publishRecordings".$params.$SALT); |
|
143 | +function bigbluebuttonbn_getPublishRecordingsURL($recordID, $set, $URL, $SALT) { |
|
144 | + $url_publish = $URL . "api/publishRecordings?"; |
|
145 | + $params = 'recordID=' . $recordID . "&publish=" . $set; |
|
146 | + $url = $url_publish . $params . '&checksum=' . sha1("publishRecordings" . $params . $SALT); |
|
147 | 147 | return $url; |
148 | 148 | } |
149 | 149 | |
150 | -function bigbluebuttonbn_getCreateMeetingArray( $username, $meetingID, $welcomeString, $mPW, $aPW, $SALT, $URL, $logoutURL, $record='false', $duration=0, $voiceBridge=0, $maxParticipants=0, $metadata=array(), $presentation_name=null, $presentation_url=null ) { |
|
150 | +function bigbluebuttonbn_getCreateMeetingArray($username, $meetingID, $welcomeString, $mPW, $aPW, $SALT, $URL, $logoutURL, $record = 'false', $duration = 0, $voiceBridge = 0, $maxParticipants = 0, $metadata = array(), $presentation_name = null, $presentation_url = null) { |
|
151 | 151 | $create_meeting_url = bigbluebuttonbn_getCreateMeetingURL($username, $meetingID, $aPW, $mPW, $welcomeString, $logoutURL, $SALT, $URL, $record, $duration, $voiceBridge, $maxParticipants, $metadata); |
152 | - if( !is_null($presentation_name) && !is_null($presentation_url) ) { |
|
153 | - $xml = bigbluebuttonbn_wrap_xml_load_file( $create_meeting_url, |
|
152 | + if (!is_null($presentation_name) && !is_null($presentation_url)) { |
|
153 | + $xml = bigbluebuttonbn_wrap_xml_load_file($create_meeting_url, |
|
154 | 154 | BIGBLUEBUTTONBN_METHOD_POST, |
155 | - "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='".$presentation_url."' /></module></modules>" |
|
155 | + "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='" . $presentation_url . "' /></module></modules>" |
|
156 | 156 | ); |
157 | 157 | } else { |
158 | - $xml = bigbluebuttonbn_wrap_xml_load_file( $create_meeting_url ); |
|
158 | + $xml = bigbluebuttonbn_wrap_xml_load_file($create_meeting_url); |
|
159 | 159 | } |
160 | 160 | |
161 | - if ( $xml ) { |
|
161 | + if ($xml) { |
|
162 | 162 | if ($xml->meetingID) { |
163 | - return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded ); |
|
163 | + return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded); |
|
164 | 164 | } else { |
165 | - return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey ); |
|
165 | + return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); |
|
166 | 166 | } |
167 | 167 | } else { |
168 | 168 | return null; |
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | -function bigbluebuttonbn_getMeetingsArray($meetingID, $URL, $SALT ) { |
|
173 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingsURL($URL, $SALT) ); |
|
172 | +function bigbluebuttonbn_getMeetingsArray($meetingID, $URL, $SALT) { |
|
173 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingsURL($URL, $SALT)); |
|
174 | 174 | |
175 | - if ( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey ) { //The meetings were returned |
|
175 | + if ($xml && $xml->returncode == 'SUCCESS' && $xml->messageKey) { //The meetings were returned |
|
176 | 176 | return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); |
177 | 177 | |
178 | - } else if($xml && $xml->returncode == 'SUCCESS') { //If there were meetings already created |
|
178 | + } else if ($xml && $xml->returncode == 'SUCCESS') { //If there were meetings already created |
|
179 | 179 | foreach ($xml->meetings->meeting as $meeting) { |
180 | - $meetings[] = array( 'meetingID' => $meeting->meetingID, 'moderatorPW' => $meeting->moderatorPW, 'attendeePW' => $meeting->attendeePW, 'hasBeenForciblyEnded' => $meeting->hasBeenForciblyEnded, 'running' => $meeting->running ); |
|
180 | + $meetings[] = array('meetingID' => $meeting->meetingID, 'moderatorPW' => $meeting->moderatorPW, 'attendeePW' => $meeting->attendeePW, 'hasBeenForciblyEnded' => $meeting->hasBeenForciblyEnded, 'running' => $meeting->running); |
|
181 | 181 | } |
182 | 182 | return $meetings; |
183 | 183 | |
184 | - } else if( $xml ) { //If the xml packet returned failure it displays the message to the user |
|
184 | + } else if ($xml) { //If the xml packet returned failure it displays the message to the user |
|
185 | 185 | return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); |
186 | 186 | |
187 | 187 | } else { //If the server is unreachable, then prompts the user of the necessary action |
@@ -189,21 +189,21 @@ discard block |
||
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | -function bigbluebuttonbn_getMeetingInfo( $meetingID, $modPW, $URL, $SALT ) { |
|
193 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) ); |
|
192 | +function bigbluebuttonbn_getMeetingInfo($meetingID, $modPW, $URL, $SALT) { |
|
193 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT)); |
|
194 | 194 | return $xml; |
195 | 195 | } |
196 | 196 | |
197 | -function bigbluebuttonbn_getMeetingInfoArray( $meetingID, $modPW, $URL, $SALT ) { |
|
198 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) ); |
|
197 | +function bigbluebuttonbn_getMeetingInfoArray($meetingID, $modPW, $URL, $SALT) { |
|
198 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT)); |
|
199 | 199 | |
200 | - if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey == null){//The meeting info was returned |
|
201 | - return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey ); |
|
200 | + if ($xml && $xml->returncode == 'SUCCESS' && $xml->messageKey == null) {//The meeting info was returned |
|
201 | + return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); |
|
202 | 202 | |
203 | - } else if($xml && $xml->returncode == 'SUCCESS'){ //If there were meetings already created |
|
204 | - return array('returncode' => $xml->returncode, 'meetingID' => $xml->meetingID, 'moderatorPW' => $xml->moderatorPW, 'attendeePW' => $xml->attendeePW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded, 'running' => $xml->running, 'recording' => $xml->recording, 'startTime' => $xml->startTime, 'endTime' => $xml->endTime, 'participantCount' => $xml->participantCount, 'moderatorCount' => $xml->moderatorCount, 'attendees' => $xml->attendees, 'metadata' => $xml->metadata ); |
|
203 | + } else if ($xml && $xml->returncode == 'SUCCESS') { //If there were meetings already created |
|
204 | + return array('returncode' => $xml->returncode, 'meetingID' => $xml->meetingID, 'moderatorPW' => $xml->moderatorPW, 'attendeePW' => $xml->attendeePW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded, 'running' => $xml->running, 'recording' => $xml->recording, 'startTime' => $xml->startTime, 'endTime' => $xml->endTime, 'participantCount' => $xml->participantCount, 'moderatorCount' => $xml->moderatorCount, 'attendees' => $xml->attendees, 'metadata' => $xml->metadata); |
|
205 | 205 | |
206 | - } else if( ($xml && $xml->returncode == 'FAILED') || $xml) { //If the xml packet returned failure it displays the message to the user |
|
206 | + } else if (($xml && $xml->returncode == 'FAILED') || $xml) { //If the xml packet returned failure it displays the message to the user |
|
207 | 207 | return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); |
208 | 208 | |
209 | 209 | } else { //If the server is unreachable, then prompts the user of the necessary action |
@@ -211,19 +211,19 @@ discard block |
||
211 | 211 | } |
212 | 212 | } |
213 | 213 | |
214 | -function bigbluebuttonbn_getRecordingsArray( $meetingIDs, $URL, $SALT ) { |
|
214 | +function bigbluebuttonbn_getRecordingsArray($meetingIDs, $URL, $SALT) { |
|
215 | 215 | $recordings = array(); |
216 | 216 | |
217 | - if ( is_array($meetingIDs) ) { |
|
217 | + if (is_array($meetingIDs)) { |
|
218 | 218 | // getRecordings is executed using a method POST (supported only on BBB 1.0 and later) |
219 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT ), BIGBLUEBUTTONBN_METHOD_POST, $meetingIDs ); |
|
219 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT), BIGBLUEBUTTONBN_METHOD_POST, $meetingIDs); |
|
220 | 220 | } else { |
221 | 221 | // getRecordings is executed using a method GET (supported by all versions of BBB) |
222 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingIDs ) ); |
|
222 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingIDs)); |
|
223 | 223 | } |
224 | 224 | |
225 | - if ( $xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings) ) { //If there were meetings already created |
|
226 | - foreach ( $xml->recordings->recording as $recording ) { |
|
225 | + if ($xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings)) { //If there were meetings already created |
|
226 | + foreach ($xml->recordings->recording as $recording) { |
|
227 | 227 | $recordings[] = bigbluebuttonbn_getRecordingArrayRow($recording); |
228 | 228 | } |
229 | 229 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | return $recordings; |
234 | 234 | } |
235 | 235 | |
236 | -function bigbluebuttonbn_index_recordings($recordings, $index_key='recordID') { |
|
236 | +function bigbluebuttonbn_index_recordings($recordings, $index_key = 'recordID') { |
|
237 | 237 | $indexed_recordings = array(); |
238 | 238 | |
239 | 239 | foreach ($recordings as $recording) { |
@@ -243,14 +243,14 @@ discard block |
||
243 | 243 | return $indexed_recordings; |
244 | 244 | } |
245 | 245 | |
246 | -function bigbluebuttonbn_getRecordingArray( $recordingID, $meetingID, $URL, $SALT ) { |
|
246 | +function bigbluebuttonbn_getRecordingArray($recordingID, $meetingID, $URL, $SALT) { |
|
247 | 247 | $recordingArray = array(); |
248 | 248 | |
249 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingID ) ); |
|
249 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingID)); |
|
250 | 250 | |
251 | - if ( $xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings) ) { //If there were meetings already created |
|
251 | + if ($xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings)) { //If there were meetings already created |
|
252 | 252 | foreach ($xml->recordings->recording as $recording) { |
253 | - if( $recording->recordID == $recordingID ) { |
|
253 | + if ($recording->recordID == $recordingID) { |
|
254 | 254 | $recordingArray = bigbluebuttonbn_getRecordingArrayRow($recording); |
255 | 255 | break; |
256 | 256 | } |
@@ -260,64 +260,64 @@ discard block |
||
260 | 260 | return $recordingArray; |
261 | 261 | } |
262 | 262 | |
263 | -function bigbluebuttonbn_getRecordingArrayRow( $recording ) { |
|
263 | +function bigbluebuttonbn_getRecordingArrayRow($recording) { |
|
264 | 264 | |
265 | 265 | $playbackArray = array(); |
266 | - foreach ( $recording->playback->format as $format ) { |
|
267 | - $playbackArray[(string) $format->type] = array( 'type' => (string) $format->type, 'url' => (string) $format->url, 'length' => (string) $format->length ); |
|
266 | + foreach ($recording->playback->format as $format) { |
|
267 | + $playbackArray[(string)$format->type] = array('type' => (string)$format->type, 'url' => (string)$format->url, 'length' => (string)$format->length); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | //Add the metadata to the recordings array |
271 | 271 | $metadataArray = array(); |
272 | 272 | $metadata = get_object_vars($recording->metadata); |
273 | - foreach ( $metadata as $key => $value ) { |
|
274 | - if ( is_object($value) ) { |
|
273 | + foreach ($metadata as $key => $value) { |
|
274 | + if (is_object($value)) { |
|
275 | 275 | $value = ''; |
276 | 276 | } |
277 | - $metadataArray['meta_'.$key] = $value; |
|
277 | + $metadataArray['meta_' . $key] = $value; |
|
278 | 278 | } |
279 | 279 | |
280 | - $recordingArrayRow = array( 'recordID' => (string) $recording->recordID, 'meetingID' => (string) $recording->meetingID, 'meetingName' => (string) $recording->name, 'published' => (string) $recording->published, 'startTime' => (string) $recording->startTime, 'endTime' => (string) $recording->endTime, 'playbacks' => $playbackArray ) + $metadataArray; |
|
280 | + $recordingArrayRow = array('recordID' => (string)$recording->recordID, 'meetingID' => (string)$recording->meetingID, 'meetingName' => (string)$recording->name, 'published' => (string)$recording->published, 'startTime' => (string)$recording->startTime, 'endTime' => (string)$recording->endTime, 'playbacks' => $playbackArray) + $metadataArray; |
|
281 | 281 | |
282 | 282 | return $recordingArrayRow; |
283 | 283 | } |
284 | 284 | |
285 | -function bigbluebuttonbn_recordingBuildSorter($a, $b){ |
|
286 | - if ( $a['startTime'] < $b['startTime'] ) { |
|
285 | +function bigbluebuttonbn_recordingBuildSorter($a, $b) { |
|
286 | + if ($a['startTime'] < $b['startTime']) { |
|
287 | 287 | return -1; |
288 | - } else if ( $a['startTime'] == $b['startTime']) { |
|
288 | + } else if ($a['startTime'] == $b['startTime']) { |
|
289 | 289 | return 0; |
290 | 290 | } else { |
291 | 291 | return 1; |
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
295 | -function bigbluebuttonbn_doDeleteRecordings( $recordIDs, $URL, $SALT ) { |
|
296 | - $ids = explode(",", $recordIDs); |
|
297 | - foreach( $ids as $id){ |
|
298 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getDeleteRecordingsURL($id, $URL, $SALT) ); |
|
299 | - if( $xml && $xml->returncode != 'SUCCESS' ) { |
|
295 | +function bigbluebuttonbn_doDeleteRecordings($recordIDs, $URL, $SALT) { |
|
296 | + $ids = explode(",", $recordIDs); |
|
297 | + foreach ($ids as $id) { |
|
298 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getDeleteRecordingsURL($id, $URL, $SALT)); |
|
299 | + if ($xml && $xml->returncode != 'SUCCESS') { |
|
300 | 300 | return false; |
301 | 301 | } |
302 | 302 | } |
303 | 303 | return true; |
304 | 304 | } |
305 | 305 | |
306 | -function bigbluebuttonbn_doPublishRecordings( $recordIDs, $set, $URL, $SALT ) { |
|
307 | - $ids = explode(",", $recordIDs); |
|
308 | - foreach( $ids as $id){ |
|
309 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getPublishRecordingsURL($id, $set, $URL, $SALT) ); |
|
310 | - if( $xml && $xml->returncode != 'SUCCESS' ) { |
|
306 | +function bigbluebuttonbn_doPublishRecordings($recordIDs, $set, $URL, $SALT) { |
|
307 | + $ids = explode(",", $recordIDs); |
|
308 | + foreach ($ids as $id) { |
|
309 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getPublishRecordingsURL($id, $set, $URL, $SALT)); |
|
310 | + if ($xml && $xml->returncode != 'SUCCESS') { |
|
311 | 311 | return false; |
312 | 312 | } |
313 | 313 | } |
314 | 314 | return true; |
315 | 315 | } |
316 | 316 | |
317 | -function bigbluebuttonbn_doEndMeeting( $meetingID, $modPW, $URL, $SALT ) { |
|
318 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getEndMeetingURL( $meetingID, $modPW, $URL, $SALT ) ); |
|
317 | +function bigbluebuttonbn_doEndMeeting($meetingID, $modPW, $URL, $SALT) { |
|
318 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $URL, $SALT)); |
|
319 | 319 | |
320 | - if( $xml ) { //If the xml packet returned failure it displays the message to the user |
|
320 | + if ($xml) { //If the xml packet returned failure it displays the message to the user |
|
321 | 321 | return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); |
322 | 322 | } |
323 | 323 | else { //If the server is unreachable, then prompts the user of the necessary action |
@@ -325,46 +325,46 @@ discard block |
||
325 | 325 | } |
326 | 326 | } |
327 | 327 | |
328 | -function bigbluebuttonbn_isMeetingRunning( $meetingID, $URL, $SALT ) { |
|
329 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) ); |
|
330 | - if ( $xml && $xml->returncode == 'SUCCESS' ) { |
|
331 | - return ( ( $xml->running == 'true' ) ? true : false); |
|
328 | +function bigbluebuttonbn_isMeetingRunning($meetingID, $URL, $SALT) { |
|
329 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT)); |
|
330 | + if ($xml && $xml->returncode == 'SUCCESS') { |
|
331 | + return (($xml->running == 'true') ? true : false); |
|
332 | 332 | } else { |
333 | - return ( false ); |
|
333 | + return (false); |
|
334 | 334 | } |
335 | 335 | } |
336 | 336 | |
337 | 337 | |
338 | -function bigbluebuttonbn_getServerVersion( $URL ){ |
|
339 | - $xml = bigbluebuttonbn_wrap_xml_load_file( $URL."api" ); |
|
340 | - if ( $xml && $xml->returncode == 'SUCCESS' ) { |
|
338 | +function bigbluebuttonbn_getServerVersion($URL) { |
|
339 | + $xml = bigbluebuttonbn_wrap_xml_load_file($URL . "api"); |
|
340 | + if ($xml && $xml->returncode == 'SUCCESS') { |
|
341 | 341 | return $xml->version; |
342 | 342 | } else { |
343 | 343 | return NULL; |
344 | 344 | } |
345 | 345 | } |
346 | 346 | |
347 | -function bigbluebuttonbn_getMeetingXML( $meetingID, $URL, $SALT ) { |
|
348 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) ); |
|
349 | - if ( $xml && $xml->returncode == 'SUCCESS') { |
|
350 | - return ( str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML()))); |
|
347 | +function bigbluebuttonbn_getMeetingXML($meetingID, $URL, $SALT) { |
|
348 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT)); |
|
349 | + if ($xml && $xml->returncode == 'SUCCESS') { |
|
350 | + return (str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML()))); |
|
351 | 351 | } else { |
352 | 352 | return 'false'; |
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
356 | -function bigbluebuttonbn_wrap_xml_load_file($url, $method=BIGBLUEBUTTONBN_METHOD_GET, $data=null) { |
|
357 | - if ( bigbluebuttonbn_debugdisplay() ) error_log("Request to: ".$url); |
|
356 | +function bigbluebuttonbn_wrap_xml_load_file($url, $method = BIGBLUEBUTTONBN_METHOD_GET, $data = null) { |
|
357 | + if (bigbluebuttonbn_debugdisplay()) error_log("Request to: " . $url); |
|
358 | 358 | |
359 | 359 | if (extension_loaded('curl')) { |
360 | 360 | $c = new curl(); |
361 | - $c->setopt( Array( "SSL_VERIFYPEER" => true)); |
|
362 | - if( $method == BIGBLUEBUTTONBN_METHOD_POST ) { |
|
363 | - if( !is_null($data) ) { |
|
364 | - if( !is_array($data) ) { |
|
361 | + $c->setopt(Array("SSL_VERIFYPEER" => true)); |
|
362 | + if ($method == BIGBLUEBUTTONBN_METHOD_POST) { |
|
363 | + if (!is_null($data)) { |
|
364 | + if (!is_array($data)) { |
|
365 | 365 | $options['CURLOPT_HTTPHEADER'] = array( |
366 | 366 | 'Content-Type: text/xml', |
367 | - 'Content-Length: '.strlen($data), |
|
367 | + 'Content-Length: ' . strlen($data), |
|
368 | 368 | 'Content-Language: en-US' |
369 | 369 | ); |
370 | 370 | $response = $c->post($url, $data, $options); |
@@ -386,9 +386,9 @@ discard block |
||
386 | 386 | try { |
387 | 387 | $xml = new SimpleXMLElement($response, LIBXML_NOCDATA); |
388 | 388 | return $xml; |
389 | - } catch (Exception $e){ |
|
389 | + } catch (Exception $e) { |
|
390 | 390 | libxml_use_internal_errors($previous); |
391 | - $error = 'Caught exception: '.$e->getMessage(); |
|
391 | + $error = 'Caught exception: ' . $e->getMessage(); |
|
392 | 392 | error_log($error); |
393 | 393 | return NULL; |
394 | 394 | } |
@@ -400,9 +400,9 @@ discard block |
||
400 | 400 | } else { |
401 | 401 | $previous = libxml_use_internal_errors(true); |
402 | 402 | try { |
403 | - $xml = simplexml_load_file($url,'SimpleXMLElement', LIBXML_NOCDATA); |
|
403 | + $xml = simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA); |
|
404 | 404 | return $xml; |
405 | - } catch (Exception $e){ |
|
405 | + } catch (Exception $e) { |
|
406 | 406 | libxml_use_internal_errors($previous); |
407 | 407 | return NULL; |
408 | 408 | } |
@@ -416,10 +416,10 @@ discard block |
||
416 | 416 | $user_roles = get_user_roles($context, $userid); |
417 | 417 | if ($user_roles) { |
418 | 418 | $where = ''; |
419 | - foreach ($user_roles as $key => $value){ |
|
420 | - $where .= (empty($where) ? ' WHERE' : ' AND').' id='.$value->roleid; |
|
419 | + foreach ($user_roles as $key => $value) { |
|
420 | + $where .= (empty($where) ? ' WHERE' : ' AND') . ' id=' . $value->roleid; |
|
421 | 421 | } |
422 | - $user_roles = $DB->get_records_sql('SELECT * FROM {role}'.$where); |
|
422 | + $user_roles = $DB->get_records_sql('SELECT * FROM {role}' . $where); |
|
423 | 423 | } |
424 | 424 | return $user_roles; |
425 | 425 | } |
@@ -429,9 +429,9 @@ discard block |
||
429 | 429 | return array($guest_role->id => $guest_role); |
430 | 430 | } |
431 | 431 | |
432 | -function bigbluebuttonbn_get_role_name($role_shortname){ |
|
432 | +function bigbluebuttonbn_get_role_name($role_shortname) { |
|
433 | 433 | $role = bigbluebuttonbn_get_db_moodle_roles($role_shortname); |
434 | - if( $role != null && $role->name != "") { |
|
434 | + if ($role != null && $role->name != "") { |
|
435 | 435 | $role_name = $role->name; |
436 | 436 | } else { |
437 | 437 | switch ($role_shortname) { |
@@ -451,13 +451,13 @@ discard block |
||
451 | 451 | return $role_name; |
452 | 452 | } |
453 | 453 | |
454 | -function bigbluebuttonbn_get_roles($rolename='all', $format='json'){ |
|
454 | +function bigbluebuttonbn_get_roles($rolename = 'all', $format = 'json') { |
|
455 | 455 | $roles = bigbluebuttonbn_get_db_moodle_roles($rolename); |
456 | 456 | $roles_array = array(); |
457 | - foreach($roles as $role){ |
|
458 | - if( $format=='json' ) { |
|
457 | + foreach ($roles as $role) { |
|
458 | + if ($format == 'json') { |
|
459 | 459 | array_push($roles_array, |
460 | - array( "id" => $role->shortname, |
|
460 | + array("id" => $role->shortname, |
|
461 | 461 | "name" => bigbluebuttonbn_get_role_name($role->shortname) |
462 | 462 | ) |
463 | 463 | ); |
@@ -468,19 +468,19 @@ discard block |
||
468 | 468 | return $roles_array; |
469 | 469 | } |
470 | 470 | |
471 | -function bigbluebuttonbn_get_roles_json($rolename='all'){ |
|
471 | +function bigbluebuttonbn_get_roles_json($rolename = 'all') { |
|
472 | 472 | return json_encode(bigbluebuttonbn_get_roles($rolename)); |
473 | 473 | } |
474 | 474 | |
475 | -function bigbluebuttonbn_get_users_json($users, $full=false) { |
|
476 | - if( $full ) { |
|
475 | +function bigbluebuttonbn_get_users_json($users, $full = false) { |
|
476 | + if ($full) { |
|
477 | 477 | return json_encode($users); |
478 | 478 | } else { |
479 | 479 | $users_array = array(); |
480 | - foreach($users as $user){ |
|
480 | + foreach ($users as $user) { |
|
481 | 481 | array_push($users_array, |
482 | - array( "id" => $user->id, |
|
483 | - "name" => $user->firstname.' '.$user->lastname |
|
482 | + array("id" => $user->id, |
|
483 | + "name" => $user->firstname . ' ' . $user->lastname |
|
484 | 484 | ) |
485 | 485 | ); |
486 | 486 | } |
@@ -488,15 +488,15 @@ discard block |
||
488 | 488 | } |
489 | 489 | } |
490 | 490 | |
491 | -function bigbluebuttonbn_get_participant_list($bigbluebuttonbn=null, $context=null){ |
|
491 | +function bigbluebuttonbn_get_participant_list($bigbluebuttonbn = null, $context = null) { |
|
492 | 492 | global $CFG, $USER; |
493 | 493 | |
494 | 494 | $participant_list_array = array(); |
495 | 495 | |
496 | - if( $bigbluebuttonbn != null ) { |
|
496 | + if ($bigbluebuttonbn != null) { |
|
497 | 497 | $participant_list = json_decode($bigbluebuttonbn->participants); |
498 | 498 | if (is_array($participant_list)) { |
499 | - foreach($participant_list as $participant){ |
|
499 | + foreach ($participant_list as $participant) { |
|
500 | 500 | array_push($participant_list_array, |
501 | 501 | array( |
502 | 502 | "selectiontype" => $participant->selectiontype, |
@@ -516,16 +516,16 @@ discard block |
||
516 | 516 | ); |
517 | 517 | |
518 | 518 | $moderator_defaults = bigbluebuttonbn_get_cfg_moderator_default(); |
519 | - if ( !isset($moderator_defaults) ) { |
|
519 | + if (!isset($moderator_defaults)) { |
|
520 | 520 | $moderator_defaults = array('owner'); |
521 | 521 | } else { |
522 | 522 | $moderator_defaults = explode(',', $moderator_defaults); |
523 | 523 | } |
524 | - foreach( $moderator_defaults as $moderator_default ) { |
|
525 | - if( $moderator_default == 'owner' ) { |
|
524 | + foreach ($moderator_defaults as $moderator_default) { |
|
525 | + if ($moderator_default == 'owner') { |
|
526 | 526 | $users = bigbluebuttonbn_get_users($context); |
527 | - foreach( $users as $user ){ |
|
528 | - if( $user->id == $USER->id ){ |
|
527 | + foreach ($users as $user) { |
|
528 | + if ($user->id == $USER->id) { |
|
529 | 529 | array_push($participant_list_array, |
530 | 530 | array( |
531 | 531 | "selectiontype" => "user", |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | return $participant_list_array; |
552 | 552 | } |
553 | 553 | |
554 | -function bigbluebuttonbn_get_participant_list_json($bigbluebuttonbnid=null){ |
|
554 | +function bigbluebuttonbn_get_participant_list_json($bigbluebuttonbnid = null) { |
|
555 | 555 | return json_encode(bigbluebuttonbn_get_participant_list($bigbluebuttonbnid)); |
556 | 556 | } |
557 | 557 | |
@@ -560,9 +560,9 @@ discard block |
||
560 | 560 | |
561 | 561 | if (is_array($participant_list)) { |
562 | 562 | // Iterate looking for all configuration |
563 | - foreach($participant_list as $participant){ |
|
564 | - if( $participant->selectiontype == 'all' ) { |
|
565 | - if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) { |
|
563 | + foreach ($participant_list as $participant) { |
|
564 | + if ($participant->selectiontype == 'all') { |
|
565 | + if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR) { |
|
566 | 566 | return true; |
567 | 567 | } |
568 | 568 | } |
@@ -570,12 +570,12 @@ discard block |
||
570 | 570 | |
571 | 571 | //Iterate looking for roles |
572 | 572 | $db_moodle_roles = bigbluebuttonbn_get_db_moodle_roles(); |
573 | - foreach($participant_list as $participant){ |
|
574 | - if( $participant->selectiontype == 'role' ) { |
|
575 | - foreach( $roles as $role ) { |
|
573 | + foreach ($participant_list as $participant) { |
|
574 | + if ($participant->selectiontype == 'role') { |
|
575 | + foreach ($roles as $role) { |
|
576 | 576 | $db_moodle_role = bigbluebuttonbn_moodle_db_role_lookup($db_moodle_roles, $role->id); |
577 | - if( $participant->selectionid == $db_moodle_role->shortname ) { |
|
578 | - if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) { |
|
577 | + if ($participant->selectionid == $db_moodle_role->shortname) { |
|
578 | + if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR) { |
|
579 | 579 | return true; |
580 | 580 | } |
581 | 581 | } |
@@ -584,10 +584,10 @@ discard block |
||
584 | 584 | } |
585 | 585 | |
586 | 586 | //Iterate looking for users |
587 | - foreach($participant_list as $participant){ |
|
588 | - if( $participant->selectiontype == 'user' ) { |
|
589 | - if( $participant->selectionid == $user ) { |
|
590 | - if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) { |
|
587 | + foreach ($participant_list as $participant) { |
|
588 | + if ($participant->selectiontype == 'user') { |
|
589 | + if ($participant->selectionid == $user) { |
|
590 | + if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR) { |
|
591 | 591 | return true; |
592 | 592 | } |
593 | 593 | } |
@@ -599,8 +599,8 @@ discard block |
||
599 | 599 | } |
600 | 600 | |
601 | 601 | function bigbluebuttonbn_moodle_db_role_lookup($db_moodle_roles, $role_id) { |
602 | - foreach( $db_moodle_roles as $db_moodle_role ){ |
|
603 | - if( $role_id == $db_moodle_role->id ) { |
|
602 | + foreach ($db_moodle_roles as $db_moodle_role) { |
|
603 | + if ($role_id == $db_moodle_role->id) { |
|
604 | 604 | return $db_moodle_role; |
605 | 605 | } |
606 | 606 | } |
@@ -608,25 +608,25 @@ discard block |
||
608 | 608 | |
609 | 609 | function bigbluebuttonbn_get_error_key($messageKey, $defaultKey = null) { |
610 | 610 | $key = $defaultKey; |
611 | - if ( $messageKey == "checksumError" ) { |
|
611 | + if ($messageKey == "checksumError") { |
|
612 | 612 | $key = 'index_error_checksum'; |
613 | - } else if ( $messageKey == 'maxConcurrent' ) { |
|
613 | + } else if ($messageKey == 'maxConcurrent') { |
|
614 | 614 | $key = 'view_error_max_concurrent'; |
615 | 615 | } |
616 | 616 | return $key; |
617 | 617 | } |
618 | 618 | |
619 | -function bigbluebuttonbn_voicebridge_unique($voicebridge, $id=null) { |
|
619 | +function bigbluebuttonbn_voicebridge_unique($voicebridge, $id = null) { |
|
620 | 620 | global $DB; |
621 | 621 | |
622 | 622 | $is_unique = true; |
623 | - if ( $voicebridge != 0 ) { |
|
623 | + if ($voicebridge != 0) { |
|
624 | 624 | $table = "bigbluebuttonbn"; |
625 | - $select = "voicebridge = ".$voicebridge; |
|
626 | - if ( $id ) { |
|
627 | - $select .= " AND id <> ".$id; |
|
625 | + $select = "voicebridge = " . $voicebridge; |
|
626 | + if ($id) { |
|
627 | + $select .= " AND id <> " . $id; |
|
628 | 628 | } |
629 | - if ( $rooms = $DB->get_records_select($table, $select) ) { |
|
629 | + if ($rooms = $DB->get_records_select($table, $select)) { |
|
630 | 630 | $is_unique = false; |
631 | 631 | } |
632 | 632 | } |
@@ -639,8 +639,8 @@ discard block |
||
639 | 639 | |
640 | 640 | $duration = 0; |
641 | 641 | $now = time(); |
642 | - if ( $closingtime > 0 && $now < $closingtime ) { |
|
643 | - $duration = ceil(($closingtime - $now)/60); |
|
642 | + if ($closingtime > 0 && $now < $closingtime) { |
|
643 | + $duration = ceil(($closingtime - $now) / 60); |
|
644 | 644 | $compensation_time = intval(bigbluebuttonbn_get_cfg_scheduled_duration_compensation()); |
645 | 645 | $duration = intval($duration) + $compensation_time; |
646 | 646 | } |
@@ -648,13 +648,13 @@ discard block |
||
648 | 648 | return $duration; |
649 | 649 | } |
650 | 650 | |
651 | -function bigbluebuttonbn_get_presentation_array($context, $presentation, $id=null) { |
|
651 | +function bigbluebuttonbn_get_presentation_array($context, $presentation, $id = null) { |
|
652 | 652 | $presentation_name = null; |
653 | 653 | $presentation_url = null; |
654 | 654 | $presentation_icon = null; |
655 | 655 | $presentation_mimetype_description = null; |
656 | 656 | |
657 | - if ( !empty($presentation) ) { |
|
657 | + if (!empty($presentation)) { |
|
658 | 658 | $fs = get_file_storage(); |
659 | 659 | $files = $fs->get_area_files($context->id, 'mod_bigbluebuttonbn', 'presentation', 0, 'itemid, filepath, filename', false); |
660 | 660 | if (count($files) < 1) { |
@@ -668,12 +668,12 @@ discard block |
||
668 | 668 | $presentation_icon = file_file_icon($file, 24); |
669 | 669 | $presentation_mimetype_description = get_mimetype_description($file); |
670 | 670 | |
671 | - if( !is_null($id) ) { |
|
671 | + if (!is_null($id)) { |
|
672 | 672 | //Create the nonce component for granting a temporary public access |
673 | 673 | $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'presentation_cache'); |
674 | 674 | $presentation_nonce_key = sha1($id); |
675 | 675 | $presentation_nonce_value = bigbluebuttonbn_generate_nonce(); |
676 | - $cache->set($presentation_nonce_key, array( "value" => $presentation_nonce_value, "counter" => 0 )); |
|
676 | + $cache->set($presentation_nonce_key, array("value" => $presentation_nonce_value, "counter" => 0)); |
|
677 | 677 | |
678 | 678 | //The item id was adapted for granting public access to the presentation once in order to allow BigBlueButton to gather the file |
679 | 679 | $url = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(), $file->get_filearea(), $presentation_nonce_value, $file->get_filepath(), $file->get_filename()); |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | } |
685 | 685 | } |
686 | 686 | |
687 | - $presentation_array = array( "url" => $presentation_url, "name" => $presentation_name, "icon" => $presentation_icon, "mimetype_description" => $presentation_mimetype_description); |
|
687 | + $presentation_array = array("url" => $presentation_url, "name" => $presentation_name, "icon" => $presentation_icon, "mimetype_description" => $presentation_mimetype_description); |
|
688 | 688 | |
689 | 689 | return $presentation_array; |
690 | 690 | } |
@@ -694,13 +694,13 @@ discard block |
||
694 | 694 | $mt = microtime(); |
695 | 695 | $rand = mt_rand(); |
696 | 696 | |
697 | - return md5($mt.$rand); |
|
697 | + return md5($mt . $rand); |
|
698 | 698 | } |
699 | 699 | |
700 | -function bigbluebuttonbn_random_password( $length = 8 ) { |
|
700 | +function bigbluebuttonbn_random_password($length = 8) { |
|
701 | 701 | |
702 | 702 | $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?"; |
703 | - $password = substr( str_shuffle( $chars ), 0, $length ); |
|
703 | + $password = substr(str_shuffle($chars), 0, $length); |
|
704 | 704 | |
705 | 705 | return $password; |
706 | 706 | } |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | global $CFG; |
793 | 793 | |
794 | 794 | $version_major = bigbluebuttonbn_get_moodle_version_major(); |
795 | - if ( $version_major < '2014051200' ) { |
|
795 | + if ($version_major < '2014051200') { |
|
796 | 796 | //This is valid before v2.7 |
797 | 797 | bigbluebuttonbn_event_log_legacy($event_type, $bigbluebuttonbn, $context, $cm); |
798 | 798 | |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | } |
803 | 803 | } |
804 | 804 | |
805 | -function bigbluebuttonbn_bbb_broker_get_recordings($meetingid, $password, $forced=false) { |
|
805 | +function bigbluebuttonbn_bbb_broker_get_recordings($meetingid, $password, $forced = false) { |
|
806 | 806 | global $CFG; |
807 | 807 | |
808 | 808 | $recordings = array(); |
@@ -818,19 +818,19 @@ discard block |
||
818 | 818 | $result = $cache->get($meetingid); |
819 | 819 | $meeting_info = json_decode($result['meeting_info']); |
820 | 820 | $meeting_info->participantCount += 1; |
821 | - if( $is_moderator ) { |
|
821 | + if ($is_moderator) { |
|
822 | 822 | $meeting_info->moderatorCount += 1; |
823 | 823 | } |
824 | - $cache->set($meetingid, array('creation_time' => $result['creation_time'], 'meeting_info' => json_encode($meeting_info) )); |
|
824 | + $cache->set($meetingid, array('creation_time' => $result['creation_time'], 'meeting_info' => json_encode($meeting_info))); |
|
825 | 825 | } |
826 | 826 | |
827 | 827 | function bigbluebuttonbn_bbb_broker_is_meeting_running($meeting_info) { |
828 | - $meeting_running = ( isset($meeting_info) && isset($meeting_info->returncode) && $meeting_info->returncode == 'SUCCESS' ); |
|
828 | + $meeting_running = (isset($meeting_info) && isset($meeting_info->returncode) && $meeting_info->returncode == 'SUCCESS'); |
|
829 | 829 | |
830 | 830 | return $meeting_running; |
831 | 831 | } |
832 | 832 | |
833 | -function bigbluebuttonbn_bbb_broker_get_meeting_info($meetingid, $password, $forced=false) { |
|
833 | +function bigbluebuttonbn_bbb_broker_get_meeting_info($meetingid, $password, $forced = false) { |
|
834 | 834 | global $CFG; |
835 | 835 | |
836 | 836 | $meeting_info = array(); |
@@ -841,19 +841,19 @@ discard block |
||
841 | 841 | $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'meetings_cache'); |
842 | 842 | $result = $cache->get($meetingid); |
843 | 843 | $now = time(); |
844 | - if( isset($result) && $now < ($result['creation_time'] + $cache_ttl) && !$forced ) { |
|
844 | + if (isset($result) && $now < ($result['creation_time'] + $cache_ttl) && !$forced) { |
|
845 | 845 | //Use the value in the cache |
846 | 846 | $meeting_info = json_decode($result['meeting_info']); |
847 | 847 | } else { |
848 | 848 | //Ping again and refresh the cache |
849 | - $meeting_info = (array) bigbluebuttonbn_getMeetingInfo( $meetingid, $password, $endpoint, $shared_secret ); |
|
850 | - $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meeting_info) )); |
|
849 | + $meeting_info = (array)bigbluebuttonbn_getMeetingInfo($meetingid, $password, $endpoint, $shared_secret); |
|
850 | + $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meeting_info))); |
|
851 | 851 | } |
852 | 852 | |
853 | 853 | return $meeting_info; |
854 | 854 | } |
855 | 855 | |
856 | -function bigbluebuttonbn_bbb_broker_do_end_meeting($meetingid, $password){ |
|
856 | +function bigbluebuttonbn_bbb_broker_do_end_meeting($meetingid, $password) { |
|
857 | 857 | global $CFG; |
858 | 858 | |
859 | 859 | $endpoint = bigbluebuttonbn_get_cfg_server_url(); |
@@ -862,16 +862,16 @@ discard block |
||
862 | 862 | bigbluebuttonbn_doEndMeeting($meetingid, $password, $endpoint, $shared_secret); |
863 | 863 | } |
864 | 864 | |
865 | -function bigbluebuttonbn_bbb_broker_do_publish_recording($recordingid, $publish=true){ |
|
865 | +function bigbluebuttonbn_bbb_broker_do_publish_recording($recordingid, $publish = true) { |
|
866 | 866 | global $CFG; |
867 | 867 | |
868 | 868 | $endpoint = bigbluebuttonbn_get_cfg_server_url(); |
869 | 869 | $shared_secret = bigbluebuttonbn_get_cfg_shared_secret(); |
870 | 870 | |
871 | - bigbluebuttonbn_doPublishRecordings($recordingid, ($publish)? 'true': 'false', $endpoint, $shared_secret); |
|
871 | + bigbluebuttonbn_doPublishRecordings($recordingid, ($publish) ? 'true' : 'false', $endpoint, $shared_secret); |
|
872 | 872 | } |
873 | 873 | |
874 | -function bigbluebuttonbn_bbb_broker_do_publish_recording_imported($recordingid, $courseID, $bigbluebuttonbnID, $publish=true){ |
|
874 | +function bigbluebuttonbn_bbb_broker_do_publish_recording_imported($recordingid, $courseID, $bigbluebuttonbnID, $publish = true) { |
|
875 | 875 | global $DB; |
876 | 876 | |
877 | 877 | //Locate the record to be updated |
@@ -880,9 +880,9 @@ discard block |
||
880 | 880 | $recordings_imported = array(); |
881 | 881 | foreach ($records as $key => $record) { |
882 | 882 | $meta = json_decode($record->meta, true); |
883 | - if( $recordingid == $meta['recording']['recordID'] ) { |
|
883 | + if ($recordingid == $meta['recording']['recordID']) { |
|
884 | 884 | // Found, prepare data for the update |
885 | - $meta['recording']['published'] = ($publish)? 'true': 'false'; |
|
885 | + $meta['recording']['published'] = ($publish) ? 'true' : 'false'; |
|
886 | 886 | $records[$key]->meta = json_encode($meta); |
887 | 887 | |
888 | 888 | // Proceed with the update |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | } |
892 | 892 | } |
893 | 893 | |
894 | -function bigbluebuttonbn_bbb_broker_do_delete_recording($recordingid){ |
|
894 | +function bigbluebuttonbn_bbb_broker_do_delete_recording($recordingid) { |
|
895 | 895 | global $CFG; |
896 | 896 | |
897 | 897 | $endpoint = bigbluebuttonbn_get_cfg_server_url(); |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | bigbluebuttonbn_doDeleteRecordings($recordingid, $endpoint, $shared_secret); |
901 | 901 | } |
902 | 902 | |
903 | -function bigbluebuttonbn_bbb_broker_do_delete_recording_imported($recordingid, $courseID, $bigbluebuttonbnID){ |
|
903 | +function bigbluebuttonbn_bbb_broker_do_delete_recording_imported($recordingid, $courseID, $bigbluebuttonbnID) { |
|
904 | 904 | global $DB; |
905 | 905 | |
906 | 906 | //Locate the record to be updated |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | $recordings_imported = array(); |
910 | 910 | foreach ($records as $key => $record) { |
911 | 911 | $meta = json_decode($record->meta, true); |
912 | - if( $recordingid == $meta['recording']['recordID'] ) { |
|
912 | + if ($recordingid == $meta['recording']['recordID']) { |
|
913 | 913 | // Execute delete |
914 | 914 | $DB->delete_records("bigbluebuttonbn_logs", array('id' => $key)); |
915 | 915 | } |
@@ -919,18 +919,18 @@ discard block |
||
919 | 919 | function bigbluebuttonbn_bbb_broker_validate_parameters($params) { |
920 | 920 | $error = ''; |
921 | 921 | |
922 | - if ( !isset($params['callback']) ) { |
|
922 | + if (!isset($params['callback'])) { |
|
923 | 923 | $error = bigbluebuttonbn_bbb_broker_add_error($error, 'This call must include a javascript callback.'); |
924 | 924 | } |
925 | 925 | |
926 | - if ( !isset($params['action']) ) { |
|
926 | + if (!isset($params['action'])) { |
|
927 | 927 | $error = bigbluebuttonbn_bbb_broker_add_error($error, 'Action parameter must be included.'); |
928 | 928 | } else { |
929 | - switch ( strtolower($params['action']) ){ |
|
929 | + switch (strtolower($params['action'])) { |
|
930 | 930 | case 'server_ping': |
931 | 931 | case 'meeting_info': |
932 | 932 | case 'meeting_end': |
933 | - if ( !isset($params['id']) ) { |
|
933 | + if (!isset($params['id'])) { |
|
934 | 934 | $error = bigbluebuttonbn_bbb_broker_add_error($error, 'The meetingID must be specified.'); |
935 | 935 | } |
936 | 936 | break; |
@@ -940,76 +940,76 @@ discard block |
||
940 | 940 | case 'recording_unpublish': |
941 | 941 | case 'recording_delete': |
942 | 942 | case 'recording_import': |
943 | - if ( !isset($params['id']) ) { |
|
943 | + if (!isset($params['id'])) { |
|
944 | 944 | $error = bigbluebuttonbn_bbb_broker_add_error($error, 'The recordingID must be specified.'); |
945 | 945 | } |
946 | 946 | break; |
947 | 947 | case 'recording_ready': |
948 | - if( empty($params['signed_parameters']) ) { |
|
948 | + if (empty($params['signed_parameters'])) { |
|
949 | 949 | $error = bigbluebuttonbn_bbb_broker_add_error($error, 'A JWT encoded string must be included as [signed_parameters].'); |
950 | 950 | } |
951 | 951 | break; |
952 | 952 | default: |
953 | - $error = bigbluebuttonbn_bbb_broker_add_error($error, 'Action '.$params['action'].' can not be performed.'); |
|
953 | + $error = bigbluebuttonbn_bbb_broker_add_error($error, 'Action ' . $params['action'] . ' can not be performed.'); |
|
954 | 954 | } |
955 | 955 | } |
956 | 956 | |
957 | 957 | return $error; |
958 | 958 | } |
959 | 959 | |
960 | -function bigbluebuttonbn_bbb_broker_add_error($org_msg, $new_msg='') { |
|
960 | +function bigbluebuttonbn_bbb_broker_add_error($org_msg, $new_msg = '') { |
|
961 | 961 | $error = $org_msg; |
962 | 962 | |
963 | - if( !empty($new_msg) ) { |
|
964 | - if( !empty($error) ) $error .= ' '; |
|
963 | + if (!empty($new_msg)) { |
|
964 | + if (!empty($error)) $error .= ' '; |
|
965 | 965 | $error .= $new_msg; |
966 | 966 | } |
967 | 967 | |
968 | 968 | return $error; |
969 | 969 | } |
970 | 970 | |
971 | -function bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools=["publishing", "deleting"]) { |
|
971 | +function bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools = ["publishing", "deleting"]) { |
|
972 | 972 | global $OUTPUT, $CFG, $USER; |
973 | 973 | |
974 | 974 | $row = null; |
975 | 975 | |
976 | - if ( $bbbsession['managerecordings'] || $recording['published'] == 'true' ) { |
|
977 | - $startTime = isset($recording['startTime'])? floatval($recording['startTime']):0; |
|
976 | + if ($bbbsession['managerecordings'] || $recording['published'] == 'true') { |
|
977 | + $startTime = isset($recording['startTime']) ? floatval($recording['startTime']) : 0; |
|
978 | 978 | $startTime = $startTime - ($startTime % 1000); |
979 | 979 | $duration = intval(array_values($recording['playbacks'])[0]['length']); |
980 | 980 | |
981 | 981 | //For backward compatibility |
982 | - if( isset($recording['meta_contextactivity']) ) { |
|
982 | + if (isset($recording['meta_contextactivity'])) { |
|
983 | 983 | $meta_activity = str_replace('"', '\"', $recording['meta_contextactivity']); |
984 | - } if( isset($recording['meta_bbb-recording-name']) ) { |
|
984 | + } if (isset($recording['meta_bbb-recording-name'])) { |
|
985 | 985 | $meta_activity = str_replace('"', '\"', $recording['meta_bbb-recording-name']); |
986 | 986 | } else { |
987 | 987 | $meta_activity = str_replace('"', '\"', $recording['meetingName']); |
988 | 988 | } |
989 | 989 | |
990 | - if( isset($recording['meta_contextactivitydescription']) ) { |
|
990 | + if (isset($recording['meta_contextactivitydescription'])) { |
|
991 | 991 | $meta_description = str_replace('"', '\"', $recording['meta_contextactivitydescription']); |
992 | - } else if( isset($recording['meta_bbb-recording-description']) ) { |
|
992 | + } else if (isset($recording['meta_bbb-recording-description'])) { |
|
993 | 993 | $meta_description = str_replace('"', '\"', $recording['meta_bbb-recording-description']); |
994 | 994 | } else { |
995 | 995 | $meta_description = ''; |
996 | 996 | } |
997 | 997 | |
998 | 998 | //Set recording_types |
999 | - if ( isset($recording['imported']) ) { |
|
1000 | - $attributes = 'data-imported="true" title='.get_string('view_recording_link_warning', 'bigbluebuttonbn'); |
|
999 | + if (isset($recording['imported'])) { |
|
1000 | + $attributes = 'data-imported="true" title=' . get_string('view_recording_link_warning', 'bigbluebuttonbn'); |
|
1001 | 1001 | } else { |
1002 | 1002 | $attributes = 'data-imported="false"'; |
1003 | 1003 | } |
1004 | 1004 | |
1005 | 1005 | $recording_types = ''; |
1006 | 1006 | if ($recording['published'] == 'true') { |
1007 | - $recording_types .= '<div id="playbacks-'.$recording['recordID'].'" '.$attributes.'>'; |
|
1007 | + $recording_types .= '<div id="playbacks-' . $recording['recordID'] . '" ' . $attributes . '>'; |
|
1008 | 1008 | } else { |
1009 | - $recording_types .= '<div id="playbacks-'.$recording['recordID'].'" '.$attributes.'" hidden>'; |
|
1009 | + $recording_types .= '<div id="playbacks-' . $recording['recordID'] . '" ' . $attributes . '" hidden>'; |
|
1010 | 1010 | } |
1011 | - foreach ( $recording['playbacks'] as $playback ) { |
|
1012 | - $recording_types .= $OUTPUT->action_link($playback['url'], get_string('view_recording_format_'.$playback['type'], 'bigbluebuttonbn'), null, array('title' => get_string('view_recording_format_'.$playback['type'], 'bigbluebuttonbn'), 'target' => '_new') ).' '; |
|
1011 | + foreach ($recording['playbacks'] as $playback) { |
|
1012 | + $recording_types .= $OUTPUT->action_link($playback['url'], get_string('view_recording_format_' . $playback['type'], 'bigbluebuttonbn'), null, array('title' => get_string('view_recording_format_' . $playback['type'], 'bigbluebuttonbn'), 'target' => '_new')) . ' '; |
|
1013 | 1013 | } |
1014 | 1014 | $recording_types .= '</div>'; |
1015 | 1015 | |
@@ -1018,11 +1018,11 @@ discard block |
||
1018 | 1018 | |
1019 | 1019 | //Set actionbar, if user is allowed to manage recordings |
1020 | 1020 | $actionbar = ''; |
1021 | - if ( $bbbsession['managerecordings'] ) { |
|
1021 | + if ($bbbsession['managerecordings']) { |
|
1022 | 1022 | // Set style for imported links |
1023 | - if( isset($recording['imported']) ) { |
|
1023 | + if (isset($recording['imported'])) { |
|
1024 | 1024 | $recordings_imported_count = 0; |
1025 | - $tag_tail = ' '.get_string('view_recording_link', 'bigbluebuttonbn'); |
|
1025 | + $tag_tail = ' ' . get_string('view_recording_link', 'bigbluebuttonbn'); |
|
1026 | 1026 | $head = '<i>'; |
1027 | 1027 | $tail = '</i>'; |
1028 | 1028 | } else { |
@@ -1036,53 +1036,53 @@ discard block |
||
1036 | 1036 | |
1037 | 1037 | if (in_array("publishing", $tools)) { |
1038 | 1038 | ///Set action [show|hide] |
1039 | - if ( $recording['published'] == 'true' ){ |
|
1039 | + if ($recording['published'] == 'true') { |
|
1040 | 1040 | $manage_tag = 'hide'; |
1041 | 1041 | $manage_action = 'unpublish'; |
1042 | 1042 | } else { |
1043 | 1043 | $manage_tag = 'show'; |
1044 | 1044 | $manage_action = 'publish'; |
1045 | 1045 | } |
1046 | - $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("'.$manage_action.'", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");'; |
|
1046 | + $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("' . $manage_action . '", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");'; |
|
1047 | 1047 | |
1048 | - if ( bigbluebuttonbn_get_cfg_recording_icons_enabled() ) { |
|
1048 | + if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) { |
|
1049 | 1049 | //With icon for publish/unpublish |
1050 | - $icon_attributes = array('id' => 'recording-btn-'.$manage_action.'-'.$recording['recordID']); |
|
1051 | - $icon = new pix_icon('t/'.$manage_tag, get_string($manage_tag).$tag_tail, 'moodle', $icon_attributes); |
|
1052 | - $link_attributes = array('id' => 'recording-link-'.$manage_action.'-'.$recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count); |
|
1050 | + $icon_attributes = array('id' => 'recording-btn-' . $manage_action . '-' . $recording['recordID']); |
|
1051 | + $icon = new pix_icon('t/' . $manage_tag, get_string($manage_tag) . $tag_tail, 'moodle', $icon_attributes); |
|
1052 | + $link_attributes = array('id' => 'recording-link-' . $manage_action . '-' . $recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count); |
|
1053 | 1053 | $actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false); |
1054 | 1054 | } else { |
1055 | 1055 | //With text for publish/unpublish |
1056 | - $link_attributes = array('title' => get_string($manage_tag).$tag_tail, 'class' => 'btn btn-xs', 'onclick' => $onclick, 'data-links' => $recordings_imported_count); |
|
1057 | - $actionbar .= $OUTPUT->action_link($url, get_string($manage_tag).$tag_tail, $action, $link_attributes); |
|
1056 | + $link_attributes = array('title' => get_string($manage_tag) . $tag_tail, 'class' => 'btn btn-xs', 'onclick' => $onclick, 'data-links' => $recordings_imported_count); |
|
1057 | + $actionbar .= $OUTPUT->action_link($url, get_string($manage_tag) . $tag_tail, $action, $link_attributes); |
|
1058 | 1058 | $actionbar .= " "; |
1059 | 1059 | } |
1060 | 1060 | } |
1061 | 1061 | |
1062 | 1062 | if (in_array("deleting", $tools)) { |
1063 | - $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("delete", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");'; |
|
1063 | + $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("delete", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");'; |
|
1064 | 1064 | |
1065 | - if ( bigbluebuttonbn_get_cfg_recording_icons_enabled() ) { |
|
1065 | + if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) { |
|
1066 | 1066 | //With icon for delete |
1067 | - $icon_attributes = array('id' => 'recording-btn-delete-'.$recording['recordID']); |
|
1068 | - $icon = new pix_icon('t/delete', get_string('delete').$tag_tail, 'moodle', $icon_attributes); |
|
1069 | - $link_attributes = array('id' => 'recording-link-delete-'.$recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count); |
|
1067 | + $icon_attributes = array('id' => 'recording-btn-delete-' . $recording['recordID']); |
|
1068 | + $icon = new pix_icon('t/delete', get_string('delete') . $tag_tail, 'moodle', $icon_attributes); |
|
1069 | + $link_attributes = array('id' => 'recording-link-delete-' . $recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count); |
|
1070 | 1070 | $actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false); |
1071 | 1071 | } else { |
1072 | 1072 | //With text for delete |
1073 | - $link_attributes = array('title' => get_string('delete').$tag_tail, 'class' => 'btn btn-xs btn-danger', 'onclick' => $onclick, 'data-links' => $recordings_imported_count); |
|
1074 | - $actionbar .= $OUTPUT->action_link($url, get_string('delete').$tag_tail, $action, $link_attributes); |
|
1073 | + $link_attributes = array('title' => get_string('delete') . $tag_tail, 'class' => 'btn btn-xs btn-danger', 'onclick' => $onclick, 'data-links' => $recordings_imported_count); |
|
1074 | + $actionbar .= $OUTPUT->action_link($url, get_string('delete') . $tag_tail, $action, $link_attributes); |
|
1075 | 1075 | } |
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | if (in_array("importing", $tools)) { |
1079 | - $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("import", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");'; |
|
1079 | + $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("import", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");'; |
|
1080 | 1080 | |
1081 | - if ( bigbluebuttonbn_get_cfg_recording_icons_enabled() ) { |
|
1081 | + if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) { |
|
1082 | 1082 | //With icon for import |
1083 | - $icon_attributes = array('id' => 'recording-btn-import-'.$recording['recordID']); |
|
1083 | + $icon_attributes = array('id' => 'recording-btn-import-' . $recording['recordID']); |
|
1084 | 1084 | $icon = new pix_icon('i/import', get_string('import'), 'moodle', $icon_attributes); |
1085 | - $link_attributes = array('id' => 'recording-link-import-'.$recording['recordID'], 'onclick' => $onclick); |
|
1085 | + $link_attributes = array('id' => 'recording-link-import-' . $recording['recordID'], 'onclick' => $onclick); |
|
1086 | 1086 | $actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false); |
1087 | 1087 | } else { |
1088 | 1088 | //With text for import |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | } |
1094 | 1094 | |
1095 | 1095 | //Set corresponding format |
1096 | - $dateformat = get_string('strftimerecentfull', 'langconfig').' %Z'; |
|
1096 | + $dateformat = get_string('strftimerecentfull', 'langconfig') . ' %Z'; |
|
1097 | 1097 | $formattedStartDate = userdate($startTime / 1000, $dateformat, usertimezone($USER->timezone)); |
1098 | 1098 | |
1099 | 1099 | $row = new stdClass(); |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | $row->date_formatted = "{$head}{$formattedStartDate}{$tail}"; |
1105 | 1105 | $row->duration = "{$duration}"; |
1106 | 1106 | $row->duration_formatted = "{$head}{$duration}{$tail}"; |
1107 | - if ( $bbbsession['managerecordings'] ) { |
|
1107 | + if ($bbbsession['managerecordings']) { |
|
1108 | 1108 | $row->actionbar = $actionbar; |
1109 | 1109 | } |
1110 | 1110 | } |
@@ -1130,21 +1130,21 @@ discard block |
||
1130 | 1130 | array("key" =>"duration", "label" => $view_recording_duration, "width" => "50px") |
1131 | 1131 | ); |
1132 | 1132 | |
1133 | - if ( $bbbsession['managerecordings'] ) { |
|
1133 | + if ($bbbsession['managerecordings']) { |
|
1134 | 1134 | array_push($recordingsbn_columns, array("key" =>"actionbar", "label" => $view_recording_actionbar, "width" => "75px", "allowHTML" => true)); |
1135 | 1135 | } |
1136 | 1136 | |
1137 | 1137 | return $recordingsbn_columns; |
1138 | 1138 | } |
1139 | 1139 | |
1140 | -function bigbluebuttonbn_get_recording_data($bbbsession, $recordings, $tools=["publishing", "deleting"]) { |
|
1140 | +function bigbluebuttonbn_get_recording_data($bbbsession, $recordings, $tools = ["publishing", "deleting"]) { |
|
1141 | 1141 | $table_data = array(); |
1142 | 1142 | |
1143 | 1143 | ///Build table content |
1144 | - if ( isset($recordings) && !array_key_exists('messageKey', $recordings)) { // There are recordings for this meeting |
|
1145 | - foreach ( $recordings as $recording ) { |
|
1144 | + if (isset($recordings) && !array_key_exists('messageKey', $recordings)) { // There are recordings for this meeting |
|
1145 | + foreach ($recordings as $recording) { |
|
1146 | 1146 | $row = bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools); |
1147 | - if( $row != null ) { |
|
1147 | + if ($row != null) { |
|
1148 | 1148 | array_push($table_data, $row); |
1149 | 1149 | } |
1150 | 1150 | } |
@@ -1153,7 +1153,7 @@ discard block |
||
1153 | 1153 | return $table_data; |
1154 | 1154 | } |
1155 | 1155 | |
1156 | -function bigbluebuttonbn_get_recording_table($bbbsession, $recordings, $tools=['publishing','deleting']) { |
|
1156 | +function bigbluebuttonbn_get_recording_table($bbbsession, $recordings, $tools = ['publishing', 'deleting']) { |
|
1157 | 1157 | global $OUTPUT, $CFG; |
1158 | 1158 | |
1159 | 1159 | ///Set strings to show |
@@ -1172,20 +1172,20 @@ discard block |
||
1172 | 1172 | $table->data = array(); |
1173 | 1173 | |
1174 | 1174 | ///Initialize table headers |
1175 | - if ( $bbbsession['managerecordings'] ) { |
|
1176 | - $table->head = array ($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration, $view_recording_actionbar); |
|
1177 | - $table->align = array ('left', 'left', 'left', 'left', 'center', 'left'); |
|
1175 | + if ($bbbsession['managerecordings']) { |
|
1176 | + $table->head = array($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration, $view_recording_actionbar); |
|
1177 | + $table->align = array('left', 'left', 'left', 'left', 'center', 'left'); |
|
1178 | 1178 | } else { |
1179 | - $table->head = array ($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration); |
|
1180 | - $table->align = array ('left', 'left', 'left', 'left', 'center'); |
|
1179 | + $table->head = array($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration); |
|
1180 | + $table->align = array('left', 'left', 'left', 'left', 'center'); |
|
1181 | 1181 | } |
1182 | 1182 | |
1183 | 1183 | ///Build table content |
1184 | - if ( isset($recordings) && !array_key_exists('messageKey', $recordings)) { // There are recordings for this meeting |
|
1185 | - foreach ( $recordings as $recording ){ |
|
1184 | + if (isset($recordings) && !array_key_exists('messageKey', $recordings)) { // There are recordings for this meeting |
|
1185 | + foreach ($recordings as $recording) { |
|
1186 | 1186 | $row = new html_table_row(); |
1187 | - $row->id = 'recording-td-'.$recording['recordID']; |
|
1188 | - if ( isset($recording['imported']) ) { |
|
1187 | + $row->id = 'recording-td-' . $recording['recordID']; |
|
1188 | + if (isset($recording['imported'])) { |
|
1189 | 1189 | $row->attributes['data-imported'] = 'true'; |
1190 | 1190 | $row->attributes['title'] = get_string('view_recording_link_warning', 'bigbluebuttonbn'); |
1191 | 1191 | } else { |
@@ -1193,12 +1193,12 @@ discard block |
||
1193 | 1193 | } |
1194 | 1194 | |
1195 | 1195 | $row_data = bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools); |
1196 | - if( $row_data != null ) { |
|
1196 | + if ($row_data != null) { |
|
1197 | 1197 | $row_data->date_formatted = str_replace(" ", " ", $row_data->date_formatted); |
1198 | - if ( $bbbsession['managerecordings'] ) { |
|
1199 | - $row->cells = array ($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration_formatted, $row_data->actionbar ); |
|
1198 | + if ($bbbsession['managerecordings']) { |
|
1199 | + $row->cells = array($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration_formatted, $row_data->actionbar); |
|
1200 | 1200 | } else { |
1201 | - $row->cells = array ($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration_formatted ); |
|
1201 | + $row->cells = array($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration_formatted); |
|
1202 | 1202 | } |
1203 | 1203 | |
1204 | 1204 | array_push($table->data, $row); |
@@ -1218,12 +1218,12 @@ discard block |
||
1218 | 1218 | /// Build the message_body |
1219 | 1219 | $msg->activity_type = ""; |
1220 | 1220 | $msg->activity_title = $bigbluebuttonbn->name; |
1221 | - $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>'; |
|
1221 | + $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>'; |
|
1222 | 1222 | |
1223 | 1223 | bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message_text); |
1224 | 1224 | } |
1225 | 1225 | |
1226 | -function bigbluebuttonbn_server_offers($capability_name){ |
|
1226 | +function bigbluebuttonbn_server_offers($capability_name) { |
|
1227 | 1227 | global $CFG; |
1228 | 1228 | |
1229 | 1229 | $capability_offered = null; |
@@ -1237,12 +1237,12 @@ discard block |
||
1237 | 1237 | $host_ends = explode(".", $host); |
1238 | 1238 | $host_ends_length = count($host_ends); |
1239 | 1239 | |
1240 | - if( $host_ends_length > 0 && $host_ends[$host_ends_length -1] == 'com' && $host_ends[$host_ends_length -2] == 'blindsidenetworks' ) { |
|
1240 | + if ($host_ends_length > 0 && $host_ends[$host_ends_length - 1] == 'com' && $host_ends[$host_ends_length - 2] == 'blindsidenetworks') { |
|
1241 | 1241 | //Validate the capabilities offered |
1242 | - $capabilities = bigbluebuttonbn_getCapabilitiesArray( $endpoint, $shared_secret ); |
|
1243 | - if( $capabilities ) { |
|
1242 | + $capabilities = bigbluebuttonbn_getCapabilitiesArray($endpoint, $shared_secret); |
|
1243 | + if ($capabilities) { |
|
1244 | 1244 | foreach ($capabilities as $capability) { |
1245 | - if ( $capability["name"] == $capability_name) { |
|
1245 | + if ($capability["name"] == $capability_name) { |
|
1246 | 1246 | $capability_offered = $capability; |
1247 | 1247 | } |
1248 | 1248 | } |
@@ -1252,14 +1252,14 @@ discard block |
||
1252 | 1252 | return $capability_offered; |
1253 | 1253 | } |
1254 | 1254 | |
1255 | -function bigbluebuttonbn_server_offers_bn_capabilities(){ |
|
1255 | +function bigbluebuttonbn_server_offers_bn_capabilities() { |
|
1256 | 1256 | //Validates if the server may have extended capabilities |
1257 | 1257 | $parsed_url = parse_url(bigbluebuttonbn_get_cfg_server_url()); |
1258 | 1258 | $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; |
1259 | 1259 | $host_ends = explode(".", $host); |
1260 | 1260 | $host_ends_length = count($host_ends); |
1261 | 1261 | |
1262 | - return ( $host_ends_length > 0 && $host_ends[$host_ends_length -1] == 'com' && $host_ends[$host_ends_length -2] == 'blindsidenetworks' ); |
|
1262 | + return ($host_ends_length > 0 && $host_ends[$host_ends_length - 1] == 'com' && $host_ends[$host_ends_length - 2] == 'blindsidenetworks'); |
|
1263 | 1263 | } |
1264 | 1264 | |
1265 | 1265 | function bigbluebuttonbn_get_locales_for_ui() { |
@@ -1304,89 +1304,89 @@ discard block |
||
1304 | 1304 | |
1305 | 1305 | function bigbluebuttonbn_get_cfg_server_url_default() { |
1306 | 1306 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1307 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url: (isset($CFG->bigbluebuttonbn_server_url)? $CFG->bigbluebuttonbn_server_url: (isset($CFG->BigBlueButtonBNServerURL)? $CFG->BigBlueButtonBNServerURL: BIGBLUEBUTTONBN_DEFAULT_SERVER_URL))); |
|
1307 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url : (isset($CFG->bigbluebuttonbn_server_url) ? $CFG->bigbluebuttonbn_server_url : (isset($CFG->BigBlueButtonBNServerURL) ? $CFG->BigBlueButtonBNServerURL : BIGBLUEBUTTONBN_DEFAULT_SERVER_URL))); |
|
1308 | 1308 | } |
1309 | 1309 | |
1310 | 1310 | function bigbluebuttonbn_get_cfg_shared_secret_default() { |
1311 | 1311 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1312 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret: (isset($CFG->bigbluebuttonbn_shared_secret)? $CFG->bigbluebuttonbn_shared_secret: (isset($CFG->BigBlueButtonBNSecuritySalt)? $CFG->BigBlueButtonBNSecuritySalt: BIGBLUEBUTTONBN_DEFAULT_SHARED_SECRET))); |
|
1312 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret : (isset($CFG->bigbluebuttonbn_shared_secret) ? $CFG->bigbluebuttonbn_shared_secret : (isset($CFG->BigBlueButtonBNSecuritySalt) ? $CFG->BigBlueButtonBNSecuritySalt : BIGBLUEBUTTONBN_DEFAULT_SHARED_SECRET))); |
|
1313 | 1313 | } |
1314 | 1314 | |
1315 | 1315 | function bigbluebuttonbn_get_cfg_voicebridge_editable() { |
1316 | 1316 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1317 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable: (isset($CFG->bigbluebuttonbn_voicebridge_editable)? $CFG->bigbluebuttonbn_voicebridge_editable: false)); |
|
1317 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable : (isset($CFG->bigbluebuttonbn_voicebridge_editable) ? $CFG->bigbluebuttonbn_voicebridge_editable : false)); |
|
1318 | 1318 | } |
1319 | 1319 | |
1320 | 1320 | function bigbluebuttonbn_get_cfg_recording_default() { |
1321 | 1321 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1322 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default: (isset($CFG->bigbluebuttonbn_recording_default)? $CFG->bigbluebuttonbn_recording_default: true)); |
|
1322 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default : (isset($CFG->bigbluebuttonbn_recording_default) ? $CFG->bigbluebuttonbn_recording_default : true)); |
|
1323 | 1323 | } |
1324 | 1324 | |
1325 | 1325 | function bigbluebuttonbn_get_cfg_recording_editable() { |
1326 | 1326 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1327 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable: (isset($CFG->bigbluebuttonbn_recording_editable)? $CFG->bigbluebuttonbn_recording_editable: true)); |
|
1327 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable : (isset($CFG->bigbluebuttonbn_recording_editable) ? $CFG->bigbluebuttonbn_recording_editable : true)); |
|
1328 | 1328 | } |
1329 | 1329 | |
1330 | 1330 | function bigbluebuttonbn_get_cfg_recording_tagging_default() { |
1331 | 1331 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1332 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default: (isset($CFG->bigbluebuttonbn_recordingtagging_default)? $CFG->bigbluebuttonbn_recordingtagging_default: false)); |
|
1332 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default : (isset($CFG->bigbluebuttonbn_recordingtagging_default) ? $CFG->bigbluebuttonbn_recordingtagging_default : false)); |
|
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | function bigbluebuttonbn_get_cfg_recording_tagging_editable() { |
1336 | 1336 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1337 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable: (isset($CFG->bigbluebuttonbn_recordingtagging_editable)? $CFG->bigbluebuttonbn_recordingtagging_editable: false)); |
|
1337 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable : (isset($CFG->bigbluebuttonbn_recordingtagging_editable) ? $CFG->bigbluebuttonbn_recordingtagging_editable : false)); |
|
1338 | 1338 | } |
1339 | 1339 | |
1340 | 1340 | function bigbluebuttonbn_get_cfg_recording_icons_enabled() { |
1341 | 1341 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1342 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled: (isset($CFG->bigbluebuttonbn_recording_icons_enabled)? $CFG->bigbluebuttonbn_recording_icons_enabled: true)); |
|
1342 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled : (isset($CFG->bigbluebuttonbn_recording_icons_enabled) ? $CFG->bigbluebuttonbn_recording_icons_enabled : true)); |
|
1343 | 1343 | } |
1344 | 1344 | |
1345 | 1345 | function bigbluebuttonbn_get_cfg_importrecordings_enabled() { |
1346 | 1346 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1347 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled: (isset($CFG->bigbluebuttonbn_importrecordings_enabled)? $CFG->bigbluebuttonbn_importrecordings_enabled: false)); |
|
1347 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled : (isset($CFG->bigbluebuttonbn_importrecordings_enabled) ? $CFG->bigbluebuttonbn_importrecordings_enabled : false)); |
|
1348 | 1348 | } |
1349 | 1349 | |
1350 | 1350 | function bigbluebuttonbn_get_cfg_importrecordings_from_deleted_activities_enabled() { |
1351 | 1351 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1352 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled: (isset($CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled)? $CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled: false)); |
|
1352 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled : (isset($CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled) ? $CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled : false)); |
|
1353 | 1353 | } |
1354 | 1354 | |
1355 | 1355 | function bigbluebuttonbn_get_cfg_waitformoderator_default() { |
1356 | 1356 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1357 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default: (isset($CFG->bigbluebuttonbn_waitformoderator_default)? $CFG->bigbluebuttonbn_waitformoderator_default: false)); |
|
1357 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default : (isset($CFG->bigbluebuttonbn_waitformoderator_default) ? $CFG->bigbluebuttonbn_waitformoderator_default : false)); |
|
1358 | 1358 | } |
1359 | 1359 | |
1360 | 1360 | function bigbluebuttonbn_get_cfg_waitformoderator_editable() { |
1361 | 1361 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1362 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable: (isset($CFG->bigbluebuttonbn_waitformoderator_editable)? $CFG->bigbluebuttonbn_waitformoderator_editable: true)); |
|
1362 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable : (isset($CFG->bigbluebuttonbn_waitformoderator_editable) ? $CFG->bigbluebuttonbn_waitformoderator_editable : true)); |
|
1363 | 1363 | } |
1364 | 1364 | |
1365 | 1365 | function bigbluebuttonbn_get_cfg_waitformoderator_ping_interval() { |
1366 | 1366 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1367 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval: (isset($CFG->bigbluebuttonbn_waitformoderator_ping_interval)? $CFG->bigbluebuttonbn_waitformoderator_ping_interval: 15)); |
|
1367 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval : (isset($CFG->bigbluebuttonbn_waitformoderator_ping_interval) ? $CFG->bigbluebuttonbn_waitformoderator_ping_interval : 15)); |
|
1368 | 1368 | } |
1369 | 1369 | |
1370 | 1370 | function bigbluebuttonbn_get_cfg_waitformoderator_cache_ttl() { |
1371 | 1371 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1372 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl: (isset($CFG->bigbluebuttonbn_waitformoderator_cache_ttl)? $CFG->bigbluebuttonbn_waitformoderator_cache_ttl: 60)); |
|
1372 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl : (isset($CFG->bigbluebuttonbn_waitformoderator_cache_ttl) ? $CFG->bigbluebuttonbn_waitformoderator_cache_ttl : 60)); |
|
1373 | 1373 | } |
1374 | 1374 | |
1375 | 1375 | function bigbluebuttonbn_get_cfg_userlimit_default() { |
1376 | 1376 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1377 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default: (isset($CFG->bigbluebuttonbn_userlimit_default)? $CFG->bigbluebuttonbn_userlimit_default: 0)); |
|
1377 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default : (isset($CFG->bigbluebuttonbn_userlimit_default) ? $CFG->bigbluebuttonbn_userlimit_default : 0)); |
|
1378 | 1378 | } |
1379 | 1379 | |
1380 | 1380 | function bigbluebuttonbn_get_cfg_userlimit_editable() { |
1381 | 1381 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1382 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable: (isset($CFG->bigbluebuttonbn_userlimit_editable)? $CFG->bigbluebuttonbn_userlimit_editable: false)); |
|
1382 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable : (isset($CFG->bigbluebuttonbn_userlimit_editable) ? $CFG->bigbluebuttonbn_userlimit_editable : false)); |
|
1383 | 1383 | } |
1384 | 1384 | |
1385 | 1385 | function bigbluebuttonbn_get_cfg_preuploadpresentation_enabled() { |
1386 | 1386 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1387 | 1387 | if (extension_loaded('curl')) { |
1388 | 1388 | // This feature only works if curl is installed |
1389 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled: (isset($CFG->bigbluebuttonbn_preuploadpresentation_enabled)? $CFG->bigbluebuttonbn_preuploadpresentation_enabled: false)); |
|
1389 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled : (isset($CFG->bigbluebuttonbn_preuploadpresentation_enabled) ? $CFG->bigbluebuttonbn_preuploadpresentation_enabled : false)); |
|
1390 | 1390 | } else { |
1391 | 1391 | return false; |
1392 | 1392 | } |
@@ -1394,37 +1394,37 @@ discard block |
||
1394 | 1394 | |
1395 | 1395 | function bigbluebuttonbn_get_cfg_sendnotifications_enabled() { |
1396 | 1396 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1397 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled: (isset($CFG->bigbluebuttonbn_sendnotifications_enabled)? $CFG->bigbluebuttonbn_sendnotifications_enabled: false)); |
|
1397 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled : (isset($CFG->bigbluebuttonbn_sendnotifications_enabled) ? $CFG->bigbluebuttonbn_sendnotifications_enabled : false)); |
|
1398 | 1398 | } |
1399 | 1399 | |
1400 | 1400 | function bigbluebuttonbn_get_cfg_recordingready_enabled() { |
1401 | 1401 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1402 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled: (isset($CFG->bigbluebuttonbn_recordingready_enabled)? $CFG->bigbluebuttonbn_recordingready_enabled: false)); |
|
1402 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled : (isset($CFG->bigbluebuttonbn_recordingready_enabled) ? $CFG->bigbluebuttonbn_recordingready_enabled : false)); |
|
1403 | 1403 | } |
1404 | 1404 | |
1405 | 1405 | function bigbluebuttonbn_get_cfg_moderator_default() { |
1406 | 1406 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1407 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default: (isset($CFG->bigbluebuttonbn_moderator_default)? $CFG->bigbluebuttonbn_moderator_default: 'owner')); |
|
1407 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default : (isset($CFG->bigbluebuttonbn_moderator_default) ? $CFG->bigbluebuttonbn_moderator_default : 'owner')); |
|
1408 | 1408 | } |
1409 | 1409 | |
1410 | 1410 | function bigbluebuttonbn_get_cfg_scheduled_duration_enabled() { |
1411 | 1411 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1412 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled: (isset($CFG->bigbluebuttonbn_scheduled_duration_enabled)? $CFG->bigbluebuttonbn_scheduled_duration_enabled: false)); |
|
1412 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled : (isset($CFG->bigbluebuttonbn_scheduled_duration_enabled) ? $CFG->bigbluebuttonbn_scheduled_duration_enabled : false)); |
|
1413 | 1413 | } |
1414 | 1414 | |
1415 | 1415 | function bigbluebuttonbn_get_cfg_scheduled_duration_compensation() { |
1416 | 1416 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1417 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_compensation)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_compensation: (isset($CFG->bigbluebuttonbn_scheduled_duration_compensation)? $CFG->bigbluebuttonbn_scheduled_duration_compensation: 10)); |
|
1417 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_compensation) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_compensation : (isset($CFG->bigbluebuttonbn_scheduled_duration_compensation) ? $CFG->bigbluebuttonbn_scheduled_duration_compensation : 10)); |
|
1418 | 1418 | } |
1419 | 1419 | |
1420 | 1420 | function bigbluebuttonbn_get_cfg_scheduled_pre_opening() { |
1421 | 1421 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
1422 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_pre_opening)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_pre_opening: (isset($CFG->bigbluebuttonbn_scheduled_pre_opening)? $CFG->bigbluebuttonbn_scheduled_pre_opening: 10)); |
|
1422 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_pre_opening) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_pre_opening : (isset($CFG->bigbluebuttonbn_scheduled_pre_opening) ? $CFG->bigbluebuttonbn_scheduled_pre_opening : 10)); |
|
1423 | 1423 | } |
1424 | 1424 | |
1425 | 1425 | function bigbluebuttonbn_import_get_courses_for_select(array $bbbsession) { |
1426 | 1426 | |
1427 | - if( $bbbsession['administrator'] ) { |
|
1427 | + if ($bbbsession['administrator']) { |
|
1428 | 1428 | $courses = get_courses('all', 'c.id ASC', 'c.id,c.shortname,c.fullname'); |
1429 | 1429 | //It includes the name of the site as a course (category 0), so remove the first one |
1430 | 1430 | unset($courses["1"]); |
@@ -1433,21 +1433,21 @@ discard block |
||
1433 | 1433 | } |
1434 | 1434 | |
1435 | 1435 | $courses_for_select = []; |
1436 | - foreach($courses as $course) { |
|
1437 | - if( $course->id != $bbbsession['course']->id ) { |
|
1436 | + foreach ($courses as $course) { |
|
1437 | + if ($course->id != $bbbsession['course']->id) { |
|
1438 | 1438 | $courses_for_select[$course->id] = $course->fullname; |
1439 | 1439 | } |
1440 | 1440 | } |
1441 | 1441 | return $courses_for_select; |
1442 | 1442 | } |
1443 | 1443 | |
1444 | -function bigbluebuttonbn_getRecordedMeetingsDeleted($courseID, $bigbluebuttonbnID=NULL) { |
|
1444 | +function bigbluebuttonbn_getRecordedMeetingsDeleted($courseID, $bigbluebuttonbnID = NULL) { |
|
1445 | 1445 | global $DB; |
1446 | 1446 | |
1447 | 1447 | $records_deleted = array(); |
1448 | 1448 | |
1449 | - $filter = array('courseid' => $courseID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_DELETE ); |
|
1450 | - if ( $bigbluebuttonbnID != NULL ) { |
|
1449 | + $filter = array('courseid' => $courseID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_DELETE); |
|
1450 | + if ($bigbluebuttonbnID != NULL) { |
|
1451 | 1451 | $filter['id'] = $bigbluebuttonbnID; |
1452 | 1452 | } |
1453 | 1453 | |
@@ -1456,17 +1456,17 @@ discard block |
||
1456 | 1456 | foreach ($bigbluebuttonbns_deleted as $key => $bigbluebuttonbn_deleted) { |
1457 | 1457 | $records = $DB->get_records('bigbluebuttonbn_logs', array('courseid' => $courseID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_CREATE)); |
1458 | 1458 | |
1459 | - if( !empty($records) ) { |
|
1459 | + if (!empty($records)) { |
|
1460 | 1460 | //Remove duplicates |
1461 | 1461 | $unique_records = array(); |
1462 | 1462 | foreach ($records as $key => $record) { |
1463 | - if (array_key_exists($record->meetingid, $unique_records) ) { |
|
1463 | + if (array_key_exists($record->meetingid, $unique_records)) { |
|
1464 | 1464 | unset($records[$key]); |
1465 | 1465 | } else { |
1466 | 1466 | $meta = json_decode($record->meta); |
1467 | - if ( !$meta->record ) { |
|
1467 | + if (!$meta->record) { |
|
1468 | 1468 | unset($records[$key]); |
1469 | - } else if ( $bigbluebuttonbn_deleted->meetingid != substr($record->meetingid, 0, strlen($bigbluebuttonbn_deleted->meetingid))) { |
|
1469 | + } else if ($bigbluebuttonbn_deleted->meetingid != substr($record->meetingid, 0, strlen($bigbluebuttonbn_deleted->meetingid))) { |
|
1470 | 1470 | unset($records[$key]); |
1471 | 1471 | } else { |
1472 | 1472 | array_push($unique_records, $record->meetingid); |
@@ -1481,27 +1481,27 @@ discard block |
||
1481 | 1481 | return $records_deleted; |
1482 | 1482 | } |
1483 | 1483 | |
1484 | -function bigbluebuttonbn_getRecordedMeetings($courseID, $bigbluebuttonbnID=NULL) { |
|
1484 | +function bigbluebuttonbn_getRecordedMeetings($courseID, $bigbluebuttonbnID = NULL) { |
|
1485 | 1485 | global $DB; |
1486 | 1486 | |
1487 | 1487 | $records = Array(); |
1488 | 1488 | |
1489 | 1489 | $filter = array('course' => $courseID); |
1490 | - if ( $bigbluebuttonbnID != NULL ) { |
|
1490 | + if ($bigbluebuttonbnID != NULL) { |
|
1491 | 1491 | $filter['id'] = $bigbluebuttonbnID; |
1492 | 1492 | } |
1493 | 1493 | $bigbluebuttonbns = $DB->get_records('bigbluebuttonbn', $filter); |
1494 | 1494 | |
1495 | - if ( !empty($bigbluebuttonbns) ) { |
|
1495 | + if (!empty($bigbluebuttonbns)) { |
|
1496 | 1496 | $table = 'bigbluebuttonbn_logs'; |
1497 | 1497 | |
1498 | 1498 | //Prepare select for loading records based on existent bigbluebuttonbns |
1499 | 1499 | $select = ""; |
1500 | 1500 | foreach ($bigbluebuttonbns as $key => $bigbluebuttonbn) { |
1501 | - $select .= strlen($select) == 0? "(": " OR "; |
|
1502 | - $select .= "bigbluebuttonbnid=".$bigbluebuttonbn->id; |
|
1501 | + $select .= strlen($select) == 0 ? "(" : " OR "; |
|
1502 | + $select .= "bigbluebuttonbnid=" . $bigbluebuttonbn->id; |
|
1503 | 1503 | } |
1504 | - $select .= ") AND log='".BIGBLUEBUTTONBN_LOG_EVENT_CREATE."'"; |
|
1504 | + $select .= ") AND log='" . BIGBLUEBUTTONBN_LOG_EVENT_CREATE . "'"; |
|
1505 | 1505 | |
1506 | 1506 | //Execute select for loading records based on existent bigbluebuttonbns |
1507 | 1507 | $records = $DB->get_records_select($table, $select); |
@@ -1509,8 +1509,8 @@ discard block |
||
1509 | 1509 | //Remove duplicates |
1510 | 1510 | $unique_records = array(); |
1511 | 1511 | foreach ($records as $key => $record) { |
1512 | - $record_key = $record->meetingid.','.$record->bigbluebuttonbnid.','.$record->meta; |
|
1513 | - if( array_search($record_key, $unique_records) === false ) { |
|
1512 | + $record_key = $record->meetingid . ',' . $record->bigbluebuttonbnid . ',' . $record->meta; |
|
1513 | + if (array_search($record_key, $unique_records) === false) { |
|
1514 | 1514 | array_push($unique_records, $record_key); |
1515 | 1515 | } else { |
1516 | 1516 | unset($records[$key]); |
@@ -1520,7 +1520,7 @@ discard block |
||
1520 | 1520 | //Remove the ones with record=false |
1521 | 1521 | foreach ($records as $key => $record) { |
1522 | 1522 | $meta = json_decode($record->meta); |
1523 | - if ( !$meta || !$meta->record ) { |
|
1523 | + if (!$meta || !$meta->record) { |
|
1524 | 1524 | unset($records[$key]); |
1525 | 1525 | } |
1526 | 1526 | } |
@@ -1533,15 +1533,15 @@ discard block |
||
1533 | 1533 | $recordings = array(); |
1534 | 1534 | |
1535 | 1535 | // Load the meetingIDs to be used in the getRecordings request |
1536 | - if ( is_numeric($courseID) ) { |
|
1536 | + if (is_numeric($courseID)) { |
|
1537 | 1537 | $results = bigbluebuttonbn_getRecordedMeetings($courseID); |
1538 | 1538 | |
1539 | - if( bigbluebuttonbn_get_cfg_importrecordings_from_deleted_activities_enabled() ) { |
|
1539 | + if (bigbluebuttonbn_get_cfg_importrecordings_from_deleted_activities_enabled()) { |
|
1540 | 1540 | $results_deleted = bigbluebuttonbn_getRecordedMeetingsDeleted($courseID); |
1541 | 1541 | $results = array_merge($results, $results_deleted); |
1542 | 1542 | } |
1543 | 1543 | |
1544 | - if( $results ) { |
|
1544 | + if ($results) { |
|
1545 | 1545 | $mIDs = array(); |
1546 | 1546 | //Eliminates duplicates |
1547 | 1547 | foreach ($results as $result) { |
@@ -1549,10 +1549,10 @@ discard block |
||
1549 | 1549 | } |
1550 | 1550 | |
1551 | 1551 | // If there are mIDs excecute a paginated getRecordings request |
1552 | - if ( !empty($mIDs) ) { |
|
1552 | + if (!empty($mIDs)) { |
|
1553 | 1553 | $pages = floor(sizeof($mIDs) / 25) + 1; |
1554 | - for ( $page = 1; $page <= $pages; $page++ ) { |
|
1555 | - $meetingIDs = array_slice($mIDs, ($page-1)*25, 25); |
|
1554 | + for ($page = 1; $page <= $pages; $page++) { |
|
1555 | + $meetingIDs = array_slice($mIDs, ($page - 1) * 25, 25); |
|
1556 | 1556 | $fetched_recordings = bigbluebuttonbn_getRecordingsArray(implode(',', $meetingIDs), $URL, $SALT); |
1557 | 1557 | $recordings = array_merge($recordings, $fetched_recordings); |
1558 | 1558 | } |
@@ -1579,37 +1579,37 @@ discard block |
||
1579 | 1579 | $recordings_already_imported_indexed = bigbluebuttonbn_index_recordings($recordings_already_imported); |
1580 | 1580 | |
1581 | 1581 | foreach ($recordings as $key => $recording) { |
1582 | - if( isset($recordings_already_imported_indexed[$recording['recordID']]) ) { |
|
1582 | + if (isset($recordings_already_imported_indexed[$recording['recordID']])) { |
|
1583 | 1583 | unset($recordings[$key]); |
1584 | 1584 | } |
1585 | 1585 | } |
1586 | 1586 | return $recordings; |
1587 | 1587 | } |
1588 | 1588 | |
1589 | -function bigbluebutton_output_recording_table($bbbsession, $recordings, $tools=['publishing','deleting']) { |
|
1589 | +function bigbluebutton_output_recording_table($bbbsession, $recordings, $tools = ['publishing', 'deleting']) { |
|
1590 | 1590 | |
1591 | - if ( isset($recordings) && !empty($recordings) ) { // There are recordings for this meeting |
|
1591 | + if (isset($recordings) && !empty($recordings)) { // There are recordings for this meeting |
|
1592 | 1592 | $table = bigbluebuttonbn_get_recording_table($bbbsession, $recordings, $tools); |
1593 | 1593 | } |
1594 | 1594 | |
1595 | 1595 | $output = ''; |
1596 | - if( isset($table->data) ) { |
|
1596 | + if (isset($table->data)) { |
|
1597 | 1597 | //Print the table |
1598 | - $output .= '<div id="bigbluebuttonbn_html_table">'."\n"; |
|
1599 | - $output .= html_writer::table($table)."\n"; |
|
1600 | - $output .= '</div>'."\n"; |
|
1598 | + $output .= '<div id="bigbluebuttonbn_html_table">' . "\n"; |
|
1599 | + $output .= html_writer::table($table) . "\n"; |
|
1600 | + $output .= '</div>' . "\n"; |
|
1601 | 1601 | |
1602 | 1602 | } else { |
1603 | - $output .= get_string('view_message_norecordings', 'bigbluebuttonbn').'<br>'."\n"; |
|
1603 | + $output .= get_string('view_message_norecordings', 'bigbluebuttonbn') . '<br>' . "\n"; |
|
1604 | 1604 | } |
1605 | 1605 | |
1606 | 1606 | return $output; |
1607 | 1607 | } |
1608 | 1608 | |
1609 | -function bigbluebuttonbn_getRecordingsImported($courseID, $bigbluebuttonbnID=NULL) { |
|
1609 | +function bigbluebuttonbn_getRecordingsImported($courseID, $bigbluebuttonbnID = NULL) { |
|
1610 | 1610 | global $DB; |
1611 | 1611 | |
1612 | - if ( $bigbluebuttonbnID != NULL ) { |
|
1612 | + if ($bigbluebuttonbnID != NULL) { |
|
1613 | 1613 | // Fetch only those related to the $courseID and $bigbluebuttonbnID requested |
1614 | 1614 | $recordings_imported = $DB->get_records('bigbluebuttonbn_logs', array('courseid' => $courseID, 'bigbluebuttonbnid' => $bigbluebuttonbnID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_IMPORT)); |
1615 | 1615 | } else { |
@@ -1619,7 +1619,7 @@ discard block |
||
1619 | 1619 | return $recordings_imported; |
1620 | 1620 | } |
1621 | 1621 | |
1622 | -function bigbluebuttonbn_getRecordingsImportedArray($courseID, $bigbluebuttonbnID=NULL) { |
|
1622 | +function bigbluebuttonbn_getRecordingsImportedArray($courseID, $bigbluebuttonbnID = NULL) { |
|
1623 | 1623 | $recordings_imported = bigbluebuttonbn_getRecordingsImported($courseID, $bigbluebuttonbnID); |
1624 | 1624 | $recordings_imported_array = bigbluebuttonbn_import_get_recordings_imported($recordings_imported); |
1625 | 1625 | return $recordings_imported_array; |
@@ -1628,7 +1628,7 @@ discard block |
||
1628 | 1628 | function bigbluebuttonbn_getRecordingsImportedAllInstances($recordID) { |
1629 | 1629 | global $DB, $CFG; |
1630 | 1630 | |
1631 | - $recordings_imported = $DB->get_records_sql('SELECT * FROM '.$CFG->prefix.'bigbluebuttonbn_logs WHERE log=? AND '.$DB->sql_like('meta', '?'), array( BIGBLUEBUTTONBN_LOG_EVENT_IMPORT, '%'.$recordID.'%' )); |
|
1631 | + $recordings_imported = $DB->get_records_sql('SELECT * FROM ' . $CFG->prefix . 'bigbluebuttonbn_logs WHERE log=? AND ' . $DB->sql_like('meta', '?'), array(BIGBLUEBUTTONBN_LOG_EVENT_IMPORT, '%' . $recordID . '%')); |
|
1632 | 1632 | return $recordings_imported; |
1633 | 1633 | } |
1634 | 1634 | |
@@ -1647,8 +1647,8 @@ discard block |
||
1647 | 1647 | function bigbluebuttonbn_html2text($html, $len) { |
1648 | 1648 | $text = strip_tags($html); |
1649 | 1649 | $text = str_replace(" ", ' ', $text); |
1650 | - if( strlen($text) > $len ) { |
|
1651 | - $text = substr($text, 0, $len)."..."; |
|
1650 | + if (strlen($text) > $len) { |
|
1651 | + $text = substr($text, 0, $len) . "..."; |
|
1652 | 1652 | } else { |
1653 | 1653 | $text = substr($text, 0, $len); |
1654 | 1654 | } |
@@ -47,119 +47,119 @@ |
||
47 | 47 | $bbbsession = $SESSION->bigbluebuttonbn_bbbsession; |
48 | 48 | } |
49 | 49 | switch (strtolower($action)) { |
50 | - case 'logout': |
|
51 | - if (isset($errors) && $errors != '') { |
|
52 | - bigbluebutton_bbb_view_errors($errors, $id); |
|
50 | + case 'logout': |
|
51 | + if (isset($errors) && $errors != '') { |
|
52 | + bigbluebutton_bbb_view_errors($errors, $id); |
|
53 | 53 | |
54 | - } else if (isset($bbbsession) && !is_null($bbbsession)) { |
|
55 | - /// Moodle event logger: Create an event for meeting left |
|
56 | - bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_LEFT, $bigbluebuttonbn, $context, $cm); |
|
54 | + } else if (isset($bbbsession) && !is_null($bbbsession)) { |
|
55 | + /// Moodle event logger: Create an event for meeting left |
|
56 | + bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_LEFT, $bigbluebuttonbn, $context, $cm); |
|
57 | 57 | |
58 | - /// Update the cache |
|
59 | - $meeting_info = bigbluebuttonbn_bbb_broker_get_meeting_info($bbbsession['meetingid'], $bbbsession['modPW'], BIGBLUEBUTTONBN_FORCED); |
|
58 | + /// Update the cache |
|
59 | + $meeting_info = bigbluebuttonbn_bbb_broker_get_meeting_info($bbbsession['meetingid'], $bbbsession['modPW'], BIGBLUEBUTTONBN_FORCED); |
|
60 | 60 | |
61 | - /// Close the tab or window where BBB was opened |
|
62 | - bigbluebutton_bbb_view_close_window(); |
|
63 | - |
|
64 | - } else { |
|
65 | - bigbluebutton_bbb_view_close_window_manually(); |
|
66 | - } |
|
67 | - break; |
|
68 | - case 'join': |
|
69 | - if (isset($bbbsession) && !is_null($bbbsession)) { |
|
70 | - //See if the session is in progress |
|
71 | - if (bigbluebuttonbn_isMeetingRunning($bbbsession['meetingid'], $bbbsession['endpoint'], $bbbsession['shared_secret'])) { |
|
72 | - /// Since the meeting is already running, we just join the session |
|
73 | - bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $context, $bigbluebuttonbn); |
|
61 | + /// Close the tab or window where BBB was opened |
|
62 | + bigbluebutton_bbb_view_close_window(); |
|
74 | 63 | |
75 | 64 | } else { |
76 | - // If user is administrator, moderator or if is viewer and no waiting is required |
|
77 | - if ($bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait']) { |
|
78 | - /// Prepare the metadata |
|
79 | - $metadata = array("meta_bn-origin" => $bbbsession['origin'], |
|
80 | - "meta_bbb-origin-version" => $bbbsession['originVersion'], |
|
81 | - "meta_bbb-origin-server-name" => $bbbsession['originServerName'], |
|
82 | - "meta_bbb-origin-server-common-name" => $bbbsession['originServerCommonName'], |
|
83 | - "meta_bbb-origin-tag" => $bbbsession['originTag'], |
|
84 | - "meta_bbb-context" => $bbbsession['course']->fullname, |
|
85 | - "meta_bbb-recording-name" => (isset($name) && $name != '') ? $name : $bbbsession['contextActivityName'], |
|
86 | - "meta_bbb-recording-description" => (isset($description) && $description != '') ? $description : $bbbsession['contextActivityDescription'], |
|
87 | - "meta_bbb-recording-tags" => (isset($tags) && $tags != '') ? $tags : $bbbsession['contextActivityTags'], |
|
88 | - ); |
|
89 | - |
|
90 | - if (bigbluebuttonbn_server_offers_bn_capabilities() && bigbluebuttonbn_get_cfg_recordingready_enabled()) { |
|
91 | - $metadata["meta_bn-recording-ready-url"] = $bbbsession['recordingReadyURL']; |
|
92 | - } |
|
65 | + bigbluebutton_bbb_view_close_window_manually(); |
|
66 | + } |
|
67 | + break; |
|
68 | + case 'join': |
|
69 | + if (isset($bbbsession) && !is_null($bbbsession)) { |
|
70 | + //See if the session is in progress |
|
71 | + if (bigbluebuttonbn_isMeetingRunning($bbbsession['meetingid'], $bbbsession['endpoint'], $bbbsession['shared_secret'])) { |
|
72 | + /// Since the meeting is already running, we just join the session |
|
73 | + bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $context, $bigbluebuttonbn); |
|
93 | 74 | |
94 | - /// Set the duration for the meeting |
|
95 | - if (bigbluebuttonbn_get_cfg_scheduled_duration_enabled()) { |
|
96 | - $durationtime = bigbluebuttonbn_get_duration($bigbluebuttonbn->openingtime, $bigbluebuttonbn->closingtime); |
|
97 | - if ($durationtime > 0) |
|
98 | - $bbbsession['welcome'] .= '<br><br>' . str_replace("%duration%", '' . $durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn')); |
|
99 | - } else { |
|
100 | - $durationtime = 0; |
|
101 | - } |
|
102 | - /// Execute the create command |
|
103 | - $response = bigbluebuttonbn_getCreateMeetingArray( |
|
104 | - $bbbsession['meetingname'], |
|
105 | - $bbbsession['meetingid'], |
|
106 | - $bbbsession['welcome'], |
|
107 | - $bbbsession['modPW'], |
|
108 | - $bbbsession['viewerPW'], |
|
109 | - $bbbsession['shared_secret'], |
|
110 | - $bbbsession['endpoint'], |
|
111 | - $bbbsession['logoutURL'], |
|
112 | - $bbbsession['record'] ? 'true' : 'false', |
|
113 | - $durationtime, |
|
114 | - $bbbsession['voicebridge'], |
|
115 | - $bbbsession['userlimit'], |
|
116 | - $metadata, |
|
117 | - $bbbsession['presentation']['name'], |
|
118 | - $bbbsession['presentation']['url'] |
|
119 | - ); |
|
120 | - |
|
121 | - if (!$response) { |
|
122 | - // If the server is unreachable, then prompts the user of the necessary action |
|
123 | - if ($bbbsession['administrator']) { |
|
124 | - print_error('view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
125 | - } else if ($bbbsession['moderator']) { |
|
126 | - print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
127 | - } else { |
|
128 | - print_error('view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
75 | + } else { |
|
76 | + // If user is administrator, moderator or if is viewer and no waiting is required |
|
77 | + if ($bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait']) { |
|
78 | + /// Prepare the metadata |
|
79 | + $metadata = array("meta_bn-origin" => $bbbsession['origin'], |
|
80 | + "meta_bbb-origin-version" => $bbbsession['originVersion'], |
|
81 | + "meta_bbb-origin-server-name" => $bbbsession['originServerName'], |
|
82 | + "meta_bbb-origin-server-common-name" => $bbbsession['originServerCommonName'], |
|
83 | + "meta_bbb-origin-tag" => $bbbsession['originTag'], |
|
84 | + "meta_bbb-context" => $bbbsession['course']->fullname, |
|
85 | + "meta_bbb-recording-name" => (isset($name) && $name != '') ? $name : $bbbsession['contextActivityName'], |
|
86 | + "meta_bbb-recording-description" => (isset($description) && $description != '') ? $description : $bbbsession['contextActivityDescription'], |
|
87 | + "meta_bbb-recording-tags" => (isset($tags) && $tags != '') ? $tags : $bbbsession['contextActivityTags'], |
|
88 | + ); |
|
89 | + |
|
90 | + if (bigbluebuttonbn_server_offers_bn_capabilities() && bigbluebuttonbn_get_cfg_recordingready_enabled()) { |
|
91 | + $metadata["meta_bn-recording-ready-url"] = $bbbsession['recordingReadyURL']; |
|
129 | 92 | } |
130 | 93 | |
131 | - } else if ($response['returncode'] == "FAILED") { |
|
132 | - // The meeting was not created |
|
133 | - $error_key = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create'); |
|
134 | - if (!$error_key) { |
|
135 | - print_error($response['message'], 'bigbluebuttonbn'); |
|
94 | + /// Set the duration for the meeting |
|
95 | + if (bigbluebuttonbn_get_cfg_scheduled_duration_enabled()) { |
|
96 | + $durationtime = bigbluebuttonbn_get_duration($bigbluebuttonbn->openingtime, $bigbluebuttonbn->closingtime); |
|
97 | + if ($durationtime > 0) |
|
98 | + $bbbsession['welcome'] .= '<br><br>' . str_replace("%duration%", '' . $durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn')); |
|
136 | 99 | } else { |
137 | - print_error($error_key, 'bigbluebuttonbn'); |
|
100 | + $durationtime = 0; |
|
101 | + } |
|
102 | + /// Execute the create command |
|
103 | + $response = bigbluebuttonbn_getCreateMeetingArray( |
|
104 | + $bbbsession['meetingname'], |
|
105 | + $bbbsession['meetingid'], |
|
106 | + $bbbsession['welcome'], |
|
107 | + $bbbsession['modPW'], |
|
108 | + $bbbsession['viewerPW'], |
|
109 | + $bbbsession['shared_secret'], |
|
110 | + $bbbsession['endpoint'], |
|
111 | + $bbbsession['logoutURL'], |
|
112 | + $bbbsession['record'] ? 'true' : 'false', |
|
113 | + $durationtime, |
|
114 | + $bbbsession['voicebridge'], |
|
115 | + $bbbsession['userlimit'], |
|
116 | + $metadata, |
|
117 | + $bbbsession['presentation']['name'], |
|
118 | + $bbbsession['presentation']['url'] |
|
119 | + ); |
|
120 | + |
|
121 | + if (!$response) { |
|
122 | + // If the server is unreachable, then prompts the user of the necessary action |
|
123 | + if ($bbbsession['administrator']) { |
|
124 | + print_error('view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
125 | + } else if ($bbbsession['moderator']) { |
|
126 | + print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
127 | + } else { |
|
128 | + print_error('view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
129 | + } |
|
130 | + |
|
131 | + } else if ($response['returncode'] == "FAILED") { |
|
132 | + // The meeting was not created |
|
133 | + $error_key = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create'); |
|
134 | + if (!$error_key) { |
|
135 | + print_error($response['message'], 'bigbluebuttonbn'); |
|
136 | + } else { |
|
137 | + print_error($error_key, 'bigbluebuttonbn'); |
|
138 | + } |
|
139 | + |
|
140 | + } else if ($response['hasBeenForciblyEnded'] == "true") { |
|
141 | + print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn')); |
|
142 | + |
|
143 | + } else { ///////////////Everything is ok ///////////////////// |
|
144 | + /// Moodle event logger: Create an event for meeting created |
|
145 | + bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_CREATED, $bigbluebuttonbn, $context, $cm); |
|
146 | + /// Internal logger: Instert a record with the meeting created |
|
147 | + bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_CREATE); |
|
148 | + /// Since the meeting is already running, we just join the session |
|
149 | + bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $context, $bigbluebuttonbn); |
|
138 | 150 | } |
139 | 151 | |
140 | - } else if ($response['hasBeenForciblyEnded'] == "true") { |
|
141 | - print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn')); |
|
142 | - |
|
143 | - } else { ///////////////Everything is ok ///////////////////// |
|
144 | - /// Moodle event logger: Create an event for meeting created |
|
145 | - bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_CREATED, $bigbluebuttonbn, $context, $cm); |
|
146 | - /// Internal logger: Instert a record with the meeting created |
|
147 | - bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_CREATE); |
|
148 | - /// Since the meeting is already running, we just join the session |
|
149 | - bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $context, $bigbluebuttonbn); |
|
152 | + } else { |
|
153 | + header('Location: ' . $bbbsession['logoutURL']); |
|
150 | 154 | } |
151 | - |
|
152 | - } else { |
|
153 | - header('Location: ' . $bbbsession['logoutURL']); |
|
154 | 155 | } |
155 | - } |
|
156 | 156 | |
157 | - } else { |
|
158 | - print_error('view_error_unable_join', 'bigbluebuttonbn'); |
|
159 | - } |
|
160 | - break; |
|
161 | - default: |
|
162 | - bigbluebutton_bbb_view_close_window(); |
|
157 | + } else { |
|
158 | + print_error('view_error_unable_join', 'bigbluebuttonbn'); |
|
159 | + } |
|
160 | + break; |
|
161 | + default: |
|
162 | + bigbluebutton_bbb_view_close_window(); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 |
@@ -94,8 +94,9 @@ |
||
94 | 94 | /// Set the duration for the meeting |
95 | 95 | if (bigbluebuttonbn_get_cfg_scheduled_duration_enabled()) { |
96 | 96 | $durationtime = bigbluebuttonbn_get_duration($bigbluebuttonbn->openingtime, $bigbluebuttonbn->closingtime); |
97 | - if ($durationtime > 0) |
|
98 | - $bbbsession['welcome'] .= '<br><br>' . str_replace("%duration%", '' . $durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn')); |
|
97 | + if ($durationtime > 0) { |
|
98 | + $bbbsession['welcome'] .= '<br><br>' . str_replace("%duration%", '' . $durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn')); |
|
99 | + } |
|
99 | 100 | } else { |
100 | 101 | $durationtime = 0; |
101 | 102 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | switch (strtolower($action)) { |
50 | 50 | case 'logout': |
51 | 51 | if (isset($errors) && $errors != '') { |
52 | - bigbluebutton_bbb_view_errors($errors, $id); |
|
52 | + bigbluebutton_bbb_view_errors($errors, $id); |
|
53 | 53 | |
54 | 54 | } else if (isset($bbbsession) && !is_null($bbbsession)) { |
55 | 55 | /// Moodle event logger: Create an event for meeting left |
@@ -81,49 +81,49 @@ |
||
81 | 81 | $can_join = false; |
82 | 82 | } |
83 | 83 | |
84 | - if( $bbbsession['administrator'] || $bbbsession['moderator'] ) { |
|
84 | + if ($bbbsession['administrator'] || $bbbsession['moderator']) { |
|
85 | 85 | $end_button_text = get_string('view_conference_action_end', 'bigbluebuttonbn'); |
86 | 86 | $can_end = true; |
87 | - $status_can_end = '"can_end": true, "end_button_text": "'.$end_button_text.'", '; |
|
87 | + $status_can_end = '"can_end": true, "end_button_text": "' . $end_button_text . '", '; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | } else { |
91 | 91 | // If user is administrator, moderator or if is viewer and no waiting is required |
92 | 92 | $join_button_text = get_string('view_conference_action_join', 'bigbluebuttonbn'); |
93 | - if ( $bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait'] ) { |
|
93 | + if ($bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait']) { |
|
94 | 94 | $initial_message = get_string('view_message_conference_room_ready', 'bigbluebuttonbn'); |
95 | 95 | $can_join = true; |
96 | 96 | |
97 | 97 | } else { |
98 | 98 | $initial_message = get_string('view_message_conference_not_started', 'bigbluebuttonbn'); |
99 | - if ( $bbbsession['wait'] ) { |
|
100 | - $initial_message .= ' '.get_string('view_message_conference_wait_for_moderator', 'bigbluebuttonbn'); |
|
99 | + if ($bbbsession['wait']) { |
|
100 | + $initial_message .= ' ' . get_string('view_message_conference_wait_for_moderator', 'bigbluebuttonbn'); |
|
101 | 101 | } |
102 | 102 | $can_join = false; |
103 | 103 | } |
104 | 104 | |
105 | - if( $bbbsession['tagging'] && ($bbbsession['administrator'] || $bbbsession['moderator']) ) { |
|
105 | + if ($bbbsession['tagging'] && ($bbbsession['administrator'] || $bbbsession['moderator'])) { |
|
106 | 106 | $can_tag = true; |
107 | 107 | |
108 | 108 | } else { |
109 | 109 | $can_tag = false; |
110 | 110 | } |
111 | - $status_can_end = '"can_tag": '.($can_tag? 'true': 'false').', '; |
|
111 | + $status_can_end = '"can_tag": ' . ($can_tag ? 'true' : 'false') . ', '; |
|
112 | 112 | } |
113 | 113 | |
114 | - echo $params['callback'].'({ "running": '.($meeting_running? 'true':'false').', "info": '.json_encode($meeting_info).', "status": {"can_join": '.($can_join? 'true':'false').',"join_url": "'.$bbbsession['joinURL'].'","join_button_text": "'.$join_button_text.'", '.$status_can_end.$status_can_tag.'"message": "'.$initial_message.'"} });'; |
|
114 | + echo $params['callback'] . '({ "running": ' . ($meeting_running ? 'true' : 'false') . ', "info": ' . json_encode($meeting_info) . ', "status": {"can_join": ' . ($can_join ? 'true' : 'false') . ',"join_url": "' . $bbbsession['joinURL'] . '","join_button_text": "' . $join_button_text . '", ' . $status_can_end . $status_can_tag . '"message": "' . $initial_message . '"} });'; |
|
115 | 115 | break; |
116 | 116 | case 'meeting_end': |
117 | - if( $bbbsession['administrator'] || $bbbsession['moderator'] ) { |
|
117 | + if ($bbbsession['administrator'] || $bbbsession['moderator']) { |
|
118 | 118 | //Execute the end command |
119 | 119 | $meeting_info = bigbluebuttonbn_bbb_broker_do_end_meeting($params['id'], $bbbsession['modPW']); |
120 | 120 | // Moodle event logger: Create an event for meeting ended |
121 | - if( isset($bigbluebuttonbn) ) |
|
121 | + if (isset($bigbluebuttonbn)) |
|
122 | 122 | bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_ENDED, $bigbluebuttonbn, $context, $cm); |
123 | 123 | // Update the cache |
124 | 124 | $meeting_info = bigbluebuttonbn_bbb_broker_get_meeting_info($params['id'], $bbbsession['modPW'], true); |
125 | 125 | |
126 | - echo $params['callback'].'({ "status": true });'; |
|
126 | + echo $params['callback'] . '({ "status": true });'; |
|
127 | 127 | } else { |
128 | 128 | error_log("ERROR: User not authorized to execute end command"); |
129 | 129 | header("HTTP/1.0 401 Unauthorized. User not authorized to execute end command"); |
@@ -118,8 +118,9 @@ |
||
118 | 118 | //Execute the end command |
119 | 119 | $meeting_info = bigbluebuttonbn_bbb_broker_do_end_meeting($params['id'], $bbbsession['modPW']); |
120 | 120 | // Moodle event logger: Create an event for meeting ended |
121 | - if( isset($bigbluebuttonbn) ) |
|
122 | - bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_ENDED, $bigbluebuttonbn, $context, $cm); |
|
121 | + if( isset($bigbluebuttonbn) ) { |
|
122 | + bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_ENDED, $bigbluebuttonbn, $context, $cm); |
|
123 | + } |
|
123 | 124 | // Update the cache |
124 | 125 | $meeting_info = bigbluebuttonbn_bbb_broker_get_meeting_info($params['id'], $bbbsession['modPW'], true); |
125 | 126 |
@@ -93,7 +93,7 @@ |
||
93 | 93 | } else { |
94 | 94 | $getArray = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $endpoint, $shared_secret)); |
95 | 95 | } |
96 | - redirect('index.php?id=' . $id); |
|
96 | + redirect('index.php?id=' . $id); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 |