Completed
Push — master ( 12ecea...43b232 )
by Jesus
03:32
created
locallib.php 4 patches
Doc Comments   +28 added lines patch added patch discarded remove patch
@@ -189,6 +189,9 @@  discard block
 block discarded – undo
189 189
     return $xml;
190 190
 }
191 191
 
192
+/**
193
+ * @param string $meetingID
194
+ */
192 195
 function bigbluebuttonbn_getMeetingInfoArray( $meetingID, $modPW, $URL, $SALT ) {
193 196
     $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) );
194 197
 
@@ -287,6 +290,10 @@  discard block
 block discarded – undo
287 290
     else return 1;
288 291
 }
289 292
 
293
+/**
294
+ * @param string $URL
295
+ * @param string $SALT
296
+ */
290 297
 function bigbluebuttonbn_doDeleteRecordings( $recordIDs, $URL, $SALT ) {
291 298
     $ids = 	explode(",", $recordIDs);
292 299
     foreach( $ids as $id){
@@ -297,6 +304,11 @@  discard block
 block discarded – undo
297 304
     return true;
298 305
 }
299 306
 
307
+/**
308
+ * @param string $set
309
+ * @param string $URL
310
+ * @param string $SALT
311
+ */
300 312
 function bigbluebuttonbn_doPublishRecordings( $recordIDs, $set, $URL, $SALT ) {
301 313
     $ids = 	explode(",", $recordIDs);
302 314
     foreach( $ids as $id){
@@ -307,6 +319,10 @@  discard block
 block discarded – undo
307 319
     return true;
308 320
 }
309 321
 
322
+/**
323
+ * @param string $URL
324
+ * @param string $SALT
325
+ */
310 326
 function bigbluebuttonbn_doEndMeeting( $meetingID, $modPW, $URL, $SALT ) {
311 327
     $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getEndMeetingURL( $meetingID, $modPW, $URL, $SALT ) );
312 328
 
@@ -328,6 +344,9 @@  discard block
 block discarded – undo
328 344
 }
329 345
 
330 346
 
347
+/**
348
+ * @param string $URL
349
+ */
331 350
 function bigbluebuttonbn_getServerVersion( $URL ){
332 351
     $xml = bigbluebuttonbn_wrap_xml_load_file( $URL."api" );
333 352
     if ( $xml && $xml->returncode == 'SUCCESS' ) {
@@ -346,6 +365,9 @@  discard block
 block discarded – undo
346 365
     }
347 366
 }
348 367
 
368
+/**
369
+ * @param string $url
370
+ */
349 371
 function bigbluebuttonbn_wrap_xml_load_file($url, $method=BIGBLUEBUTTONBN_METHOD_GET, $data=null) {
350 372
     if ( bigbluebuttonbn_debugdisplay() ) error_log("Request to: ".$url);
351 373
 
@@ -781,6 +803,9 @@  discard block
 block discarded – undo
781 803
     $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'meetings_cache');
782 804
 }
783 805
 
806
+/**
807
+ * @param boolean $is_moderator
808
+ */
784 809
 function bigbluebuttonbn_bbb_broker_participant_joined($meetingid, $is_moderator) {
785 810
     $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'meetings_cache');
786 811
     $result = $cache->get($meetingid);
@@ -1370,6 +1395,9 @@  discard block
 block discarded – undo
1370 1395
     return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled: (isset($CFG->bigbluebuttonbn_recordingready_enabled)? $CFG->bigbluebuttonbn_recordingready_enabled: false));
1371 1396
 }
1372 1397
 
1398
+/**
1399
+ * @return string
1400
+ */
1373 1401
 function bigbluebuttonbn_get_cfg_moderator_default() {
1374 1402
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1375 1403
     return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default: (isset($CFG->bigbluebuttonbn_moderator_default)? $CFG->bigbluebuttonbn_moderator_default: 'owner'));
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
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);
@@ -1590,8 +1590,8 @@  discard block
 block discarded – undo
1590 1590
         // Fetch only those related to the $courseID and $bigbluebuttonbnID requested
1591 1591
         $recordings_imported = $DB->get_records('bigbluebuttonbn_logs', array('courseid' => $courseID, 'bigbluebuttonbnid' => $bigbluebuttonbnID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_IMPORT));
1592 1592
     } else {
1593
-      // Fetch all the ones corresponding to the $courseID requested
1594
-      $recordings_imported = $DB->get_records('bigbluebuttonbn_logs', array('courseid' => $courseID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_IMPORT));
1593
+        // Fetch all the ones corresponding to the $courseID requested
1594
+        $recordings_imported = $DB->get_records('bigbluebuttonbn_logs', array('courseid' => $courseID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_IMPORT));
1595 1595
     }
1596 1596
     return $recordings_imported;
1597 1597
 }
Please login to merge, or discard this patch.
Spacing   +336 added lines, -336 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
33 33
 const BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED = 'recording_imported';
34 34
 const BIGBLUEBUTTON_EVENT_MEETING_LEFT = "meeting_left";
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,127 +56,127 @@  discard block
 block discarded – undo
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
     $duration = intval($duration);
76
-    if( $duration > 0 )
77
-        $params .= '&duration='.$duration;
76
+    if ($duration > 0)
77
+        $params .= '&duration=' . $duration;
78 78
 
79 79
     $maxParticipants = intval($maxParticipants);
80
-    if( $maxParticipants > 0 )
81
-        $params .= '&maxParticipants='.$maxParticipants;
80
+    if ($maxParticipants > 0)
81
+        $params .= '&maxParticipants=' . $maxParticipants;
82 82
 
83
-    if( trim( $welcome ) )
84
-        $params .= '&welcome='.urlencode($welcome);
83
+    if (trim($welcome))
84
+        $params .= '&welcome=' . urlencode($welcome);
85 85
 
86 86
     foreach ($metadata as $key => $value) {
87
-        $params .= '&'.$key.'='.urlencode($value);
87
+        $params .= '&' . $key . '=' . urlencode($value);
88 88
     }
89 89
 
90
-    $url = $url_create.$params.'&checksum='.sha1("create".$params.$SALT);
90
+    $url = $url_create . $params . '&checksum=' . sha1("create" . $params . $SALT);
91 91
     return $url;
92 92
 }
93 93
 
94
-function bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) {
95
-    $base_url = $URL."api/isMeetingRunning?";
96
-    $params = 'meetingID='.urlencode($meetingID);
97
-    $url = $base_url.$params.'&checksum='.sha1("isMeetingRunning".$params.$SALT);
94
+function bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT) {
95
+    $base_url = $URL . "api/isMeetingRunning?";
96
+    $params = 'meetingID=' . urlencode($meetingID);
97
+    $url = $base_url . $params . '&checksum=' . sha1("isMeetingRunning" . $params . $SALT);
98 98
     return $url;
99 99
 }
100 100
 
101
-function bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) {
102
-    $base_url = $URL."api/getMeetingInfo?";
103
-    $params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW);
104
-    $url = $base_url.$params.'&checksum='.sha1("getMeetingInfo".$params.$SALT);
101
+function bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT) {
102
+    $base_url = $URL . "api/getMeetingInfo?";
103
+    $params = 'meetingID=' . urlencode($meetingID) . '&password=' . urlencode($modPW);
104
+    $url = $base_url . $params . '&checksum=' . sha1("getMeetingInfo" . $params . $SALT);
105 105
     return $url;
106 106
 }
107 107
 
108
-function bigbluebuttonbn_getMeetingsURL( $URL, $SALT ) {
109
-    $base_url = $URL."api/getMeetings?";
110
-    $url = $base_url.'&checksum='.sha1("getMeetings".$SALT);
108
+function bigbluebuttonbn_getMeetingsURL($URL, $SALT) {
109
+    $base_url = $URL . "api/getMeetings?";
110
+    $url = $base_url . '&checksum=' . sha1("getMeetings" . $SALT);
111 111
     return $url;
112 112
 }
113 113
 
114
-function bigbluebuttonbn_getEndMeetingURL( $meetingID, $modPW, $URL, $SALT ) {
115
-    $base_url = $URL."api/end?";
116
-    $params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW);
117
-    $url = $base_url.$params.'&checksum='.sha1("end".$params.$SALT);
114
+function bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $URL, $SALT) {
115
+    $base_url = $URL . "api/end?";
116
+    $params = 'meetingID=' . urlencode($meetingID) . '&password=' . urlencode($modPW);
117
+    $url = $base_url . $params . '&checksum=' . sha1("end" . $params . $SALT);
118 118
     return $url;
119 119
 }
120 120
 
121
-function bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingID=null ) {
122
-    $base_url_record = $URL."api/getRecordings?";
123
-    if( $meetingID == null ) {
121
+function bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingID = null) {
122
+    $base_url_record = $URL . "api/getRecordings?";
123
+    if ($meetingID == null) {
124 124
         $params = "";
125 125
     } else {
126
-        $params = "meetingID=".urlencode($meetingID);
126
+        $params = "meetingID=" . urlencode($meetingID);
127 127
     }
128
-    $url = $base_url_record.$params."&checksum=".sha1("getRecordings".$params.$SALT);
128
+    $url = $base_url_record . $params . "&checksum=" . sha1("getRecordings" . $params . $SALT);
129 129
     return $url;
130 130
 }
131 131
 
132
-function bigbluebuttonbn_getDeleteRecordingsURL( $recordID, $URL, $SALT ) {
133
-    $url_delete = $URL."api/deleteRecordings?";
134
-    $params = 'recordID='.urlencode($recordID);
135
-    $url = $url_delete.$params.'&checksum='.sha1("deleteRecordings".$params.$SALT);
132
+function bigbluebuttonbn_getDeleteRecordingsURL($recordID, $URL, $SALT) {
133
+    $url_delete = $URL . "api/deleteRecordings?";
134
+    $params = 'recordID=' . urlencode($recordID);
135
+    $url = $url_delete . $params . '&checksum=' . sha1("deleteRecordings" . $params . $SALT);
136 136
     return $url;
137 137
 }
138 138
 
139
-function bigbluebuttonbn_getPublishRecordingsURL( $recordID, $set, $URL, $SALT ) {
140
-    $url_publish = $URL."api/publishRecordings?";
141
-    $params = 'recordID='.$recordID."&publish=".$set;
142
-    $url = $url_publish.$params.'&checksum='.sha1("publishRecordings".$params.$SALT);
139
+function bigbluebuttonbn_getPublishRecordingsURL($recordID, $set, $URL, $SALT) {
140
+    $url_publish = $URL . "api/publishRecordings?";
141
+    $params = 'recordID=' . $recordID . "&publish=" . $set;
142
+    $url = $url_publish . $params . '&checksum=' . sha1("publishRecordings" . $params . $SALT);
143 143
     return $url;
144 144
 }
145 145
 
146
-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 ) {
146
+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) {
147 147
     $create_meeting_url = bigbluebuttonbn_getCreateMeetingURL($username, $meetingID, $aPW, $mPW, $welcomeString, $logoutURL, $SALT, $URL, $record, $duration, $voiceBridge, $maxParticipants, $metadata);
148
-    if( !is_null($presentation_name) && !is_null($presentation_url) ) {
149
-        $xml = bigbluebuttonbn_wrap_xml_load_file( $create_meeting_url,
148
+    if (!is_null($presentation_name) && !is_null($presentation_url)) {
149
+        $xml = bigbluebuttonbn_wrap_xml_load_file($create_meeting_url,
150 150
                 BIGBLUEBUTTONBN_METHOD_POST,
151
-                "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='".$presentation_url."' /></module></modules>"
151
+                "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='" . $presentation_url . "' /></module></modules>"
152 152
                 );
153 153
     } else {
154
-        $xml = bigbluebuttonbn_wrap_xml_load_file( $create_meeting_url );
154
+        $xml = bigbluebuttonbn_wrap_xml_load_file($create_meeting_url);
155 155
     }
156 156
 
157
-    if ( $xml ) {
157
+    if ($xml) {
158 158
         if ($xml->meetingID)
159
-            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded );
159
+            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded);
160 160
         else
161
-            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey );
161
+            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
162 162
     } else {
163 163
         return null;
164 164
     }
165 165
 }
166 166
 
167
-function bigbluebuttonbn_getMeetingsArray($meetingID, $URL, $SALT ) {
168
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingsURL($URL, $SALT) );
167
+function bigbluebuttonbn_getMeetingsArray($meetingID, $URL, $SALT) {
168
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingsURL($URL, $SALT));
169 169
 
170
-    if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey ) {    //The meetings were returned
170
+    if ($xml && $xml->returncode == 'SUCCESS' && $xml->messageKey) {    //The meetings were returned
171 171
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
172 172
 
173
-    } else if($xml && $xml->returncode == 'SUCCESS'){                    //If there were meetings already created
173
+    } else if ($xml && $xml->returncode == 'SUCCESS') {                    //If there were meetings already created
174 174
         foreach ($xml->meetings->meeting as $meeting) {
175
-            $meetings[] = array( 'meetingID' => $meeting->meetingID, 'moderatorPW' => $meeting->moderatorPW, 'attendeePW' => $meeting->attendeePW, 'hasBeenForciblyEnded' => $meeting->hasBeenForciblyEnded, 'running' => $meeting->running );
175
+            $meetings[] = array('meetingID' => $meeting->meetingID, 'moderatorPW' => $meeting->moderatorPW, 'attendeePW' => $meeting->attendeePW, 'hasBeenForciblyEnded' => $meeting->hasBeenForciblyEnded, 'running' => $meeting->running);
176 176
         }
177 177
         return $meetings;
178 178
 
179
-    } else if( $xml ) { //If the xml packet returned failure it displays the message to the user
179
+    } else if ($xml) { //If the xml packet returned failure it displays the message to the user
180 180
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
181 181
 
182 182
     } else { //If the server is unreachable, then prompts the user of the necessary action
@@ -184,21 +184,21 @@  discard block
 block discarded – undo
184 184
     }
185 185
 }
186 186
 
187
-function bigbluebuttonbn_getMeetingInfo( $meetingID, $modPW, $URL, $SALT ) {
188
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) );
187
+function bigbluebuttonbn_getMeetingInfo($meetingID, $modPW, $URL, $SALT) {
188
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT));
189 189
     return $xml;
190 190
 }
191 191
 
192
-function bigbluebuttonbn_getMeetingInfoArray( $meetingID, $modPW, $URL, $SALT ) {
193
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) );
192
+function bigbluebuttonbn_getMeetingInfoArray($meetingID, $modPW, $URL, $SALT) {
193
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT));
194 194
 
195
-    if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey == null){//The meeting info was returned
196
-        return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey );
195
+    if ($xml && $xml->returncode == 'SUCCESS' && $xml->messageKey == null) {//The meeting info was returned
196
+        return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
197 197
 
198
-    } else if($xml && $xml->returncode == 'SUCCESS'){ //If there were meetings already created
199
-        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 );
198
+    } else if ($xml && $xml->returncode == 'SUCCESS') { //If there were meetings already created
199
+        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);
200 200
 
201
-    } else if( ($xml && $xml->returncode == 'FAILED') || $xml) { //If the xml packet returned failure it displays the message to the user
201
+    } else if (($xml && $xml->returncode == 'FAILED') || $xml) { //If the xml packet returned failure it displays the message to the user
202 202
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
203 203
 
204 204
     } else { //If the server is unreachable, then prompts the user of the necessary action
@@ -206,33 +206,33 @@  discard block
 block discarded – undo
206 206
     }
207 207
 }
208 208
 
209
-function bigbluebuttonbn_getRecordingsArray( $meetingIDs, $URL, $SALT ) {
209
+function bigbluebuttonbn_getRecordingsArray($meetingIDs, $URL, $SALT) {
210 210
     $recordings = array();
211 211
 
212
-    if ( is_array($meetingIDs) ) {
212
+    if (is_array($meetingIDs)) {
213 213
         // getRecordings is executes using a method POST (supported only on BBB 1.0 and later)
214
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT ), BIGBLUEBUTTONBN_METHOD_POST, $meetingIDs );
214
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT), BIGBLUEBUTTONBN_METHOD_POST, $meetingIDs);
215 215
     } else {
216 216
         // getRecordings is executes using a method GET supported by any version of BBB
217
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingIDs ) );
217
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingIDs));
218 218
     }
219 219
 
220
-    if ( $xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings) ) { //If there were meetings already created
221
-        foreach ( $xml->recordings->recording as $recording ) {
220
+    if ($xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings)) { //If there were meetings already created
221
+        foreach ($xml->recordings->recording as $recording) {
222 222
             $playbackArray = array();
223
-            foreach ( $recording->playback->format as $format ) {
224
-                $playbackArray[(string) $format->type] = array( 'type' => (string) $format->type, 'url' => (string) $format->url );
223
+            foreach ($recording->playback->format as $format) {
224
+                $playbackArray[(string)$format->type] = array('type' => (string)$format->type, 'url' => (string)$format->url);
225 225
             }
226 226
 
227 227
             //Add the metadata to the recordings array
228 228
             $metadataArray = array();
229 229
             $metadata = get_object_vars($recording->metadata);
230
-            foreach ( $metadata as $key => $value ) {
231
-                if ( is_object($value) ) $value = '';
232
-                $metadataArray['meta_'.$key] = $value;
230
+            foreach ($metadata as $key => $value) {
231
+                if (is_object($value)) $value = '';
232
+                $metadataArray['meta_' . $key] = $value;
233 233
             }
234 234
 
235
-            $recordings[] = 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;
235
+            $recordings[] = 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;
236 236
         }
237 237
 
238 238
         usort($recordings, 'bigbluebuttonbn_recordingBuildSorter');
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
     return $recordings;
242 242
 }
243 243
 
244
-function bigbluebuttonbn_index_recordings($recordings, $index_key='recordID') {
244
+function bigbluebuttonbn_index_recordings($recordings, $index_key = 'recordID') {
245 245
     $indexed_recordings = array();
246 246
 
247 247
     foreach ($recordings as $recording) {
@@ -251,28 +251,28 @@  discard block
 block discarded – undo
251 251
     return $indexed_recordings;
252 252
 }
253 253
 
254
-function bigbluebuttonbn_getRecordingArray( $recordingID, $meetingID, $URL, $SALT ) {
254
+function bigbluebuttonbn_getRecordingArray($recordingID, $meetingID, $URL, $SALT) {
255 255
     $recording = array();
256 256
 
257
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingID ) );
257
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingID));
258 258
 
259
-    if ( $xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings) ) { //If there were meetings already created
259
+    if ($xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings)) { //If there were meetings already created
260 260
         foreach ($xml->recordings->recording as $recording) {
261
-            if( $recording->recordID == $recordingID ) {
261
+            if ($recording->recordID == $recordingID) {
262 262
                 $playbackArray = array();
263
-                foreach ( $recording->playback->format as $format ){
264
-                    $playbackArray[(string) $format->type] = array( 'type' => (string) $format->type, 'url' => (string) $format->url );
263
+                foreach ($recording->playback->format as $format) {
264
+                    $playbackArray[(string)$format->type] = array('type' => (string)$format->type, 'url' => (string)$format->url);
265 265
                 }
266 266
 
267 267
                 //Add the metadata to the recordings array
268 268
                 $metadataArray = array();
269 269
                 $metadata = get_object_vars($recording->metadata);
270 270
                 foreach ($metadata as $key => $value) {
271
-                    if(is_object($value)) $value = '';
272
-                    $metadataArray['meta_'.$key] = $value;
271
+                    if (is_object($value)) $value = '';
272
+                    $metadataArray['meta_' . $key] = $value;
273 273
                 }
274 274
 
275
-                $recording = 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;
275
+                $recording = 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;
276 276
                 break;
277 277
             }
278 278
         }
@@ -281,36 +281,36 @@  discard block
 block discarded – undo
281 281
     return $recording;
282 282
 }
283 283
 
284
-function bigbluebuttonbn_recordingBuildSorter($a, $b){
285
-    if( $a['startTime'] < $b['startTime']) return -1;
286
-    else if( $a['startTime'] == $b['startTime']) return 0;
284
+function bigbluebuttonbn_recordingBuildSorter($a, $b) {
285
+    if ($a['startTime'] < $b['startTime']) return -1;
286
+    else if ($a['startTime'] == $b['startTime']) return 0;
287 287
     else return 1;
288 288
 }
289 289
 
290
-function bigbluebuttonbn_doDeleteRecordings( $recordIDs, $URL, $SALT ) {
291
-    $ids = 	explode(",", $recordIDs);
292
-    foreach( $ids as $id){
293
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getDeleteRecordingsURL($id, $URL, $SALT) );
294
-        if( $xml && $xml->returncode != 'SUCCESS' )
290
+function bigbluebuttonbn_doDeleteRecordings($recordIDs, $URL, $SALT) {
291
+    $ids = explode(",", $recordIDs);
292
+    foreach ($ids as $id) {
293
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getDeleteRecordingsURL($id, $URL, $SALT));
294
+        if ($xml && $xml->returncode != 'SUCCESS')
295 295
             return false;
296 296
     }
297 297
     return true;
298 298
 }
299 299
 
300
-function bigbluebuttonbn_doPublishRecordings( $recordIDs, $set, $URL, $SALT ) {
301
-    $ids = 	explode(",", $recordIDs);
302
-    foreach( $ids as $id){
303
-        $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getPublishRecordingsURL($id, $set, $URL, $SALT) );
304
-        if( $xml && $xml->returncode != 'SUCCESS' )
300
+function bigbluebuttonbn_doPublishRecordings($recordIDs, $set, $URL, $SALT) {
301
+    $ids = explode(",", $recordIDs);
302
+    foreach ($ids as $id) {
303
+        $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getPublishRecordingsURL($id, $set, $URL, $SALT));
304
+        if ($xml && $xml->returncode != 'SUCCESS')
305 305
             return false;
306 306
     }
307 307
     return true;
308 308
 }
309 309
 
310
-function bigbluebuttonbn_doEndMeeting( $meetingID, $modPW, $URL, $SALT ) {
311
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getEndMeetingURL( $meetingID, $modPW, $URL, $SALT ) );
310
+function bigbluebuttonbn_doEndMeeting($meetingID, $modPW, $URL, $SALT) {
311
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $URL, $SALT));
312 312
 
313
-    if( $xml ) { //If the xml packet returned failure it displays the message to the user
313
+    if ($xml) { //If the xml packet returned failure it displays the message to the user
314 314
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
315 315
     }
316 316
     else { //If the server is unreachable, then prompts the user of the necessary action
@@ -318,46 +318,46 @@  discard block
 block discarded – undo
318 318
     }
319 319
 }
320 320
 
321
-function bigbluebuttonbn_isMeetingRunning( $meetingID, $URL, $SALT ) {
322
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) );
323
-    if ( $xml && $xml->returncode == 'SUCCESS' ) {
324
-        return ( ( $xml->running == 'true' ) ? true : false);
321
+function bigbluebuttonbn_isMeetingRunning($meetingID, $URL, $SALT) {
322
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT));
323
+    if ($xml && $xml->returncode == 'SUCCESS') {
324
+        return (($xml->running == 'true') ? true : false);
325 325
     } else {
326
-        return ( false );
326
+        return (false);
327 327
     }
328 328
 }
329 329
 
330 330
 
331
-function bigbluebuttonbn_getServerVersion( $URL ){
332
-    $xml = bigbluebuttonbn_wrap_xml_load_file( $URL."api" );
333
-    if ( $xml && $xml->returncode == 'SUCCESS' ) {
331
+function bigbluebuttonbn_getServerVersion($URL) {
332
+    $xml = bigbluebuttonbn_wrap_xml_load_file($URL . "api");
333
+    if ($xml && $xml->returncode == 'SUCCESS') {
334 334
         return $xml->version;
335 335
     } else {
336 336
         return NULL;
337 337
     }
338 338
 }
339 339
 
340
-function bigbluebuttonbn_getMeetingXML( $meetingID, $URL, $SALT ) {
341
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) );
342
-    if ( $xml && $xml->returncode == 'SUCCESS') {
343
-        return ( str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML())));
340
+function bigbluebuttonbn_getMeetingXML($meetingID, $URL, $SALT) {
341
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT));
342
+    if ($xml && $xml->returncode == 'SUCCESS') {
343
+        return (str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML())));
344 344
     } else {
345 345
         return 'false';
346 346
     }
347 347
 }
348 348
 
349
-function bigbluebuttonbn_wrap_xml_load_file($url, $method=BIGBLUEBUTTONBN_METHOD_GET, $data=null) {
350
-    if ( bigbluebuttonbn_debugdisplay() ) error_log("Request to: ".$url);
349
+function bigbluebuttonbn_wrap_xml_load_file($url, $method = BIGBLUEBUTTONBN_METHOD_GET, $data = null) {
350
+    if (bigbluebuttonbn_debugdisplay()) error_log("Request to: " . $url);
351 351
 
352 352
     if (extension_loaded('curl')) {
353 353
         $c = new curl();
354
-        $c->setopt( Array( "SSL_VERIFYPEER" => true));
355
-        if( $method == BIGBLUEBUTTONBN_METHOD_POST ) {
356
-            if( !is_null($data) ) {
357
-                if( !is_array($data) ) {
354
+        $c->setopt(Array("SSL_VERIFYPEER" => true));
355
+        if ($method == BIGBLUEBUTTONBN_METHOD_POST) {
356
+            if (!is_null($data)) {
357
+                if (!is_array($data)) {
358 358
                     $options['CURLOPT_HTTPHEADER'] = array(
359 359
                             'Content-Type: text/xml',
360
-                            'Content-Length: '.strlen($data),
360
+                            'Content-Length: ' . strlen($data),
361 361
                             'Content-Language: en-US'
362 362
                         );
363 363
                     $response = $c->post($url, $data, $options);
@@ -379,9 +379,9 @@  discard block
 block discarded – undo
379 379
             try {
380 380
                 $xml = new SimpleXMLElement($response, LIBXML_NOCDATA);
381 381
                 return $xml;
382
-            } catch (Exception $e){
382
+            } catch (Exception $e) {
383 383
                 libxml_use_internal_errors($previous);
384
-                $error = 'Caught exception: '.$e->getMessage();
384
+                $error = 'Caught exception: ' . $e->getMessage();
385 385
                 error_log($error);
386 386
                 return NULL;
387 387
             }
@@ -393,18 +393,18 @@  discard block
 block discarded – undo
393 393
     } else {
394 394
         $previous = libxml_use_internal_errors(true);
395 395
         try {
396
-            $xml = simplexml_load_file($url,'SimpleXMLElement', LIBXML_NOCDATA);
396
+            $xml = simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA);
397 397
             return $xml;
398
-        } catch  (Exception $e){
398
+        } catch (Exception $e) {
399 399
             libxml_use_internal_errors($previous);
400 400
             return NULL;
401 401
         }
402 402
     }
403 403
 }
404 404
 
405
-function bigbluebuttonbn_get_role_name($role_shortname){
405
+function bigbluebuttonbn_get_role_name($role_shortname) {
406 406
     $role = bigbluebuttonbn_get_db_moodle_roles($role_shortname);
407
-    if( $role != null && $role->name != "") {
407
+    if ($role != null && $role->name != "") {
408 408
         $role_name = $role->name;
409 409
     } else {
410 410
         switch ($role_shortname) {
@@ -424,13 +424,13 @@  discard block
 block discarded – undo
424 424
     return $role_name;
425 425
 }
426 426
 
427
-function bigbluebuttonbn_get_roles($rolename='all', $format='json'){
427
+function bigbluebuttonbn_get_roles($rolename = 'all', $format = 'json') {
428 428
     $roles = bigbluebuttonbn_get_db_moodle_roles($rolename);
429 429
     $roles_array = array();
430
-    foreach($roles as $role){
431
-        if( $format=='json' ) {
430
+    foreach ($roles as $role) {
431
+        if ($format == 'json') {
432 432
             array_push($roles_array,
433
-                    array( "id" => $role->shortname,
433
+                    array("id" => $role->shortname,
434 434
                         "name" => bigbluebuttonbn_get_role_name($role->shortname)
435 435
                     )
436 436
             );
@@ -441,19 +441,19 @@  discard block
 block discarded – undo
441 441
     return $roles_array;
442 442
 }
443 443
 
444
-function bigbluebuttonbn_get_roles_json($rolename='all'){
444
+function bigbluebuttonbn_get_roles_json($rolename = 'all') {
445 445
     return json_encode(bigbluebuttonbn_get_roles($rolename));
446 446
 }
447 447
 
448
-function bigbluebuttonbn_get_users_json($users, $full=false) {
449
-    if( $full ) {
448
+function bigbluebuttonbn_get_users_json($users, $full = false) {
449
+    if ($full) {
450 450
         return json_encode($users);
451 451
     } else {
452 452
         $users_array = array();
453
-        foreach($users as $user){
453
+        foreach ($users as $user) {
454 454
             array_push($users_array,
455
-                    array( "id" => $user->id,
456
-                            "name" => $user->firstname.' '.$user->lastname
455
+                    array("id" => $user->id,
456
+                            "name" => $user->firstname . ' ' . $user->lastname
457 457
                     )
458 458
             );
459 459
         }
@@ -461,15 +461,15 @@  discard block
 block discarded – undo
461 461
     }
462 462
 }
463 463
 
464
-function bigbluebuttonbn_get_participant_list($bigbluebuttonbn=null, $context=null){
464
+function bigbluebuttonbn_get_participant_list($bigbluebuttonbn = null, $context = null) {
465 465
     global $CFG, $USER;
466 466
 
467 467
     $participant_list_array = array();
468 468
 
469
-    if( $bigbluebuttonbn != null ) {
469
+    if ($bigbluebuttonbn != null) {
470 470
         $participant_list = json_decode($bigbluebuttonbn->participants);
471 471
         if (is_array($participant_list)) {
472
-            foreach($participant_list as $participant){
472
+            foreach ($participant_list as $participant) {
473 473
                 array_push($participant_list_array,
474 474
                         array(
475 475
                             "selectiontype" => $participant->selectiontype,
@@ -489,16 +489,16 @@  discard block
 block discarded – undo
489 489
         );
490 490
 
491 491
         $moderator_defaults = bigbluebuttonbn_get_cfg_moderator_default();
492
-        if ( !isset($moderator_defaults) ) {
492
+        if (!isset($moderator_defaults)) {
493 493
             $moderator_defaults = array('owner');
494 494
         } else {
495 495
             $moderator_defaults = explode(',', $moderator_defaults);
496 496
         }
497
-        foreach( $moderator_defaults as $moderator_default ) {
498
-            if( $moderator_default == 'owner' ) {
497
+        foreach ($moderator_defaults as $moderator_default) {
498
+            if ($moderator_default == 'owner') {
499 499
                 $users = bigbluebuttonbn_get_users($context);
500
-                foreach( $users as $user ){
501
-                    if( $user->id == $USER->id ){
500
+                foreach ($users as $user) {
501
+                    if ($user->id == $USER->id) {
502 502
                         array_push($participant_list_array,
503 503
                                 array(
504 504
                                         "selectiontype" => "user",
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
     return $participant_list_array;
525 525
 }
526 526
 
527
-function bigbluebuttonbn_get_participant_list_json($bigbluebuttonbnid=null){
527
+function bigbluebuttonbn_get_participant_list_json($bigbluebuttonbnid = null) {
528 528
     return json_encode(bigbluebuttonbn_get_participant_list($bigbluebuttonbnid));
529 529
 }
530 530
 
@@ -533,21 +533,21 @@  discard block
 block discarded – undo
533 533
 
534 534
     if (is_array($participant_list)) {
535 535
         // Iterate looking for all configuration
536
-        foreach($participant_list as $participant){
537
-            if( $participant->selectiontype == 'all' ) {
538
-                if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
536
+        foreach ($participant_list as $participant) {
537
+            if ($participant->selectiontype == 'all') {
538
+                if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR)
539 539
                     return true;
540 540
             }
541 541
         }
542 542
 
543 543
         //Iterate looking for roles
544 544
         $db_moodle_roles = bigbluebuttonbn_get_db_moodle_roles();
545
-        foreach($participant_list as $participant){
546
-            if( $participant->selectiontype == 'role' ) {
547
-                foreach( $roles as $role ) {
545
+        foreach ($participant_list as $participant) {
546
+            if ($participant->selectiontype == 'role') {
547
+                foreach ($roles as $role) {
548 548
                     $db_moodle_role = bigbluebuttonbn_moodle_db_role_lookup($db_moodle_roles, $role->roleid);
549
-                    if( $participant->selectionid == $db_moodle_role->shortname ) {
550
-                        if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
549
+                    if ($participant->selectionid == $db_moodle_role->shortname) {
550
+                        if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR)
551 551
                             return true;
552 552
                     }
553 553
                 }
@@ -555,10 +555,10 @@  discard block
 block discarded – undo
555 555
         }
556 556
 
557 557
         //Iterate looking for users
558
-        foreach($participant_list as $participant){
559
-            if( $participant->selectiontype == 'user' ) {
560
-                if( $participant->selectionid == $user ) {
561
-                    if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
558
+        foreach ($participant_list as $participant) {
559
+            if ($participant->selectiontype == 'user') {
560
+                if ($participant->selectionid == $user) {
561
+                    if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR)
562 562
                         return true;
563 563
                 }
564 564
             }
@@ -569,8 +569,8 @@  discard block
 block discarded – undo
569 569
 }
570 570
 
571 571
 function bigbluebuttonbn_moodle_db_role_lookup($db_moodle_roles, $role_id) {
572
-    foreach( $db_moodle_roles as $db_moodle_role ){
573
-        if( $role_id ==  $db_moodle_role->id ) {
572
+    foreach ($db_moodle_roles as $db_moodle_role) {
573
+        if ($role_id == $db_moodle_role->id) {
574 574
             return $db_moodle_role;
575 575
         }
576 576
     }
@@ -578,23 +578,23 @@  discard block
 block discarded – undo
578 578
 
579 579
 function bigbluebuttonbn_get_error_key($messageKey, $defaultKey = null) {
580 580
     $key = $defaultKey;
581
-    if ( $messageKey == "checksumError" ){
581
+    if ($messageKey == "checksumError") {
582 582
         $key = 'index_error_checksum';
583
-    } else if ( $messageKey == 'maxConcurrent' ) {
583
+    } else if ($messageKey == 'maxConcurrent') {
584 584
         $key = 'view_error_max_concurrent';
585 585
     }
586 586
     return $key;
587 587
 }
588 588
 
589
-function bigbluebuttonbn_voicebridge_unique($voicebridge, $id=null) {
589
+function bigbluebuttonbn_voicebridge_unique($voicebridge, $id = null) {
590 590
     global $DB;
591 591
 
592 592
     $is_unique = true;
593
-    if( $voicebridge != 0 ) {
593
+    if ($voicebridge != 0) {
594 594
         $table = "bigbluebuttonbn";
595
-        $select = "voicebridge = ".$voicebridge;
596
-        if( $id ) $select .= " AND id <> ".$id;
597
-        if ( $rooms = $DB->get_records_select($table, $select)  ) {
595
+        $select = "voicebridge = " . $voicebridge;
596
+        if ($id) $select .= " AND id <> " . $id;
597
+        if ($rooms = $DB->get_records_select($table, $select)) {
598 598
             $is_unique = false;
599 599
         }
600 600
     }
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 
608 608
     $duration = 0;
609 609
     $now = time();
610
-    if( $closingtime > 0 && $now < $closingtime ) {
611
-        $duration = ceil(($closingtime - $now)/60);
610
+    if ($closingtime > 0 && $now < $closingtime) {
611
+        $duration = ceil(($closingtime - $now) / 60);
612 612
         $compensation_time = intval(bigbluebuttonbn_get_cfg_scheduled_duration_compensation());
613 613
         $duration = intval($duration) + $compensation_time;
614 614
     }
@@ -616,13 +616,13 @@  discard block
 block discarded – undo
616 616
     return $duration;
617 617
 }
618 618
 
619
-function bigbluebuttonbn_get_presentation_array($context, $presentation, $id=null) {
619
+function bigbluebuttonbn_get_presentation_array($context, $presentation, $id = null) {
620 620
     $presentation_name = null;
621 621
     $presentation_url = null;
622 622
     $presentation_icon = null;
623 623
     $presentation_mimetype_description = null;
624 624
 
625
-    if( !empty($presentation) ) {
625
+    if (!empty($presentation)) {
626 626
         $fs = get_file_storage();
627 627
         $files = $fs->get_area_files($context->id, 'mod_bigbluebuttonbn', 'presentation', 0, 'itemid, filepath, filename', false);
628 628
         if (count($files) < 1) {
@@ -636,12 +636,12 @@  discard block
 block discarded – undo
636 636
             $presentation_icon = file_file_icon($file, 24);
637 637
             $presentation_mimetype_description = get_mimetype_description($file);
638 638
 
639
-            if( !is_null($id) ) {
639
+            if (!is_null($id)) {
640 640
                 //Create the nonce component for granting a temporary public access
641 641
                 $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'presentation_cache');
642 642
                 $presentation_nonce_key = sha1($id);
643 643
                 $presentation_nonce_value = bigbluebuttonbn_generate_nonce();
644
-                $cache->set($presentation_nonce_key, array( "value" => $presentation_nonce_value, "counter" => 0 ));
644
+                $cache->set($presentation_nonce_key, array("value" => $presentation_nonce_value, "counter" => 0));
645 645
 
646 646
                 //The item id was adapted for granting public access to the presentation once in order to allow BigBlueButton to gather the file
647 647
                 $url = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(), $file->get_filearea(), $presentation_nonce_value, $file->get_filepath(), $file->get_filename());
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
         }
653 653
     }
654 654
 
655
-    $presentation_array = array( "url" => $presentation_url, "name" => $presentation_name, "icon" => $presentation_icon, "mimetype_description" => $presentation_mimetype_description);
655
+    $presentation_array = array("url" => $presentation_url, "name" => $presentation_name, "icon" => $presentation_icon, "mimetype_description" => $presentation_mimetype_description);
656 656
 
657 657
     return $presentation_array;
658 658
 }
@@ -662,13 +662,13 @@  discard block
 block discarded – undo
662 662
     $mt = microtime();
663 663
     $rand = mt_rand();
664 664
 
665
-    return md5($mt.$rand);
665
+    return md5($mt . $rand);
666 666
 }
667 667
 
668
-function bigbluebuttonbn_random_password( $length = 8 ) {
668
+function bigbluebuttonbn_random_password($length = 8) {
669 669
 
670 670
     $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?";
671
-    $password = substr( str_shuffle( $chars ), 0, $length );
671
+    $password = substr(str_shuffle($chars), 0, $length);
672 672
 
673 673
     return $password;
674 674
 }
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
     global $CFG;
761 761
 
762 762
     $version_major = bigbluebuttonbn_get_moodle_version_major();
763
-    if ( $version_major < '2014051200' ) {
763
+    if ($version_major < '2014051200') {
764 764
         //This is valid before v2.7
765 765
         bigbluebuttonbn_event_log_legacy($event_type, $bigbluebuttonbn, $context, $cm);
766 766
 
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
     }
771 771
 }
772 772
 
773
-function bigbluebuttonbn_bbb_broker_get_recordings($meetingid, $password, $forced=false) {
773
+function bigbluebuttonbn_bbb_broker_get_recordings($meetingid, $password, $forced = false) {
774 774
     global $CFG;
775 775
 
776 776
     $recordings = array();
@@ -786,19 +786,19 @@  discard block
 block discarded – undo
786 786
     $result = $cache->get($meetingid);
787 787
     $meeting_info = json_decode($result['meeting_info']);
788 788
     $meeting_info->participantCount += 1;
789
-    if( $is_moderator ) {
789
+    if ($is_moderator) {
790 790
         $meeting_info->moderatorCount += 1;
791 791
     }
792
-    $cache->set($meetingid, array('creation_time' => $result['creation_time'], 'meeting_info' => json_encode($meeting_info) ));
792
+    $cache->set($meetingid, array('creation_time' => $result['creation_time'], 'meeting_info' => json_encode($meeting_info)));
793 793
 }
794 794
 
795 795
 function bigbluebuttonbn_bbb_broker_is_meeting_running($meeting_info) {
796
-    $meeting_running = ( isset($meeting_info) && isset($meeting_info->returncode) && $meeting_info->returncode == 'SUCCESS' );
796
+    $meeting_running = (isset($meeting_info) && isset($meeting_info->returncode) && $meeting_info->returncode == 'SUCCESS');
797 797
 
798 798
     return $meeting_running;
799 799
 }
800 800
 
801
-function bigbluebuttonbn_bbb_broker_get_meeting_info($meetingid, $password, $forced=false) {
801
+function bigbluebuttonbn_bbb_broker_get_meeting_info($meetingid, $password, $forced = false) {
802 802
     global $CFG;
803 803
 
804 804
     $meeting_info = array();
@@ -809,19 +809,19 @@  discard block
 block discarded – undo
809 809
     $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'meetings_cache');
810 810
     $result = $cache->get($meetingid);
811 811
     $now = time();
812
-    if( isset($result) && $now < ($result['creation_time'] + $cache_ttl) && !$forced ) {
812
+    if (isset($result) && $now < ($result['creation_time'] + $cache_ttl) && !$forced) {
813 813
         //Use the value in the cache
814 814
         $meeting_info = json_decode($result['meeting_info']);
815 815
     } else {
816 816
         //Ping again and refresh the cache
817
-        $meeting_info = (array) bigbluebuttonbn_getMeetingInfo( $meetingid, $password, $endpoint, $shared_secret );
818
-        $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meeting_info) ));
817
+        $meeting_info = (array)bigbluebuttonbn_getMeetingInfo($meetingid, $password, $endpoint, $shared_secret);
818
+        $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meeting_info)));
819 819
     }
820 820
 
821 821
     return $meeting_info;
822 822
 }
823 823
 
824
-function bigbluebuttonbn_bbb_broker_do_end_meeting($meetingid, $password){
824
+function bigbluebuttonbn_bbb_broker_do_end_meeting($meetingid, $password) {
825 825
     global $CFG;
826 826
 
827 827
     $endpoint = bigbluebuttonbn_get_cfg_server_url();
@@ -830,16 +830,16 @@  discard block
 block discarded – undo
830 830
     bigbluebuttonbn_doEndMeeting($meetingid, $password, $endpoint, $shared_secret);
831 831
 }
832 832
 
833
-function bigbluebuttonbn_bbb_broker_do_publish_recording($recordingid, $publish=true){
833
+function bigbluebuttonbn_bbb_broker_do_publish_recording($recordingid, $publish = true) {
834 834
     global $CFG;
835 835
 
836 836
     $endpoint = bigbluebuttonbn_get_cfg_server_url();
837 837
     $shared_secret = bigbluebuttonbn_get_cfg_shared_secret();
838 838
 
839
-    bigbluebuttonbn_doPublishRecordings($recordingid, ($publish)? 'true': 'false', $endpoint, $shared_secret);
839
+    bigbluebuttonbn_doPublishRecordings($recordingid, ($publish) ? 'true' : 'false', $endpoint, $shared_secret);
840 840
 }
841 841
 
842
-function bigbluebuttonbn_bbb_broker_do_publish_recording_imported($recordingid, $courseID, $bigbluebuttonbnID, $publish=true){
842
+function bigbluebuttonbn_bbb_broker_do_publish_recording_imported($recordingid, $courseID, $bigbluebuttonbnID, $publish = true) {
843 843
     global $DB;
844 844
 
845 845
     //Locate the record to be updated
@@ -848,9 +848,9 @@  discard block
 block discarded – undo
848 848
     $recordings_imported = array();
849 849
     foreach ($records as $key => $record) {
850 850
         $meta = json_decode($record->meta, true);
851
-        if( $recordingid == $meta['recording']['recordID'] ) {
851
+        if ($recordingid == $meta['recording']['recordID']) {
852 852
             // Found, prepare data for the update
853
-            $meta['recording']['published'] = ($publish)? 'true': 'false';
853
+            $meta['recording']['published'] = ($publish) ? 'true' : 'false';
854 854
             $records[$key]->meta = json_encode($meta);
855 855
 
856 856
             // Proceed with the update
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
     }
860 860
 }
861 861
 
862
-function bigbluebuttonbn_bbb_broker_do_delete_recording($recordingid){
862
+function bigbluebuttonbn_bbb_broker_do_delete_recording($recordingid) {
863 863
     global $CFG;
864 864
 
865 865
     $endpoint = bigbluebuttonbn_get_cfg_server_url();
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
     bigbluebuttonbn_doDeleteRecordings($recordingid, $endpoint, $shared_secret);
869 869
 }
870 870
 
871
-function bigbluebuttonbn_bbb_broker_do_delete_recording_imported($recordingid, $courseID, $bigbluebuttonbnID){
871
+function bigbluebuttonbn_bbb_broker_do_delete_recording_imported($recordingid, $courseID, $bigbluebuttonbnID) {
872 872
     global $DB;
873 873
 
874 874
     //Locate the record to be updated
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
     $recordings_imported = array();
878 878
     foreach ($records as $key => $record) {
879 879
         $meta = json_decode($record->meta, true);
880
-        if( $recordingid == $meta['recording']['recordID'] ) {
880
+        if ($recordingid == $meta['recording']['recordID']) {
881 881
             // Execute delete
882 882
             $DB->delete_records("bigbluebuttonbn_logs", array('id' => $key));
883 883
         }
@@ -887,18 +887,18 @@  discard block
 block discarded – undo
887 887
 function bigbluebuttonbn_bbb_broker_validate_parameters($params) {
888 888
     $error = '';
889 889
 
890
-    if ( !isset($params['callback']) ) {
890
+    if (!isset($params['callback'])) {
891 891
         $error = $bigbluebuttonbn_bbb_broker_add_error($error, 'This call must include a javascript callback.');
892 892
     }
893 893
 
894
-    if ( !isset($params['action']) ) {
894
+    if (!isset($params['action'])) {
895 895
         $error = $bigbluebuttonbn_bbb_broker_add_error($error, 'Action parameter must be included.');
896 896
     } else {
897
-        switch ( strtolower($params['action']) ){
897
+        switch (strtolower($params['action'])) {
898 898
             case 'server_ping':
899 899
             case 'meeting_info':
900 900
             case 'meeting_end':
901
-                if ( !isset($params['id']) ) {
901
+                if (!isset($params['id'])) {
902 902
                     $error = $bigbluebuttonbn_bbb_broker_add_error($error, 'The meetingID must be specified.');
903 903
                 }
904 904
                 break;
@@ -908,80 +908,80 @@  discard block
 block discarded – undo
908 908
             case 'recording_unpublish':
909 909
             case 'recording_delete':
910 910
             case 'recording_import':
911
-                if ( !isset($params['id']) ) {
911
+                if (!isset($params['id'])) {
912 912
                     $error = bigbluebuttonbn_bbb_broker_add_error($error, 'The recordingID must be specified.');
913 913
                 }
914 914
                 break;
915 915
             case 'recording_ready':
916
-                if( empty($params['signed_parameters']) ) {
916
+                if (empty($params['signed_parameters'])) {
917 917
                     $error = bigbluebuttonbn_bbb_broker_add_error($error, 'A JWT encoded string must be included as [signed_parameters].');
918 918
                 }
919 919
                 break;
920 920
             default:
921
-                $error = bigbluebuttonbn_bbb_broker_add_error($error, 'Action '.$params['action'].' can not be performed.');
921
+                $error = bigbluebuttonbn_bbb_broker_add_error($error, 'Action ' . $params['action'] . ' can not be performed.');
922 922
         }
923 923
     }
924 924
 
925 925
     return $error;
926 926
 }
927 927
 
928
-function bigbluebuttonbn_bbb_broker_add_error($org_msg, $new_msg='') {
928
+function bigbluebuttonbn_bbb_broker_add_error($org_msg, $new_msg = '') {
929 929
     $error = $org_msg;
930 930
 
931
-    if( !empty($new_msg) ) {
932
-        if( !empty($error) ) $error .= ' ';
931
+    if (!empty($new_msg)) {
932
+        if (!empty($error)) $error .= ' ';
933 933
         $error .= $new_msg;
934 934
     }
935 935
 
936 936
     return $error;
937 937
 }
938 938
 
939
-function bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools=["publishing", "deleting"]) {
939
+function bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools = ["publishing", "deleting"]) {
940 940
     global $OUTPUT, $CFG, $USER;
941 941
 
942 942
     $row = null;
943 943
 
944
-    if ( $bbbsession['managerecordings'] || $recording['published'] == 'true' ) {
944
+    if ($bbbsession['managerecordings'] || $recording['published'] == 'true') {
945 945
         $length = 0;
946
-        $endTime = isset($recording['endTime'])? floatval($recording['endTime']):0;
946
+        $endTime = isset($recording['endTime']) ? floatval($recording['endTime']) : 0;
947 947
         $endTime = $endTime - ($endTime % 1000);
948
-        $startTime = isset($recording['startTime'])? floatval($recording['startTime']):0;
948
+        $startTime = isset($recording['startTime']) ? floatval($recording['startTime']) : 0;
949 949
         $startTime = $startTime - ($startTime % 1000);
950 950
         $duration = intval(($endTime - $startTime) / 60000);
951 951
 
952 952
         //$meta_course = isset($recording['meta_context'])?str_replace('"', '\"', $recording['meta_context']):'';
953 953
         //For backward compatibility
954
-        if( isset($recording['meta_contextactivity']) ) {
954
+        if (isset($recording['meta_contextactivity'])) {
955 955
             $meta_activity = str_replace('"', '\"', $recording['meta_contextactivity']);
956
-        } if( isset($recording['meta_bbb-recording-name']) ) {
956
+        } if (isset($recording['meta_bbb-recording-name'])) {
957 957
             $meta_activity = str_replace('"', '\"', $recording['meta_bbb-recording-name']);
958 958
         } else {
959 959
             $meta_activity = str_replace('"', '\"', $recording['meetingName']);
960 960
         }
961 961
 
962
-        if( isset($recording['meta_contextactivitydescription']) ) {
962
+        if (isset($recording['meta_contextactivitydescription'])) {
963 963
             $meta_description = str_replace('"', '\"', $recording['meta_contextactivitydescription']);
964
-        } else if( isset($recording['meta_bbb-recording-description']) ) {
964
+        } else if (isset($recording['meta_bbb-recording-description'])) {
965 965
             $meta_description = str_replace('"', '\"', $recording['meta_bbb-recording-description']);
966 966
         } else {
967 967
             $meta_description = '';
968 968
         }
969 969
 
970 970
         //Set recording_types
971
-        if ( isset($recording['imported']) ) {
972
-            $attributes = 'data-imported="true" title='.get_string('view_recording_link_warning', 'bigbluebuttonbn');
971
+        if (isset($recording['imported'])) {
972
+            $attributes = 'data-imported="true" title=' . get_string('view_recording_link_warning', 'bigbluebuttonbn');
973 973
         } else {
974 974
             $attributes = 'data-imported="false"';
975 975
         }
976 976
 
977 977
         $recording_types = '';
978 978
         if ($recording['published'] == 'true') {
979
-            $recording_types .= '<div id="playbacks-'.$recording['recordID'].'" '.$attributes.'>';
979
+            $recording_types .= '<div id="playbacks-' . $recording['recordID'] . '" ' . $attributes . '>';
980 980
         } else {
981
-            $recording_types .= '<div id="playbacks-'.$recording['recordID'].'" '.$attributes.'" hidden>';
981
+            $recording_types .= '<div id="playbacks-' . $recording['recordID'] . '" ' . $attributes . '" hidden>';
982 982
         }
983
-        foreach ( $recording['playbacks'] as $playback ) {
984
-            $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') ).'&#32;';
983
+        foreach ($recording['playbacks'] as $playback) {
984
+            $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')) . '&#32;';
985 985
         }
986 986
         $recording_types .= '</div>';
987 987
 
@@ -990,11 +990,11 @@  discard block
 block discarded – undo
990 990
 
991 991
         //Set actionbar, if user is allowed to manage recordings
992 992
         $actionbar = '';
993
-        if ( $bbbsession['managerecordings'] ) {
993
+        if ($bbbsession['managerecordings']) {
994 994
             // Set style for imported links
995
-            if( isset($recording['imported']) ) {
995
+            if (isset($recording['imported'])) {
996 996
                 $recordings_imported_count = 0;
997
-                $tag_tail = ' '.get_string('view_recording_link', 'bigbluebuttonbn');
997
+                $tag_tail = ' ' . get_string('view_recording_link', 'bigbluebuttonbn');
998 998
                 $head = '<i>';
999 999
                 $tail = '</i>';
1000 1000
 
@@ -1010,55 +1010,55 @@  discard block
 block discarded – undo
1010 1010
 
1011 1011
             if (in_array("publishing", $tools)) {
1012 1012
                 ///Set action [show|hide]
1013
-                if ( $recording['published'] == 'true' ){
1013
+                if ($recording['published'] == 'true') {
1014 1014
                     $manage_tag = 'hide';
1015 1015
                     $manage_action = 'unpublish';
1016 1016
                 } else {
1017 1017
                     $manage_tag = 'show';
1018 1018
                     $manage_action = 'publish';
1019 1019
                 }
1020
-                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("'.$manage_action.'", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");';
1020
+                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("' . $manage_action . '", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");';
1021 1021
 
1022
-                if ( bigbluebuttonbn_get_cfg_recording_icons_enabled() ) {
1022
+                if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) {
1023 1023
                     //With icon for publish/unpublish
1024
-                    $icon_attributes = array('id' => 'recording-btn-'.$manage_action.'-'.$recording['recordID']);
1025
-                    $icon = new pix_icon('t/'.$manage_tag, get_string($manage_tag).$tag_tail, 'moodle', $icon_attributes);
1026
-                    $link_attributes = array('id' => 'recording-link-'.$manage_action.'-'.$recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1024
+                    $icon_attributes = array('id' => 'recording-btn-' . $manage_action . '-' . $recording['recordID']);
1025
+                    $icon = new pix_icon('t/' . $manage_tag, get_string($manage_tag) . $tag_tail, 'moodle', $icon_attributes);
1026
+                    $link_attributes = array('id' => 'recording-link-' . $manage_action . '-' . $recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1027 1027
                     $actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false);
1028 1028
 
1029 1029
                 } else {
1030 1030
                     //With text for publish/unpublish
1031
-                    $link_attributes = array('title' => get_string($manage_tag).$tag_tail, 'class' => 'btn btn-xs', 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1032
-                    $actionbar .= $OUTPUT->action_link($url, get_string($manage_tag).$tag_tail, $action, $link_attributes);
1031
+                    $link_attributes = array('title' => get_string($manage_tag) . $tag_tail, 'class' => 'btn btn-xs', 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1032
+                    $actionbar .= $OUTPUT->action_link($url, get_string($manage_tag) . $tag_tail, $action, $link_attributes);
1033 1033
                     $actionbar .= "&nbsp;";
1034 1034
                 }
1035 1035
             }
1036 1036
 
1037 1037
             if (in_array("deleting", $tools)) {
1038
-                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("delete", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");';
1038
+                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("delete", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");';
1039 1039
 
1040
-                if ( bigbluebuttonbn_get_cfg_recording_icons_enabled() ) {
1040
+                if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) {
1041 1041
                     //With icon for delete
1042
-                    $icon_attributes = array('id' => 'recording-btn-delete-'.$recording['recordID']);
1043
-                    $icon = new pix_icon('t/delete', get_string('delete').$tag_tail, 'moodle', $icon_attributes);
1044
-                    $link_attributes = array('id' => 'recording-link-delete-'.$recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1042
+                    $icon_attributes = array('id' => 'recording-btn-delete-' . $recording['recordID']);
1043
+                    $icon = new pix_icon('t/delete', get_string('delete') . $tag_tail, 'moodle', $icon_attributes);
1044
+                    $link_attributes = array('id' => 'recording-link-delete-' . $recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1045 1045
                     $actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false);
1046 1046
 
1047 1047
                 } else {
1048 1048
                     //With text for delete
1049
-                    $link_attributes = array('title' => get_string('delete').$tag_tail, 'class' => 'btn btn-xs btn-danger', 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1050
-                    $actionbar .= $OUTPUT->action_link($url, get_string('delete').$tag_tail, $action, $link_attributes);
1049
+                    $link_attributes = array('title' => get_string('delete') . $tag_tail, 'class' => 'btn btn-xs btn-danger', 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
1050
+                    $actionbar .= $OUTPUT->action_link($url, get_string('delete') . $tag_tail, $action, $link_attributes);
1051 1051
                 }
1052 1052
             }
1053 1053
 
1054 1054
             if (in_array("importing", $tools)) {
1055
-                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("import", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");';
1055
+                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("import", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");';
1056 1056
 
1057
-                if ( bigbluebuttonbn_get_cfg_recording_icons_enabled() ) {
1057
+                if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) {
1058 1058
                     //With icon for import
1059
-                    $icon_attributes = array('id' => 'recording-btn-import-'.$recording['recordID']);
1059
+                    $icon_attributes = array('id' => 'recording-btn-import-' . $recording['recordID']);
1060 1060
                     $icon = new pix_icon('i/import', get_string('import'), 'moodle', $icon_attributes);
1061
-                    $link_attributes = array('id' => 'recording-link-import-'.$recording['recordID'], 'onclick' => $onclick);
1061
+                    $link_attributes = array('id' => 'recording-link-import-' . $recording['recordID'], 'onclick' => $onclick);
1062 1062
                     $actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false);
1063 1063
 
1064 1064
                 } else {
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
         $row->date = floatval($recording['startTime']);
1081 1081
         $row->date_formatted = "{$head}{$formattedStartDate}{$tail}";
1082 1082
         $row->duration = "{$head}{$duration}{$tail}";
1083
-        if ( $bbbsession['managerecordings'] ) {
1083
+        if ($bbbsession['managerecordings']) {
1084 1084
             $row->actionbar = $actionbar;
1085 1085
         }
1086 1086
     }
@@ -1106,21 +1106,21 @@  discard block
 block discarded – undo
1106 1106
         array("key" =>"duration", "label" => $view_recording_duration, "width" => "50px")
1107 1107
         );
1108 1108
 
1109
-    if ( $bbbsession['managerecordings'] ) {
1109
+    if ($bbbsession['managerecordings']) {
1110 1110
         array_push($recordingsbn_columns, array("key" =>"actionbar", "label" => $view_recording_actionbar, "width" => "75px", "allowHTML" => true));
1111 1111
     }
1112 1112
 
1113 1113
     return $recordingsbn_columns;
1114 1114
 }
1115 1115
 
1116
-function bigbluebuttonbn_get_recording_data($bbbsession, $recordings, $tools=["publishing", "deleting"]) {
1116
+function bigbluebuttonbn_get_recording_data($bbbsession, $recordings, $tools = ["publishing", "deleting"]) {
1117 1117
     $table_data = array();
1118 1118
 
1119 1119
     ///Build table content
1120
-    if ( isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
1121
-        foreach ( $recordings as $recording ) {
1120
+    if (isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
1121
+        foreach ($recordings as $recording) {
1122 1122
             $row = bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools);
1123
-            if( $row != null ) {
1123
+            if ($row != null) {
1124 1124
                 array_push($table_data, $row);
1125 1125
             }
1126 1126
         }
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
     return $table_data;
1130 1130
 }
1131 1131
 
1132
-function bigbluebuttonbn_get_recording_table($bbbsession, $recordings, $tools=['publishing','deleting']) {
1132
+function bigbluebuttonbn_get_recording_table($bbbsession, $recordings, $tools = ['publishing', 'deleting']) {
1133 1133
     global $OUTPUT, $CFG;
1134 1134
 
1135 1135
     ///Set strings to show
@@ -1148,20 +1148,20 @@  discard block
 block discarded – undo
1148 1148
     $table->data = array();
1149 1149
 
1150 1150
     ///Initialize table headers
1151
-    if ( $bbbsession['managerecordings'] ) {
1152
-        $table->head  = array ($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration, $view_recording_actionbar);
1153
-        $table->align = array ('left', 'left', 'left', 'left', 'center', 'left');
1151
+    if ($bbbsession['managerecordings']) {
1152
+        $table->head  = array($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration, $view_recording_actionbar);
1153
+        $table->align = array('left', 'left', 'left', 'left', 'center', 'left');
1154 1154
     } else {
1155
-        $table->head  = array ($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration);
1156
-        $table->align = array ('left', 'left', 'left', 'left', 'center');
1155
+        $table->head  = array($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration);
1156
+        $table->align = array('left', 'left', 'left', 'left', 'center');
1157 1157
     }
1158 1158
 
1159 1159
     ///Build table content
1160
-    if ( isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
1161
-        foreach ( $recordings as $recording ){
1160
+    if (isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting
1161
+        foreach ($recordings as $recording) {
1162 1162
             $row = new html_table_row();
1163
-            $row->id = 'recording-td-'.$recording['recordID'];
1164
-            if ( isset($recording['imported']) ) {
1163
+            $row->id = 'recording-td-' . $recording['recordID'];
1164
+            if (isset($recording['imported'])) {
1165 1165
                 $row->attributes['data-imported'] = 'true';
1166 1166
                 $row->attributes['title'] = get_string('view_recording_link_warning', 'bigbluebuttonbn');
1167 1167
             } else {
@@ -1169,12 +1169,12 @@  discard block
 block discarded – undo
1169 1169
             }
1170 1170
 
1171 1171
             $row_data = bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools);
1172
-            if( $row_data != null ) {
1172
+            if ($row_data != null) {
1173 1173
                 $row_data->date_formatted = str_replace(" ", "&nbsp;", $row_data->date_formatted);
1174
-                if ( $bbbsession['managerecordings'] ) {
1175
-                    $row->cells = array ($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration, $row_data->actionbar );
1174
+                if ($bbbsession['managerecordings']) {
1175
+                    $row->cells = array($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration, $row_data->actionbar);
1176 1176
                 } else {
1177
-                    $row->cells = array ($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration );
1177
+                    $row->cells = array($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration);
1178 1178
                 }
1179 1179
 
1180 1180
                 array_push($table->data, $row);
@@ -1194,12 +1194,12 @@  discard block
 block discarded – undo
1194 1194
     /// Build the message_body
1195 1195
     $msg->activity_type = "";
1196 1196
     $msg->activity_title = $bigbluebuttonbn->name;
1197
-    $message_text = '<p>'.get_string('email_body_recording_ready_for', 'bigbluebuttonbn').' '.$msg->activity_type.' &quot;'.$msg->activity_title.'&quot; '.get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn').'.</p>';
1197
+    $message_text = '<p>' . get_string('email_body_recording_ready_for', 'bigbluebuttonbn') . ' ' . $msg->activity_type . ' &quot;' . $msg->activity_title . '&quot; ' . get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn') . '.</p>';
1198 1198
 
1199 1199
     bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message_text);
1200 1200
 }
1201 1201
 
1202
-function bigbluebuttonbn_server_offers($capability_name){
1202
+function bigbluebuttonbn_server_offers($capability_name) {
1203 1203
     global $CFG;
1204 1204
 
1205 1205
     $capability_offered = null;
@@ -1213,12 +1213,12 @@  discard block
 block discarded – undo
1213 1213
     $host_ends = explode(".", $host);
1214 1214
     $host_ends_length = count($host_ends);
1215 1215
 
1216
-    if( $host_ends_length > 0 && $host_ends[$host_ends_length -1] == 'com' &&  $host_ends[$host_ends_length -2] == 'blindsidenetworks' ) {
1216
+    if ($host_ends_length > 0 && $host_ends[$host_ends_length - 1] == 'com' && $host_ends[$host_ends_length - 2] == 'blindsidenetworks') {
1217 1217
         //Validate the capabilities offered
1218
-        $capabilities = bigbluebuttonbn_getCapabilitiesArray( $endpoint, $shared_secret );
1219
-        if( $capabilities ) {
1218
+        $capabilities = bigbluebuttonbn_getCapabilitiesArray($endpoint, $shared_secret);
1219
+        if ($capabilities) {
1220 1220
             foreach ($capabilities as $capability) {
1221
-                if( $capability["name"] == $capability_name)
1221
+                if ($capability["name"] == $capability_name)
1222 1222
                     $capability_offered = $capability;
1223 1223
             }
1224 1224
         }
@@ -1227,14 +1227,14 @@  discard block
 block discarded – undo
1227 1227
     return $capability_offered;
1228 1228
 }
1229 1229
 
1230
-function bigbluebuttonbn_server_offers_bn_capabilities(){
1230
+function bigbluebuttonbn_server_offers_bn_capabilities() {
1231 1231
     //Validates if the server may have extended capabilities
1232 1232
     $parsed_url = parse_url(bigbluebuttonbn_get_cfg_server_url());
1233 1233
     $host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
1234 1234
     $host_ends = explode(".", $host);
1235 1235
     $host_ends_length = count($host_ends);
1236 1236
 
1237
-    return ( $host_ends_length > 0 && $host_ends[$host_ends_length -1] == 'com' && $host_ends[$host_ends_length -2] == 'blindsidenetworks' );
1237
+    return ($host_ends_length > 0 && $host_ends[$host_ends_length - 1] == 'com' && $host_ends[$host_ends_length - 2] == 'blindsidenetworks');
1238 1238
 }
1239 1239
 
1240 1240
 function bigbluebuttonbn_get_locales_for_ui() {
@@ -1277,84 +1277,84 @@  discard block
 block discarded – undo
1277 1277
 
1278 1278
 function bigbluebuttonbn_get_cfg_server_url_default() {
1279 1279
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1280
-    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: 'http://test-install.blindsidenetworks.com/bigbluebutton/')));
1280
+    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 : 'http://test-install.blindsidenetworks.com/bigbluebutton/')));
1281 1281
 }
1282 1282
 
1283 1283
 function bigbluebuttonbn_get_cfg_shared_secret_default() {
1284 1284
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1285
-    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: '8cd8ef52e8e101574e400365b55e11a6')));
1285
+    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 : '8cd8ef52e8e101574e400365b55e11a6')));
1286 1286
 }
1287 1287
 
1288 1288
 function bigbluebuttonbn_get_cfg_voicebridge_editable() {
1289 1289
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1290
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable: (isset($CFG->bigbluebuttonbn_voicebridge_editable)? $CFG->bigbluebuttonbn_voicebridge_editable: false));
1290
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable : (isset($CFG->bigbluebuttonbn_voicebridge_editable) ? $CFG->bigbluebuttonbn_voicebridge_editable : false));
1291 1291
 }
1292 1292
 
1293 1293
 function bigbluebuttonbn_get_cfg_recording_default() {
1294 1294
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1295
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default: (isset($CFG->bigbluebuttonbn_recording_default)? $CFG->bigbluebuttonbn_recording_default: true));
1295
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default : (isset($CFG->bigbluebuttonbn_recording_default) ? $CFG->bigbluebuttonbn_recording_default : true));
1296 1296
 }
1297 1297
 
1298 1298
 function bigbluebuttonbn_get_cfg_recording_editable() {
1299 1299
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1300
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable: (isset($CFG->bigbluebuttonbn_recording_editable)? $CFG->bigbluebuttonbn_recording_editable: true));
1300
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable : (isset($CFG->bigbluebuttonbn_recording_editable) ? $CFG->bigbluebuttonbn_recording_editable : true));
1301 1301
 }
1302 1302
 
1303 1303
 function bigbluebuttonbn_get_cfg_recording_tagging_default() {
1304 1304
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1305
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default: (isset($CFG->bigbluebuttonbn_recordingtagging_default)? $CFG->bigbluebuttonbn_recordingtagging_default: false));
1305
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default : (isset($CFG->bigbluebuttonbn_recordingtagging_default) ? $CFG->bigbluebuttonbn_recordingtagging_default : false));
1306 1306
 }
1307 1307
 
1308 1308
 function bigbluebuttonbn_get_cfg_recording_tagging_editable() {
1309 1309
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1310
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable: (isset($CFG->bigbluebuttonbn_recordingtagging_editable)? $CFG->bigbluebuttonbn_recordingtagging_editable: false));
1310
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable : (isset($CFG->bigbluebuttonbn_recordingtagging_editable) ? $CFG->bigbluebuttonbn_recordingtagging_editable : false));
1311 1311
 }
1312 1312
 
1313 1313
 function bigbluebuttonbn_get_cfg_recording_icons_enabled() {
1314 1314
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1315
-    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));
1315
+    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));
1316 1316
 }
1317 1317
 
1318 1318
 function bigbluebuttonbn_get_cfg_importrecordings_enabled() {
1319 1319
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1320
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled: (isset($CFG->bigbluebuttonbn_importrecordings_enabled)? $CFG->bigbluebuttonbn_importrecordings_enabled: false));
1320
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled : (isset($CFG->bigbluebuttonbn_importrecordings_enabled) ? $CFG->bigbluebuttonbn_importrecordings_enabled : false));
1321 1321
 }
1322 1322
 
1323 1323
 function bigbluebuttonbn_get_cfg_waitformoderator_default() {
1324 1324
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1325
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default: (isset($CFG->bigbluebuttonbn_waitformoderator_default)? $CFG->bigbluebuttonbn_waitformoderator_default: false));
1325
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default : (isset($CFG->bigbluebuttonbn_waitformoderator_default) ? $CFG->bigbluebuttonbn_waitformoderator_default : false));
1326 1326
 }
1327 1327
 
1328 1328
 function bigbluebuttonbn_get_cfg_waitformoderator_editable() {
1329 1329
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1330
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable: (isset($CFG->bigbluebuttonbn_waitformoderator_editable)? $CFG->bigbluebuttonbn_waitformoderator_editable: true));
1330
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable : (isset($CFG->bigbluebuttonbn_waitformoderator_editable) ? $CFG->bigbluebuttonbn_waitformoderator_editable : true));
1331 1331
 }
1332 1332
 
1333 1333
 function bigbluebuttonbn_get_cfg_waitformoderator_ping_interval() {
1334 1334
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1335
-    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));
1335
+    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));
1336 1336
 }
1337 1337
 
1338 1338
 function bigbluebuttonbn_get_cfg_waitformoderator_cache_ttl() {
1339 1339
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1340
-    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));
1340
+    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));
1341 1341
 }
1342 1342
 
1343 1343
 function bigbluebuttonbn_get_cfg_userlimit_default() {
1344 1344
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1345
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default: (isset($CFG->bigbluebuttonbn_userlimit_default)? $CFG->bigbluebuttonbn_userlimit_default: 0));
1345
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default : (isset($CFG->bigbluebuttonbn_userlimit_default) ? $CFG->bigbluebuttonbn_userlimit_default : 0));
1346 1346
 }
1347 1347
 
1348 1348
 function bigbluebuttonbn_get_cfg_userlimit_editable() {
1349 1349
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1350
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable: (isset($CFG->bigbluebuttonbn_userlimit_editable)? $CFG->bigbluebuttonbn_userlimit_editable: false));
1350
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable : (isset($CFG->bigbluebuttonbn_userlimit_editable) ? $CFG->bigbluebuttonbn_userlimit_editable : false));
1351 1351
 }
1352 1352
 
1353 1353
 function bigbluebuttonbn_get_cfg_preuploadpresentation_enabled() {
1354 1354
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1355 1355
     if (extension_loaded('curl')) {
1356 1356
         // This feature only works if curl is installed
1357
-        return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled: (isset($CFG->bigbluebuttonbn_preuploadpresentation_enabled)? $CFG->bigbluebuttonbn_preuploadpresentation_enabled: false));
1357
+        return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled : (isset($CFG->bigbluebuttonbn_preuploadpresentation_enabled) ? $CFG->bigbluebuttonbn_preuploadpresentation_enabled : false));
1358 1358
     } else {
1359 1359
         return false;
1360 1360
     }
@@ -1362,37 +1362,37 @@  discard block
 block discarded – undo
1362 1362
 
1363 1363
 function bigbluebuttonbn_get_cfg_sendnotifications_enabled() {
1364 1364
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1365
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled: (isset($CFG->bigbluebuttonbn_sendnotifications_enabled)? $CFG->bigbluebuttonbn_sendnotifications_enabled: false));
1365
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled : (isset($CFG->bigbluebuttonbn_sendnotifications_enabled) ? $CFG->bigbluebuttonbn_sendnotifications_enabled : false));
1366 1366
 }
1367 1367
 
1368 1368
 function bigbluebuttonbn_get_cfg_recordingready_enabled() {
1369 1369
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1370
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled: (isset($CFG->bigbluebuttonbn_recordingready_enabled)? $CFG->bigbluebuttonbn_recordingready_enabled: false));
1370
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled : (isset($CFG->bigbluebuttonbn_recordingready_enabled) ? $CFG->bigbluebuttonbn_recordingready_enabled : false));
1371 1371
 }
1372 1372
 
1373 1373
 function bigbluebuttonbn_get_cfg_moderator_default() {
1374 1374
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1375
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default: (isset($CFG->bigbluebuttonbn_moderator_default)? $CFG->bigbluebuttonbn_moderator_default: 'owner'));
1375
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default : (isset($CFG->bigbluebuttonbn_moderator_default) ? $CFG->bigbluebuttonbn_moderator_default : 'owner'));
1376 1376
 }
1377 1377
 
1378 1378
 function bigbluebuttonbn_get_cfg_scheduled_duration_enabled() {
1379 1379
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1380
-    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));
1380
+    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));
1381 1381
 }
1382 1382
 
1383 1383
 function bigbluebuttonbn_get_cfg_scheduled_duration_compensation() {
1384 1384
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1385
-    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));
1385
+    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));
1386 1386
 }
1387 1387
 
1388 1388
 function bigbluebuttonbn_get_cfg_scheduled_pre_opening() {
1389 1389
     global $BIGBLUEBUTTONBN_CFG, $CFG;
1390
-    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));
1390
+    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));
1391 1391
 }
1392 1392
 
1393 1393
 function bigbluebuttonbn_import_get_courses_for_select(array $bbbsession) {
1394 1394
 
1395
-    if( $bbbsession['administrator'] ) {
1395
+    if ($bbbsession['administrator']) {
1396 1396
         $courses = get_courses('all', 'c.id ASC', 'c.id,c.shortname,c.fullname');
1397 1397
         //It includes the name of the site as a course (category 0), so remove the first one
1398 1398
         unset($courses["1"]);
@@ -1401,8 +1401,8 @@  discard block
 block discarded – undo
1401 1401
     }
1402 1402
 
1403 1403
     $courses_for_select = [];
1404
-    foreach($courses as $course) {
1405
-        if( $course->id != $bbbsession['course']->id ) {
1404
+    foreach ($courses as $course) {
1405
+        if ($course->id != $bbbsession['course']->id) {
1406 1406
             $courses_for_select[$course->id] = $course->fullname;
1407 1407
         }
1408 1408
     }
@@ -1417,11 +1417,11 @@  discard block
 block discarded – undo
1417 1417
     //Remove duplicates
1418 1418
     $unique_records = array();
1419 1419
     foreach ($records as $key => $record) {
1420
-        if (array_key_exists($record->meetingid, $unique_records) ) {
1420
+        if (array_key_exists($record->meetingid, $unique_records)) {
1421 1421
             unset($records[$key]);
1422 1422
         } else {
1423 1423
             $meta = json_decode($record->meta);
1424
-            if ( !$meta->record ) {
1424
+            if (!$meta->record) {
1425 1425
                 unset($records[$key]);
1426 1426
             } else {
1427 1427
                 array_push($unique_records, $record->meetingid);
@@ -1442,17 +1442,17 @@  discard block
 block discarded – undo
1442 1442
     foreach ($bigbluebuttonbns_deleted as $key => $bigbluebuttonbn_deleted) {
1443 1443
         $records = $DB->get_records('bigbluebuttonbn_logs', array('courseid' => $courseID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_CREATE));
1444 1444
 
1445
-        if( !empty($records) ) {
1445
+        if (!empty($records)) {
1446 1446
             //Remove duplicates
1447 1447
             $unique_records = array();
1448 1448
             foreach ($records as $key => $record) {
1449
-                if (array_key_exists($record->meetingid, $unique_records) ) {
1449
+                if (array_key_exists($record->meetingid, $unique_records)) {
1450 1450
                     unset($records[$key]);
1451 1451
                 } else {
1452 1452
                     $meta = json_decode($record->meta);
1453
-                    if ( !$meta->record ) {
1453
+                    if (!$meta->record) {
1454 1454
                         unset($records[$key]);
1455
-                    } else if ( $bigbluebuttonbn_deleted->meetingid != substr($record->meetingid, 0, strlen($bigbluebuttonbn_deleted->meetingid))) {
1455
+                    } else if ($bigbluebuttonbn_deleted->meetingid != substr($record->meetingid, 0, strlen($bigbluebuttonbn_deleted->meetingid))) {
1456 1456
                         unset($records[$key]);
1457 1457
                     } else {
1458 1458
                         array_push($unique_records, $record->meetingid);
@@ -1474,16 +1474,16 @@  discard block
 block discarded – undo
1474 1474
 
1475 1475
     $bigbluebuttonbns = $DB->get_records('bigbluebuttonbn', array('course' => $courseID));
1476 1476
 
1477
-    if ( !empty($bigbluebuttonbns) ) {
1477
+    if (!empty($bigbluebuttonbns)) {
1478 1478
         $table = 'bigbluebuttonbn_logs';
1479 1479
 
1480 1480
         //Prepare select for loading records based on existent bigbluebuttonbns
1481 1481
         $select = "";
1482 1482
         foreach ($bigbluebuttonbns as $key => $bigbluebuttonbn) {
1483
-            $select .= strlen($select) == 0? "(": " OR ";
1484
-            $select .= "bigbluebuttonbnid=".$bigbluebuttonbn->id;
1483
+            $select .= strlen($select) == 0 ? "(" : " OR ";
1484
+            $select .= "bigbluebuttonbnid=" . $bigbluebuttonbn->id;
1485 1485
         }
1486
-        $select .= ") AND log='".BIGBLUEBUTTONBN_LOG_EVENT_CREATE."'";
1486
+        $select .= ") AND log='" . BIGBLUEBUTTONBN_LOG_EVENT_CREATE . "'";
1487 1487
 
1488 1488
         //Execute select for loading records based on existent bigbluebuttonbns
1489 1489
         $records = $DB->get_records_select($table, $select);
@@ -1491,8 +1491,8 @@  discard block
 block discarded – undo
1491 1491
         //Remove duplicates
1492 1492
         $unique_records = array();
1493 1493
         foreach ($records as $key => $record) {
1494
-            $record_key = $record->meetingid.','.$record->bigbluebuttonbnid.','.$record->meta;
1495
-            if( array_search($record_key, $unique_records) === false ) {
1494
+            $record_key = $record->meetingid . ',' . $record->bigbluebuttonbnid . ',' . $record->meta;
1495
+            if (array_search($record_key, $unique_records) === false) {
1496 1496
                 array_push($unique_records, $record_key);
1497 1497
             } else {
1498 1498
                 unset($records[$key]);
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
         //Remove the ones with record=false
1503 1503
         foreach ($records as $key => $record) {
1504 1504
             $meta = json_decode($record->meta);
1505
-            if ( !$meta || !$meta->record ) {
1505
+            if (!$meta || !$meta->record) {
1506 1506
                 unset($records[$key]);
1507 1507
             }
1508 1508
         }
@@ -1516,9 +1516,9 @@  discard block
 block discarded – undo
1516 1516
 
1517 1517
     // Load the meetingIDs to be used in the getRecordings request
1518 1518
     $meetingID = '';
1519
-    if ( is_numeric($courseID) ) {
1519
+    if (is_numeric($courseID)) {
1520 1520
         $results = bigbluebuttonbn_getRecordedMeetings($courseID);
1521
-        if( $results ) {
1521
+        if ($results) {
1522 1522
             //Eliminates duplicates
1523 1523
             $mIDs = array();
1524 1524
             foreach ($results as $result) {
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
     }
1534 1534
 
1535 1535
     // If there were meetingIDs excecute the getRecordings request
1536
-    if ( $meetingID != '' ) {
1536
+    if ($meetingID != '') {
1537 1537
         $recordings = bigbluebuttonbn_getRecordingsArray($meetingID, $URL, $SALT);
1538 1538
     }
1539 1539
 
@@ -1556,28 +1556,28 @@  discard block
 block discarded – undo
1556 1556
     $recordings_already_imported_indexed = bigbluebuttonbn_index_recordings($recordings_already_imported);
1557 1557
 
1558 1558
     foreach ($recordings as $key => $recording) {
1559
-        if( isset($recordings_already_imported_indexed[$recording['recordID']]) ) {
1559
+        if (isset($recordings_already_imported_indexed[$recording['recordID']])) {
1560 1560
             unset($recordings[$key]);
1561 1561
         }
1562 1562
     }
1563 1563
     return $recordings;
1564 1564
 }
1565 1565
 
1566
-function bigbluebutton_output_recording_table($bbbsession, $recordings, $tools=['publishing','deleting']) {
1566
+function bigbluebutton_output_recording_table($bbbsession, $recordings, $tools = ['publishing', 'deleting']) {
1567 1567
 
1568
-    if ( isset($recordings) && !empty($recordings) ) {  // There are recordings for this meeting
1568
+    if (isset($recordings) && !empty($recordings)) {  // There are recordings for this meeting
1569 1569
         $table = bigbluebuttonbn_get_recording_table($bbbsession, $recordings, $tools);
1570 1570
     }
1571 1571
 
1572 1572
     $output = '';
1573
-    if( isset($table->data) ) {
1573
+    if (isset($table->data)) {
1574 1574
         //Print the table
1575
-        $output .= '<div id="bigbluebuttonbn_html_table">'."\n";
1576
-        $output .= html_writer::table($table)."\n";
1577
-        $output .= '</div>'."\n";
1575
+        $output .= '<div id="bigbluebuttonbn_html_table">' . "\n";
1576
+        $output .= html_writer::table($table) . "\n";
1577
+        $output .= '</div>' . "\n";
1578 1578
 
1579 1579
     } else {
1580
-        $output .= get_string('view_message_norecordings', 'bigbluebuttonbn').'<br>'."\n";
1580
+        $output .= get_string('view_message_norecordings', 'bigbluebuttonbn') . '<br>' . "\n";
1581 1581
     }
1582 1582
 
1583 1583
     return $output;
@@ -1586,7 +1586,7 @@  discard block
 block discarded – undo
1586 1586
 function bigbluebuttonbn_getRecordingsImported($courseID, $bigbluebuttonbnID) {
1587 1587
     global $DB;
1588 1588
 
1589
-    if ( $bigbluebuttonbnID != NULL ) {
1589
+    if ($bigbluebuttonbnID != NULL) {
1590 1590
         // Fetch only those related to the $courseID and $bigbluebuttonbnID requested
1591 1591
         $recordings_imported = $DB->get_records('bigbluebuttonbn_logs', array('courseid' => $courseID, 'bigbluebuttonbnid' => $bigbluebuttonbnID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_IMPORT));
1592 1592
     } else {
@@ -1605,7 +1605,7 @@  discard block
 block discarded – undo
1605 1605
 function bigbluebuttonbn_getRecordingsImportedAllInstances($recordID) {
1606 1606
     global $DB, $CFG;
1607 1607
 
1608
-    $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.'%' ));
1608
+    $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 . '%'));
1609 1609
     return $recordings_imported;
1610 1610
 }
1611 1611
 
@@ -1624,8 +1624,8 @@  discard block
 block discarded – undo
1624 1624
 function bigbluebuttonbn_html2text($html, $len) {
1625 1625
     $text = strip_tags($html);
1626 1626
     $text = str_replace("&nbsp;", ' ', $text);
1627
-    if( strlen($text) > $len )
1628
-        $text = substr($text, 0, $len)."...";
1627
+    if (strlen($text) > $len)
1628
+        $text = substr($text, 0, $len) . "...";
1629 1629
     else
1630 1630
         $text = substr($text, 0, $len);
1631 1631
     return $text;
Please login to merge, or discard this patch.
Braces   +67 added lines, -40 removed lines patch added patch discarded remove patch
@@ -69,19 +69,23 @@  discard block
 block discarded – undo
69 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
     $duration = intval($duration);
76
-    if( $duration > 0 )
77
-        $params .= '&duration='.$duration;
77
+    if( $duration > 0 ) {
78
+            $params .= '&duration='.$duration;
79
+    }
78 80
 
79 81
     $maxParticipants = intval($maxParticipants);
80
-    if( $maxParticipants > 0 )
81
-        $params .= '&maxParticipants='.$maxParticipants;
82
+    if( $maxParticipants > 0 ) {
83
+            $params .= '&maxParticipants='.$maxParticipants;
84
+    }
82 85
 
83
-    if( trim( $welcome ) )
84
-        $params .= '&welcome='.urlencode($welcome);
86
+    if( trim( $welcome ) ) {
87
+            $params .= '&welcome='.urlencode($welcome);
88
+    }
85 89
 
86 90
     foreach ($metadata as $key => $value) {
87 91
         $params .= '&'.$key.'='.urlencode($value);
@@ -155,10 +159,11 @@  discard block
 block discarded – undo
155 159
     }
156 160
 
157 161
     if ( $xml ) {
158
-        if ($xml->meetingID)
159
-            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded );
160
-        else
161
-            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey );
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 );
164
+        } else {
165
+                    return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey );
166
+        }
162 167
     } else {
163 168
         return null;
164 169
     }
@@ -228,7 +233,9 @@  discard block
 block discarded – undo
228 233
             $metadataArray = array();
229 234
             $metadata = get_object_vars($recording->metadata);
230 235
             foreach ( $metadata as $key => $value ) {
231
-                if ( is_object($value) ) $value = '';
236
+                if ( is_object($value) ) {
237
+                    $value = '';
238
+                }
232 239
                 $metadataArray['meta_'.$key] = $value;
233 240
             }
234 241
 
@@ -268,7 +275,9 @@  discard block
 block discarded – undo
268 275
                 $metadataArray = array();
269 276
                 $metadata = get_object_vars($recording->metadata);
270 277
                 foreach ($metadata as $key => $value) {
271
-                    if(is_object($value)) $value = '';
278
+                    if(is_object($value)) {
279
+                        $value = '';
280
+                    }
272 281
                     $metadataArray['meta_'.$key] = $value;
273 282
                 }
274 283
 
@@ -282,17 +291,22 @@  discard block
 block discarded – undo
282 291
 }
283 292
 
284 293
 function bigbluebuttonbn_recordingBuildSorter($a, $b){
285
-    if( $a['startTime'] < $b['startTime']) return -1;
286
-    else if( $a['startTime'] == $b['startTime']) return 0;
287
-    else return 1;
288
-}
294
+    if( $a['startTime'] < $b['startTime']) {
295
+        return -1;
296
+    } else if( $a['startTime'] == $b['startTime']) {
297
+        return 0;
298
+    } else {
299
+        return 1;
300
+    }
301
+    }
289 302
 
290 303
 function bigbluebuttonbn_doDeleteRecordings( $recordIDs, $URL, $SALT ) {
291 304
     $ids = 	explode(",", $recordIDs);
292 305
     foreach( $ids as $id){
293 306
         $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getDeleteRecordingsURL($id, $URL, $SALT) );
294
-        if( $xml && $xml->returncode != 'SUCCESS' )
295
-            return false;
307
+        if( $xml && $xml->returncode != 'SUCCESS' ) {
308
+                    return false;
309
+        }
296 310
     }
297 311
     return true;
298 312
 }
@@ -301,8 +315,9 @@  discard block
 block discarded – undo
301 315
     $ids = 	explode(",", $recordIDs);
302 316
     foreach( $ids as $id){
303 317
         $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getPublishRecordingsURL($id, $set, $URL, $SALT) );
304
-        if( $xml && $xml->returncode != 'SUCCESS' )
305
-            return false;
318
+        if( $xml && $xml->returncode != 'SUCCESS' ) {
319
+                    return false;
320
+        }
306 321
     }
307 322
     return true;
308 323
 }
@@ -312,8 +327,7 @@  discard block
 block discarded – undo
312 327
 
313 328
     if( $xml ) { //If the xml packet returned failure it displays the message to the user
314 329
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
315
-    }
316
-    else { //If the server is unreachable, then prompts the user of the necessary action
330
+    } else { //If the server is unreachable, then prompts the user of the necessary action
317 331
         return null;
318 332
     }
319 333
 }
@@ -347,7 +361,9 @@  discard block
 block discarded – undo
347 361
 }
348 362
 
349 363
 function bigbluebuttonbn_wrap_xml_load_file($url, $method=BIGBLUEBUTTONBN_METHOD_GET, $data=null) {
350
-    if ( bigbluebuttonbn_debugdisplay() ) error_log("Request to: ".$url);
364
+    if ( bigbluebuttonbn_debugdisplay() ) {
365
+        error_log("Request to: ".$url);
366
+    }
351 367
 
352 368
     if (extension_loaded('curl')) {
353 369
         $c = new curl();
@@ -535,8 +551,9 @@  discard block
 block discarded – undo
535 551
         // Iterate looking for all configuration
536 552
         foreach($participant_list as $participant){
537 553
             if( $participant->selectiontype == 'all' ) {
538
-                if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
539
-                    return true;
554
+                if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) {
555
+                                    return true;
556
+                }
540 557
             }
541 558
         }
542 559
 
@@ -547,8 +564,9 @@  discard block
 block discarded – undo
547 564
                 foreach( $roles as $role ) {
548 565
                     $db_moodle_role = bigbluebuttonbn_moodle_db_role_lookup($db_moodle_roles, $role->roleid);
549 566
                     if( $participant->selectionid == $db_moodle_role->shortname ) {
550
-                        if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
551
-                            return true;
567
+                        if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) {
568
+                                                    return true;
569
+                        }
552 570
                     }
553 571
                 }
554 572
             }
@@ -558,8 +576,9 @@  discard block
 block discarded – undo
558 576
         foreach($participant_list as $participant){
559 577
             if( $participant->selectiontype == 'user' ) {
560 578
                 if( $participant->selectionid == $user ) {
561
-                    if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
562
-                        return true;
579
+                    if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) {
580
+                                            return true;
581
+                    }
563 582
                 }
564 583
             }
565 584
         }
@@ -593,7 +612,9 @@  discard block
 block discarded – undo
593 612
     if( $voicebridge != 0 ) {
594 613
         $table = "bigbluebuttonbn";
595 614
         $select = "voicebridge = ".$voicebridge;
596
-        if( $id ) $select .= " AND id <> ".$id;
615
+        if( $id ) {
616
+            $select .= " AND id <> ".$id;
617
+        }
597 618
         if ( $rooms = $DB->get_records_select($table, $select)  ) {
598 619
             $is_unique = false;
599 620
         }
@@ -929,7 +950,9 @@  discard block
 block discarded – undo
929 950
     $error = $org_msg;
930 951
 
931 952
     if( !empty($new_msg) ) {
932
-        if( !empty($error) ) $error .= ' ';
953
+        if( !empty($error) ) {
954
+            $error .= ' ';
955
+        }
933 956
         $error .= $new_msg;
934 957
     }
935 958
 
@@ -1218,8 +1241,9 @@  discard block
 block discarded – undo
1218 1241
         $capabilities = bigbluebuttonbn_getCapabilitiesArray( $endpoint, $shared_secret );
1219 1242
         if( $capabilities ) {
1220 1243
             foreach ($capabilities as $capability) {
1221
-                if( $capability["name"] == $capability_name)
1222
-                    $capability_offered = $capability;
1244
+                if( $capability["name"] == $capability_name) {
1245
+                                    $capability_offered = $capability;
1246
+                }
1223 1247
             }
1224 1248
         }
1225 1249
     }
@@ -1526,7 +1550,9 @@  discard block
 block discarded – undo
1526 1550
             }
1527 1551
             //Generates the meetingID string
1528 1552
             foreach ($mIDs as $mID) {
1529
-                if (strlen($meetingID) > 0) $meetingID .= ',';
1553
+                if (strlen($meetingID) > 0) {
1554
+                    $meetingID .= ',';
1555
+                }
1530 1556
                 $meetingID .= $mID;
1531 1557
             }
1532 1558
         }
@@ -1624,9 +1650,10 @@  discard block
 block discarded – undo
1624 1650
 function bigbluebuttonbn_html2text($html, $len) {
1625 1651
     $text = strip_tags($html);
1626 1652
     $text = str_replace("&nbsp;", ' ', $text);
1627
-    if( strlen($text) > $len )
1628
-        $text = substr($text, 0, $len)."...";
1629
-    else
1630
-        $text = substr($text, 0, $len);
1653
+    if( strlen($text) > $len ) {
1654
+            $text = substr($text, 0, $len)."...";
1655
+    } else {
1656
+            $text = substr($text, 0, $len);
1657
+    }
1631 1658
     return $text;
1632 1659
 }
1633 1660
\ No newline at end of file
Please login to merge, or discard this patch.
import_view.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@  discard block
 block discarded – undo
8 8
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later
9 9
  */
10 10
 
11
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
12
-require_once(dirname(__FILE__).'/locallib.php');
11
+require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
12
+require_once(dirname(__FILE__) . '/locallib.php');
13 13
 
14
-$bn = required_param('bn', PARAM_INT);     // bigbluebuttonbn instance ID
15
-$tc = optional_param('tc', 0, PARAM_INT);  // target course ID
14
+$bn = required_param('bn', PARAM_INT); // bigbluebuttonbn instance ID
15
+$tc = optional_param('tc', 0, PARAM_INT); // target course ID
16 16
 
17 17
 if ($bn) {
18 18
     $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $bn), '*', MUST_EXIST);
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 require_login($course, true, $cm);
28 28
 
29
-if ( isset($SESSION) && isset($SESSION->bigbluebuttonbn_bbbsession)) {
29
+if (isset($SESSION) && isset($SESSION->bigbluebuttonbn_bbbsession)) {
30 30
     $bbbsession = $SESSION->bigbluebuttonbn_bbbsession;
31 31
 }
32 32
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
 $options = bigbluebuttonbn_import_get_courses_for_select($bbbsession);
49 49
 $selected = bigbluebuttonbn_selected_course($options, $tc);
50
-if( empty($options) ) {
50
+if (empty($options)) {
51 51
     $output .= html_writer::tag('div', get_string('view_error_import_no_courses', 'bigbluebuttonbn'));
52 52
 
53 53
 } else {
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
     $recordings = bigbluebuttonbn_import_exlcude_recordings_already_imported($bbbsession['course']->id, $bbbsession['bigbluebuttonbn']->id, $recordings);
59 59
     //store remaining recordings (indexed) in a session variable
60 60
     $SESSION->bigbluebuttonbn_importrecordings = bigbluebuttonbn_index_recordings($recordings);
61
-    if( empty($recordings) ) {
61
+    if (empty($recordings)) {
62 62
         $output .= html_writer::tag('div', get_string('view_error_import_no_recordings', 'bigbluebuttonbn'));
63 63
     } else {
64
-        $output .= html_writer::tag('span', '', ['id' => 'import_recording_links_table' ,'name'=>'import_recording_links_table']);
64
+        $output .= html_writer::tag('span', '', ['id' => 'import_recording_links_table', 'name'=>'import_recording_links_table']);
65 65
         $output .= bigbluebutton_output_recording_table($bbbsession, $recordings, ['importing']);
66 66
     }
67 67
     $output .= html_writer::start_tag('br');
68
-    $output .= html_writer::tag( 'input', '', array('type' => 'button', 'value' => get_string('view_recording_button_return', 'bigbluebuttonbn'), 'onclick' => 'window.location=\''.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$cm->id.'\'') );
68
+    $output .= html_writer::tag('input', '', array('type' => 'button', 'value' => get_string('view_recording_button_return', 'bigbluebuttonbn'), 'onclick' => 'window.location=\'' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $cm->id . '\''));
69 69
 
70 70
     $jsvars = array(
71 71
         'bn' => $bn,
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 // finally, render the output
88 88
 echo $output;
89 89
 
90
-function bigbluebuttonbn_selected_course($options, $tc='') {
91
-    if( empty($options) ) {
90
+function bigbluebuttonbn_selected_course($options, $tc = '') {
91
+    if (empty($options)) {
92 92
         $selected = '';
93
-    } else if(array_key_exists($tc, $options)) {
93
+    } else if (array_key_exists($tc, $options)) {
94 94
         $selected = $tc;
95 95
     } else {
96 96
         $selected = '';
Please login to merge, or discard this patch.
lib.php 2 patches
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -13,23 +13,23 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
254 254
  *
255 255
  * @return boolean
256 256
  **/
257
-function bigbluebuttonbn_cron () {
257
+function bigbluebuttonbn_cron() {
258 258
     return true;
259 259
 }
260 260
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 function bigbluebuttonbn_get_coursemodule_info($coursemodule) {
351 351
     global $CFG, $DB;
352 352
 
353
-    if ( !$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id'=>$coursemodule->instance), 'id, name, intro, introformat, newwindow')) {
353
+    if (!$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id'=>$coursemodule->instance), 'id, name, intro, introformat, newwindow')) {
354 354
         return NULL;
355 355
     }
356 356
 
@@ -376,10 +376,10 @@  discard block
 block discarded – undo
376 376
 function bigbluebuttonbn_process_pre_save(&$bigbluebuttonbn) {
377 377
     global $DB, $CFG;
378 378
 
379
-    if ( !isset($bigbluebuttonbn->timecreated) || !$bigbluebuttonbn->timecreated ) {
379
+    if (!isset($bigbluebuttonbn->timecreated) || !$bigbluebuttonbn->timecreated) {
380 380
         $bigbluebuttonbn->timecreated = time();
381 381
         //Assign password only if it is a new activity
382
-        if( isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add) ) {
382
+        if (isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add)) {
383 383
             $bigbluebuttonbn->moderatorpass = bigbluebuttonbn_random_password(12);
384 384
             $bigbluebuttonbn->viewerpass = bigbluebuttonbn_random_password(12);
385 385
         }
@@ -388,13 +388,13 @@  discard block
 block discarded – undo
388 388
         $bigbluebuttonbn->timemodified = time();
389 389
     }
390 390
 
391
-    if (! isset($bigbluebuttonbn->newwindow))
391
+    if (!isset($bigbluebuttonbn->newwindow))
392 392
         $bigbluebuttonbn->newwindow = 0;
393
-    if (! isset($bigbluebuttonbn->wait))
393
+    if (!isset($bigbluebuttonbn->wait))
394 394
         $bigbluebuttonbn->wait = 0;
395
-    if (! isset($bigbluebuttonbn->record))
395
+    if (!isset($bigbluebuttonbn->record))
396 396
         $bigbluebuttonbn->record = 0;
397
-    if (! isset($bigbluebuttonbn->tagging))
397
+    if (!isset($bigbluebuttonbn->tagging))
398 398
         $bigbluebuttonbn->tagging = 0;
399 399
 
400 400
     $bigbluebuttonbn->participants = htmlspecialchars_decode($bigbluebuttonbn->participants);
@@ -413,8 +413,8 @@  discard block
 block discarded – undo
413 413
 
414 414
     // Now that an id was assigned, generate and set the meetingid property based on 
415 415
     // [Moodle Instance + Activity ID + BBB Secret] (but only for new activities)
416
-    if( isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add) ) {
417
-        $bigbluebuttonbn_meetingid = sha1($CFG->wwwroot.$bigbluebuttonbn->id.bigbluebuttonbn_get_cfg_shared_secret());
416
+    if (isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add)) {
417
+        $bigbluebuttonbn_meetingid = sha1($CFG->wwwroot . $bigbluebuttonbn->id . bigbluebuttonbn_get_cfg_shared_secret());
418 418
         $DB->set_field('bigbluebuttonbn', 'meetingid', $bigbluebuttonbn_meetingid, array('id' => $bigbluebuttonbn->id));
419 419
         $action = get_string('mod_form_field_notification_msg_created', 'bigbluebuttonbn');
420 420
     } else {
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
     $at = get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn');
424 424
 
425 425
     // Add evento to the calendar when if openingtime is set
426
-    if ( isset($bigbluebuttonbn->openingtime) && $bigbluebuttonbn->openingtime ){
426
+    if (isset($bigbluebuttonbn->openingtime) && $bigbluebuttonbn->openingtime) {
427 427
         $event = new stdClass();
428 428
         $event->name        = $bigbluebuttonbn->name;
429 429
         $event->courseid    = $bigbluebuttonbn->course;
@@ -433,13 +433,13 @@  discard block
 block discarded – undo
433 433
         $event->instance    = $bigbluebuttonbn->id;
434 434
         $event->timestart   = $bigbluebuttonbn->openingtime;
435 435
 
436
-        if ( $bigbluebuttonbn->closingtime ){
436
+        if ($bigbluebuttonbn->closingtime) {
437 437
             $event->durationtime = $bigbluebuttonbn->closingtime - $bigbluebuttonbn->openingtime;
438 438
         } else {
439 439
             $event->durationtime = 0;
440 440
         }
441 441
 
442
-        if ( $event->id = $DB->get_field('event', 'id', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id)) ) {
442
+        if ($event->id = $DB->get_field('event', 'id', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) {
443 443
             $calendarevent = calendar_event::load($event->id);
444 444
             $calendarevent->update($event);
445 445
         } else {
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
         $DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id));
451 451
     }
452 452
 
453
-    if( isset($bigbluebuttonbn->notification) && $bigbluebuttonbn->notification ) {
453
+    if (isset($bigbluebuttonbn->notification) && $bigbluebuttonbn->notification) {
454 454
         // Prepare message
455 455
         $msg = new stdClass();
456 456
 
@@ -458,35 +458,35 @@  discard block
 block discarded – undo
458 458
         $msg->action = $action;
459 459
         $msg->activity_type = "";
460 460
         $msg->activity_title = $bigbluebuttonbn->name;
461
-        $message_text = '<p>'.$msg->activity_type.' &quot;'.$msg->activity_title.'&quot; '.get_string('email_body_notification_meeting_has_been', 'bigbluebuttonbn').' '.$msg->action.'.</p>';
461
+        $message_text = '<p>' . $msg->activity_type . ' &quot;' . $msg->activity_title . '&quot; ' . get_string('email_body_notification_meeting_has_been', 'bigbluebuttonbn') . ' ' . $msg->action . '.</p>';
462 462
 
463 463
         /// Add the meeting details to the message_body
464 464
         $msg->action = ucfirst($action);
465 465
         $msg->activity_description = "";
466
-        if( !empty($bigbluebuttonbn->intro) )
466
+        if (!empty($bigbluebuttonbn->intro))
467 467
             $msg->activity_description = trim($bigbluebuttonbn->intro);
468 468
         $msg->activity_openingtime = "";
469 469
         if ($bigbluebuttonbn->openingtime) {
470
-            $msg->activity_openingtime = calendar_day_representation($bigbluebuttonbn->openingtime).' '.$at.' '.calendar_time_representation($bigbluebuttonbn->openingtime);
470
+            $msg->activity_openingtime = calendar_day_representation($bigbluebuttonbn->openingtime) . ' ' . $at . ' ' . calendar_time_representation($bigbluebuttonbn->openingtime);
471 471
         }
472 472
         $msg->activity_closingtime = "";
473
-        if ($bigbluebuttonbn->closingtime ) {
474
-            $msg->activity_closingtime = calendar_day_representation($bigbluebuttonbn->closingtime).' '.$at.' '.calendar_time_representation($bigbluebuttonbn->closingtime);
473
+        if ($bigbluebuttonbn->closingtime) {
474
+            $msg->activity_closingtime = calendar_day_representation($bigbluebuttonbn->closingtime) . ' ' . $at . ' ' . calendar_time_representation($bigbluebuttonbn->closingtime);
475 475
         }
476
-        $msg->activity_owner = $USER->firstname.' '.$USER->lastname;
476
+        $msg->activity_owner = $USER->firstname . ' ' . $USER->lastname;
477 477
 
478
-        $message_text .= '<p><b>'.$msg->activity_title.'</b> '.get_string('email_body_notification_meeting_details', 'bigbluebuttonbn').':';
478
+        $message_text .= '<p><b>' . $msg->activity_title . '</b> ' . get_string('email_body_notification_meeting_details', 'bigbluebuttonbn') . ':';
479 479
         $message_text .= '<table border="0" style="margin: 5px 0 0 20px"><tbody>';
480
-        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_title', 'bigbluebuttonbn').': </td><td>';
481
-        $message_text .= $msg->activity_title.'</td></tr>';
482
-        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_description', 'bigbluebuttonbn').': </td><td>';
483
-        $message_text .= $msg->activity_description.'</td></tr>';
484
-        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_start_date', 'bigbluebuttonbn').': </td><td>';
485
-        $message_text .= $msg->activity_openingtime.'</td></tr>';
486
-        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_end_date', 'bigbluebuttonbn').': </td><td>';
487
-        $message_text .= $msg->activity_closingtime.'</td></tr>';
488
-        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.$msg->action.' '.get_string('email_body_notification_meeting_by', 'bigbluebuttonbn').': </td><td>';
489
-        $message_text .= $msg->activity_owner.'</td></tr></tbody></table></p>';
480
+        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_title', 'bigbluebuttonbn') . ': </td><td>';
481
+        $message_text .= $msg->activity_title . '</td></tr>';
482
+        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_description', 'bigbluebuttonbn') . ': </td><td>';
483
+        $message_text .= $msg->activity_description . '</td></tr>';
484
+        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_start_date', 'bigbluebuttonbn') . ': </td><td>';
485
+        $message_text .= $msg->activity_openingtime . '</td></tr>';
486
+        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_end_date', 'bigbluebuttonbn') . ': </td><td>';
487
+        $message_text .= $msg->activity_closingtime . '</td></tr>';
488
+        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . $msg->action . ' ' . get_string('email_body_notification_meeting_by', 'bigbluebuttonbn') . ': </td><td>';
489
+        $message_text .= $msg->activity_owner . '</td></tr></tbody></table></p>';
490 490
 
491 491
         // Send notification to all users enrolled
492 492
         bigbluebuttonbn_send_notification($USER, $bigbluebuttonbn, $message_text);
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
  * @param array $options additional options affecting the file serving
538 538
  * @return bool false if file not found, does not return if found - justsend the file
539 539
  */
540
-function bigbluebuttonbn_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) {
540
+function bigbluebuttonbn_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
541 541
     global $CFG, $DB;
542 542
 
543 543
     if ($context->contextlevel != CONTEXT_MODULE) {
@@ -553,21 +553,21 @@  discard block
 block discarded – undo
553 553
         return false;
554 554
     }
555 555
 
556
-    if( sizeof($args) > 1 ) {
556
+    if (sizeof($args) > 1) {
557 557
         $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'presentation_cache');
558 558
         $presentation_nonce_key = sha1($bigbluebuttonbn->id);
559 559
         $presentation_nonce = $cache->get($presentation_nonce_key);
560 560
         $presentation_nonce_value = $presentation_nonce['value'];
561 561
         $presentation_nonce_counter = $presentation_nonce['counter'];
562 562
 
563
-        if( $args["0"] != $presentation_nonce_value ) {
563
+        if ($args["0"] != $presentation_nonce_value) {
564 564
             return false;
565 565
         }
566 566
 
567 567
         //The nonce value is actually used twice because BigBlueButton reads the file two times
568 568
         $presentation_nonce_counter += 1;
569
-        if( $presentation_nonce_counter < 2 ) {
570
-            $cache->set($presentation_nonce_key, array( "value" => $presentation_nonce_value, "counter" => $presentation_nonce_counter ));
569
+        if ($presentation_nonce_counter < 2) {
570
+            $cache->set($presentation_nonce_key, array("value" => $presentation_nonce_value, "counter" => $presentation_nonce_counter));
571 571
         } else {
572 572
             $cache->delete($presentation_nonce_key);
573 573
         }
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
     }
586 586
 
587 587
     if ($filearea === 'presentation') {
588
-        $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename;
588
+        $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename;
589 589
     } else {
590 590
         return false;
591 591
     }
@@ -619,10 +619,10 @@  discard block
 block discarded – undo
619 619
  * @package  mod_bigbluebuttonbn
620 620
  * @return array a list of available roles
621 621
  */
622
-function bigbluebuttonbn_get_db_moodle_roles($rolename='all') {
622
+function bigbluebuttonbn_get_db_moodle_roles($rolename = 'all') {
623 623
     global $DB;
624 624
 
625
-    if( $rolename != 'all')
625
+    if ($rolename != 'all')
626 626
         $roles = $DB->get_record('role', array('shortname' => $rolename));
627 627
     else
628 628
         $roles = $DB->get_records('role', array());
@@ -641,22 +641,22 @@  discard block
 block discarded – undo
641 641
 
642 642
     $roles = bigbluebuttonbn_get_db_moodle_roles();
643 643
     $sqluserids = array();
644
-    foreach($roles as $role){
644
+    foreach ($roles as $role) {
645 645
         $users = get_role_users($role->id, $context);
646
-        foreach($users as $user) {
646
+        foreach ($users as $user) {
647 647
             array_push($sqluserids, $user->id);
648 648
         }
649 649
     }
650 650
 
651 651
     $users_array = array();
652
-    if( !empty($sqluserids) ) {
652
+    if (!empty($sqluserids)) {
653 653
         $users_array = $DB->get_records_select("user", "id IN (" . implode(', ', $sqluserids) . ") AND deleted = 0");
654 654
     }
655 655
 
656 656
     return $users_array;
657 657
 }
658 658
 
659
-function bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message="") {
659
+function bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message = "") {
660 660
     global $CFG, $DB;
661 661
 
662 662
     $context = bigbluebuttonbn_get_context_course($bigbluebuttonbn->course);
@@ -664,19 +664,19 @@  discard block
 block discarded – undo
664 664
 
665 665
     //Complete message
666 666
     $msg = new stdClass();
667
-    $msg->user_name = $sender->firstname.' '.$sender->lastname;
667
+    $msg->user_name = $sender->firstname . ' ' . $sender->lastname;
668 668
     $msg->user_email = $sender->email;
669 669
     $msg->course_name = "$course->fullname";
670
-    $message .= '<p><hr/><br/>'.get_string('email_footer_sent_by', 'bigbluebuttonbn').' '.$msg->user_name.'('.$msg->user_email.') ';
671
-    $message .= get_string('email_footer_sent_from', 'bigbluebuttonbn').' '.$msg->course_name.'.</p>';
670
+    $message .= '<p><hr/><br/>' . get_string('email_footer_sent_by', 'bigbluebuttonbn') . ' ' . $msg->user_name . '(' . $msg->user_email . ') ';
671
+    $message .= get_string('email_footer_sent_from', 'bigbluebuttonbn') . ' ' . $msg->course_name . '.</p>';
672 672
     
673 673
     $users = bigbluebuttonbn_get_users($context);
674
-    foreach( $users as $user ) {
675
-        if( $user->id != $sender->id ){
676
-            error_log("Sending msg to ".$user->firstname." ".$user->lastname.".");
674
+    foreach ($users as $user) {
675
+        if ($user->id != $sender->id) {
676
+            error_log("Sending msg to " . $user->firstname . " " . $user->lastname . ".");
677 677
             $messageid = message_post_message($sender, $user, $message, FORMAT_HTML);
678 678
             if (!empty($messageid)) {
679
-                error_log("Msg sent to ".$user->firstname." ".$user->lastname.".");
679
+                error_log("Msg sent to " . $user->firstname . " " . $user->lastname . ".");
680 680
             } else {
681 681
                 error_log("Msg was NOT sent.");
682 682
             }
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
     global $CFG;
689 689
 
690 690
     $version_major = bigbluebuttonbn_get_moodle_version_major();
691
-    if ( $version_major < '2013111800' ) {
691
+    if ($version_major < '2013111800') {
692 692
         //This is valid before v2.6
693 693
         $context = get_context_instance(CONTEXT_MODULE, $id);
694 694
     } else {
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
     global $CFG;
704 704
 
705 705
     $version_major = bigbluebuttonbn_get_moodle_version_major();
706
-    if ( $version_major < '2013111800' ) {
706
+    if ($version_major < '2013111800') {
707 707
         //This is valid before v2.6
708 708
         $context = get_context_instance(CONTEXT_COURSE, $id);
709 709
     } else {
@@ -716,11 +716,11 @@  discard block
 block discarded – undo
716 716
 
717 717
 function bigbluebuttonbn_get_cfg_server_url() {
718 718
     global $BIGBLUEBUTTONBN_CFG, $CFG;
719
-    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/'));
719
+    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/'));
720 720
 }
721 721
 
722 722
 function bigbluebuttonbn_get_cfg_shared_secret() {
723 723
     global $BIGBLUEBUTTONBN_CFG, $CFG;
724
-    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret)? trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret): (isset($CFG->bigbluebuttonbn_shared_secret)? trim($CFG->bigbluebuttonbn_shared_secret): '8cd8ef52e8e101574e400365b55e11a6'));
724
+    return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) ? trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) : (isset($CFG->bigbluebuttonbn_shared_secret) ? trim($CFG->bigbluebuttonbn_shared_secret) : '8cd8ef52e8e101574e400365b55e11a6'));
725 725
 }
726 726
 
Please login to merge, or discard this patch.
Braces   +20 added lines, -14 removed lines patch added patch discarded remove patch
@@ -388,14 +388,18 @@  discard block
 block discarded – undo
388 388
         $bigbluebuttonbn->timemodified = time();
389 389
     }
390 390
 
391
-    if (! isset($bigbluebuttonbn->newwindow))
392
-        $bigbluebuttonbn->newwindow = 0;
393
-    if (! isset($bigbluebuttonbn->wait))
394
-        $bigbluebuttonbn->wait = 0;
395
-    if (! isset($bigbluebuttonbn->record))
396
-        $bigbluebuttonbn->record = 0;
397
-    if (! isset($bigbluebuttonbn->tagging))
398
-        $bigbluebuttonbn->tagging = 0;
391
+    if (! isset($bigbluebuttonbn->newwindow)) {
392
+            $bigbluebuttonbn->newwindow = 0;
393
+    }
394
+    if (! isset($bigbluebuttonbn->wait)) {
395
+            $bigbluebuttonbn->wait = 0;
396
+    }
397
+    if (! isset($bigbluebuttonbn->record)) {
398
+            $bigbluebuttonbn->record = 0;
399
+    }
400
+    if (! isset($bigbluebuttonbn->tagging)) {
401
+            $bigbluebuttonbn->tagging = 0;
402
+    }
399 403
 
400 404
     $bigbluebuttonbn->participants = htmlspecialchars_decode($bigbluebuttonbn->participants);
401 405
 }
@@ -463,8 +467,9 @@  discard block
 block discarded – undo
463 467
         /// Add the meeting details to the message_body
464 468
         $msg->action = ucfirst($action);
465 469
         $msg->activity_description = "";
466
-        if( !empty($bigbluebuttonbn->intro) )
467
-            $msg->activity_description = trim($bigbluebuttonbn->intro);
470
+        if( !empty($bigbluebuttonbn->intro) ) {
471
+                    $msg->activity_description = trim($bigbluebuttonbn->intro);
472
+        }
468 473
         $msg->activity_openingtime = "";
469 474
         if ($bigbluebuttonbn->openingtime) {
470 475
             $msg->activity_openingtime = calendar_day_representation($bigbluebuttonbn->openingtime).' '.$at.' '.calendar_time_representation($bigbluebuttonbn->openingtime);
@@ -622,10 +627,11 @@  discard block
 block discarded – undo
622 627
 function bigbluebuttonbn_get_db_moodle_roles($rolename='all') {
623 628
     global $DB;
624 629
 
625
-    if( $rolename != 'all')
626
-        $roles = $DB->get_record('role', array('shortname' => $rolename));
627
-    else
628
-        $roles = $DB->get_records('role', array());
630
+    if( $rolename != 'all') {
631
+            $roles = $DB->get_record('role', array('shortname' => $rolename));
632
+    } else {
633
+            $roles = $DB->get_records('role', array());
634
+    }
629 635
 
630 636
     return $roles;
631 637
 }
Please login to merge, or discard this patch.
db/upgrade.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later
11 11
  */
12 12
 
13
-function xmldb_bigbluebuttonbn_upgrade($oldversion=0) {
13
+function xmldb_bigbluebuttonbn_upgrade($oldversion = 0) {
14 14
 
15 15
     global $CFG, $THEME, $DB;
16 16
     $dbman = $DB->get_manager(); // loads ddl manager and xmldb classes
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
     if ($result && $oldversion < 2012040200) {
21 21
         // Define field intro to be droped from bigbluebuttonbn
22 22
         $table = new xmldb_table('bigbluebuttonbn');
23
-        $field = new xmldb_field('intro', XMLDB_TYPE_TEXT, 'medium', null, null, null, null,'name');
23
+        $field = new xmldb_field('intro', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'name');
24 24
 
25 25
         // Drop field intro
26 26
         if ($dbman->field_exists($table, $field)) {
27
-            $dbman->drop_field($table, $field, $continue=true, $feedback=true);
27
+            $dbman->drop_field($table, $field, $continue = true, $feedback = true);
28 28
         }
29 29
 
30 30
         // Define field introformat to be droped from bigbluebuttonbn
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
         // Drop field introformat
35 35
         if ($dbman->field_exists($table, $field)) {
36
-            $dbman->drop_field($table, $field, $continue=true, $feedback=true);
36
+            $dbman->drop_field($table, $field, $continue = true, $feedback = true);
37 37
         }
38 38
 
39 39
         // Once we reach this point, we can store the new version and consider the module
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $field = new xmldb_field('welcome');
74 74
         $field->set_attributes(XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null, null, null, 'type');
75 75
 
76
-        $dbman->change_field_type($table, $field, $continue=true, $feedback=true);
76
+        $dbman->change_field_type($table, $field, $continue = true, $feedback = true);
77 77
 
78 78
         upgrade_mod_savepoint(true, 2012100100, 'bigbluebuttonbn');
79 79
     }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0);
86 86
 
87 87
         if (!$dbman->field_exists($table, $field)) {
88
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
88
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
89 89
         }
90 90
 
91 91
         upgrade_mod_savepoint(true, 2014050100, 'bigbluebuttonbn');
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $field = new xmldb_field('participants', XMLDB_TYPE_TEXT, 'medium', null, null, null, null);
98 98
 
99 99
         if (!$dbman->field_exists($table, $field)) {
100
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
100
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
101 101
         }
102 102
 
103 103
         upgrade_mod_savepoint(true, 2014070420, 'bigbluebuttonbn');
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         $field = new xmldb_field('participants');
110 110
         $field->set_attributes(XMLDB_TYPE_TEXT, 'medium', null, null, null, null);
111 111
 
112
-        $dbman->change_field_type($table, $field, $continue=true, $feedback=true);
112
+        $dbman->change_field_type($table, $field, $continue = true, $feedback = true);
113 113
 
114 114
         upgrade_mod_savepoint(true, 2014101004, 'bigbluebuttonbn');
115 115
     }
@@ -119,67 +119,67 @@  discard block
 block discarded – undo
119 119
         $table = new xmldb_table('bigbluebuttonbn');
120 120
         //// Drop field timeduration
121 121
         $field = new xmldb_field('timeduration');
122
-        if( $dbman->field_exists($table, $field) ) {
123
-            $dbman->drop_field($table, $field, $continue=true, $feedback=true);
122
+        if ($dbman->field_exists($table, $field)) {
123
+            $dbman->drop_field($table, $field, $continue = true, $feedback = true);
124 124
         }
125 125
         //// Drop field allmoderators
126 126
         $field = new xmldb_field('allmoderators');
127
-        if( $dbman->field_exists($table, $field) ) {
128
-            $dbman->drop_field($table, $field, $continue=true, $feedback=true);
127
+        if ($dbman->field_exists($table, $field)) {
128
+            $dbman->drop_field($table, $field, $continue = true, $feedback = true);
129 129
         }
130 130
         //// Add field intro
131 131
         $field = new xmldb_field('intro');
132 132
         $field->set_attributes(XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'name');
133
-        if( !$dbman->field_exists($table, $field) ) {
134
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
133
+        if (!$dbman->field_exists($table, $field)) {
134
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
135 135
         }
136 136
         //// Add field introformat
137 137
         $field = new xmldb_field('introformat');
138 138
         $field->set_attributes(XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 1, 'intro');
139
-        if( !$dbman->field_exists($table, $field) ) {
140
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
139
+        if (!$dbman->field_exists($table, $field)) {
140
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
141 141
         }
142 142
         //// Add field tagging
143 143
         $field = new xmldb_field('tagging');
144 144
         $field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'record');
145
-        if( !$dbman->field_exists($table, $field) ) {
146
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
145
+        if (!$dbman->field_exists($table, $field)) {
146
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
147 147
         }
148 148
         //// Add field presentation
149 149
         $field = new xmldb_field('presentation');
150 150
         $field->set_attributes(XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'timemodified');
151
-        if( !$dbman->field_exists($table, $field) ) {
152
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
151
+        if (!$dbman->field_exists($table, $field)) {
152
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
153 153
         }
154 154
         //// Add field type
155 155
         $field = new xmldb_field('type');
156 156
         $field->set_attributes(XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'course');
157
-        if( !$dbman->field_exists($table, $field) ) {
158
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
157
+        if (!$dbman->field_exists($table, $field)) {
158
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
159 159
         }
160 160
         //// Rename field timeavailable
161 161
         $field = new xmldb_field('timeavailable');
162 162
         $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0);
163
-        if( $dbman->field_exists($table, $field) ) {
164
-            $dbman->rename_field($table, $field, 'openingtime', $continue=true, $feedback=true);
163
+        if ($dbman->field_exists($table, $field)) {
164
+            $dbman->rename_field($table, $field, 'openingtime', $continue = true, $feedback = true);
165 165
         }
166 166
         //// Rename field timedue
167 167
         $field = new xmldb_field('timedue');
168 168
         $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0);
169
-        if( $dbman->field_exists($table, $field) ) {
170
-            $dbman->rename_field($table, $field, 'closingtime', $continue=true, $feedback=true);
169
+        if ($dbman->field_exists($table, $field)) {
170
+            $dbman->rename_field($table, $field, 'closingtime', $continue = true, $feedback = true);
171 171
         }
172 172
         //// Add field timecreated
173 173
         $field = new xmldb_field('timecreated');
174 174
         $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'closingtime');
175
-        if( !$dbman->field_exists($table, $field) ) {
176
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
175
+        if (!$dbman->field_exists($table, $field)) {
176
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
177 177
         }
178 178
         //// Add field userlimit
179 179
         $field = new xmldb_field('userlimit');
180 180
         $field->set_attributes(XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0);
181 181
         if (!$dbman->field_exists($table, $field)) {
182
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
182
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
183 183
         }
184 184
 
185 185
         // Update the bigbluebuttonbn_logs table
@@ -187,18 +187,18 @@  discard block
 block discarded – undo
187 187
         //// Add field userid
188 188
         $field = new xmldb_field('userid');
189 189
         $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'bigbluebuttonbnid');
190
-        if( !$dbman->field_exists($table, $field) ) {
191
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
190
+        if (!$dbman->field_exists($table, $field)) {
191
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
192 192
         }
193 193
         //// Add field meta
194 194
         $field = new xmldb_field('meta');
195 195
         $field->set_attributes(XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'event');
196
-        if( !$dbman->field_exists($table, $field) ) {
197
-            $dbman->add_field($table, $field, $continue=true, $feedback=true);
196
+        if (!$dbman->field_exists($table, $field)) {
197
+            $dbman->add_field($table, $field, $continue = true, $feedback = true);
198 198
         }
199 199
         //// Drop field recording
200 200
         $field = new xmldb_field('record');
201
-        if( $dbman->field_exists($table, $field) ) {
201
+        if ($dbman->field_exists($table, $field)) {
202 202
             //// Migrate data in field recording to new format in meta
203 203
             $meta = new \stdClass();
204 204
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             $DB->set_field('bigbluebuttonbn_logs', 'meta', json_encode($meta), array('event' => 'Create', 'record' => 0));
212 212
 
213 213
             // Drop field recording
214
-            $dbman->drop_field($table, $field, $continue=true, $feedback=true);
214
+            $dbman->drop_field($table, $field, $continue = true, $feedback = true);
215 215
         }
216 216
 
217 217
         upgrade_mod_savepoint(true, 2015063000, 'bigbluebuttonbn');
@@ -222,14 +222,14 @@  discard block
 block discarded – undo
222 222
         $table = new xmldb_table('bigbluebuttonbn');
223 223
         //// Drop field description
224 224
         $field = new xmldb_field('description');
225
-        if( $dbman->field_exists($table, $field) ) {
226
-            $dbman->drop_field($table, $field, $continue=true, $feedback=true);
225
+        if ($dbman->field_exists($table, $field)) {
226
+            $dbman->drop_field($table, $field, $continue = true, $feedback = true);
227 227
         }
228 228
         //// Change welcome, allow null
229 229
         $field = new xmldb_field('welcome');
230 230
         $field->set_attributes(XMLDB_TYPE_TEXT, null, null, null, null, null, null, null, 'type');
231
-        if( $dbman->field_exists($table, $field) ) {
232
-            $dbman->change_field_notnull($table, $field, $continue=true, $feedback=true);
231
+        if ($dbman->field_exists($table, $field)) {
232
+            $dbman->change_field_notnull($table, $field, $continue = true, $feedback = true);
233 233
         }
234 234
 
235 235
         // Update the bigbluebuttonbn_logs table
@@ -238,29 +238,29 @@  discard block
 block discarded – undo
238 238
         $field = new xmldb_field('userid');
239 239
         //$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'bigbluebuttonbnid');
240 240
         $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null, 'bigbluebuttonbnid');
241
-        if( $dbman->field_exists($table, $field) ) {
242
-            $dbman->change_field_notnull($table, $field, $continue=true, $feedback=true);
241
+        if ($dbman->field_exists($table, $field)) {
242
+            $dbman->change_field_notnull($table, $field, $continue = true, $feedback = true);
243 243
         }
244 244
 
245 245
         upgrade_mod_savepoint(true, 2015080605, 'bigbluebuttonbn');
246 246
     }
247 247
 
248
-    if ( $result && $oldversion < 2016011305 ) {
248
+    if ($result && $oldversion < 2016011305) {
249 249
         // Update the bigbluebuttonbn table
250 250
         $table = new xmldb_table('bigbluebuttonbn');
251 251
 
252 252
         // Define field type to be droped from bigbluebuttonbn
253 253
         $field = new xmldb_field('type');
254 254
         $field->set_attributes(XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'course');
255
-        if ( $dbman->field_exists($table, $field) ) {
256
-            $dbman->drop_field($table, $field, $continue=true, $feedback=true);
255
+        if ($dbman->field_exists($table, $field)) {
256
+            $dbman->drop_field($table, $field, $continue = true, $feedback = true);
257 257
         }
258 258
 
259 259
         // Make sure bigbluebuttonbn_logs table exists
260 260
         $table = new xmldb_table('bigbluebuttonbn_log');
261 261
         // Conditionally launch rename table for bigbluebuttonbn_logs
262 262
         if ($dbman->table_exists($table)) {
263
-            $dbman->rename_table($table, 'bigbluebuttonbn_logs', $continue=true, $feedback=true);
263
+            $dbman->rename_table($table, 'bigbluebuttonbn_logs', $continue = true, $feedback = true);
264 264
         }
265 265
 
266 266
         // Update the bigbluebuttonbn_logs table
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
         // Define field 'event' to be renamed
270 270
         $field = new xmldb_field('event');
271 271
         $field->set_attributes(XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null);
272
-        if ( $dbman->field_exists($table, $field) ) {
273
-            $dbman->rename_field($table, $field, 'log', $continue=true, $feedback=true);
272
+        if ($dbman->field_exists($table, $field)) {
273
+            $dbman->rename_field($table, $field, 'log', $continue = true, $feedback = true);
274 274
         }
275 275
 
276 276
         upgrade_mod_savepoint(true, 2016011305, 'bigbluebuttonbn');
Please login to merge, or discard this patch.
backup/moodle2/backup_bigbluebuttonbn_activity_task.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,14 +54,14 @@
 block discarded – undo
54 54
     static public function encode_content_links($content) {
55 55
         global $CFG;
56 56
 
57
-        $base = preg_quote($CFG->wwwroot.'/mod/bigbluebuttonbn','#');
57
+        $base = preg_quote($CFG->wwwroot . '/mod/bigbluebuttonbn', '#');
58 58
 
59 59
         //Link to the list of bigbluebuttonbns
60
-        $pattern = "#(".$base."\/index.php\?id\=)([0-9]+)#";
60
+        $pattern = "#(" . $base . "\/index.php\?id\=)([0-9]+)#";
61 61
         $content = preg_replace($pattern, '$@BIGBLUEBUTTONBNINDEX*$2@$', $content);
62 62
 
63 63
         //Link to bigbluebuttonbn view by moduleid
64
-        $pattern = "#(".$base."\/view.php\?id\=)([0-9]+)#";
64
+        $pattern = "#(" . $base . "\/view.php\?id\=)([0-9]+)#";
65 65
         $content = preg_replace($pattern, '$@BIGBLUEBUTTONBNVIEWBYID*$2@$', $content);
66 66
 
67 67
         return $content;
Please login to merge, or discard this patch.
backup/moodle2/backup_bigbluebuttonbn_stepslib.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,11 +36,11 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
bbb_view.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Switch Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -47,119 +47,119 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@  discard block
 block discarded – undo
8 8
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later
9 9
  */
10 10
 
11
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
12
-require_once(dirname(__FILE__).'/locallib.php');
11
+require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
12
+require_once(dirname(__FILE__) . '/locallib.php');
13 13
 
14
-$id = optional_param('id', 0, PARAM_INT);  // course_module ID, or
15
-$bn = optional_param('bn', 0, PARAM_INT);  // bigbluebuttonbn instance ID
14
+$id = optional_param('id', 0, PARAM_INT); // course_module ID, or
15
+$bn = optional_param('bn', 0, PARAM_INT); // bigbluebuttonbn instance ID
16 16
 $action = required_param('action', PARAM_TEXT);
17 17
 $name = optional_param('name', '', PARAM_TEXT);
18 18
 $description = optional_param('description', '', PARAM_TEXT);
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 require_login($course, true, $cm);
45 45
 
46
-if ( isset($SESSION) && isset($SESSION->bigbluebuttonbn_bbbsession)) {
46
+if (isset($SESSION) && isset($SESSION->bigbluebuttonbn_bbbsession)) {
47 47
     $bbbsession = $SESSION->bigbluebuttonbn_bbbsession;
48 48
 }
49 49
 switch (strtolower($action)) {
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         if (isset($errors) && $errors != '') {
52 52
           bigbluebutton_bbb_view_errors($errors, $id);
53 53
 
54
-        } else if ( isset($bbbsession) && !is_null($bbbsession) ) {
54
+        } else if (isset($bbbsession) && !is_null($bbbsession)) {
55 55
             /// Moodle event logger: Create an event for meeting left
56 56
             bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_LEFT, $bigbluebuttonbn, $context, $cm);
57 57
 
@@ -66,15 +66,15 @@  discard block
 block discarded – undo
66 66
         }
67 67
         break;
68 68
     case 'join':
69
-        if ( isset($bbbsession) && !is_null($bbbsession) ) {
69
+        if (isset($bbbsession) && !is_null($bbbsession)) {
70 70
             //See if the session is in progress
71
-            if( bigbluebuttonbn_isMeetingRunning( $bbbsession['meetingid'], $bbbsession['endpoint'], $bbbsession['shared_secret'] ) ) {
71
+            if (bigbluebuttonbn_isMeetingRunning($bbbsession['meetingid'], $bbbsession['endpoint'], $bbbsession['shared_secret'])) {
72 72
                 /// Since the meeting is already running, we just join the session
73 73
                 bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $context, $bigbluebuttonbn);
74 74
 
75 75
             } else {
76 76
                 // If user is administrator, moderator or if is viewer and no waiting is required
77
-                if( $bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait'] ) {
77
+                if ($bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait']) {
78 78
                     /// Prepare the metadata
79 79
                     $metadata = array("meta_bn-origin" => $bbbsession['origin'],
80 80
                             "meta_bbb-origin-version" => $bbbsession['originVersion'],
@@ -82,20 +82,20 @@  discard block
 block discarded – undo
82 82
                             "meta_bbb-origin-server-common-name" => $bbbsession['originServerCommonName'],
83 83
                             "meta_bbb-origin-tag" => $bbbsession['originTag'],
84 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'],
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 88
                     );
89 89
 
90
-                    if ( bigbluebuttonbn_server_offers_bn_capabilities() && bigbluebuttonbn_get_cfg_recordingready_enabled() ) {
90
+                    if (bigbluebuttonbn_server_offers_bn_capabilities() && bigbluebuttonbn_get_cfg_recordingready_enabled()) {
91 91
                         $metadata["meta_bn-recording-ready-url"] = $bbbsession['recordingReadyURL'];
92 92
                     }
93 93
 
94 94
                     /// Set the duration for the meeting
95
-                    if ( bigbluebuttonbn_get_cfg_scheduled_duration_enabled() ) {
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
                     } else {
100 100
                         $durationtime = 0;
101 101
                     }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
                             $bbbsession['shared_secret'],
110 110
                             $bbbsession['endpoint'],
111 111
                             $bbbsession['logoutURL'],
112
-                            $bbbsession['record']? 'true': 'false',
112
+                            $bbbsession['record'] ? 'true' : 'false',
113 113
                             $durationtime,
114 114
                             $bbbsession['voicebridge'],
115 115
                             $bbbsession['userlimit'],
@@ -120,25 +120,25 @@  discard block
 block discarded – undo
120 120
 
121 121
                     if (!$response) {
122 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' );
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 127
                         } else {
128
-                            print_error( 'view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' );
128
+                            print_error('view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
129 129
                         }
130 130
 
131
-                    } else if( $response['returncode'] == "FAILED" ) {
131
+                    } else if ($response['returncode'] == "FAILED") {
132 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' );
133
+                        $error_key = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create');
134
+                        if (!$error_key) {
135
+                            print_error($response['message'], 'bigbluebuttonbn');
136 136
                         } else {
137
-                            print_error( $error_key, 'bigbluebuttonbn' );
137
+                            print_error($error_key, 'bigbluebuttonbn');
138 138
                         }
139 139
 
140
-                    } else if ($response['hasBeenForciblyEnded'] == "true"){
141
-                        print_error( get_string( 'index_error_forciblyended', 'bigbluebuttonbn' ));
140
+                    } else if ($response['hasBeenForciblyEnded'] == "true") {
141
+                        print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn'));
142 142
 
143 143
                     } else { ///////////////Everything is ok /////////////////////
144 144
                         /// Moodle event logger: Create an event for meeting created
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
                     }
151 151
 
152 152
                 } else {
153
-                    header('Location: '.$bbbsession['logoutURL'] );
153
+                    header('Location: ' . $bbbsession['logoutURL']);
154 154
                 }
155 155
             }
156 156
 
157 157
         } else {
158
-            print_error( 'view_error_unable_join', 'bigbluebuttonbn' );
158
+            print_error('view_error_unable_join', 'bigbluebuttonbn');
159 159
         }
160 160
         break;
161 161
     default:
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 function bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $context, $bigbluebuttonbn) {
180 180
     //// Update the cache
181 181
     $meeting_info = bigbluebuttonbn_bbb_broker_get_meeting_info($bbbsession['meetingid'], $bbbsession['modPW'], true);
182
-    if( $bbbsession['userlimit'] == 0 || intval($meeting_info['participantCount']) < $bbbsession['userlimit']  ) {
182
+    if ($bbbsession['userlimit'] == 0 || intval($meeting_info['participantCount']) < $bbbsession['userlimit']) {
183 183
         //// Build the URL
184
-        if( $bbbsession['administrator'] || $bbbsession['moderator'] ) {
184
+        if ($bbbsession['administrator'] || $bbbsession['moderator']) {
185 185
             $password = $bbbsession['modPW'];
186 186
         } else {
187 187
             $password = $bbbsession['viewerPW'];
@@ -192,25 +192,25 @@  discard block
 block discarded – undo
192 192
         /// Internal logger: Instert a record with the meeting created
193 193
         bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_JOIN);
194 194
         //// Before executing the redirect, increment the number of participants
195
-        bigbluebuttonbn_bbb_broker_participant_joined($bbbsession['meetingid'], ($bbbsession['administrator'] || $bbbsession['moderator']) );
195
+        bigbluebuttonbn_bbb_broker_participant_joined($bbbsession['meetingid'], ($bbbsession['administrator'] || $bbbsession['moderator']));
196 196
         //// Execute the redirect
197
-        header('Location: '.$join_url );
197
+        header('Location: ' . $join_url);
198 198
 
199 199
     } else {
200
-        header('Location: '.$bbbsession['logoutURL'] );
200
+        header('Location: ' . $bbbsession['logoutURL']);
201 201
     }
202 202
 }
203 203
 
204 204
 function bigbluebutton_bbb_view_errors($sErrors, $id) {
205 205
     global $CFG, $OUTPUT, $PAGE;
206 206
 
207
-    $errors = (array) json_decode(urldecode($sErrors));
207
+    $errors = (array)json_decode(urldecode($sErrors));
208 208
     $msgErrors = "";
209 209
     foreach ($errors as $error) {
210 210
         $msgErrors .= html_writer::tag('p', $error->{"message"}, array('class' => 'alert alert-danger')) . "\n";
211 211
     }
212 212
 
213 213
     echo $OUTPUT->header();
214
-    print_error( 'view_error_bigbluebutton', 'bigbluebuttonbn', $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$id, $msgErrors, $sErrors );
214
+    print_error('view_error_bigbluebutton', 'bigbluebuttonbn', $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $id, $msgErrors, $sErrors);
215 215
     echo $OUTPUT->footer();
216 216
 }
Please login to merge, or discard this patch.
mod_form.php 1 patch
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
@@ -180,84 +180,84 @@  discard block
 block discarded – undo
180 180
         $mform->addElement('hidden', 'participants', json_encode($participant_list));
181 181
         $mform->setType('participants', PARAM_TEXT);
182 182
 
183
-        $html_participant_selection = ''.
184
-             '<div id="fitem_bigbluebuttonbn_participant_selection" class="fitem fitem_fselect">'."\n".
185
-             '  <div class="fitemtitle">'."\n".
186
-             '    <label for="bigbluebuttonbn_participant_selectiontype">'.get_string('mod_form_field_participant_add', 'bigbluebuttonbn').' </label>'."\n".
187
-             '  </div>'."\n".
188
-             '  <div class="felement fselect">'."\n".
189
-             '    <select id="bigbluebuttonbn_participant_selection_type" onchange="bigbluebuttonbn_participant_selection_set(); return 0;">'."\n".
190
-             '      <option value="all" selected="selected">'.get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn').'</option>'."\n".
191
-             '      <option value="role">'.get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn').'</option>'."\n".
192
-             '      <option value="user">'.get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn').'</option>'."\n".
193
-             '    </select>'."\n".
194
-             '    &nbsp;&nbsp;'."\n".
195
-             '    <select id="bigbluebuttonbn_participant_selection" disabled="disabled">'."\n".
196
-             '      <option value="all" selected="selected">---------------</option>'."\n".
197
-             '    </select>'."\n".
198
-             '    &nbsp;&nbsp;'."\n".
199
-             '    <input value="'.get_string('mod_form_field_participant_list_action_add', 'bigbluebuttonbn').'" type="button" id="id_addselectionid" onclick="bigbluebuttonbn_participant_add(); return 0;" />'."\n".
200
-             '  </div>'."\n".
201
-             '</div>'."\n".
202
-             '<div id="fitem_bigbluebuttonbn_participant_list" class="fitem">'."\n".
203
-             '  <div class="fitemtitle">'."\n".
204
-             '    <label for="bigbluebuttonbn_participant_list">'.get_string('mod_form_field_participant_list', 'bigbluebuttonbn').' </label>'."\n".
205
-             '  </div>'."\n".
206
-             '  <div class="felement fselect">'."\n".
207
-             '    <table id="participant_list_table">'."\n";
183
+        $html_participant_selection = '' .
184
+             '<div id="fitem_bigbluebuttonbn_participant_selection" class="fitem fitem_fselect">' . "\n" .
185
+             '  <div class="fitemtitle">' . "\n" .
186
+             '    <label for="bigbluebuttonbn_participant_selectiontype">' . get_string('mod_form_field_participant_add', 'bigbluebuttonbn') . ' </label>' . "\n" .
187
+             '  </div>' . "\n" .
188
+             '  <div class="felement fselect">' . "\n" .
189
+             '    <select id="bigbluebuttonbn_participant_selection_type" onchange="bigbluebuttonbn_participant_selection_set(); return 0;">' . "\n" .
190
+             '      <option value="all" selected="selected">' . get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn') . '</option>' . "\n" .
191
+             '      <option value="role">' . get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn') . '</option>' . "\n" .
192
+             '      <option value="user">' . get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn') . '</option>' . "\n" .
193
+             '    </select>' . "\n" .
194
+             '    &nbsp;&nbsp;' . "\n" .
195
+             '    <select id="bigbluebuttonbn_participant_selection" disabled="disabled">' . "\n" .
196
+             '      <option value="all" selected="selected">---------------</option>' . "\n" .
197
+             '    </select>' . "\n" .
198
+             '    &nbsp;&nbsp;' . "\n" .
199
+             '    <input value="' . get_string('mod_form_field_participant_list_action_add', 'bigbluebuttonbn') . '" type="button" id="id_addselectionid" onclick="bigbluebuttonbn_participant_add(); return 0;" />' . "\n" .
200
+             '  </div>' . "\n" .
201
+             '</div>' . "\n" .
202
+             '<div id="fitem_bigbluebuttonbn_participant_list" class="fitem">' . "\n" .
203
+             '  <div class="fitemtitle">' . "\n" .
204
+             '    <label for="bigbluebuttonbn_participant_list">' . get_string('mod_form_field_participant_list', 'bigbluebuttonbn') . ' </label>' . "\n" .
205
+             '  </div>' . "\n" .
206
+             '  <div class="felement fselect">' . "\n" .
207
+             '    <table id="participant_list_table">' . "\n";
208 208
 
209 209
         // Add participant list
210
-        foreach($participant_list as $participant){
210
+        foreach ($participant_list as $participant) {
211 211
             $participant_selectionid = '';
212 212
             $participant_selectiontype = $participant['selectiontype'];
213
-            if( $participant_selectiontype == 'all') {
214
-                $participant_selectiontype = '<b><i>'.get_string('mod_form_field_participant_list_type_'.$participant_selectiontype, 'bigbluebuttonbn').'</i></b>';
213
+            if ($participant_selectiontype == 'all') {
214
+                $participant_selectiontype = '<b><i>' . get_string('mod_form_field_participant_list_type_' . $participant_selectiontype, 'bigbluebuttonbn') . '</i></b>';
215 215
             } else {
216
-                if ( $participant_selectiontype == 'role') {
216
+                if ($participant_selectiontype == 'role') {
217 217
                     $participant_selectionid = bigbluebuttonbn_get_role_name($participant['selectionid']);
218 218
                 } else {
219
-                    foreach($users as $user){
220
-                        if( $user->id == $participant['selectionid']) {
221
-                            $participant_selectionid = $user->firstname.' '.$user->lastname;
219
+                    foreach ($users as $user) {
220
+                        if ($user->id == $participant['selectionid']) {
221
+                            $participant_selectionid = $user->firstname . ' ' . $user->lastname;
222 222
                             break;
223 223
                         }
224 224
                     }
225 225
                 }
226
-                $participant_selectiontype = '<b><i>'.get_string('mod_form_field_participant_list_type_'.$participant_selectiontype, 'bigbluebuttonbn').':</i></b>&nbsp;';
226
+                $participant_selectiontype = '<b><i>' . get_string('mod_form_field_participant_list_type_' . $participant_selectiontype, 'bigbluebuttonbn') . ':</i></b>&nbsp;';
227 227
             }
228
-            $participant_role = get_string('mod_form_field_participant_bbb_role_'.$participant['role'], 'bigbluebuttonbn');
229
-
230
-            $html_participant_selection .= ''.
231
-                '      <tr id="participant_list_tr_'.$participant['selectiontype'].'-'.$participant['selectionid'].'">'."\n".
232
-                '        <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".
233
-                '        <td width="125px">'.$participant_selectiontype.'</td>'."\n".
234
-                '        <td>'.$participant_selectionid.'</td>'."\n".
235
-                '        <td><i>&nbsp;'.get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn').'&nbsp;</i>'."\n".
236
-                '          <select id="participant_list_role_'.$participant['selectiontype'].'-'.$participant['selectionid'].'" onchange="bigbluebuttonbn_participant_list_role_update(\''.$participant['selectiontype'].'\', \''.$participant['selectionid'].'\'); return 0;">'."\n".
237
-                '            <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".
238
-                '            <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".
239
-                '        </td>'."\n".
240
-                '      </tr>'."\n";
228
+            $participant_role = get_string('mod_form_field_participant_bbb_role_' . $participant['role'], 'bigbluebuttonbn');
229
+
230
+            $html_participant_selection .= '' .
231
+                '      <tr id="participant_list_tr_' . $participant['selectiontype'] . '-' . $participant['selectionid'] . '">' . "\n" .
232
+                '        <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" .
233
+                '        <td width="125px">' . $participant_selectiontype . '</td>' . "\n" .
234
+                '        <td>' . $participant_selectionid . '</td>' . "\n" .
235
+                '        <td><i>&nbsp;' . get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn') . '&nbsp;</i>' . "\n" .
236
+                '          <select id="participant_list_role_' . $participant['selectiontype'] . '-' . $participant['selectionid'] . '" onchange="bigbluebuttonbn_participant_list_role_update(\'' . $participant['selectiontype'] . '\', \'' . $participant['selectionid'] . '\'); return 0;">' . "\n" .
237
+                '            <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" .
238
+                '            <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" .
239
+                '        </td>' . "\n" .
240
+                '      </tr>' . "\n";
241 241
         }
242 242
 
243
-        $html_participant_selection .= ''.
244
-             '    </table>'."\n".
245
-             '  </div>'."\n".
246
-             '</div>'."\n".
247
-             '<script type="text/javascript" src="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/mod_form.js">'."\n".
248
-             '</script>'."\n";
243
+        $html_participant_selection .= '' .
244
+             '    </table>' . "\n" .
245
+             '  </div>' . "\n" .
246
+             '</div>' . "\n" .
247
+             '<script type="text/javascript" src="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/mod_form.js">' . "\n" .
248
+             '</script>' . "\n";
249 249
 
250 250
         $mform->addElement('html', $html_participant_selection);
251 251
 
252 252
         // Add data
253
-        $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_selection = {"all": [], "role": '.json_encode($roles).', "user": '.bigbluebuttonbn_get_users_json($users).'}; </script>');
254
-        $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_list = '.json_encode($participant_list).'; </script>');
255
-        $bigbluebuttonbn_strings = Array( "as" => get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn'),
253
+        $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_selection = {"all": [], "role": ' . json_encode($roles) . ', "user": ' . bigbluebuttonbn_get_users_json($users) . '}; </script>');
254
+        $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_list = ' . json_encode($participant_list) . '; </script>');
255
+        $bigbluebuttonbn_strings = Array("as" => get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn'),
256 256
                                           "viewer" => get_string('mod_form_field_participant_bbb_role_viewer', 'bigbluebuttonbn'),
257 257
                                           "moderator" => get_string('mod_form_field_participant_bbb_role_moderator', 'bigbluebuttonbn'),
258 258
                                           "remove" => get_string('mod_form_field_participant_list_action_remove', 'bigbluebuttonbn'),
259 259
                                     );
260
-        $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_strings = '.json_encode($bigbluebuttonbn_strings).'; </script>');
260
+        $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_strings = ' . json_encode($bigbluebuttonbn_strings) . '; </script>');
261 261
         //-------------------------------------------------------------------------------
262 262
         // Third block ends here
263 263
         //-------------------------------------------------------------------------------
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         // Fourth block starts here
268 268
         //-------------------------------------------------------------------------------
269 269
         $mform->addElement('header', 'schedule', get_string('mod_form_block_schedule', 'bigbluebuttonbn'));
270
-        if( isset($current_activity->openingtime) && $current_activity->openingtime != 0 || isset($current_activity->closingtime) && $current_activity->closingtime != 0 )
270
+        if (isset($current_activity->openingtime) && $current_activity->openingtime != 0 || isset($current_activity->closingtime) && $current_activity->closingtime != 0)
271 271
             $mform->setExpanded('schedule');
272 272
 
273 273
         $mform->addElement('date_time_selector', 'openingtime', get_string('mod_form_field_openingtime', 'bigbluebuttonbn'), array('optional' => true));
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
                 $draftitemid = file_get_submitted_draft_itemid('presentation');
296 296
                 file_prepare_draft_area($draftitemid, $this->context->id, 'mod_bigbluebuttonbn', 'presentation', 0, array('subdirs'=>0, 'maxbytes' => 0, 'maxfiles' => 1, 'mainfile' => true));
297 297
                 $default_values['presentation'] = $draftitemid;
298
-            } catch (Exception $e){
299
-                error_log("Presentation could not be loaded: ".$e->getMessage());
298
+            } catch (Exception $e) {
299
+                error_log("Presentation could not be loaded: " . $e->getMessage());
300 300
                 return NULL;
301 301
             }
302 302
         }
@@ -305,14 +305,14 @@  discard block
 block discarded – undo
305 305
     function validation($data, $files) {
306 306
         $errors = parent::validation($data, $files);
307 307
 
308
-        if ( isset($data['openingtime']) && isset($data['closingtime']) ) {
309
-            if ( $data['openingtime'] != 0 && $data['closingtime'] != 0 && $data['closingtime'] < $data['openingtime']) {
308
+        if (isset($data['openingtime']) && isset($data['closingtime'])) {
309
+            if ($data['openingtime'] != 0 && $data['closingtime'] != 0 && $data['closingtime'] < $data['openingtime']) {
310 310
                 $errors['closingtime'] = get_string('bbbduetimeoverstartingtime', 'bigbluebuttonbn');
311 311
             }
312 312
         }
313 313
         
314
-        if ( isset($data['voicebridge']) ) {
315
-            if ( !bigbluebuttonbn_voicebridge_unique($data['voicebridge'], $data['instance'])) {
314
+        if (isset($data['voicebridge'])) {
315
+            if (!bigbluebuttonbn_voicebridge_unique($data['voicebridge'], $data['instance'])) {
316 316
                 $errors['voicebridge'] = get_string('mod_form_field_voicebridge_notunique_error', 'bigbluebuttonbn');
317 317
             }
318 318
         }
Please login to merge, or discard this patch.
bbb_broker.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -8,15 +8,15 @@  discard block
 block discarded – undo
8 8
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later
9 9
  */
10 10
 
11
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
12
-require_once(dirname(__FILE__).'/locallib.php');
11
+require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
12
+require_once(dirname(__FILE__) . '/locallib.php');
13 13
 
14 14
 global $PAGE, $USER, $CFG, $SESSION, $DB;
15 15
 
16
-$params['action']  = optional_param('action', '', PARAM_TEXT);
16
+$params['action'] = optional_param('action', '', PARAM_TEXT);
17 17
 $params['callback'] = optional_param('callback', '', PARAM_TEXT);
18
-$params['id'] = optional_param('id', '', PARAM_TEXT);    //recordID, the BBB recordID
19
-$params['idx'] = optional_param('idx', '', PARAM_TEXT);  //meetingID, the BBB meetingID
18
+$params['id'] = optional_param('id', '', PARAM_TEXT); //recordID, the BBB recordID
19
+$params['idx'] = optional_param('idx', '', PARAM_TEXT); //meetingID, the BBB meetingID
20 20
 $params['bigbluebuttonbn'] = optional_param('bigbluebuttonbn', 0, PARAM_INT);
21 21
 $params['signed_parameters'] = optional_param('signed_parameters', '', PARAM_TEXT);
22 22
 
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
 
26 26
 $error = '';
27 27
 
28
-if( empty($params['action']) ) {
28
+if (empty($params['action'])) {
29 29
     $error = bigbluebuttonbn_bbb_broker_add_error($error, "Parameter [action] was not included");
30 30
 
31 31
 } else {
32 32
     $error = bigbluebuttonbn_bbb_broker_validate_parameters($params);
33 33
 
34
-    if( empty($error) && $params['action'] != "recording_ready" ) {
34
+    if (empty($error) && $params['action'] != "recording_ready") {
35 35
 
36 36
         if ($params['bigbluebuttonbn'] != 0) {
37 37
             $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $params['bigbluebuttonbn']), '*', MUST_EXIST);
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
             $context = bigbluebuttonbn_get_context_module($cm->id);
41 41
         }
42 42
 
43
-        if ( isset($SESSION->bigbluebuttonbn_bbbsession) && !is_null($SESSION->bigbluebuttonbn_bbbsession) ) {
43
+        if (isset($SESSION->bigbluebuttonbn_bbbsession) && !is_null($SESSION->bigbluebuttonbn_bbbsession)) {
44 44
             $bbbsession = $SESSION->bigbluebuttonbn_bbbsession;
45 45
         } else {
46 46
             $error = bigbluebuttonbn_bbb_broker_add_error($error, "No session variable set");
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 }
50 50
 
51 51
 header('Content-Type: application/javascript; charset=utf-8');
52
-if ( empty($error) ) {
52
+if (empty($error)) {
53 53
 
54 54
     if (!isloggedin() && $PAGE->course->id == SITEID) {
55 55
         $userid = guest_user()->id;
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
     }
59 59
     $hascourseaccess = ($PAGE->course->id == SITEID) || can_access_course($PAGE->course, $userid);
60 60
 
61
-    if( !$hascourseaccess ){
61
+    if (!$hascourseaccess) {
62 62
         header("HTTP/1.0 401 Unauthorized");
63 63
         return;
64 64
     } else {
65 65
         try {
66
-            switch ( strtolower($params['action']) ){
66
+            switch (strtolower($params['action'])) {
67 67
                 case 'meeting_info':
68 68
                     $meeting_info = bigbluebuttonbn_bbb_broker_get_meeting_info($params['id'], $bbbsession['modPW']);
69 69
                     $meeting_running = bigbluebuttonbn_bbb_broker_is_meeting_running($meeting_info); 
70 70
 
71 71
                     $status_can_end = '';
72 72
                     $status_can_tag = '';
73
-                    if( $meeting_running ) {
73
+                    if ($meeting_running) {
74 74
                         $join_button_text = get_string('view_conference_action_join', 'bigbluebuttonbn');
75
-                        if( $bbbsession['userlimit'] == 0 || $meeting_info->participantCount < $bbbsession['userlimit'] ) {
75
+                        if ($bbbsession['userlimit'] == 0 || $meeting_info->participantCount < $bbbsession['userlimit']) {
76 76
                             $initial_message = get_string('view_message_conference_in_progress', 'bigbluebuttonbn');
77 77
                             $can_join = true;
78 78
 
@@ -81,50 +81,50 @@  discard block
 block discarded – undo
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
-                        if ( $bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait'] ) {
92
+                        if ($bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait']) {
93 93
                             $initial_message = get_string('view_message_conference_room_ready', 'bigbluebuttonbn');
94 94
                             $join_button_text = get_string('view_conference_action_join', '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
                             $join_button_text = get_string('view_conference_action_lineup', 'bigbluebuttonbn');
103 103
                             $can_join = false;
104 104
                         }
105 105
 
106
-                        if( $bbbsession['tagging'] && ($bbbsession['administrator'] || $bbbsession['moderator']) ) {
106
+                        if ($bbbsession['tagging'] && ($bbbsession['administrator'] || $bbbsession['moderator'])) {
107 107
                             $can_tag = true;
108 108
 
109 109
                         } else {
110 110
                             $can_tag = false;
111 111
                         }
112
-                        $status_can_end = '"can_tag": '.($can_tag? 'true': 'false').', ';
112
+                        $status_can_end = '"can_tag": ' . ($can_tag ? 'true' : 'false') . ', ';
113 113
                     }
114 114
 
115
-                    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
+                    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 . '"} });';
116 116
                     break;
117 117
                 case 'meeting_end':
118
-                    if( $bbbsession['administrator'] || $bbbsession['moderator'] ) {
118
+                    if ($bbbsession['administrator'] || $bbbsession['moderator']) {
119 119
                         //Execute the end command
120 120
                         $meeting_info = bigbluebuttonbn_bbb_broker_do_end_meeting($params['id'], $bbbsession['modPW']);
121 121
                         // Moodle event logger: Create an event for meeting ended
122
-                        if( isset($bigbluebuttonbn) )
122
+                        if (isset($bigbluebuttonbn))
123 123
                             bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_ENDED, $bigbluebuttonbn, $context, $cm);
124 124
                         // Update the cache
125 125
                         $meeting_info = bigbluebuttonbn_bbb_broker_get_meeting_info($params['id'], $bbbsession['modPW'], true);
126 126
 
127
-                        echo $params['callback'].'({ "status": true });';
127
+                        echo $params['callback'] . '({ "status": true });';
128 128
                     } else {
129 129
                         error_log("ERROR: User not authorized to execute end command");
130 130
                         header("HTTP/1.0 401 Unauthorized. User not authorized to execute end command");
@@ -133,26 +133,26 @@  discard block
 block discarded – undo
133 133
                 case 'recording_list':
134 134
                     break;
135 135
                 case 'recording_info':
136
-                    if( $bbbsession['managerecordings'] ) {
136
+                    if ($bbbsession['managerecordings']) {
137 137
                         //Retrieve the array of imported recordings
138
-                        $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn'])?$bbbsession['bigbluebuttonbn']->id: NULL);
138
+                        $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn']) ? $bbbsession['bigbluebuttonbn']->id : NULL);
139 139
                         $recordings_indexed = bigbluebuttonbn_index_recordings($recordings_imported);
140
-                        if( isset($recordings_indexed[$params['id']]) ) {
140
+                        if (isset($recordings_indexed[$params['id']])) {
141 141
                             //Look up for an update on the imported recording
142 142
                             $recording = $recordings_indexed[$params['id']];
143
-                            if ( isset($recording) && !empty($recording) && !array_key_exists('messageKey', $recording)) {  // The recording was found
144
-                                echo $params['callback'].'({ "status": "true", "published": "'.$recording['published'].'"});';
143
+                            if (isset($recording) && !empty($recording) && !array_key_exists('messageKey', $recording)) {  // The recording was found
144
+                                echo $params['callback'] . '({ "status": "true", "published": "' . $recording['published'] . '"});';
145 145
                             } else {
146
-                                echo $params['callback'].'({ "status": "false" });';
146
+                                echo $params['callback'] . '({ "status": "false" });';
147 147
                             }
148 148
 
149 149
                         // As the recordingid was not identified as imported recording link, look up for a real recording
150 150
                         } else {
151 151
                             $recording = bigbluebuttonbn_getRecordingArray($params['id'], $params['idx'], $endpoint, $shared_secret);
152
-                            if ( isset($recording) && !empty($recording) && !array_key_exists('messageKey', $recording)) {  // The recording was found
153
-                                echo $params['callback'].'({ "status": "true", "published": "'.$recording['published'].'"});';
152
+                            if (isset($recording) && !empty($recording) && !array_key_exists('messageKey', $recording)) {  // The recording was found
153
+                                echo $params['callback'] . '({ "status": "true", "published": "' . $recording['published'] . '"});';
154 154
                             } else {
155
-                                echo $params['callback'].'({ "status": "false" });';
155
+                                echo $params['callback'] . '({ "status": "false" });';
156 156
                             }
157 157
                         }
158 158
 
@@ -162,16 +162,16 @@  discard block
 block discarded – undo
162 162
                     }
163 163
                     break;
164 164
                 case 'recording_publish':
165
-                    if( $bbbsession['managerecordings'] ) {
165
+                    if ($bbbsession['managerecordings']) {
166 166
                         $status = true;
167 167
                         //Retrieve the array of imported recordings for the current course and activity
168
-                        $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn'])?$bbbsession['bigbluebuttonbn']->id: NULL);
168
+                        $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn']) ? $bbbsession['bigbluebuttonbn']->id : NULL);
169 169
                         $recordings_imported_indexed = bigbluebuttonbn_index_recordings($recordings_imported);
170
-                        if( isset($recordings_imported_indexed[$params['id']]) ) {
170
+                        if (isset($recordings_imported_indexed[$params['id']])) {
171 171
                             $recordings = bigbluebuttonbn_getRecordingsArray($recordings_imported_indexed[$params['id']]['meetingID'], $bbbsession['endpoint'], $bbbsession['shared_secret']);
172 172
                             $recordings_indexed = bigbluebuttonbn_index_recordings($recordings);
173 173
                             $recording = $recordings_indexed[$params['id']];
174
-                            if ( $recording['published'] === 'true' ) {
174
+                            if ($recording['published'] === 'true') {
175 175
                                 // Only if the physical recording is published, execute publish on imported recording link
176 176
                                 $meeting_info = bigbluebuttonbn_bbb_broker_do_publish_recording_imported($params['id'], $bbbsession['course']->id, $bbbsession['bigbluebuttonbn']->id, true);
177 177
                             } else {
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
                             $meeting_info = bigbluebuttonbn_bbb_broker_do_publish_recording($params['id'], true);
184 184
                         }
185 185
 
186
-                        if ( $status ) {
186
+                        if ($status) {
187 187
                             $callback_response['status'] = "true";
188 188
 
189 189
                             // Moodle event logger: Create an event for recording published
190
-                            if( isset($bigbluebuttonbn) ) {
190
+                            if (isset($bigbluebuttonbn)) {
191 191
                                 bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED, $bigbluebuttonbn, $context, $cm);
192 192
                             }
193 193
 
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
                     }
206 206
                     break;
207 207
                 case 'recording_unpublish':
208
-                    if( $bbbsession['managerecordings'] ) {
208
+                    if ($bbbsession['managerecordings']) {
209 209
                         //Retrieve the array of imported recordings for the current course and activity
210
-                        $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn'])?$bbbsession['bigbluebuttonbn']->id: NULL);
210
+                        $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn']) ? $bbbsession['bigbluebuttonbn']->id : NULL);
211 211
                         $recordings_indexed = bigbluebuttonbn_index_recordings($recordings_imported);
212
-                        if( isset($recordings_indexed[$params['id']]) ) {
212
+                        if (isset($recordings_indexed[$params['id']])) {
213 213
                             // Execute unpublish on imported recording link
214 214
                             $meeting_info = bigbluebuttonbn_bbb_broker_do_publish_recording_imported($params['id'], $bbbsession['course']->id, $bbbsession['bigbluebuttonbn']->id, false);
215 215
                         } else {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
                             // First: Unpublish imported links associated to the recording 
218 218
                             $recordings_imported_all = bigbluebuttonbn_getRecordingsImportedAllInstances($params['id']);
219 219
 
220
-                            if( count($recordings_imported_all) > 0 ) {
220
+                            if (count($recordings_imported_all) > 0) {
221 221
                                 foreach ($recordings_imported_all as $key => $record) {
222 222
                                     $meta = json_decode($record->meta, true);
223 223
                                     // Prepare data for the update
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
                         }
234 234
 
235 235
                         // Moodle event logger: Create an event for recording unpublished
236
-                        if( isset($bigbluebuttonbn) ) {
236
+                        if (isset($bigbluebuttonbn)) {
237 237
                             bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED, $bigbluebuttonbn, $context, $cm);
238 238
                         }
239 239
 
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
                     }
248 248
                     break;
249 249
                 case 'recording_delete':
250
-                    if( $bbbsession['managerecordings'] ) {
250
+                    if ($bbbsession['managerecordings']) {
251 251
                         //Retrieve the array of imported recordings
252
-                        $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn'])?$bbbsession['bigbluebuttonbn']->id: NULL);
252
+                        $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn']) ? $bbbsession['bigbluebuttonbn']->id : NULL);
253 253
                         $recordings_indexed = bigbluebuttonbn_index_recordings($recordings_imported);
254
-                        if( isset($recordings_indexed[$params['id']]) ) {
254
+                        if (isset($recordings_indexed[$params['id']])) {
255 255
                             // Execute unpublish on imported recording link
256 256
                             bigbluebuttonbn_bbb_broker_do_delete_recording_imported($params['id'], $bbbsession['course']->id, $bbbsession['bigbluebuttonbn']->id);
257 257
                         } else {
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
                             // First: Delete imported links associated to the recording 
260 260
                             $recordings_imported_all = bigbluebuttonbn_getRecordingsImportedAllInstances($params['id']);
261 261
 
262
-                            if( count($recordings_imported_all) > 0 ) {
262
+                            if (count($recordings_imported_all) > 0) {
263 263
                                 foreach ($recordings_imported_all as $key => $record) {
264 264
                                     // Execute delete
265 265
                                     $DB->delete_records("bigbluebuttonbn_logs", array('id' => $key));
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
                         }
271 271
 
272 272
                         // Moodle event logger: Create an event for recording deleted
273
-                        if( isset($bigbluebuttonbn) ) {
273
+                        if (isset($bigbluebuttonbn)) {
274 274
                             bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_DELETED, $bigbluebuttonbn, $context, $cm);
275 275
                         }
276 276
 
@@ -289,9 +289,9 @@  discard block
 block discarded – undo
289 289
                         $decoded_parameters = JWT::decode($params['signed_parameters'], $shared_secret, array('HS256'));
290 290
 
291 291
                     } catch (Exception $e) {
292
-                        $error = 'Caught exception: '.$e->getMessage();
292
+                        $error = 'Caught exception: ' . $e->getMessage();
293 293
                         error_log($error);
294
-                        header("HTTP/1.0 400 Bad Request. ".$error);
294
+                        header("HTTP/1.0 400 Bad Request. " . $error);
295 295
                         return;
296 296
                     }
297 297
 
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
                         $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $meeting_id_elements[2]), '*', MUST_EXIST);
303 303
 
304 304
                     } catch (Exception $e) {
305
-                        $error = 'Caught exception: '.$e->getMessage();
305
+                        $error = 'Caught exception: ' . $e->getMessage();
306 306
                         error_log($error);
307
-                        header("HTTP/1.0 410 Gone. ".$error);
307
+                        header("HTTP/1.0 410 Gone. " . $error);
308 308
                         return;
309 309
                     }
310 310
 
@@ -314,22 +314,22 @@  discard block
 block discarded – undo
314 314
                         header("HTTP/1.0 202 Accepted");
315 315
                         return;
316 316
                     } catch (Exception $e) {
317
-                        $error = 'Caught exception: '.$e->getMessage();
317
+                        $error = 'Caught exception: ' . $e->getMessage();
318 318
                         error_log($error);
319
-                        header("HTTP/1.0 503 Service Unavailable. ".$error);
319
+                        header("HTTP/1.0 503 Service Unavailable. " . $error);
320 320
                         return;
321 321
                     }
322 322
                     break;
323 323
                 case 'recording_import':
324
-                    if( $bbbsession['managerecordings'] ) {
324
+                    if ($bbbsession['managerecordings']) {
325 325
                         $importrecordings = $SESSION->bigbluebuttonbn_importrecordings;
326
-                        if( isset($importrecordings[$params['id']]) ) {
326
+                        if (isset($importrecordings[$params['id']])) {
327 327
                             $importrecordings[$params['id']]['imported'] = true;
328 328
                             $overrides['meetingid'] = $importrecordings[$params['id']]['meetingID'];
329
-                            $meta = '{"recording":'.json_encode($importrecordings[$params['id']]).'}';
329
+                            $meta = '{"recording":' . json_encode($importrecordings[$params['id']]) . '}';
330 330
                             bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_IMPORT, $overrides, $meta);
331 331
                             // Moodle event logger: Create an event for recording imported
332
-                            if( isset($bigbluebuttonbn) ) {
332
+                            if (isset($bigbluebuttonbn)) {
333 333
                                 bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED, $bigbluebuttonbn, $context, $cm);
334 334
                             }
335 335
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
                         } else {
341 341
                             $error = "Recording {$params['id']} could not be found. It can not be imported";
342 342
                             error_log($error);
343
-                            header("HTTP/1.0 404 Not found. ".$error);
343
+                            header("HTTP/1.0 404 Not found. " . $error);
344 344
                             return;
345 345
                         }
346 346
                     }
@@ -351,14 +351,14 @@  discard block
 block discarded – undo
351 351
                     break;
352 352
             }
353 353
 
354
-        } catch(Exception $e) {
355
-            error_log("BBB_BROKER ERROR: ".$e->getCode().", ".$e->getMessage());
356
-            header("HTTP/1.0 502 Bad Gateway. ".$e->getMessage());
354
+        } catch (Exception $e) {
355
+            error_log("BBB_BROKER ERROR: " . $e->getCode() . ", " . $e->getMessage());
356
+            header("HTTP/1.0 502 Bad Gateway. " . $e->getMessage());
357 357
             return;
358 358
         }
359 359
     }
360 360
 
361 361
 } else {
362
-    header("HTTP/1.0 400 Bad Request. ".$error);
362
+    header("HTTP/1.0 400 Bad Request. " . $error);
363 363
     return;
364 364
 }
365 365
\ No newline at end of file
Please login to merge, or discard this patch.