Completed
Push — master ( 70a753...5b2228 )
by Jesus
02:02
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
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         // Complete the process.
130 130
         bigbluebuttonbn_process_post_save($data);
131 131
         return $data->id;
132
-    } catch(Exception $e) {
132
+    } catch (Exception $e) {
133 133
         $transaction->rollback($e);
134 134
     }
135 135
     return null;
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         $transaction->allow_commit();
157 157
         // Complete the process.
158 158
         bigbluebuttonbn_process_post_save($data);
159
-    } catch(Exception $e) {
159
+    } catch (Exception $e) {
160 160
         $transaction->rollback($e);
161 161
         return false;
162 162
     }
@@ -225,10 +225,10 @@  discard block
 block discarded – undo
225 225
     $completed = $DB->count_records('bigbluebuttonbn_logs', array('courseid' => $course->id,
226 226
                                                               'bigbluebuttonbnid' => $bigbluebuttonbn->id,
227 227
                                                               'userid' => $user->id,
228
-                                                              'log' => 'Join', ), '*');
228
+                                                              'log' => 'Join',), '*');
229 229
     if ($completed > 0) {
230
-        return fullname($user).' '.get_string('view_message_has_joined', 'bigbluebuttonbn').' '.
231
-            get_string('view_message_session_for', 'bigbluebuttonbn').' '.(string) $completed.' '.
230
+        return fullname($user) . ' ' . get_string('view_message_has_joined', 'bigbluebuttonbn') . ' ' .
231
+            get_string('view_message_session_for', 'bigbluebuttonbn') . ' ' . (string)$completed . ' ' .
232 232
             get_string('view_message_times', 'bigbluebuttonbn');
233 233
     }
234 234
     return '';
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     $completed = $DB->count_recorda('bigbluebuttonbn_logs', array('courseid' => $course->id,
246 246
                                                               'bigbluebuttonbnid' => $bigbluebuttonbn->id,
247 247
                                                               'userid' => $user->id,
248
-                                                              'log' => 'Join', ), '*', IGNORE_MULTIPLE);
248
+                                                              'log' => 'Join',), '*', IGNORE_MULTIPLE);
249 249
     return $completed > 0;
250 250
 }
251 251
 
@@ -313,16 +313,16 @@  discard block
 block discarded – undo
313 313
     if ($bigbluebuttonbn->visible) {
314 314
         $classes = 'class="dimmed" ';
315 315
     }
316
-    $str  = '<div class="bigbluebuttonbn overview">'."\n";
317
-    $str .= '  <div class="name">'.get_string('modulename', 'bigbluebuttonbn').':&nbsp;'."\n";
318
-    $str .= '    <a '.$classes.'href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.
319
-      '">'.$bigbluebuttonbn->name.'</a>'."\n";
320
-    $str .= '  </div>'."\n";
321
-    $str .= '  <div class="info">'.get_string($start, 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime).
322
-        '</div>'."\n";
323
-    $str .= '  <div class="info">'.get_string('ends_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->closingtime)
324
-      .'</div>'."\n";
325
-    $str .= '</div>'."\n";
316
+    $str  = '<div class="bigbluebuttonbn overview">' . "\n";
317
+    $str .= '  <div class="name">' . get_string('modulename', 'bigbluebuttonbn') . ':&nbsp;' . "\n";
318
+    $str .= '    <a ' . $classes . 'href="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bigbluebuttonbn->coursemodule .
319
+      '">' . $bigbluebuttonbn->name . '</a>' . "\n";
320
+    $str .= '  </div>' . "\n";
321
+    $str .= '  <div class="info">' . get_string($start, 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->openingtime) .
322
+        '</div>' . "\n";
323
+    $str .= '  <div class="info">' . get_string('ends_at', 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->closingtime)
324
+      .'</div>' . "\n";
325
+    $str .= '</div>' . "\n";
326 326
     return $str;
327 327
 }
328 328
 
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     if (count($files) == 1) {
479 479
         // Get the first (and only) file.
480 480
         $file = reset($files);
481
-        $filesrc = '/'.$file->get_filename();
481
+        $filesrc = '/' . $file->get_filename();
482 482
     }
483 483
     // Set the presentation column in the bigbluebuttonbn table.
484 484
     $DB->set_field('bigbluebuttonbn', 'presentation', $filesrc, array('id' => $bigbluebuttonbn->id));
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
         return false;
536 536
     }
537 537
 
538
-    $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename;
538
+    $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename;
539 539
     $fs = get_file_storage();
540 540
     $file = $fs->get_file_by_hash(sha1($fullpath));
541 541
     if (!$file || $file->is_directory()) {
Please login to merge, or discard this patch.