Completed
Push — master ( 711720...864c5a )
by Jesus
02:41
created
bbb_view.php 2 patches
Switch Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -47,126 +47,126 @@
 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_bbb-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()) {
91
-                        if (bigbluebuttonbn_get_cfg_recordingready_enabled()) {
92
-                            $metadata["meta_bn-recording-ready-url"] = $bbbsession['recordingReadyURL'];
93
-                        }
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);
94 74
 
95
-                        if (bigbluebuttonbn_get_cfg_meetingevents_enabled()) {
96
-                            $metadata["meta_bn-meeting-events-url"] = $bbbsession['meetingEventsURL'];
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_bbb-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()) {
91
+                            if (bigbluebuttonbn_get_cfg_recordingready_enabled()) {
92
+                                $metadata["meta_bn-recording-ready-url"] = $bbbsession['recordingReadyURL'];
93
+                            }
94
+
95
+                            if (bigbluebuttonbn_get_cfg_meetingevents_enabled()) {
96
+                                $metadata["meta_bn-meeting-events-url"] = $bbbsession['meetingEventsURL'];
97
+                            }
97 98
                         }
98
-                    }
99 99
 
100
-                    /// Set the duration for the meeting
101
-                    if (bigbluebuttonbn_get_cfg_scheduled_duration_enabled()) {
102
-                        $durationtime = bigbluebuttonbn_get_duration($bigbluebuttonbn->openingtime, $bigbluebuttonbn->closingtime);
103
-                        if ($durationtime > 0) {
104
-                                                    $bbbsession['welcome'] .= '<br><br>' . str_replace("%duration%", '' . $durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn'));
105
-                        }
106
-                    } else {
107
-                        $durationtime = 0;
108
-                    }
109
-                    /// Execute the create command
110
-                    $response = bigbluebuttonbn_getCreateMeetingArray(
111
-                            $bbbsession['meetingname'],
112
-                            $bbbsession['meetingid'],
113
-                            $bbbsession['welcome'],
114
-                            $bbbsession['modPW'],
115
-                            $bbbsession['viewerPW'],
116
-                            $bbbsession['shared_secret'],
117
-                            $bbbsession['endpoint'],
118
-                            $bbbsession['logoutURL'],
119
-                            $bbbsession['record'] ? 'true' : 'false',
120
-                            $durationtime,
121
-                            $bbbsession['voicebridge'],
122
-                            $bbbsession['userlimit'],
123
-                            $metadata,
124
-                            $bbbsession['presentation']['name'],
125
-                            $bbbsession['presentation']['url']
126
-                    );
127
-
128
-                    if (!$response) {
129
-                        // If the server is unreachable, then prompts the user of the necessary action
130
-                        if ($bbbsession['administrator']) {
131
-                            print_error('view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
132
-                        } else if ($bbbsession['moderator']) {
133
-                            print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
100
+                        /// Set the duration for the meeting
101
+                        if (bigbluebuttonbn_get_cfg_scheduled_duration_enabled()) {
102
+                            $durationtime = bigbluebuttonbn_get_duration($bigbluebuttonbn->openingtime, $bigbluebuttonbn->closingtime);
103
+                            if ($durationtime > 0) {
104
+                                                        $bbbsession['welcome'] .= '<br><br>' . str_replace("%duration%", '' . $durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn'));
105
+                            }
134 106
                         } else {
135
-                            print_error('view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
107
+                            $durationtime = 0;
136 108
                         }
137
-
138
-                    } else if ($response['returncode'] == "FAILED") {
139
-                        // The meeting was not created
140
-                        $error_key = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create');
141
-                        if (!$error_key) {
142
-                            print_error($response['message'], 'bigbluebuttonbn');
143
-                        } else {
144
-                            print_error($error_key, 'bigbluebuttonbn');
109
+                        /// Execute the create command
110
+                        $response = bigbluebuttonbn_getCreateMeetingArray(
111
+                                $bbbsession['meetingname'],
112
+                                $bbbsession['meetingid'],
113
+                                $bbbsession['welcome'],
114
+                                $bbbsession['modPW'],
115
+                                $bbbsession['viewerPW'],
116
+                                $bbbsession['shared_secret'],
117
+                                $bbbsession['endpoint'],
118
+                                $bbbsession['logoutURL'],
119
+                                $bbbsession['record'] ? 'true' : 'false',
120
+                                $durationtime,
121
+                                $bbbsession['voicebridge'],
122
+                                $bbbsession['userlimit'],
123
+                                $metadata,
124
+                                $bbbsession['presentation']['name'],
125
+                                $bbbsession['presentation']['url']
126
+                        );
127
+
128
+                        if (!$response) {
129
+                            // If the server is unreachable, then prompts the user of the necessary action
130
+                            if ($bbbsession['administrator']) {
131
+                                print_error('view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
132
+                            } else if ($bbbsession['moderator']) {
133
+                                print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
134
+                            } else {
135
+                                print_error('view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
136
+                            }
137
+
138
+                        } else if ($response['returncode'] == "FAILED") {
139
+                            // The meeting was not created
140
+                            $error_key = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create');
141
+                            if (!$error_key) {
142
+                                print_error($response['message'], 'bigbluebuttonbn');
143
+                            } else {
144
+                                print_error($error_key, 'bigbluebuttonbn');
145
+                            }
146
+
147
+                        } else if ($response['hasBeenForciblyEnded'] == "true") {
148
+                            print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn'));
149
+
150
+                        } else { ///////////////Everything is ok /////////////////////
151
+                            /// Moodle event logger: Create an event for meeting created
152
+                            bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_CREATED, $bigbluebuttonbn, $context, $cm);
153
+                            /// Internal logger: Insert a record with the meeting created
154
+                            bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_CREATE);
155
+                            /// Since the meeting is already running, we just join the session
156
+                            bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $context, $bigbluebuttonbn);
145 157
                         }
146 158
 
147
-                    } else if ($response['hasBeenForciblyEnded'] == "true") {
148
-                        print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn'));
149
-
150
-                    } else { ///////////////Everything is ok /////////////////////
151
-                        /// Moodle event logger: Create an event for meeting created
152
-                        bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_CREATED, $bigbluebuttonbn, $context, $cm);
153
-                        /// Internal logger: Insert a record with the meeting created
154
-                        bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_CREATE);
155
-                        /// Since the meeting is already running, we just join the session
156
-                        bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $context, $bigbluebuttonbn);
159
+                    } else {
160
+                        header('Location: ' . $bbbsession['logoutURL']);
157 161
                     }
158
-
159
-                } else {
160
-                    header('Location: ' . $bbbsession['logoutURL']);
161 162
                 }
162
-            }
163 163
 
164
-        } else {
165
-            print_error('view_error_unable_join', 'bigbluebuttonbn');
166
-        }
167
-        break;
168
-    default:
169
-        bigbluebutton_bbb_view_close_window();
164
+            } else {
165
+                print_error('view_error_unable_join', 'bigbluebuttonbn');
166
+            }
167
+            break;
168
+        default:
169
+            bigbluebutton_bbb_view_close_window();
170 170
 }
171 171
 
172 172
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -211,7 +211,7 @@
 block discarded – undo
211 211
 function bigbluebutton_bbb_view_errors($sErrors, $id) {
212 212
     global $CFG, $OUTPUT, $PAGE;
213 213
 
214
-    $errors = (array) json_decode(urldecode($sErrors));
214
+    $errors = (array)json_decode(urldecode($sErrors));
215 215
     $msgErrors = "";
216 216
     foreach ($errors as $error) {
217 217
         $msgErrors .= html_writer::tag('p', $error->{"message"}, array('class' => 'alert alert-danger')) . "\n";
Please login to merge, or discard this patch.
backup/moodle2/restore_bigbluebuttonbn_stepslib.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     protected function process_bigbluebuttonbn($data) {
47 47
         global $DB;
48 48
 
49
-        $data = (object) $data;
49
+        $data = (object)$data;
50 50
         $data->course = $this->get_courseid();
51 51
 
52 52
         $data->timemodified = $this->apply_date_offset($data->timemodified);
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     protected function process_bigbluebuttonbn_logs($data) {
61 61
         global $DB;
62 62
 
63
-        $data = (object) $data;
63
+        $data = (object)$data;
64 64
         // Apply modifications
65 65
         $data->courseid = $this->get_mappingid('course', $data->courseid);
66 66
         $data->bigbluebuttonbnid = $this->get_new_parentid('bigbluebuttonbn');
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_recording_published.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
      */
40 40
     public function get_description() {
41 41
         $rid = isset($this->other['rid']) ? $this->other['rid'] : '';
42
-        $a = (object) array('userid' => $this->userid, 'recordingid' => $rid, 'courseid' => $this->contextinstanceid);
42
+        $a = (object)array('userid' => $this->userid, 'recordingid' => $rid, 'courseid' => $this->contextinstanceid);
43 43
         return "The user with id '$a->userid' has published a recording with id '$a->recordingid' in the course id '$a->courseid'.";
44 44
     }
45 45
 
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_meeting_event.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
      * @return string
39 39
      */
40 40
     public function get_description() {
41
-        $a = (object) array('userid' => $this->userid, 'bigbluebuttonbnid' => $this->objectid, 'courseid' => $this->contextinstanceid, 'action' => $this->other);
41
+        $a = (object)array('userid' => $this->userid, 'bigbluebuttonbnid' => $this->objectid, 'courseid' => $this->contextinstanceid, 'action' => $this->other);
42 42
         return "The user with id '$a->userid' triggered action $a->action in a bigbluebutton meeting for the bigbluebuttonbn activity with id '$a->bigbluebuttonbnid' for the course id '$a->courseid'.";
43 43
     }
44 44
 
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_recording_unpublished.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
      */
40 40
     public function get_description() {
41 41
         $rid = isset($this->other['rid']) ? $this->other['rid'] : '';
42
-        $a = (object) array('userid' => $this->userid, 'recordingid' => $rid, 'courseid' => $this->contextinstanceid);
42
+        $a = (object)array('userid' => $this->userid, 'recordingid' => $rid, 'courseid' => $this->contextinstanceid);
43 43
         return "The user with id '$a->userid' has unpublished a recording with id '$a->recordingid' in the course id '$a->courseid'.";
44 44
     }
45 45
 
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_recording_deleted.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
      */
40 40
     public function get_description() {
41 41
         $rid = isset($this->other['rid']) ? $this->other['rid'] : '';
42
-        $a = (object) array('userid' => $this->userid, 'recordingid' => $rid, 'courseid' => $this->contextinstanceid);
42
+        $a = (object)array('userid' => $this->userid, 'recordingid' => $rid, 'courseid' => $this->contextinstanceid);
43 43
         return "The user with id '$a->userid' has deleted a recording with id '$a->recordingid' from the course id '$a->courseid'.";
44 44
     }
45 45
 
Please login to merge, or discard this patch.
classes/event/bigbluebuttonbn_recording_imported.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
      */
40 40
     public function get_description() {
41 41
         $rid = isset($this->other['rid']) ? $this->other['rid'] : '';
42
-        $a = (object) array('userid' => $this->userid, 'recordingid' => $rid, 'courseid' => $this->contextinstanceid);
42
+        $a = (object)array('userid' => $this->userid, 'recordingid' => $rid, 'courseid' => $this->contextinstanceid);
43 43
         return "The user with id '$a->userid' has imported a recording with id '$a->recordingid' into the course id '$a->courseid'.";
44 44
     }
45 45
 
Please login to merge, or discard this patch.