@@ -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(); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | const BIGBLUEBUTTONBN_LOG_EVENT_DELETE = "Delete"; |
51 | 51 | |
52 | 52 | function bigbluebuttonbn_supports($feature) { |
53 | - switch($feature) { |
|
53 | + switch ($feature) { |
|
54 | 54 | case FEATURE_IDNUMBER: return true; |
55 | 55 | case FEATURE_GROUPS: return true; |
56 | 56 | case FEATURE_GROUPINGS: return true; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | function bigbluebuttonbn_add_instance($data, $mform) { |
80 | 80 | global $DB, $CFG; |
81 | 81 | |
82 | - $draftitemid = isset($data->presentation)? $data->presentation: null; |
|
82 | + $draftitemid = isset($data->presentation) ? $data->presentation : null; |
|
83 | 83 | $context = bigbluebuttonbn_get_context_module($data->coursemodule); |
84 | 84 | |
85 | 85 | bigbluebuttonbn_process_pre_save($data); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | global $DB, $CFG; |
108 | 108 | |
109 | 109 | $data->id = $data->instance; |
110 | - $draftitemid = isset($data->presentation)? $data->presentation: null; |
|
110 | + $draftitemid = isset($data->presentation) ? $data->presentation : null; |
|
111 | 111 | $context = bigbluebuttonbn_get_context_module($data->coursemodule); |
112 | 112 | |
113 | 113 | bigbluebuttonbn_process_pre_save($data); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | function bigbluebuttonbn_delete_instance($id) { |
134 | 134 | global $CFG, $DB, $USER; |
135 | 135 | |
136 | - if (! $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $id))) { |
|
136 | + if (!$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $id))) { |
|
137 | 137 | return false; |
138 | 138 | } |
139 | 139 | |
@@ -151,11 +151,11 @@ discard block |
||
151 | 151 | //if( bigbluebuttonbn_isMeetingRunning($meetingID, $url, $shared_secret) ) |
152 | 152 | // $getArray = bigbluebuttonbn_doEndMeeting( $meetingID, $modPW, $url, $shared_secret ); |
153 | 153 | |
154 | - if (! $DB->delete_records('bigbluebuttonbn', array('id' => $bigbluebuttonbn->id))) { |
|
154 | + if (!$DB->delete_records('bigbluebuttonbn', array('id' => $bigbluebuttonbn->id))) { |
|
155 | 155 | $result = false; |
156 | 156 | } |
157 | 157 | |
158 | - if (! $DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) { |
|
158 | + if (!$DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) { |
|
159 | 159 | $result = false; |
160 | 160 | } |
161 | 161 | |
@@ -171,19 +171,19 @@ discard block |
||
171 | 171 | $logs = $DB->get_records('bigbluebuttonbn_logs', array('bigbluebuttonbnid' => $bigbluebuttonbn->id, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_CREATE)); |
172 | 172 | error_log(json_encode($logs)); |
173 | 173 | $has_recordings = 'false'; |
174 | - if (! empty($logs) ) { |
|
174 | + if (!empty($logs)) { |
|
175 | 175 | error_log("IS not empty"); |
176 | - foreach ( $logs as $l ) { |
|
176 | + foreach ($logs as $l) { |
|
177 | 177 | error_log(json_encode($l)); |
178 | 178 | $meta = json_decode($l->meta); |
179 | - if ( $meta->record ) { |
|
179 | + if ($meta->record) { |
|
180 | 180 | $has_recordings = 'true'; |
181 | 181 | } |
182 | 182 | } |
183 | 183 | } |
184 | 184 | $log->meta = "{\"has_recordings\":{$has_recordings}}"; |
185 | 185 | |
186 | - if (! $returnid = $DB->insert_record('bigbluebuttonbn_logs', $log)) { |
|
186 | + if (!$returnid = $DB->insert_record('bigbluebuttonbn_logs', $log)) { |
|
187 | 187 | $result = false; |
188 | 188 | } |
189 | 189 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @return boolean |
222 | 222 | */ |
223 | 223 | function bigbluebuttonbn_print_recent_activity($course, $isteacher, $timestart) { |
224 | - return false; // True if anything was printed, otherwise false |
|
224 | + return false; // True if anything was printed, otherwise false |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * @param int $groupid defaults to 0 |
237 | 237 | * @return void adds items into $activities and increases $index |
238 | 238 | */ |
239 | -function bigbluebuttonbn_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0) { |
|
239 | +function bigbluebuttonbn_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid = 0, $groupid = 0) { |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * |
255 | 255 | * @return boolean |
256 | 256 | **/ |
257 | -function bigbluebuttonbn_cron () { |
|
257 | +function bigbluebuttonbn_cron() { |
|
258 | 258 | return true; |
259 | 259 | } |
260 | 260 | |
@@ -356,21 +356,21 @@ discard block |
||
356 | 356 | } |
357 | 357 | |
358 | 358 | $strbigbluebuttonbn = get_string('modulename', 'bigbluebuttonbn'); |
359 | - $strnextsession = get_string('nextsession', 'bigbluebuttonbn'); |
|
359 | + $strnextsession = get_string('nextsession', 'bigbluebuttonbn'); |
|
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 | - $strbigbluebuttonbn.': <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 | + $strbigbluebuttonbn . ': <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, newwindow')) { |
|
398 | + if (!$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id'=>$coursemodule->instance), 'id, name, intro, introformat, newwindow')) { |
|
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,13 +433,13 @@ discard block |
||
433 | 433 | $bigbluebuttonbn->timemodified = time(); |
434 | 434 | } |
435 | 435 | |
436 | - if (! isset($bigbluebuttonbn->newwindow)) |
|
436 | + if (!isset($bigbluebuttonbn->newwindow)) |
|
437 | 437 | $bigbluebuttonbn->newwindow = 0; |
438 | - if (! isset($bigbluebuttonbn->wait)) |
|
438 | + if (!isset($bigbluebuttonbn->wait)) |
|
439 | 439 | $bigbluebuttonbn->wait = 0; |
440 | - if (! isset($bigbluebuttonbn->record)) |
|
440 | + if (!isset($bigbluebuttonbn->record)) |
|
441 | 441 | $bigbluebuttonbn->record = 0; |
442 | - if (! isset($bigbluebuttonbn->tagging)) |
|
442 | + if (!isset($bigbluebuttonbn->tagging)) |
|
443 | 443 | $bigbluebuttonbn->tagging = 0; |
444 | 444 | |
445 | 445 | $bigbluebuttonbn->participants = htmlspecialchars_decode($bigbluebuttonbn->participants); |
@@ -458,8 +458,8 @@ discard block |
||
458 | 458 | |
459 | 459 | // Now that an id was assigned, generate and set the meetingid property based on |
460 | 460 | // [Moodle Instance + Activity ID + BBB Secret] (but only for new activities) |
461 | - if( isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add) ) { |
|
462 | - $bigbluebuttonbn_meetingid = sha1($CFG->wwwroot.$bigbluebuttonbn->id.bigbluebuttonbn_get_cfg_shared_secret()); |
|
461 | + if (isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add)) { |
|
462 | + $bigbluebuttonbn_meetingid = sha1($CFG->wwwroot . $bigbluebuttonbn->id . bigbluebuttonbn_get_cfg_shared_secret()); |
|
463 | 463 | $DB->set_field('bigbluebuttonbn', 'meetingid', $bigbluebuttonbn_meetingid, array('id' => $bigbluebuttonbn->id)); |
464 | 464 | $action = get_string('mod_form_field_notification_msg_created', 'bigbluebuttonbn'); |
465 | 465 | } else { |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $at = get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn'); |
469 | 469 | |
470 | 470 | // Add evento to the calendar when if openingtime is set |
471 | - if ( isset($bigbluebuttonbn->openingtime) && $bigbluebuttonbn->openingtime ){ |
|
471 | + if (isset($bigbluebuttonbn->openingtime) && $bigbluebuttonbn->openingtime) { |
|
472 | 472 | $event = new stdClass(); |
473 | 473 | $event->name = $bigbluebuttonbn->name; |
474 | 474 | $event->courseid = $bigbluebuttonbn->course; |
@@ -478,13 +478,13 @@ discard block |
||
478 | 478 | $event->instance = $bigbluebuttonbn->id; |
479 | 479 | $event->timestart = $bigbluebuttonbn->openingtime; |
480 | 480 | |
481 | - if ( $bigbluebuttonbn->closingtime ){ |
|
481 | + if ($bigbluebuttonbn->closingtime) { |
|
482 | 482 | $event->durationtime = $bigbluebuttonbn->closingtime - $bigbluebuttonbn->openingtime; |
483 | 483 | } else { |
484 | 484 | $event->durationtime = 0; |
485 | 485 | } |
486 | 486 | |
487 | - if ( $event->id = $DB->get_field('event', 'id', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id)) ) { |
|
487 | + if ($event->id = $DB->get_field('event', 'id', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) { |
|
488 | 488 | $calendarevent = calendar_event::load($event->id); |
489 | 489 | $calendarevent->update($event); |
490 | 490 | } else { |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | $DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id)); |
496 | 496 | } |
497 | 497 | |
498 | - if( isset($bigbluebuttonbn->notification) && $bigbluebuttonbn->notification ) { |
|
498 | + if (isset($bigbluebuttonbn->notification) && $bigbluebuttonbn->notification) { |
|
499 | 499 | // Prepare message |
500 | 500 | $msg = new stdClass(); |
501 | 501 | |
@@ -503,35 +503,35 @@ discard block |
||
503 | 503 | $msg->action = $action; |
504 | 504 | $msg->activity_type = ""; |
505 | 505 | $msg->activity_title = $bigbluebuttonbn->name; |
506 | - $message_text = '<p>'.$msg->activity_type.' "'.$msg->activity_title.'" '.get_string('email_body_notification_meeting_has_been', 'bigbluebuttonbn').' '.$msg->action.'.</p>'; |
|
506 | + $message_text = '<p>' . $msg->activity_type . ' "' . $msg->activity_title . '" ' . get_string('email_body_notification_meeting_has_been', 'bigbluebuttonbn') . ' ' . $msg->action . '.</p>'; |
|
507 | 507 | |
508 | 508 | /// Add the meeting details to the message_body |
509 | 509 | $msg->action = ucfirst($action); |
510 | 510 | $msg->activity_description = ""; |
511 | - if( !empty($bigbluebuttonbn->intro) ) |
|
511 | + if (!empty($bigbluebuttonbn->intro)) |
|
512 | 512 | $msg->activity_description = trim($bigbluebuttonbn->intro); |
513 | 513 | $msg->activity_openingtime = ""; |
514 | 514 | if ($bigbluebuttonbn->openingtime) { |
515 | - $msg->activity_openingtime = calendar_day_representation($bigbluebuttonbn->openingtime).' '.$at.' '.calendar_time_representation($bigbluebuttonbn->openingtime); |
|
515 | + $msg->activity_openingtime = calendar_day_representation($bigbluebuttonbn->openingtime) . ' ' . $at . ' ' . calendar_time_representation($bigbluebuttonbn->openingtime); |
|
516 | 516 | } |
517 | 517 | $msg->activity_closingtime = ""; |
518 | - if ($bigbluebuttonbn->closingtime ) { |
|
519 | - $msg->activity_closingtime = calendar_day_representation($bigbluebuttonbn->closingtime).' '.$at.' '.calendar_time_representation($bigbluebuttonbn->closingtime); |
|
518 | + if ($bigbluebuttonbn->closingtime) { |
|
519 | + $msg->activity_closingtime = calendar_day_representation($bigbluebuttonbn->closingtime) . ' ' . $at . ' ' . calendar_time_representation($bigbluebuttonbn->closingtime); |
|
520 | 520 | } |
521 | 521 | $msg->activity_owner = fullname($USER); |
522 | 522 | |
523 | - $message_text .= '<p><b>'.$msg->activity_title.'</b> '.get_string('email_body_notification_meeting_details', 'bigbluebuttonbn').':'; |
|
523 | + $message_text .= '<p><b>' . $msg->activity_title . '</b> ' . get_string('email_body_notification_meeting_details', 'bigbluebuttonbn') . ':'; |
|
524 | 524 | $message_text .= '<table border="0" style="margin: 5px 0 0 20px"><tbody>'; |
525 | - $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_title', 'bigbluebuttonbn').': </td><td>'; |
|
526 | - $message_text .= $msg->activity_title.'</td></tr>'; |
|
527 | - $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_description', 'bigbluebuttonbn').': </td><td>'; |
|
528 | - $message_text .= $msg->activity_description.'</td></tr>'; |
|
529 | - $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_start_date', 'bigbluebuttonbn').': </td><td>'; |
|
530 | - $message_text .= $msg->activity_openingtime.'</td></tr>'; |
|
531 | - $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_end_date', 'bigbluebuttonbn').': </td><td>'; |
|
532 | - $message_text .= $msg->activity_closingtime.'</td></tr>'; |
|
533 | - $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.$msg->action.' '.get_string('email_body_notification_meeting_by', 'bigbluebuttonbn').': </td><td>'; |
|
534 | - $message_text .= $msg->activity_owner.'</td></tr></tbody></table></p>'; |
|
525 | + $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_title', 'bigbluebuttonbn') . ': </td><td>'; |
|
526 | + $message_text .= $msg->activity_title . '</td></tr>'; |
|
527 | + $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_description', 'bigbluebuttonbn') . ': </td><td>'; |
|
528 | + $message_text .= $msg->activity_description . '</td></tr>'; |
|
529 | + $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_start_date', 'bigbluebuttonbn') . ': </td><td>'; |
|
530 | + $message_text .= $msg->activity_openingtime . '</td></tr>'; |
|
531 | + $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_end_date', 'bigbluebuttonbn') . ': </td><td>'; |
|
532 | + $message_text .= $msg->activity_closingtime . '</td></tr>'; |
|
533 | + $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . $msg->action . ' ' . get_string('email_body_notification_meeting_by', 'bigbluebuttonbn') . ': </td><td>'; |
|
534 | + $message_text .= $msg->activity_owner . '</td></tr></tbody></table></p>'; |
|
535 | 535 | |
536 | 536 | // Send notification to all users enrolled |
537 | 537 | bigbluebuttonbn_send_notification($USER, $bigbluebuttonbn, $message_text); |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | * @param array $options additional options affecting the file serving |
583 | 583 | * @return bool false if file not found, does not return if found - justsend the file |
584 | 584 | */ |
585 | -function bigbluebuttonbn_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) { |
|
585 | +function bigbluebuttonbn_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) { |
|
586 | 586 | global $CFG, $DB; |
587 | 587 | |
588 | 588 | if ($context->contextlevel != CONTEXT_MODULE) { |
@@ -598,21 +598,21 @@ discard block |
||
598 | 598 | return false; |
599 | 599 | } |
600 | 600 | |
601 | - if( sizeof($args) > 1 ) { |
|
601 | + if (sizeof($args) > 1) { |
|
602 | 602 | $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'presentation_cache'); |
603 | 603 | $presentation_nonce_key = sha1($bigbluebuttonbn->id); |
604 | 604 | $presentation_nonce = $cache->get($presentation_nonce_key); |
605 | 605 | $presentation_nonce_value = $presentation_nonce['value']; |
606 | 606 | $presentation_nonce_counter = $presentation_nonce['counter']; |
607 | 607 | |
608 | - if( $args["0"] != $presentation_nonce_value ) { |
|
608 | + if ($args["0"] != $presentation_nonce_value) { |
|
609 | 609 | return false; |
610 | 610 | } |
611 | 611 | |
612 | 612 | //The nonce value is actually used twice because BigBlueButton reads the file two times |
613 | 613 | $presentation_nonce_counter += 1; |
614 | - if( $presentation_nonce_counter < 2 ) { |
|
615 | - $cache->set($presentation_nonce_key, array( "value" => $presentation_nonce_value, "counter" => $presentation_nonce_counter )); |
|
614 | + if ($presentation_nonce_counter < 2) { |
|
615 | + $cache->set($presentation_nonce_key, array("value" => $presentation_nonce_value, "counter" => $presentation_nonce_counter)); |
|
616 | 616 | } else { |
617 | 617 | $cache->delete($presentation_nonce_key); |
618 | 618 | } |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | } |
631 | 631 | |
632 | 632 | if ($filearea === 'presentation') { |
633 | - $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename; |
|
633 | + $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename; |
|
634 | 634 | } else { |
635 | 635 | return false; |
636 | 636 | } |
@@ -664,10 +664,10 @@ discard block |
||
664 | 664 | * @package mod_bigbluebuttonbn |
665 | 665 | * @return array a list of available roles |
666 | 666 | */ |
667 | -function bigbluebuttonbn_get_db_moodle_roles($rolename='all') { |
|
667 | +function bigbluebuttonbn_get_db_moodle_roles($rolename = 'all') { |
|
668 | 668 | global $DB; |
669 | 669 | |
670 | - if( $rolename != 'all') |
|
670 | + if ($rolename != 'all') |
|
671 | 671 | $roles = $DB->get_record('role', array('shortname' => $rolename)); |
672 | 672 | else |
673 | 673 | $roles = $DB->get_records('role', array()); |
@@ -686,22 +686,22 @@ discard block |
||
686 | 686 | |
687 | 687 | $roles = bigbluebuttonbn_get_db_moodle_roles(); |
688 | 688 | $sqluserids = array(); |
689 | - foreach($roles as $role){ |
|
689 | + foreach ($roles as $role) { |
|
690 | 690 | $users = get_role_users($role->id, $context); |
691 | - foreach($users as $user) { |
|
691 | + foreach ($users as $user) { |
|
692 | 692 | array_push($sqluserids, $user->id); |
693 | 693 | } |
694 | 694 | } |
695 | 695 | |
696 | 696 | $users_array = array(); |
697 | - if( !empty($sqluserids) ) { |
|
697 | + if (!empty($sqluserids)) { |
|
698 | 698 | $users_array = $DB->get_records_select("user", "id IN (" . implode(', ', $sqluserids) . ") AND deleted = 0"); |
699 | 699 | } |
700 | 700 | |
701 | 701 | return $users_array; |
702 | 702 | } |
703 | 703 | |
704 | -function bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message="") { |
|
704 | +function bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message = "") { |
|
705 | 705 | global $CFG, $DB; |
706 | 706 | |
707 | 707 | $context = bigbluebuttonbn_get_context_course($bigbluebuttonbn->course); |
@@ -712,17 +712,17 @@ discard block |
||
712 | 712 | $msg->user_name = fullname($sender); |
713 | 713 | $msg->user_email = $sender->email; |
714 | 714 | $msg->course_name = "$course->fullname"; |
715 | - $message .= '<p><hr/><br/>'.get_string('email_footer_sent_by', 'bigbluebuttonbn').' '.$msg->user_name.'('.$msg->user_email.') '; |
|
716 | - $message .= get_string('email_footer_sent_from', 'bigbluebuttonbn').' '.$msg->course_name.'.</p>'; |
|
715 | + $message .= '<p><hr/><br/>' . get_string('email_footer_sent_by', 'bigbluebuttonbn') . ' ' . $msg->user_name . '(' . $msg->user_email . ') '; |
|
716 | + $message .= get_string('email_footer_sent_from', 'bigbluebuttonbn') . ' ' . $msg->course_name . '.</p>'; |
|
717 | 717 | |
718 | 718 | $users = bigbluebuttonbn_get_users($context); |
719 | - foreach( $users as $user ) { |
|
720 | - if( $user->id != $sender->id ){ |
|
719 | + foreach ($users as $user) { |
|
720 | + if ($user->id != $sender->id) { |
|
721 | 721 | $messageid = message_post_message($sender, $user, $message, FORMAT_HTML); |
722 | 722 | if (!empty($messageid)) { |
723 | - error_log("Msg to ".$msg->user_name." was sent."); |
|
723 | + error_log("Msg to " . $msg->user_name . " was sent."); |
|
724 | 724 | } else { |
725 | - error_log("Msg to ".$msg->user_name." was NOT sent."); |
|
725 | + error_log("Msg to " . $msg->user_name . " was NOT sent."); |
|
726 | 726 | } |
727 | 727 | } |
728 | 728 | } |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | global $CFG; |
733 | 733 | |
734 | 734 | $version_major = bigbluebuttonbn_get_moodle_version_major(); |
735 | - if ( $version_major < '2013111800' ) { |
|
735 | + if ($version_major < '2013111800') { |
|
736 | 736 | //This is valid before v2.6 |
737 | 737 | $context = get_context_instance(CONTEXT_MODULE, $id); |
738 | 738 | } else { |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | global $CFG; |
748 | 748 | |
749 | 749 | $version_major = bigbluebuttonbn_get_moodle_version_major(); |
750 | - if ( $version_major < '2013111800' ) { |
|
750 | + if ($version_major < '2013111800') { |
|
751 | 751 | //This is valid before v2.6 |
752 | 752 | $context = get_context_instance(CONTEXT_COURSE, $id); |
753 | 753 | } else { |
@@ -760,10 +760,10 @@ discard block |
||
760 | 760 | |
761 | 761 | function bigbluebuttonbn_get_cfg_server_url() { |
762 | 762 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
763 | - 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/')); |
|
763 | + 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/')); |
|
764 | 764 | } |
765 | 765 | |
766 | 766 | function bigbluebuttonbn_get_cfg_shared_secret() { |
767 | 767 | global $BIGBLUEBUTTONBN_CFG, $CFG; |
768 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret)? trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret): (isset($CFG->bigbluebuttonbn_shared_secret)? trim($CFG->bigbluebuttonbn_shared_secret): '8cd8ef52e8e101574e400365b55e11a6')); |
|
768 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) ? trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) : (isset($CFG->bigbluebuttonbn_shared_secret) ? trim($CFG->bigbluebuttonbn_shared_secret) : '8cd8ef52e8e101574e400365b55e11a6')); |
|
769 | 769 | } |