Completed
Push — master ( 5b2228...956655 )
by Jesus
02:03
created
lib.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -27,32 +27,32 @@  discard block
 block discarded – undo
27 27
 
28 28
 global $CFG;
29 29
 
30
-require_once($CFG->dirroot.'/calendar/lib.php');
31
-require_once($CFG->dirroot.'/message/lib.php');
32
-require_once($CFG->dirroot.'/mod/lti/OAuth.php');
33
-require_once($CFG->libdir.'/accesslib.php');
34
-require_once($CFG->libdir.'/completionlib.php');
35
-require_once($CFG->libdir.'/datalib.php');
36
-require_once($CFG->libdir.'/coursecatlib.php');
37
-require_once($CFG->libdir.'/enrollib.php');
38
-require_once($CFG->libdir.'/filelib.php');
39
-require_once($CFG->libdir.'/formslib.php');
40
-
41
-if (file_exists(dirname(__FILE__).'/vendor/firebase/php-jwt/src/JWT.php')) {
42
-    require_once(dirname(__FILE__).'/vendor/firebase/php-jwt/src/JWT.php');
30
+require_once($CFG->dirroot . '/calendar/lib.php');
31
+require_once($CFG->dirroot . '/message/lib.php');
32
+require_once($CFG->dirroot . '/mod/lti/OAuth.php');
33
+require_once($CFG->libdir . '/accesslib.php');
34
+require_once($CFG->libdir . '/completionlib.php');
35
+require_once($CFG->libdir . '/datalib.php');
36
+require_once($CFG->libdir . '/coursecatlib.php');
37
+require_once($CFG->libdir . '/enrollib.php');
38
+require_once($CFG->libdir . '/filelib.php');
39
+require_once($CFG->libdir . '/formslib.php');
40
+
41
+if (file_exists(dirname(__FILE__) . '/vendor/firebase/php-jwt/src/JWT.php')) {
42
+    require_once(dirname(__FILE__) . '/vendor/firebase/php-jwt/src/JWT.php');
43 43
 }
44 44
 
45 45
 if (!isset($CFG->bigbluebuttonbn)) {
46 46
     $CFG->bigbluebuttonbn = array();
47 47
 }
48 48
 
49
-if (file_exists(dirname(__FILE__).'/config.php')) {
50
-    require_once(dirname(__FILE__).'/config.php');
49
+if (file_exists(dirname(__FILE__) . '/config.php')) {
50
+    require_once(dirname(__FILE__) . '/config.php');
51 51
     // Old BigBlueButtonBN cfg schema. For backward compatibility.
52 52
     global $BIGBLUEBUTTONBN_CFG;
53 53
 
54 54
     if (isset($BIGBLUEBUTTONBN_CFG)) {
55
-        foreach ((array) $BIGBLUEBUTTONBN_CFG as $key => $value) {
55
+        foreach ((array)$BIGBLUEBUTTONBN_CFG as $key => $value) {
56 56
             $cfgkey = str_replace("bigbluebuttonbn_", "", $key);
57 57
             $CFG->bigbluebuttonbn[$cfgkey] = $value;
58 58
         }
@@ -83,19 +83,19 @@  discard block
 block discarded – undo
83 83
     }
84 84
 
85 85
     $features = array(
86
-        (string) FEATURE_IDNUMBER => true,
87
-        (string) FEATURE_GROUPS => true,
88
-        (string) FEATURE_GROUPINGS => true,
89
-        (string) FEATURE_GROUPMEMBERSONLY => true,
90
-        (string) FEATURE_MOD_INTRO => true,
91
-        (string) FEATURE_BACKUP_MOODLE2 => true,
92
-        (string) FEATURE_COMPLETION_TRACKS_VIEWS => true,
93
-        (string) FEATURE_GRADE_HAS_GRADE => false,
94
-        (string) FEATURE_GRADE_OUTCOMES => false,
95
-        (string) FEATURE_SHOW_DESCRIPTION => true,
86
+        (string)FEATURE_IDNUMBER => true,
87
+        (string)FEATURE_GROUPS => true,
88
+        (string)FEATURE_GROUPINGS => true,
89
+        (string)FEATURE_GROUPMEMBERSONLY => true,
90
+        (string)FEATURE_MOD_INTRO => true,
91
+        (string)FEATURE_BACKUP_MOODLE2 => true,
92
+        (string)FEATURE_COMPLETION_TRACKS_VIEWS => true,
93
+        (string)FEATURE_GRADE_HAS_GRADE => false,
94
+        (string)FEATURE_GRADE_OUTCOMES => false,
95
+        (string)FEATURE_SHOW_DESCRIPTION => true,
96 96
     );
97 97
 
98
-    if (isset($features[(string) $feature])) {
98
+    if (isset($features[(string)$feature])) {
99 99
         return $features[$feature];
100 100
     }
101 101
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         // Complete the process.
133 133
         bigbluebuttonbn_process_post_save($data);
134 134
         return $data->id;
135
-    } catch(Exception $e) {
135
+    } catch (Exception $e) {
136 136
         $transaction->rollback($e);
137 137
     }
138 138
     return null;
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         $transaction->allow_commit();
161 161
         // Complete the process.
162 162
         bigbluebuttonbn_process_post_save($data);
163
-    } catch(Exception $e) {
163
+    } catch (Exception $e) {
164 164
         $transaction->rollback($e);
165 165
         return false;
166 166
     }
@@ -229,10 +229,10 @@  discard block
 block discarded – undo
229 229
     $completed = $DB->count_records('bigbluebuttonbn_logs', array('courseid' => $course->id,
230 230
                                                               'bigbluebuttonbnid' => $bigbluebuttonbn->id,
231 231
                                                               'userid' => $user->id,
232
-                                                              'log' => 'Join', ), '*');
232
+                                                              'log' => 'Join',), '*');
233 233
     if ($completed > 0) {
234
-        return fullname($user).' '.get_string('view_message_has_joined', 'bigbluebuttonbn').' '.
235
-            get_string('view_message_session_for', 'bigbluebuttonbn').' '.(string) $completed.' '.
234
+        return fullname($user) . ' ' . get_string('view_message_has_joined', 'bigbluebuttonbn') . ' ' .
235
+            get_string('view_message_session_for', 'bigbluebuttonbn') . ' ' . (string)$completed . ' ' .
236 236
             get_string('view_message_times', 'bigbluebuttonbn');
237 237
     }
238 238
     return '';
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     $completed = $DB->count_recorda('bigbluebuttonbn_logs', array('courseid' => $course->id,
250 250
                                                               'bigbluebuttonbnid' => $bigbluebuttonbn->id,
251 251
                                                               'userid' => $user->id,
252
-                                                              'log' => 'Join', ), '*', IGNORE_MULTIPLE);
252
+                                                              'log' => 'Join',), '*', IGNORE_MULTIPLE);
253 253
     return $completed > 0;
254 254
 }
255 255
 
@@ -317,16 +317,16 @@  discard block
 block discarded – undo
317 317
     if ($bigbluebuttonbn->visible) {
318 318
         $classes = 'class="dimmed" ';
319 319
     }
320
-    $str  = '<div class="bigbluebuttonbn overview">'."\n";
321
-    $str .= '  <div class="name">'.get_string('modulename', 'bigbluebuttonbn').':&nbsp;'."\n";
322
-    $str .= '    <a '.$classes.'href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.
323
-      '">'.$bigbluebuttonbn->name.'</a>'."\n";
324
-    $str .= '  </div>'."\n";
325
-    $str .= '  <div class="info">'.get_string($start, 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime).
326
-        '</div>'."\n";
327
-    $str .= '  <div class="info">'.get_string('ends_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->closingtime)
328
-      .'</div>'."\n";
329
-    $str .= '</div>'."\n";
320
+    $str  = '<div class="bigbluebuttonbn overview">' . "\n";
321
+    $str .= '  <div class="name">' . get_string('modulename', 'bigbluebuttonbn') . ':&nbsp;' . "\n";
322
+    $str .= '    <a ' . $classes . 'href="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bigbluebuttonbn->coursemodule .
323
+      '">' . $bigbluebuttonbn->name . '</a>' . "\n";
324
+    $str .= '  </div>' . "\n";
325
+    $str .= '  <div class="info">' . get_string($start, 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->openingtime) .
326
+        '</div>' . "\n";
327
+    $str .= '  <div class="info">' . get_string('ends_at', 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->closingtime)
328
+      .'</div>' . "\n";
329
+    $str .= '</div>' . "\n";
330 330
     return $str;
331 331
 }
332 332
 
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
     if (count($files) == 1) {
482 482
         // Get the first (and only) file.
483 483
         $file = reset($files);
484
-        $filesrc = '/'.$file->get_filename();
484
+        $filesrc = '/' . $file->get_filename();
485 485
     }
486 486
     return $filesrc;
487 487
 }
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
     if (!$filename) {
532 532
         return false;
533 533
     }
534
-    $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename;
534
+    $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename;
535 535
     $fs = get_file_storage();
536 536
     $file = $fs->get_file_by_hash(sha1($fullpath));
537 537
     if (!$file || $file->is_directory()) {
Please login to merge, or discard this patch.