Total Complexity | 262 |
Total Lines | 2012 |
Duplicated Lines | 0 % |
Changes | 0 |
Complex classes like bbb often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use bbb, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
10 | class bbb |
||
11 | { |
||
12 | public $url; |
||
13 | public $salt; |
||
14 | public $api; |
||
15 | public $userCompleteName = ''; |
||
16 | public $protocol = 'http://'; |
||
17 | public $debug = false; |
||
18 | public $logoutUrl = ''; |
||
19 | public $pluginEnabled = false; |
||
20 | public $enableGlobalConference = false; |
||
21 | public $enableGlobalConferencePerUser = false; |
||
22 | public $isGlobalConference = false; |
||
23 | public $groupSupport = false; |
||
24 | public $userSupport = false; |
||
25 | public $accessUrl = 1; |
||
26 | public $userId = 0; |
||
27 | public $plugin; |
||
28 | private $courseCode; |
||
29 | private $courseId; |
||
30 | private $sessionId; |
||
31 | private $groupId; |
||
32 | private $maxUsersLimit; |
||
33 | |||
34 | /** |
||
35 | * Constructor (generates a connection to the API and the Chamilo settings |
||
36 | * required for the connection to the video conference server) |
||
37 | * |
||
38 | * @param string $host |
||
39 | * @param string $salt |
||
40 | * @param bool $isGlobalConference |
||
41 | * @param int $isGlobalPerUser |
||
42 | */ |
||
43 | public function __construct( |
||
44 | $host = '', |
||
45 | $salt = '', |
||
46 | $isGlobalConference = false, |
||
47 | $isGlobalPerUser = 0 |
||
48 | ) { |
||
49 | $this->courseCode = api_get_course_id(); |
||
50 | $this->courseId = api_get_course_int_id(); |
||
51 | $this->sessionId = api_get_session_id(); |
||
52 | $this->groupId = api_get_group_id(); |
||
53 | |||
54 | // Initialize video server settings from global settings |
||
55 | $this->plugin = BBBPlugin::create(); |
||
56 | $bbbPluginEnabled = $this->plugin->get('tool_enable'); |
||
|
|||
57 | |||
58 | $bbb_host = !empty($host) ? $host : $this->plugin->get('host'); |
||
59 | $bbb_salt = !empty($salt) ? $salt : $this->plugin->get('salt'); |
||
60 | |||
61 | $this->table = Database::get_main_table('plugin_bbb_meeting'); |
||
62 | $this->enableGlobalConference = $this->plugin->get('enable_global_conference') === 'true'; |
||
63 | $this->isGlobalConference = (bool) $isGlobalConference; |
||
64 | |||
65 | $columns = Database::listTableColumns($this->table); |
||
66 | $this->groupSupport = isset($columns['group_id']) ? true : false; |
||
67 | $this->userSupport = isset($columns['user_id']) ? true : false; |
||
68 | $this->accessUrl = api_get_current_access_url_id(); |
||
69 | |||
70 | $this->enableGlobalConferencePerUser = false; |
||
71 | if ($this->userSupport && !empty($isGlobalPerUser)) { |
||
72 | $this->enableGlobalConferencePerUser = $this->plugin->get('enable_global_conference_per_user') === 'true'; |
||
73 | $this->userId = $isGlobalPerUser; |
||
74 | } |
||
75 | |||
76 | if ($this->groupSupport) { |
||
77 | // Plugin check |
||
78 | $this->groupSupport = $this->plugin->get('enable_conference_in_course_groups') === 'true' ? true : false; |
||
79 | if ($this->groupSupport) { |
||
80 | // Platform check |
||
81 | $bbbSetting = api_get_setting('bbb_enable_conference_in_course_groups'); |
||
82 | $bbbSetting = isset($bbbSetting['bbb']) ? $bbbSetting['bbb'] === 'true' : false; |
||
83 | |||
84 | if ($bbbSetting) { |
||
85 | // Course check |
||
86 | $courseInfo = api_get_course_info(); |
||
87 | if ($courseInfo) { |
||
88 | $this->groupSupport = api_get_course_plugin_setting( |
||
89 | 'bbb', |
||
90 | 'bbb_enable_conference_in_groups', |
||
91 | $courseInfo |
||
92 | ) === '1'; |
||
93 | } |
||
94 | } |
||
95 | } |
||
96 | } |
||
97 | $this->maxUsersLimit = $this->plugin->get('max_users_limit'); |
||
98 | |||
99 | if ($bbbPluginEnabled === 'true') { |
||
100 | $userInfo = api_get_user_info(); |
||
101 | if (empty($userInfo) && !empty($isGlobalPerUser)) { |
||
102 | // If we are following a link to a global "per user" conference |
||
103 | // then generate a random guest name to join the conference |
||
104 | // because there is no part of the process where we give a name |
||
105 | //$this->userCompleteName = 'Guest'.rand(1000, 9999); |
||
106 | } else { |
||
107 | $this->userCompleteName = $userInfo['complete_name']; |
||
108 | } |
||
109 | |||
110 | if (api_is_anonymous()) { |
||
111 | $this->userCompleteName = get_lang('Guest').'_'.rand(1000, 9999); |
||
112 | } |
||
113 | |||
114 | $this->salt = $bbb_salt; |
||
115 | if (!empty($bbb_host)) { |
||
116 | if (substr($bbb_host, -1, 1) !== '/') { |
||
117 | $bbb_host .= '/'; |
||
118 | } |
||
119 | $this->url = $bbb_host; |
||
120 | if (!preg_match('#/bigbluebutton/$#', $bbb_host)) { |
||
121 | $this->url = $bbb_host.'bigbluebutton/'; |
||
122 | } |
||
123 | } |
||
124 | $info = parse_url($bbb_host); |
||
125 | |||
126 | if (isset($info['scheme'])) { |
||
127 | $this->protocol = $info['scheme'].'://'; |
||
128 | $this->url = str_replace($this->protocol, '', $this->url); |
||
129 | $urlWithProtocol = $bbb_host; |
||
130 | } else { |
||
131 | // We assume it's an http, if user wants to use https, the host *must* include the protocol. |
||
132 | $this->protocol = 'http://'; |
||
133 | $urlWithProtocol = $this->protocol.$bbb_host; |
||
134 | } |
||
135 | |||
136 | // Setting BBB api |
||
137 | define('CONFIG_SECURITY_SALT', $this->salt); |
||
138 | define('CONFIG_SERVER_URL_WITH_PROTOCOL', $urlWithProtocol); |
||
139 | define('CONFIG_SERVER_BASE_URL', $this->url); |
||
140 | define('CONFIG_SERVER_PROTOCOL', $this->protocol); |
||
141 | |||
142 | $this->api = new BigBlueButtonBN(); |
||
143 | $this->pluginEnabled = true; |
||
144 | $this->logoutUrl = $this->getListingUrl(); |
||
145 | } |
||
146 | } |
||
147 | |||
148 | /** |
||
149 | * @param int $courseId Optional. Course ID. |
||
150 | * @param int $sessionId Optional. Session ID. |
||
151 | * @param int $groupId Optional. Group ID. |
||
152 | * |
||
153 | * @return string |
||
154 | */ |
||
155 | public function getListingUrl($courseId = 0, $sessionId = 0, $groupId = 0) |
||
156 | { |
||
157 | return api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?' |
||
158 | .$this->getUrlParams($courseId, $sessionId, $groupId); |
||
159 | } |
||
160 | |||
161 | /** |
||
162 | * @param int $courseId Optional. Course ID. |
||
163 | * @param int $sessionId Optional. Session ID. |
||
164 | * @param int $groupId Optional. Group ID. |
||
165 | * |
||
166 | * @return string |
||
167 | */ |
||
168 | public function getUrlParams($courseId = 0, $sessionId = 0, $groupId = 0) |
||
169 | { |
||
170 | if (empty($this->courseCode) && !$courseId) { |
||
171 | if ($this->isGlobalConferencePerUserEnabled()) { |
||
172 | return 'global=1&user_id='.$this->userId; |
||
173 | } |
||
174 | |||
175 | if ($this->isGlobalConference()) { |
||
176 | return 'global=1'; |
||
177 | } |
||
178 | |||
179 | return ''; |
||
180 | } |
||
181 | |||
182 | $courseCode = $this->courseCode; |
||
183 | if (!empty($courseId)) { |
||
184 | $course = api_get_course_info_by_id($courseId); |
||
185 | if ($course) { |
||
186 | $courseCode = $course['code']; |
||
187 | } |
||
188 | } |
||
189 | |||
190 | return http_build_query( |
||
191 | [ |
||
192 | 'cidReq' => $courseCode, |
||
193 | 'id_session' => $sessionId ?: $this->sessionId, |
||
194 | 'gidReq' => $groupId ?: $this->groupId, |
||
195 | ] |
||
196 | ); |
||
197 | } |
||
198 | |||
199 | /** |
||
200 | * @return bool |
||
201 | */ |
||
202 | public function isGlobalConferencePerUserEnabled() |
||
203 | { |
||
204 | return $this->enableGlobalConferencePerUser; |
||
205 | } |
||
206 | |||
207 | /** |
||
208 | * @return bool |
||
209 | */ |
||
210 | public function isGlobalConference() |
||
211 | { |
||
212 | if ($this->isGlobalConferenceEnabled() === false) { |
||
213 | return false; |
||
214 | } |
||
215 | |||
216 | return (bool) $this->isGlobalConference; |
||
217 | } |
||
218 | |||
219 | /** |
||
220 | * @return bool |
||
221 | */ |
||
222 | public function isGlobalConferenceEnabled() |
||
223 | { |
||
224 | return $this->enableGlobalConference; |
||
225 | } |
||
226 | |||
227 | /** |
||
228 | * @param array $userInfo |
||
229 | * |
||
230 | * @return bool |
||
231 | */ |
||
232 | public static function showGlobalConferenceLink($userInfo) |
||
233 | { |
||
234 | if (empty($userInfo)) { |
||
235 | return false; |
||
236 | } |
||
237 | $setting = api_get_plugin_setting('bbb', 'enable_global_conference'); |
||
238 | $settingLink = api_get_plugin_setting('bbb', 'enable_global_conference_link'); |
||
239 | if ($setting === 'true' && $settingLink === 'true') { |
||
240 | //$content = Display::url(get_lang('LaunchVideoConferenceRoom'), $url); |
||
241 | $allowedRoles = api_get_plugin_setting( |
||
242 | 'bbb', |
||
243 | 'global_conference_allow_roles' |
||
244 | ); |
||
245 | |||
246 | if (api_is_platform_admin()) { |
||
247 | $userInfo['status'] = PLATFORM_ADMIN; |
||
248 | } |
||
249 | |||
250 | $showGlobalLink = true; |
||
251 | if (!empty($allowedRoles)) { |
||
252 | if (!in_array($userInfo['status'], $allowedRoles)) { |
||
253 | $showGlobalLink = false; |
||
254 | } |
||
255 | } |
||
256 | |||
257 | return $showGlobalLink; |
||
258 | } |
||
259 | } |
||
260 | |||
261 | /** |
||
262 | * Gets the global limit of users in a video-conference room. |
||
263 | * This value can be overridden by course-specific values |
||
264 | * @return int Maximum number of users set globally |
||
265 | */ |
||
266 | public function getMaxUsersLimit() |
||
307 | } |
||
308 | |||
309 | /** |
||
310 | * Sets the global limit of users in a video-conference room. |
||
311 | * |
||
312 | * @param int Maximum number of users (globally) |
||
313 | */ |
||
314 | public function setMaxUsersLimit($max) |
||
320 | } |
||
321 | |||
322 | /** |
||
323 | * See this file in you BBB to set up default values |
||
324 | * |
||
325 | * @param array $params Array of parameters that will be completed if not containing all expected variables |
||
326 | * |
||
327 | * /var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties |
||
328 | * |
||
329 | * More record information: |
||
330 | * http://code.google.com/p/bigbluebutton/wiki/RecordPlaybackSpecification |
||
331 | * |
||
332 | * Default maximum number of users a meeting can have. |
||
333 | * Doesn't get enforced yet but is the default value when the create |
||
334 | * API doesn't pass a value. |
||
335 | * defaultMaxUsers=20 |
||
336 | * |
||
337 | * Default duration of the meeting in minutes. |
||
338 | * Current default is 0 (meeting doesn't end). |
||
339 | * defaultMeetingDuration=0 |
||
340 | * |
||
341 | * Remove the meeting from memory when the end API is called. |
||
342 | * This allows 3rd-party apps to recycle the meeting right-away |
||
343 | * instead of waiting for the meeting to expire (see below). |
||
344 | * removeMeetingWhenEnded=false |
||
345 | * |
||
346 | * The number of minutes before the system removes the meeting from memory. |
||
347 | * defaultMeetingExpireDuration=1 |
||
348 | * |
||
349 | * The number of minutes the system waits when a meeting is created and when |
||
350 | * a user joins. If after this period, a user hasn't joined, the meeting is |
||
351 | * removed from memory. |
||
352 | * defaultMeetingCreateJoinDuration=5 |
||
353 | * |
||
354 | * @return mixed |
||
355 | */ |
||
356 | public function createMeeting($params) |
||
357 | { |
||
358 | $params['c_id'] = api_get_course_int_id(); |
||
359 | $params['session_id'] = api_get_session_id(); |
||
360 | |||
361 | if ($this->hasGroupSupport()) { |
||
362 | $params['group_id'] = api_get_group_id(); |
||
363 | } |
||
364 | |||
365 | if ($this->isGlobalConferencePerUserEnabled() && !empty($this->userId)) { |
||
366 | $params['user_id'] = (int) $this->userId; |
||
367 | } |
||
368 | |||
369 | $params['attendee_pw'] = isset($params['attendee_pw']) ? $params['attendee_pw'] : $this->getUserMeetingPassword(); |
||
370 | $attendeePassword = $params['attendee_pw']; |
||
371 | $params['moderator_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : $this->getModMeetingPassword(); |
||
372 | $moderatorPassword = $params['moderator_pw']; |
||
373 | |||
374 | $params['record'] = api_get_course_plugin_setting('bbb', 'big_blue_button_record_and_store') == 1; |
||
375 | $max = api_get_course_plugin_setting('bbb', 'big_blue_button_max_students_allowed'); |
||
376 | $max = isset($max) ? $max : -1; |
||
377 | |||
378 | $params['status'] = 1; |
||
379 | // Generate a pseudo-global-unique-id to avoid clash of conferences on |
||
380 | // the same BBB server with several Chamilo portals |
||
381 | $params['remote_id'] = uniqid(true, true); |
||
382 | // Each simultaneous conference room needs to have a different |
||
383 | // voice_bridge composed of a 5 digits number, so generating a random one |
||
384 | $params['voice_bridge'] = rand(10000, 99999); |
||
385 | $params['created_at'] = api_get_utc_datetime(); |
||
386 | $params['access_url'] = $this->accessUrl; |
||
387 | |||
388 | // Check interface feature is installed |
||
389 | $interfaceFeature = $this->plugin->get('interface'); |
||
390 | if ($interfaceFeature === false) { |
||
391 | if (isset($params['interface'])) { |
||
392 | unset($params['interface']); |
||
393 | } |
||
394 | } |
||
395 | |||
396 | $id = Database::insert($this->table, $params); |
||
397 | |||
398 | if ($id) { |
||
399 | Event::addEvent( |
||
400 | 'bbb_create_meeting', |
||
401 | 'meeting_id', |
||
402 | (int) $id, |
||
403 | null, |
||
404 | api_get_user_id(), |
||
405 | api_get_course_int_id(), |
||
406 | api_get_session_id() |
||
407 | ); |
||
408 | |||
409 | $meetingName = isset($params['meeting_name']) ? $params['meeting_name'] : $this->getCurrentVideoConferenceName(); |
||
410 | $welcomeMessage = isset($params['welcome_msg']) ? $params['welcome_msg'] : null; |
||
411 | $record = isset($params['record']) && $params['record'] ? 'true' : 'false'; |
||
412 | //$duration = isset($params['duration']) ? intval($params['duration']) : 0; |
||
413 | // This setting currently limits the maximum conference duration, |
||
414 | // to avoid lingering sessions on the video-conference server #6261 |
||
415 | $duration = 300; |
||
416 | $meetingDuration = (int) $this->plugin->get('meeting_duration'); |
||
417 | if (!empty($meetingDuration)) { |
||
418 | $duration = $meetingDuration; |
||
419 | } |
||
420 | $bbbParams = array( |
||
421 | 'meetingId' => $params['remote_id'], // REQUIRED |
||
422 | 'meetingName' => $meetingName, // REQUIRED |
||
423 | 'attendeePw' => $attendeePassword, // Match this value in getJoinMeetingURL() to join as attendee. |
||
424 | 'moderatorPw' => $moderatorPassword, // Match this value in getJoinMeetingURL() to join as moderator. |
||
425 | 'welcomeMsg' => $welcomeMessage, // ''= use default. Change to customize. |
||
426 | 'dialNumber' => '', // The main number to call into. Optional. |
||
427 | 'voiceBridge' => $params['voice_bridge'], // PIN to join voice. Required. |
||
428 | 'webVoice' => '', // Alphanumeric to join voice. Optional. |
||
429 | 'logoutUrl' => $this->logoutUrl.'&action=logout&remote_id='.$params['remote_id'], |
||
430 | 'maxParticipants' => $max, // Optional. -1 = unlimitted. Not supported in BBB. [number] |
||
431 | 'record' => $record, // New. 'true' will tell BBB to record the meeting. |
||
432 | 'duration' => $duration, // Default = 0 which means no set duration in minutes. [number] |
||
433 | //'meta_category' => '', // Use to pass additional info to BBB server. See API docs. |
||
434 | ); |
||
435 | |||
436 | $status = false; |
||
437 | $meeting = null; |
||
438 | while ($status === false) { |
||
439 | $result = $this->api->createMeetingWithXmlResponseArray($bbbParams); |
||
440 | if (isset($result) && strval($result['returncode']) == 'SUCCESS') { |
||
441 | if ($this->plugin->get('allow_regenerate_recording') === 'true') { |
||
442 | $internalId = Database::escape_string($result['internalMeetingID']); |
||
443 | $sql = "UPDATE $this->table SET internal_meeting_id = '".$internalId."' |
||
444 | WHERE id = $id"; |
||
445 | Database::query($sql); |
||
446 | } |
||
447 | $meeting = $this->joinMeeting($meetingName, true); |
||
448 | |||
449 | |||
450 | return $meeting; |
||
451 | } |
||
452 | } |
||
453 | } |
||
454 | |||
455 | return false; |
||
456 | } |
||
457 | |||
458 | /** |
||
459 | * @return bool |
||
460 | */ |
||
461 | public function hasGroupSupport() |
||
462 | { |
||
463 | return $this->groupSupport; |
||
464 | } |
||
465 | |||
466 | /** |
||
467 | * Gets the password for a specific meeting for the current user |
||
468 | * |
||
469 | * @param string $courseCode |
||
470 | * |
||
471 | * @return string A moderator password if user is teacher, or the course code otherwise |
||
472 | * |
||
473 | */ |
||
474 | public function getUserMeetingPassword($courseCode = null) |
||
475 | { |
||
476 | if ($this->isGlobalConferencePerUserEnabled()) { |
||
477 | return 'url_'.$this->userId.'_'.api_get_current_access_url_id(); |
||
478 | } |
||
479 | |||
480 | if ($this->isGlobalConference()) { |
||
481 | return 'url_'.api_get_current_access_url_id(); |
||
482 | } |
||
483 | $courseCode = empty($courseCode) ? api_get_course_id() : $courseCode; |
||
484 | |||
485 | return $courseCode; |
||
486 | } |
||
487 | |||
488 | /** |
||
489 | * Generated a moderator password for the meeting. |
||
490 | * |
||
491 | * @param string $courseCode |
||
492 | * |
||
493 | * @return string A password for the moderation of the videoconference |
||
494 | */ |
||
495 | public function getModMeetingPassword($courseCode = null) |
||
496 | { |
||
497 | if ($this->isGlobalConferencePerUserEnabled()) { |
||
498 | return 'url_'.$this->userId.'_'.api_get_current_access_url_id().'_mod'; |
||
499 | } |
||
500 | |||
501 | if ($this->isGlobalConference()) { |
||
502 | return 'url_'.api_get_current_access_url_id().'_mod'; |
||
503 | } |
||
504 | |||
505 | $courseCode = empty($courseCode) ? api_get_course_id() : $courseCode; |
||
506 | |||
507 | return $courseCode.'mod'; |
||
508 | } |
||
509 | |||
510 | /** |
||
511 | * @return string |
||
512 | */ |
||
513 | public function getCurrentVideoConferenceName() |
||
514 | { |
||
515 | if ($this->isGlobalConferencePerUserEnabled()) { |
||
516 | return 'url_'.$this->userId.'_'.api_get_current_access_url_id(); |
||
517 | } |
||
518 | |||
519 | if ($this->isGlobalConference()) { |
||
520 | return 'url_'.api_get_current_access_url_id(); |
||
521 | } |
||
522 | |||
523 | if ($this->hasGroupSupport()) { |
||
524 | return api_get_course_id().'-'.api_get_session_id().'-'.api_get_group_id(); |
||
525 | } |
||
526 | |||
527 | return api_get_course_id().'-'.api_get_session_id(); |
||
528 | } |
||
529 | |||
530 | /** |
||
531 | * Returns a meeting "join" URL |
||
532 | * |
||
533 | * @param string The name of the meeting (usually the course code) |
||
534 | * |
||
535 | * @return mixed The URL to join the meeting, or false on error |
||
536 | * @todo implement moderator pass |
||
537 | * @assert ('') === false |
||
538 | * @assert ('abcdefghijklmnopqrstuvwxyzabcdefghijklmno') === false |
||
539 | */ |
||
540 | public function joinMeeting($meetingName) |
||
650 | } |
||
651 | |||
652 | /** |
||
653 | * Checks whether a user is teacher in the current course |
||
654 | * @return bool True if the user can be considered a teacher in this course, false otherwise |
||
655 | */ |
||
656 | public function isConferenceManager() |
||
657 | { |
||
658 | if (api_is_coach() || api_is_platform_admin(false, true)) { |
||
659 | return true; |
||
660 | } |
||
661 | |||
662 | if ($this->isGlobalConferencePerUserEnabled()) { |
||
663 | $currentUserId = api_get_user_id(); |
||
664 | if ($this->userId === $currentUserId) { |
||
665 | return true; |
||
666 | } else { |
||
667 | return false; |
||
668 | } |
||
669 | } |
||
670 | |||
671 | $courseInfo = api_get_course_info(); |
||
672 | $groupId = api_get_group_id(); |
||
673 | if (!empty($groupId) && !empty($courseInfo)) { |
||
674 | $groupEnabled = api_get_course_plugin_setting('bbb', 'bbb_enable_conference_in_groups') === '1'; |
||
675 | if ($groupEnabled) { |
||
676 | $studentCanStartConference = api_get_course_plugin_setting( |
||
677 | 'bbb', |
||
678 | 'big_blue_button_students_start_conference_in_groups' |
||
679 | ) === '1'; |
||
680 | |||
681 | if ($studentCanStartConference) { |
||
682 | $isSubscribed = GroupManager::is_user_in_group( |
||
683 | api_get_user_id(), |
||
684 | GroupManager::get_group_properties($groupId) |
||
685 | ); |
||
686 | if ($isSubscribed) { |
||
687 | return true; |
||
688 | } |
||
689 | } |
||
690 | } |
||
691 | } |
||
692 | |||
693 | if (!empty($courseInfo)) { |
||
694 | return api_is_course_admin(); |
||
695 | } |
||
696 | |||
697 | return false; |
||
698 | } |
||
699 | |||
700 | /** |
||
701 | * Get information about the given meeting |
||
702 | * |
||
703 | * @param array ...? |
||
704 | * |
||
705 | * @return mixed Array of information on success, false on error |
||
706 | * @assert (array()) === false |
||
707 | */ |
||
708 | public function getMeetingInfo($params) |
||
726 | } |
||
727 | |||
728 | |||
729 | /** |
||
730 | * @param int $meetingId |
||
731 | * @param int $userId |
||
732 | * |
||
733 | * @return array |
||
734 | */ |
||
735 | public function getMeetingParticipantInfo($meetingId, $userId) |
||
736 | { |
||
737 | $meetingData = Database::select( |
||
738 | '*', |
||
739 | 'plugin_bbb_room', |
||
740 | array('where' => array('meeting_id = ? AND participant_id = ?' => [$meetingId, $userId])), |
||
741 | 'first' |
||
742 | ); |
||
743 | |||
744 | if ($meetingData) { |
||
745 | return $meetingData; |
||
746 | } |
||
747 | |||
748 | return []; |
||
749 | } |
||
750 | |||
751 | /** |
||
752 | * Save a participant in a meeting room |
||
753 | * |
||
754 | * @param int $meetingId |
||
755 | * @param int $participantId |
||
756 | * @param int $interface |
||
757 | * |
||
758 | * @return false|int The last inserted ID. Otherwise return false |
||
759 | */ |
||
760 | public function saveParticipant($meetingId, $participantId, $interface = 0) |
||
761 | { |
||
762 | $meetingData = Database::select( |
||
763 | '*', |
||
764 | 'plugin_bbb_room', |
||
765 | [ |
||
766 | 'where' => [ |
||
767 | 'meeting_id = ? AND participant_id = ? AND close = ?' => [ |
||
768 | $meetingId, |
||
769 | $participantId, |
||
770 | BBBPlugin::ROOM_OPEN, |
||
771 | ], |
||
772 | ], |
||
773 | ] |
||
774 | ); |
||
775 | |||
776 | foreach ($meetingData as $roomItem) { |
||
777 | $inAt = $roomItem['in_at']; |
||
778 | $outAt = $roomItem['out_at']; |
||
779 | $roomId = $roomItem['id']; |
||
780 | if (!empty($roomId)) { |
||
781 | if ($inAt != $outAt) { |
||
782 | Database::update( |
||
783 | 'plugin_bbb_room', |
||
784 | ['close' => BBBPlugin::ROOM_CLOSE], |
||
785 | ['id = ? ' => $roomId] |
||
786 | ); |
||
787 | } else { |
||
788 | Database::update( |
||
789 | 'plugin_bbb_room', |
||
790 | ['out_at' => api_get_utc_datetime(), 'close' => BBBPlugin::ROOM_CLOSE], |
||
791 | ['id = ? ' => $roomId] |
||
792 | ); |
||
793 | } |
||
794 | } |
||
795 | } |
||
796 | |||
797 | $params = [ |
||
798 | 'meeting_id' => $meetingId, |
||
799 | 'participant_id' => $participantId, |
||
800 | 'in_at' => api_get_utc_datetime(), |
||
801 | 'out_at' => api_get_utc_datetime(), |
||
802 | 'close' => BBBPlugin::ROOM_OPEN, |
||
803 | ]; |
||
804 | |||
805 | if ($this->plugin->get('interface') !== false) { |
||
806 | $params['interface'] = $interface; |
||
807 | } |
||
808 | |||
809 | return Database::insert( |
||
810 | 'plugin_bbb_room', |
||
811 | $params |
||
812 | ); |
||
813 | } |
||
814 | |||
815 | /** |
||
816 | * Tells whether the given meeting exists and is running |
||
817 | * (using course code as name) |
||
818 | * |
||
819 | * @param string $meetingName Meeting name (usually the course code) |
||
820 | * |
||
821 | * @return bool True if meeting exists, false otherwise |
||
822 | * @assert ('') === false |
||
823 | * @assert ('abcdefghijklmnopqrstuvwxyzabcdefghijklmno') === false |
||
824 | */ |
||
825 | public function meetingExists($meetingName) |
||
826 | { |
||
827 | $meetingData = $this->getMeetingByName($meetingName); |
||
828 | |||
829 | return !empty($meetingData); |
||
830 | } |
||
831 | |||
832 | /** |
||
833 | * @param string $meetingName |
||
834 | * |
||
835 | * @return array |
||
836 | */ |
||
837 | public function getMeetingByName($meetingName) |
||
838 | { |
||
839 | if (empty($meetingName)) { |
||
840 | return []; |
||
841 | } |
||
842 | |||
843 | $courseId = api_get_course_int_id(); |
||
844 | $sessionId = api_get_session_id(); |
||
845 | $conditions = array( |
||
846 | 'where' => array( |
||
847 | 'c_id = ? AND session_id = ? AND meeting_name = ? AND status = 1 AND access_url = ?' => |
||
848 | array($courseId, $sessionId, $meetingName, $this->accessUrl), |
||
849 | ), |
||
850 | ); |
||
851 | |||
852 | if ($this->hasGroupSupport()) { |
||
853 | $groupId = api_get_group_id(); |
||
854 | $conditions = array( |
||
855 | 'where' => array( |
||
856 | 'c_id = ? AND session_id = ? AND meeting_name = ? AND group_id = ? AND status = 1 AND access_url = ?' => |
||
857 | array( |
||
858 | $courseId, |
||
859 | $sessionId, |
||
860 | $meetingName, |
||
861 | $groupId, |
||
862 | $this->accessUrl, |
||
863 | ), |
||
864 | ), |
||
865 | ); |
||
866 | } |
||
867 | |||
868 | $meetingData = Database::select( |
||
869 | '*', |
||
870 | $this->table, |
||
871 | $conditions, |
||
872 | 'first' |
||
873 | ); |
||
874 | |||
875 | if ($this->debug) { |
||
876 | error_log('meeting_exists '.print_r($meetingData, 1)); |
||
877 | } |
||
878 | |||
879 | return $meetingData; |
||
880 | } |
||
881 | |||
882 | /** |
||
883 | * Gets a list from the database of all meetings attached to a course with the given status |
||
884 | * @param int $courseId |
||
885 | * @param int $sessionId |
||
886 | * @param int $status 0 for closed meetings, 1 for open meetings |
||
887 | * |
||
888 | * @return array |
||
889 | */ |
||
890 | public function getAllMeetingsInCourse($courseId, $sessionId, $status) |
||
891 | { |
||
892 | $conditions = array( |
||
893 | 'where' => array( |
||
894 | 'status = ? AND c_id = ? AND session_id = ? ' => array( |
||
895 | $status, |
||
896 | $courseId, |
||
897 | $sessionId, |
||
898 | ), |
||
899 | ), |
||
900 | ); |
||
901 | |||
902 | return Database::select( |
||
903 | '*', |
||
904 | $this->table, |
||
905 | $conditions |
||
906 | ); |
||
907 | } |
||
908 | |||
909 | /** |
||
910 | * Gets all the course meetings saved in the plugin_bbb_meeting table and |
||
911 | * generate actionable links (join/close/delete/etc) |
||
912 | * |
||
913 | * @param int $courseId |
||
914 | * @param int $sessionId |
||
915 | * @param int $groupId |
||
916 | * @param bool $isAdminReport Optional. Set to true then the report is for admins |
||
917 | * @param array $dateRange Optional |
||
918 | * |
||
919 | * @return array Array of current open meeting rooms |
||
920 | * @throws Exception |
||
921 | */ |
||
922 | public function getMeetings( |
||
923 | $courseId = 0, |
||
924 | $sessionId = 0, |
||
925 | $groupId = 0, |
||
926 | $isAdminReport = false, |
||
927 | $dateRange = [] |
||
928 | ) { |
||
929 | $em = Database::getManager(); |
||
930 | $manager = $this->isConferenceManager(); |
||
931 | |||
932 | $conditions = []; |
||
933 | if ($courseId || $sessionId || $groupId) { |
||
934 | $conditions = array( |
||
935 | 'where' => array( |
||
936 | 'c_id = ? AND session_id = ? ' => array($courseId, $sessionId), |
||
937 | ), |
||
938 | ); |
||
939 | |||
940 | if ($this->hasGroupSupport()) { |
||
941 | $conditions = array( |
||
942 | 'where' => array( |
||
943 | 'c_id = ? AND session_id = ? AND group_id = ? ' => array( |
||
944 | $courseId, |
||
945 | $sessionId, |
||
946 | $groupId, |
||
947 | ), |
||
948 | ), |
||
949 | ); |
||
950 | } |
||
951 | |||
952 | if ($this->isGlobalConferencePerUserEnabled()) { |
||
953 | $conditions = array( |
||
954 | 'where' => array( |
||
955 | 'c_id = ? AND session_id = ? AND user_id = ?' => array( |
||
956 | $courseId, |
||
957 | $sessionId, |
||
958 | $this->userId, |
||
959 | ), |
||
960 | ), |
||
961 | ); |
||
962 | } |
||
963 | } |
||
964 | |||
965 | if (!empty($dateRange)) { |
||
966 | $dateStart = date_create($dateRange['search_meeting_start']); |
||
967 | $dateStart = date_format($dateStart, 'Y-m-d H:i:s'); |
||
968 | $dateEnd = date_create($dateRange['search_meeting_end']); |
||
969 | $dateEnd = $dateEnd->add(new DateInterval('P1D')); |
||
970 | $dateEnd = date_format($dateEnd, 'Y-m-d H:i:s'); |
||
971 | |||
972 | $conditions = array( |
||
973 | 'where' => array( |
||
974 | 'created_at BETWEEN ? AND ? ' => array($dateStart, $dateEnd), |
||
975 | ), |
||
976 | ); |
||
977 | } |
||
978 | |||
979 | $conditions['order'] = 'created_at ASC'; |
||
980 | |||
981 | $meetingList = Database::select( |
||
982 | '*', |
||
983 | $this->table, |
||
984 | $conditions |
||
985 | ); |
||
986 | $isGlobal = $this->isGlobalConference(); |
||
987 | $newMeetingList = array(); |
||
988 | foreach ($meetingList as $meetingDB) { |
||
989 | $item = array(); |
||
990 | $courseId = $meetingDB['c_id']; |
||
991 | $courseInfo = api_get_course_info_by_id($courseId); |
||
992 | $courseCode = ''; |
||
993 | if (!empty($courseInfo)) { |
||
994 | $courseCode = $courseInfo['code']; |
||
995 | } |
||
996 | |||
997 | if ($manager) { |
||
998 | $pass = $meetingDB['moderator_pw']; |
||
999 | } else { |
||
1000 | $pass = $meetingDB['attendee_pw']; |
||
1001 | } |
||
1002 | |||
1003 | $meetingBBB = $this->getMeetingInfo( |
||
1004 | [ |
||
1005 | 'meetingId' => $meetingDB['remote_id'], |
||
1006 | 'password' => $pass, |
||
1007 | ] |
||
1008 | ); |
||
1009 | |||
1010 | if ($meetingBBB === false) { |
||
1011 | // Checking with the remote_id didn't work, so just in case and |
||
1012 | // to provide backwards support, check with the id |
||
1013 | $params = array( |
||
1014 | 'meetingId' => $meetingDB['id'], |
||
1015 | // -- REQUIRED - The unique id for the meeting |
||
1016 | 'password' => $pass |
||
1017 | // -- REQUIRED - The moderator password for the meeting |
||
1018 | ); |
||
1019 | $meetingBBB = $this->getMeetingInfo($params); |
||
1020 | } |
||
1021 | |||
1022 | if ($meetingDB['visibility'] == 0 && $this->isConferenceManager() === false) { |
||
1023 | continue; |
||
1024 | } |
||
1025 | |||
1026 | $meetingBBB['end_url'] = $this->endUrl($meetingDB); |
||
1027 | |||
1028 | if (isset($meetingBBB['returncode']) && (string) $meetingBBB['returncode'] === 'FAILED') { |
||
1029 | if ($meetingDB['status'] == 1 && $this->isConferenceManager()) { |
||
1030 | $this->endMeeting($meetingDB['id'], $courseCode); |
||
1031 | } |
||
1032 | } else { |
||
1033 | $meetingBBB['add_to_calendar_url'] = $this->addToCalendarUrl($meetingDB); |
||
1034 | } |
||
1035 | |||
1036 | if ($meetingDB['record'] == 1) { |
||
1037 | // backwards compatibility (when there was no remote ID) |
||
1038 | $mId = $meetingDB['remote_id']; |
||
1039 | if (empty($mId)) { |
||
1040 | $mId = $meetingDB['id']; |
||
1041 | } |
||
1042 | if (empty($mId)) { |
||
1043 | // if the id is still empty (should *never* occur as 'id' is |
||
1044 | // the table's primary key), skip this conference |
||
1045 | continue; |
||
1046 | } |
||
1047 | |||
1048 | $record = []; |
||
1049 | $recordingParams = ['meetingId' => $mId]; |
||
1050 | $records = $this->api->getRecordingsWithXmlResponseArray($recordingParams); |
||
1051 | |||
1052 | if (!empty($records)) { |
||
1053 | if (!isset($records['messageKey']) || $records['messageKey'] !== 'noRecordings') { |
||
1054 | $record = end($records); |
||
1055 | if (!is_array($record) || !isset($record['recordId'])) { |
||
1056 | continue; |
||
1057 | } |
||
1058 | |||
1059 | if (!empty($record['playbackFormatUrl'])) { |
||
1060 | $this->updateMeetingVideoUrl($meetingDB['id'], $record['playbackFormatUrl']); |
||
1061 | } |
||
1062 | } |
||
1063 | } |
||
1064 | |||
1065 | if (isset($record['playbackFormatUrl']) && !empty($record['playbackFormatUrl'])) { |
||
1066 | $recordLink = Display::url( |
||
1067 | $this->plugin->get_lang('ViewRecord'), |
||
1068 | $record['playbackFormatUrl'], |
||
1069 | ['target' => '_blank', 'class' => 'btn btn-default'] |
||
1070 | ); |
||
1071 | } else { |
||
1072 | $recordLink = $this->plugin->get_lang('NoRecording'); |
||
1073 | } |
||
1074 | |||
1075 | if ($isAdminReport) { |
||
1076 | $this->forceCIdReq( |
||
1077 | $courseInfo['code'], |
||
1078 | $meetingDB['session_id'], |
||
1079 | $meetingDB['group_id'] |
||
1080 | ); |
||
1081 | } |
||
1082 | |||
1083 | $actionLinks = $this->getActionLinks( |
||
1084 | $meetingDB, |
||
1085 | $record, |
||
1086 | $isGlobal, |
||
1087 | $isAdminReport |
||
1088 | ); |
||
1089 | $item['show_links'] = $recordLink; |
||
1090 | } else { |
||
1091 | $actionLinks = $this->getActionLinks( |
||
1092 | $meetingDB, |
||
1093 | [], |
||
1094 | $isGlobal, |
||
1095 | $isAdminReport |
||
1096 | ); |
||
1097 | |||
1098 | $item['show_links'] = $this->plugin->get_lang('NoRecording'); |
||
1099 | } |
||
1100 | |||
1101 | $item['action_links'] = implode(PHP_EOL, $actionLinks); |
||
1102 | $item['created_at'] = api_convert_and_format_date($meetingDB['created_at']); |
||
1103 | // created_at |
||
1104 | $meetingDB['created_at'] = $item['created_at']; //avoid overwrite in array_merge() below |
||
1105 | |||
1106 | $item['closed_at'] = ''; |
||
1107 | if (!empty($meetingDB['closed_at'])) { |
||
1108 | $item['closed_at'] = api_convert_and_format_date($meetingDB['closed_at']); |
||
1109 | $meetingDB['closed_at'] = $item['closed_at']; |
||
1110 | } |
||
1111 | |||
1112 | $item['publish_url'] = $this->publishUrl($meetingDB); |
||
1113 | $item['unpublish_url'] = $this->unPublishUrl($meetingBBB); |
||
1114 | |||
1115 | if ($meetingDB['status'] == 1) { |
||
1116 | $joinParams = [ |
||
1117 | 'meetingId' => $meetingDB['remote_id'], |
||
1118 | //-- REQUIRED - A unique id for the meeting |
||
1119 | 'username' => $this->userCompleteName, |
||
1120 | //-- REQUIRED - The name that will display for the user in the meeting |
||
1121 | 'password' => $pass, |
||
1122 | //-- REQUIRED - The attendee or moderator password, depending on what's passed here |
||
1123 | 'createTime' => '', |
||
1124 | //-- OPTIONAL - string. Leave blank ('') unless you set this correctly. |
||
1125 | 'userID' => '', |
||
1126 | // -- OPTIONAL - string |
||
1127 | 'webVoiceConf' => '', |
||
1128 | ]; |
||
1129 | $item['go_url'] = $this->protocol.$this->api->getJoinMeetingURL($joinParams); |
||
1130 | } |
||
1131 | $item = array_merge($item, $meetingDB, $meetingBBB); |
||
1132 | |||
1133 | $item['course'] = $em->find('ChamiloCoreBundle:Course', $item['c_id']); |
||
1134 | $item['session'] = $em->find('ChamiloCoreBundle:Session', $item['session_id']); |
||
1135 | $newMeetingList[] = $item; |
||
1136 | } |
||
1137 | |||
1138 | return $newMeetingList; |
||
1139 | } |
||
1140 | |||
1141 | /** |
||
1142 | * @param array $meeting |
||
1143 | * |
||
1144 | * @return string |
||
1145 | */ |
||
1146 | public function endUrl($meeting) |
||
1147 | { |
||
1148 | if (!isset($meeting['id'])) { |
||
1149 | return ''; |
||
1150 | } |
||
1151 | |||
1152 | return api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?'.$this->getUrlParams().'&action=end&id='.$meeting['id']; |
||
1153 | } |
||
1154 | |||
1155 | /** |
||
1156 | * Closes a meeting (usually when the user click on the close button from |
||
1157 | * the conferences listing. |
||
1158 | * |
||
1159 | * @param string The internal ID of the meeting (id field for this meeting) |
||
1160 | * @param string $courseCode |
||
1161 | * |
||
1162 | * @return void |
||
1163 | * @assert (0) === false |
||
1164 | */ |
||
1165 | public function endMeeting($id, $courseCode = null) |
||
1166 | { |
||
1167 | if (empty($id)) { |
||
1168 | return false; |
||
1169 | } |
||
1170 | |||
1171 | $meetingData = Database::select( |
||
1172 | '*', |
||
1173 | $this->table, |
||
1174 | array('where' => array('id = ?' => array($id))), |
||
1175 | 'first' |
||
1176 | ); |
||
1177 | $manager = $this->isConferenceManager(); |
||
1178 | if ($manager) { |
||
1179 | $pass = $meetingData['moderator_pw']; |
||
1180 | } else { |
||
1181 | $pass = $meetingData['attendee_pw']; |
||
1182 | } |
||
1183 | |||
1184 | Event::addEvent( |
||
1185 | 'bbb_end_meeting', |
||
1186 | 'meeting_id', |
||
1187 | (int) $id, |
||
1188 | null, |
||
1189 | api_get_user_id(), |
||
1190 | api_get_course_int_id(), |
||
1191 | api_get_session_id() |
||
1192 | ); |
||
1193 | |||
1194 | $endParams = array( |
||
1195 | 'meetingId' => $meetingData['remote_id'], // REQUIRED - We have to know which meeting to end. |
||
1196 | 'password' => $pass, // REQUIRED - Must match moderator pass for meeting. |
||
1197 | ); |
||
1198 | $this->api->endMeetingWithXmlResponseArray($endParams); |
||
1199 | Database::update( |
||
1200 | $this->table, |
||
1201 | array('status' => 0, 'closed_at' => api_get_utc_datetime()), |
||
1202 | array('id = ? ' => $id) |
||
1203 | ); |
||
1204 | |||
1205 | // Update users with in_at y ou_at field equal |
||
1206 | $roomTable = Database::get_main_table('plugin_bbb_room'); |
||
1207 | $conditions['where'] = ['meeting_id=? AND in_at=out_at AND close=?' => [$id, BBBPlugin::ROOM_OPEN]]; |
||
1208 | $roomList = Database::select( |
||
1209 | '*', |
||
1210 | $roomTable, |
||
1211 | $conditions |
||
1212 | ); |
||
1213 | |||
1214 | foreach ($roomList as $roomDB) { |
||
1215 | $roomId = $roomDB['id']; |
||
1216 | if (!empty($roomId)) { |
||
1217 | Database::update( |
||
1218 | $roomTable, |
||
1219 | ['out_at' => api_get_utc_datetime(), 'close' => BBBPlugin::ROOM_CLOSE], |
||
1220 | ['id = ? ' => $roomId] |
||
1221 | ); |
||
1222 | } |
||
1223 | } |
||
1224 | |||
1225 | // Close all meeting rooms with meeting ID |
||
1226 | Database::update( |
||
1227 | $roomTable, |
||
1228 | ['close' => BBBPlugin::ROOM_CLOSE], |
||
1229 | ['meeting_id = ? ' => $id] |
||
1230 | ); |
||
1231 | } |
||
1232 | |||
1233 | /** |
||
1234 | * @param array $meeting |
||
1235 | * @param array $record |
||
1236 | * |
||
1237 | * @return string |
||
1238 | */ |
||
1239 | public function addToCalendarUrl($meeting, $record = []) |
||
1240 | { |
||
1241 | $url = isset($record['playbackFormatUrl']) ? $record['playbackFormatUrl'] : ''; |
||
1242 | |||
1243 | return api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?'.$this->getUrlParams( |
||
1244 | ).'&action=add_to_calendar&id='.$meeting['id'].'&start='.api_strtotime($meeting['created_at']).'&url='.$url; |
||
1245 | } |
||
1246 | |||
1247 | /** |
||
1248 | * @param int $meetingId |
||
1249 | * @param string $videoUrl |
||
1250 | * |
||
1251 | * @return bool|int |
||
1252 | */ |
||
1253 | public function updateMeetingVideoUrl($meetingId, $videoUrl) |
||
1254 | { |
||
1255 | return Database::update( |
||
1256 | 'plugin_bbb_meeting', |
||
1257 | ['video_url' => $videoUrl], |
||
1258 | ['id = ?' => intval($meetingId)] |
||
1259 | ); |
||
1260 | } |
||
1261 | |||
1262 | /** |
||
1263 | * Force the course, session and/or group IDs |
||
1264 | * |
||
1265 | * @param string $courseCode |
||
1266 | * @param int $sessionId |
||
1267 | * @param int $groupId |
||
1268 | */ |
||
1269 | public function forceCIdReq($courseCode, $sessionId = 0, $groupId = 0) |
||
1270 | { |
||
1271 | $this->courseCode = $courseCode; |
||
1272 | $this->sessionId = (int) $sessionId; |
||
1273 | $this->groupId = (int) $groupId; |
||
1274 | } |
||
1275 | |||
1276 | /** |
||
1277 | * @param array $meetingInfo |
||
1278 | * @param array $recordInfo |
||
1279 | * @param bool $isGlobal |
||
1280 | * @param bool $isAdminReport |
||
1281 | * |
||
1282 | * @return array |
||
1283 | */ |
||
1284 | private function getActionLinks( |
||
1285 | $meetingInfo, |
||
1286 | $recordInfo, |
||
1287 | $isGlobal = false, |
||
1288 | $isAdminReport = false |
||
1289 | ) { |
||
1290 | $isVisible = $meetingInfo['visibility'] != 0; |
||
1291 | $linkVisibility = $isVisible |
||
1292 | ? Display::url( |
||
1293 | Display::return_icon('visible.png', get_lang('MakeInvisible')), |
||
1294 | $this->unPublishUrl($meetingInfo) |
||
1295 | ) |
||
1296 | : Display::url( |
||
1297 | Display::return_icon('invisible.png', get_lang('MakeVisible')), |
||
1298 | $this->publishUrl($meetingInfo) |
||
1299 | ); |
||
1300 | |||
1301 | $links = []; |
||
1302 | if ($this->plugin->get('allow_regenerate_recording') === 'true' && $meetingInfo['record'] == 1) { |
||
1303 | if (!empty($recordInfo)) { |
||
1304 | $links[] = Display::url( |
||
1305 | Display::return_icon('reload.png', get_lang('RegenerateRecord')), |
||
1306 | $this->regenerateRecordUrl($meetingInfo, $recordInfo) |
||
1307 | ); |
||
1308 | } else { |
||
1309 | $links[] = Display::url( |
||
1310 | Display::return_icon('reload.png', get_lang('RegenerateRecord')), |
||
1311 | $this->regenerateRecordUrlFromMeeting($meetingInfo) |
||
1312 | ); |
||
1313 | } |
||
1314 | } |
||
1315 | |||
1316 | if (empty($recordInfo)) { |
||
1317 | if (!$isAdminReport) { |
||
1318 | if ($meetingInfo['status'] == 0) { |
||
1319 | $links[] = Display::url( |
||
1320 | Display::return_icon('delete.png', get_lang('Delete')), |
||
1321 | $this->deleteRecordUrl($meetingInfo) |
||
1322 | ); |
||
1323 | $links[] = $linkVisibility; |
||
1324 | } |
||
1325 | |||
1326 | return $links; |
||
1327 | } else { |
||
1328 | $links[] = Display::url( |
||
1329 | Display::return_icon('course_home.png', get_lang('GoToCourse')), |
||
1330 | $this->getListingUrl($meetingInfo['c_id'], $meetingInfo['session_id'], $meetingInfo['group_id']) |
||
1331 | ); |
||
1332 | |||
1333 | return $links; |
||
1334 | } |
||
1335 | } |
||
1336 | |||
1337 | if (!$isGlobal) { |
||
1338 | $links[] = Display::url( |
||
1339 | Display::return_icon('link.gif', get_lang('UrlMeetingToShare')), |
||
1340 | $this->copyToRecordToLinkTool($meetingInfo) |
||
1341 | ); |
||
1342 | $links[] = Display::url( |
||
1343 | Display::return_icon('agenda.png', get_lang('AddToCalendar')), |
||
1344 | $this->addToCalendarUrl($meetingInfo, $recordInfo) |
||
1345 | ); |
||
1346 | } |
||
1347 | |||
1348 | $hide = $this->plugin->get('disable_download_conference_link') === 'true' ? true : false; |
||
1349 | |||
1350 | if ($hide == false) { |
||
1351 | if ($meetingInfo['has_video_m4v']) { |
||
1352 | $links[] = Display::url( |
||
1353 | Display::return_icon('save.png', get_lang('DownloadFile')), |
||
1354 | $recordInfo['playbackFormatUrl'].'/capture.m4v', |
||
1355 | ['target' => '_blank'] |
||
1356 | ); |
||
1357 | } else { |
||
1358 | $links[] = Display::url( |
||
1359 | Display::return_icon('save.png', get_lang('DownloadFile')), |
||
1360 | '#', |
||
1361 | [ |
||
1362 | 'id' => "btn-check-meeting-video-{$meetingInfo['id']}", |
||
1363 | 'class' => 'check-meeting-video', |
||
1364 | 'data-id' => $meetingInfo['id'], |
||
1365 | ] |
||
1366 | ); |
||
1367 | } |
||
1368 | } |
||
1369 | |||
1370 | |||
1371 | if (!$isAdminReport) { |
||
1372 | $links[] = Display::url( |
||
1373 | Display::return_icon('delete.png', get_lang('Delete')), |
||
1374 | $this->deleteRecordUrl($meetingInfo) |
||
1375 | ); |
||
1376 | $links[] = $linkVisibility; |
||
1377 | } else { |
||
1378 | $links[] = Display::url( |
||
1379 | Display::return_icon('course_home.png', get_lang('GoToCourse')), |
||
1380 | $this->getListingUrl($meetingInfo['c_id'], $meetingInfo['session_id'], $meetingInfo['group_id']) |
||
1381 | ); |
||
1382 | } |
||
1383 | |||
1384 | |||
1385 | return $links; |
||
1386 | } |
||
1387 | |||
1388 | /** |
||
1389 | * @param array $meeting |
||
1390 | * |
||
1391 | * @return string |
||
1392 | */ |
||
1393 | public function unPublishUrl($meeting) |
||
1394 | { |
||
1395 | if (!isset($meeting['id'])) { |
||
1396 | return null; |
||
1397 | } |
||
1398 | |||
1399 | return api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?'.$this->getUrlParams( |
||
1400 | ).'&action=unpublish&id='.$meeting['id']; |
||
1401 | } |
||
1402 | |||
1403 | /** |
||
1404 | * @param array $meeting |
||
1405 | * |
||
1406 | * @return string |
||
1407 | */ |
||
1408 | public function publishUrl($meeting) |
||
1409 | { |
||
1410 | if (!isset($meeting['id'])) { |
||
1411 | return ''; |
||
1412 | } |
||
1413 | |||
1414 | return api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?'.$this->getUrlParams( |
||
1415 | ).'&action=publish&id='.$meeting['id']; |
||
1416 | } |
||
1417 | |||
1418 | /** |
||
1419 | * @param array $meeting |
||
1420 | * @param array $recordInfo |
||
1421 | * |
||
1422 | * @return string |
||
1423 | */ |
||
1424 | public function regenerateRecordUrl($meeting, $recordInfo) |
||
1425 | { |
||
1426 | if ($this->plugin->get('allow_regenerate_recording') !== 'true') { |
||
1427 | return ''; |
||
1428 | } |
||
1429 | |||
1430 | if (!isset($meeting['id'])) { |
||
1431 | return ''; |
||
1432 | } |
||
1433 | |||
1434 | if (empty($recordInfo) || (!empty($recordInfo['recordId']) && !isset($recordInfo['recordId']))) { |
||
1435 | return ''; |
||
1436 | } |
||
1437 | |||
1438 | return api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?'.$this->getUrlParams(). |
||
1439 | '&action=regenerate_record&id='.$meeting['id'].'&record_id='.$recordInfo['recordId']; |
||
1440 | } |
||
1441 | |||
1442 | /** |
||
1443 | * @param array $meeting |
||
1444 | * |
||
1445 | * @return string |
||
1446 | */ |
||
1447 | public function regenerateRecordUrlFromMeeting($meeting) |
||
1448 | { |
||
1449 | if ($this->plugin->get('allow_regenerate_recording') !== 'true') { |
||
1450 | return ''; |
||
1451 | } |
||
1452 | |||
1453 | if (!isset($meeting['id'])) { |
||
1454 | return ''; |
||
1455 | } |
||
1456 | |||
1457 | return api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?'.$this->getUrlParams(). |
||
1458 | '&action=regenerate_record&id='.$meeting['id']; |
||
1459 | } |
||
1460 | |||
1461 | /** |
||
1462 | * @param array $meeting |
||
1463 | * |
||
1464 | * @return string |
||
1465 | */ |
||
1466 | public function deleteRecordUrl($meeting) |
||
1467 | { |
||
1468 | if (!isset($meeting['id'])) { |
||
1469 | return ''; |
||
1470 | } |
||
1471 | |||
1472 | return api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?'.$this->getUrlParams( |
||
1473 | ).'&action=delete_record&id='.$meeting['id']; |
||
1474 | } |
||
1475 | |||
1476 | /** |
||
1477 | * @param array $meeting |
||
1478 | * |
||
1479 | * @return string |
||
1480 | */ |
||
1481 | public function copyToRecordToLinkTool($meeting) |
||
1482 | { |
||
1483 | if (!isset($meeting['id'])) { |
||
1484 | return ''; |
||
1485 | } |
||
1486 | |||
1487 | return api_get_path(WEB_PLUGIN_PATH). |
||
1488 | 'bbb/listing.php?'.$this->getUrlParams().'&action=copy_record_to_link_tool&id='.$meeting['id']; |
||
1489 | } |
||
1490 | |||
1491 | /** |
||
1492 | * Function disabled |
||
1493 | */ |
||
1494 | public function publishMeeting($id) |
||
1495 | { |
||
1496 | //return BigBlueButtonBN::setPublishRecordings($id, 'true', $this->url, $this->salt); |
||
1497 | if (empty($id)) { |
||
1498 | return false; |
||
1499 | } |
||
1500 | $id = intval($id); |
||
1501 | Database::update($this->table, array('visibility' => 1), array('id = ? ' => $id)); |
||
1502 | |||
1503 | return true; |
||
1504 | } |
||
1505 | |||
1506 | /** |
||
1507 | * Function disabled |
||
1508 | */ |
||
1509 | public function unpublishMeeting($id) |
||
1510 | { |
||
1511 | //return BigBlueButtonBN::setPublishRecordings($id, 'false', $this->url, $this->salt); |
||
1512 | if (empty($id)) { |
||
1513 | return false; |
||
1514 | } |
||
1515 | $id = intval($id); |
||
1516 | Database::update($this->table, array('visibility' => 0), array('id = ?' => $id)); |
||
1517 | |||
1518 | return true; |
||
1519 | } |
||
1520 | |||
1521 | /** |
||
1522 | * Get users online in the current course room. |
||
1523 | * |
||
1524 | * @return int The number of users currently connected to the videoconference |
||
1525 | * @assert () > -1 |
||
1526 | */ |
||
1527 | public function getUsersOnlineInCurrentRoom() |
||
1528 | { |
||
1529 | $courseId = api_get_course_int_id(); |
||
1530 | $sessionId = api_get_session_id(); |
||
1531 | |||
1532 | $conditions = array( |
||
1533 | 'where' => array( |
||
1534 | 'c_id = ? AND session_id = ? AND status = 1 AND access_url = ?' => array( |
||
1535 | $courseId, |
||
1536 | $sessionId, |
||
1537 | $this->accessUrl, |
||
1538 | ), |
||
1539 | ), |
||
1540 | ); |
||
1541 | |||
1542 | if ($this->hasGroupSupport()) { |
||
1543 | $groupId = api_get_group_id(); |
||
1544 | $conditions = array( |
||
1545 | 'where' => array( |
||
1546 | 'c_id = ? AND session_id = ? AND group_id = ? AND status = 1 AND access_url = ?' => array( |
||
1547 | $courseId, |
||
1548 | $sessionId, |
||
1549 | $groupId, |
||
1550 | $this->accessUrl, |
||
1551 | ), |
||
1552 | ), |
||
1553 | ); |
||
1554 | } |
||
1555 | |||
1556 | if ($this->isGlobalConferencePerUserEnabled()) { |
||
1557 | $conditions = array( |
||
1558 | 'where' => array( |
||
1559 | 'user_id = ? AND status = 1 AND access_url = ?' => array( |
||
1560 | $this->userId, |
||
1561 | $this->accessUrl, |
||
1562 | ), |
||
1563 | ), |
||
1564 | ); |
||
1565 | } |
||
1566 | |||
1567 | $meetingData = Database::select( |
||
1568 | '*', |
||
1569 | $this->table, |
||
1570 | $conditions, |
||
1571 | 'first' |
||
1572 | ); |
||
1573 | |||
1574 | if (empty($meetingData)) { |
||
1575 | return 0; |
||
1576 | } |
||
1577 | $pass = $meetingData['moderator_pw']; |
||
1578 | $info = $this->getMeetingInfo(array('meetingId' => $meetingData['remote_id'], 'password' => $pass)); |
||
1579 | if ($info === false) { |
||
1580 | //checking with the remote_id didn't work, so just in case and |
||
1581 | // to provide backwards support, check with the id |
||
1582 | $params = array( |
||
1583 | 'meetingId' => $meetingData['id'], |
||
1584 | // -- REQUIRED - The unique id for the meeting |
||
1585 | 'password' => $pass |
||
1586 | // -- REQUIRED - The moderator password for the meeting |
||
1587 | ); |
||
1588 | $info = $this->getMeetingInfo($params); |
||
1589 | } |
||
1590 | |||
1591 | if (!empty($info) && isset($info['participantCount'])) { |
||
1592 | return $info['participantCount']; |
||
1593 | } |
||
1594 | |||
1595 | return 0; |
||
1596 | } |
||
1597 | |||
1598 | /** |
||
1599 | * @param int $id |
||
1600 | * @param string $recordId |
||
1601 | * |
||
1602 | * @return bool |
||
1603 | */ |
||
1604 | public function regenerateRecording($id, $recordId = '') |
||
1605 | { |
||
1606 | if ($this->plugin->get('allow_regenerate_recording') !== 'true') { |
||
1607 | return false; |
||
1608 | } |
||
1609 | |||
1610 | if (empty($id)) { |
||
1611 | return false; |
||
1612 | } |
||
1613 | |||
1614 | $meetingData = Database::select( |
||
1615 | '*', |
||
1616 | $this->table, |
||
1617 | array('where' => array('id = ?' => array($id))), |
||
1618 | 'first' |
||
1619 | ); |
||
1620 | |||
1621 | Event::addEvent( |
||
1622 | 'bbb_regenerate_record', |
||
1623 | 'record_id', |
||
1624 | (int) $recordId, |
||
1625 | null, |
||
1626 | api_get_user_id(), |
||
1627 | api_get_course_int_id(), |
||
1628 | api_get_session_id() |
||
1629 | ); |
||
1630 | |||
1631 | // Check if there are recordings for this meeting |
||
1632 | $recordings = $this->api->getRecordings(['meetingId' => $meetingData['remote_id']]); |
||
1633 | if (!empty($recordings) && isset($recordings['messageKey']) && $recordings['messageKey'] === 'noRecordings') { |
||
1634 | // Regenerate the meeting id |
||
1635 | if (!empty($meetingData['internal_meeting_id'])) { |
||
1636 | return $this->api->generateRecording(['recordId' => $meetingData['internal_meeting_id']]); |
||
1637 | } |
||
1638 | |||
1639 | /*$pass = $this->getModMeetingPassword(); |
||
1640 | $info = $this->getMeetingInfo(['meetingId' => $meetingData['remote_id'], 'password' => $pass]); |
||
1641 | if (!empty($info) && isset($info['internalMeetingID'])) { |
||
1642 | return $this->api->generateRecording(['recordId' => $meetingData['internal_meeting_id']]); |
||
1643 | }*/ |
||
1644 | |||
1645 | return false; |
||
1646 | } else { |
||
1647 | if (!empty($recordings['records'])) { |
||
1648 | $recordExists = false; |
||
1649 | foreach ($recordings['records'] as $record) { |
||
1650 | if ($recordId == $record['recordId']) { |
||
1651 | $recordExists = true; |
||
1652 | break; |
||
1653 | } |
||
1654 | } |
||
1655 | |||
1656 | if ($recordExists) { |
||
1657 | return $this->api->generateRecording(['recordId' => $recordId]); |
||
1658 | } |
||
1659 | } |
||
1660 | } |
||
1661 | |||
1662 | return false; |
||
1663 | } |
||
1664 | |||
1665 | /** |
||
1666 | * Deletes a recording of a meeting |
||
1667 | * |
||
1668 | * @param int $id ID of the recording |
||
1669 | * |
||
1670 | * @return bool |
||
1671 | * |
||
1672 | * @assert () === false |
||
1673 | * @todo Also delete links and agenda items created from this recording |
||
1674 | */ |
||
1675 | public function deleteRecording($id) |
||
1676 | { |
||
1677 | if (empty($id)) { |
||
1678 | return false; |
||
1679 | } |
||
1680 | |||
1681 | $meetingData = Database::select( |
||
1682 | '*', |
||
1683 | $this->table, |
||
1684 | array('where' => array('id = ?' => array($id))), |
||
1685 | 'first' |
||
1686 | ); |
||
1687 | |||
1688 | Event::addEvent( |
||
1689 | 'bbb_delete_record', |
||
1690 | 'meeting_id', |
||
1691 | $id, |
||
1692 | null, |
||
1693 | api_get_user_id(), |
||
1694 | api_get_course_int_id(), |
||
1695 | api_get_session_id() |
||
1696 | ); |
||
1697 | |||
1698 | $delete = false; |
||
1699 | $recordings = []; |
||
1700 | // Check if there are recordings for this meeting |
||
1701 | if (!empty($meetingData['remote_id'])) { |
||
1702 | Event::addEvent( |
||
1703 | 'bbb_delete_record', |
||
1704 | 'remote_id', |
||
1705 | $meetingData['remote_id'], |
||
1706 | null, |
||
1707 | api_get_user_id(), |
||
1708 | api_get_course_int_id(), |
||
1709 | api_get_session_id() |
||
1710 | ); |
||
1711 | $recordings = $this->api->getRecordings(['meetingId' => $meetingData['remote_id']]); |
||
1712 | } |
||
1713 | if (!empty($recordings) && isset($recordings['messageKey']) && $recordings['messageKey'] == 'noRecordings') { |
||
1714 | $delete = true; |
||
1715 | } else { |
||
1716 | if (!empty($recordings['records'])) { |
||
1717 | $recordsToDelete = []; |
||
1718 | foreach ($recordings['records'] as $record) { |
||
1719 | $recordsToDelete[] = $record['recordId']; |
||
1720 | } |
||
1721 | $delete = true; |
||
1722 | if (!empty($recordsToDelete)) { |
||
1723 | $recordingParams = ['recordId' => implode(',', $recordsToDelete)]; |
||
1724 | Event::addEvent( |
||
1725 | 'bbb_delete_record', |
||
1726 | 'record_id_list', |
||
1727 | implode(',', $recordsToDelete), |
||
1728 | null, |
||
1729 | api_get_user_id(), |
||
1730 | api_get_course_int_id(), |
||
1731 | api_get_session_id() |
||
1732 | ); |
||
1733 | $result = $this->api->deleteRecordingsWithXmlResponseArray($recordingParams); |
||
1734 | if (!empty($result) && isset($result['deleted']) && $result['deleted'] === 'true') { |
||
1735 | $delete = true; |
||
1736 | } |
||
1737 | } |
||
1738 | } |
||
1739 | } |
||
1740 | |||
1741 | if ($delete) { |
||
1742 | Database::delete( |
||
1743 | 'plugin_bbb_room', |
||
1744 | array('meeting_id = ?' => array($id)) |
||
1745 | ); |
||
1746 | |||
1747 | Database::delete( |
||
1748 | $this->table, |
||
1749 | array('id = ?' => array($id)) |
||
1750 | ); |
||
1751 | } |
||
1752 | |||
1753 | return $delete; |
||
1754 | } |
||
1755 | |||
1756 | /** |
||
1757 | * Creates a link in the links tool from the given videoconference recording |
||
1758 | * |
||
1759 | * @param int $id ID of the item in the plugin_bbb_meeting table |
||
1760 | * @param string Hash identifying the recording, as provided by the API |
||
1761 | * |
||
1762 | * @return mixed ID of the newly created link, or false on error |
||
1763 | * @assert (null, null) === false |
||
1764 | * @assert (1, null) === false |
||
1765 | * @assert (null, 'abcdefabcdefabcdefabcdef') === false |
||
1766 | */ |
||
1767 | public function copyRecordingToLinkTool($id) |
||
1768 | { |
||
1769 | if (empty($id)) { |
||
1770 | return false; |
||
1771 | } |
||
1772 | //$records = BigBlueButtonBN::getRecordingsUrl($id); |
||
1773 | $meetingData = Database::select( |
||
1774 | '*', |
||
1775 | $this->table, |
||
1776 | array('where' => array('id = ?' => array($id))), |
||
1777 | 'first' |
||
1778 | ); |
||
1779 | |||
1780 | $records = $this->api->getRecordingsWithXmlResponseArray( |
||
1781 | array('meetingId' => $meetingData['remote_id']) |
||
1782 | ); |
||
1783 | |||
1784 | if (!empty($records)) { |
||
1785 | if (isset($records['message']) && !empty($records['message'])) { |
||
1786 | if ($records['messageKey'] == 'noRecordings') { |
||
1787 | $recordArray[] = $this->plugin->get_lang('NoRecording'); |
||
1788 | } else { |
||
1789 | //$recordArray[] = $records['message']; |
||
1790 | } |
||
1791 | |||
1792 | return false; |
||
1793 | } else { |
||
1794 | $record = $records[0]; |
||
1795 | if (is_array($record) && isset($record['recordId'])) { |
||
1796 | $url = $record['playbackFormatUrl']; |
||
1797 | $link = new Link(); |
||
1798 | $params['url'] = $url; |
||
1799 | $params['title'] = $meetingData['meeting_name']; |
||
1800 | $id = $link->save($params); |
||
1801 | |||
1802 | return $id; |
||
1803 | } |
||
1804 | } |
||
1805 | } |
||
1806 | |||
1807 | return false; |
||
1808 | } |
||
1809 | |||
1810 | /** |
||
1811 | * Checks if the video conference server is running. |
||
1812 | * Function currently disabled (always returns 1) |
||
1813 | * @return bool True if server is running, false otherwise |
||
1814 | * @assert () === false |
||
1815 | */ |
||
1816 | public function isServerRunning() |
||
1817 | { |
||
1818 | return true; |
||
1819 | //return BigBlueButtonBN::isServerRunning($this->protocol.$this->url); |
||
1820 | } |
||
1821 | |||
1822 | /** |
||
1823 | * Checks if the video conference plugin is properly configured |
||
1824 | * @return bool True if plugin has a host and a salt, false otherwise |
||
1825 | * @assert () === false |
||
1826 | */ |
||
1827 | public function isServerConfigured() |
||
1828 | { |
||
1829 | $host = $this->plugin->get('host'); |
||
1830 | |||
1831 | if (empty($host)) { |
||
1832 | return false; |
||
1833 | } |
||
1834 | |||
1835 | $salt = $this->plugin->get('salt'); |
||
1836 | |||
1837 | if (empty($salt)) { |
||
1838 | return false; |
||
1839 | } |
||
1840 | |||
1841 | return true; |
||
1842 | //return BigBlueButtonBN::isServerRunning($this->protocol.$this->url); |
||
1843 | } |
||
1844 | |||
1845 | /** |
||
1846 | * Get active session in the all platform |
||
1847 | */ |
||
1848 | public function getActiveSessionsCount() |
||
1849 | { |
||
1850 | $meetingList = Database::select( |
||
1851 | 'count(id) as count', |
||
1852 | $this->table, |
||
1853 | array('where' => array('status = ? AND access_url = ?' => array(1, $this->accessUrl))), |
||
1854 | 'first' |
||
1855 | ); |
||
1856 | |||
1857 | return $meetingList['count']; |
||
1858 | } |
||
1859 | |||
1860 | /** |
||
1861 | * Get active session in the all platform |
||
1862 | */ |
||
1863 | public function getActiveSessions() |
||
1872 | } |
||
1873 | |||
1874 | /** |
||
1875 | * @param string $url |
||
1876 | */ |
||
1877 | public function redirectToBBB($url) |
||
1878 | { |
||
1879 | if (file_exists(__DIR__.'/../config.vm.php')) { |
||
1880 | // Using VM |
||
1881 | echo Display::url($this->plugin->get_lang('ClickToContinue'), $url); |
||
1882 | exit; |
||
1883 | } else { |
||
1884 | // Classic |
||
1885 | header("Location: $url"); |
||
1886 | exit; |
||
1887 | } |
||
1888 | } |
||
1889 | |||
1890 | /** |
||
1891 | * @return string |
||
1892 | */ |
||
1893 | public function getConferenceUrl() |
||
1894 | { |
||
1895 | return api_get_path(WEB_PLUGIN_PATH).'bbb/start.php?launch=1&'.$this->getUrlParams(); |
||
1896 | } |
||
1897 | |||
1898 | /** |
||
1899 | * Get the meeting info from DB by its name |
||
1900 | * |
||
1901 | * @param string $name |
||
1902 | * |
||
1903 | * @return array |
||
1904 | */ |
||
1905 | public function findMeetingByName($name) |
||
1906 | { |
||
1907 | $meetingData = Database::select( |
||
1908 | '*', |
||
1909 | 'plugin_bbb_meeting', |
||
1910 | array('where' => array('meeting_name = ? AND status = 1 ' => $name)), |
||
1911 | 'first' |
||
1912 | ); |
||
1913 | |||
1914 | return $meetingData; |
||
1915 | } |
||
1916 | |||
1917 | /** |
||
1918 | * Get the meeting info from DB by its name |
||
1919 | * |
||
1920 | * @param int $id |
||
1921 | * |
||
1922 | * @return array |
||
1923 | */ |
||
1924 | public function getMeeting($id) |
||
1925 | { |
||
1926 | $meetingData = Database::select( |
||
1927 | '*', |
||
1928 | 'plugin_bbb_meeting', |
||
1929 | array('where' => array('id = ?' => $id)), |
||
1930 | 'first' |
||
1931 | ); |
||
1932 | |||
1933 | return $meetingData; |
||
1934 | } |
||
1935 | |||
1936 | /** |
||
1937 | * Get the meeting info. |
||
1938 | * |
||
1939 | * @param int $id |
||
1940 | * |
||
1941 | * @return array |
||
1942 | */ |
||
1943 | public function getMeetingByRemoteId($id) |
||
1944 | { |
||
1945 | $meetingData = Database::select( |
||
1946 | '*', |
||
1947 | 'plugin_bbb_meeting', |
||
1948 | array('where' => array('remote_id = ?' => $id)), |
||
1949 | 'first' |
||
1950 | ); |
||
1951 | |||
1952 | return $meetingData; |
||
1953 | } |
||
1954 | |||
1955 | /** |
||
1956 | * @param int $meetingId |
||
1957 | * |
||
1958 | * @return array |
||
1959 | */ |
||
1960 | public function findConnectedMeetingParticipants($meetingId) |
||
1987 | } |
||
1988 | |||
1989 | /** |
||
1990 | * Check if the meeting has a capture.m4v video file. If exists then the has_video_m4v field is updated |
||
1991 | * |
||
1992 | * @param int $meetingId |
||
1993 | * |
||
1994 | * @return bool |
||
1995 | */ |
||
1996 | public function checkDirectMeetingVideoUrl($meetingId) |
||
1997 | { |
||
1998 | $meetingInfo = Database::select( |
||
1999 | '*', |
||
2000 | 'plugin_bbb_meeting', |
||
2001 | [ |
||
2002 | 'where' => ['id = ?' => intval($meetingId)], |
||
2003 | ], |
||
2004 | 'first' |
||
2005 | ); |
||
2006 | |||
2007 | if (!isset($meetingInfo['video_url'])) { |
||
2008 | return false; |
||
2009 | } |
||
2010 | |||
2011 | $hasCapture = SocialManager::verifyUrl($meetingInfo['video_url'].'/capture.m4v'); |
||
2012 | |||
2013 | if ($hasCapture) { |
||
2014 | return Database::update( |
||
2015 | 'plugin_bbb_meeting', |
||
2016 | ['has_video_m4v' => true], |
||
2022 | } |
||
2023 | } |
||
2024 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.