Issues (2037)

plugin/openmeetings/listing.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * This script initiates a videoconference session, calling the BigBlueButton API.
4
 *
5
 * @package chamilo.plugin.bigbluebutton
6
 */
7
/**
8
 * Initialization.
9
 */
10
$course_plugin = 'openmeetings'; //needed in order to load the plugin lang variables
11
require_once __DIR__.'/config.php';
12
$plugin = \OpenMeetingsPlugin::create();
13
$tool_name = $plugin->get_lang('Videoconference');
14
$tpl = new Template($tool_name);
15
16
$om = new Chamilo\Plugin\OpenMeetings\OpenMeetings();
17
$action = isset($_GET['action']) ? $_GET['action'] : null;
18
$teacher = $om->isTeacher();
19
20
api_protect_course_script(true);
21
$message = null;
22
23
if ($teacher) {
24
    switch ($action) {
25
        case 'add_to_calendar':
26
            $course_info = api_get_course_info();
27
            $agenda = new Agenda('course');
28
29
            $id = intval($_GET['id']);
30
            $title = sprintf(get_lang('VideoConferenceXCourseX'), $id, $course_info['name']);
31
            $content = Display::url(get_lang('GoToTheVideoConference'), $_GET['url']);
32
33
            $event_id = $agenda->addEvent(
34
                $_REQUEST['start'],
35
                null,
36
                'true',
37
                $title,
38
                $content,
39
                ['everyone']
40
            );
41
            if (!empty($event_id)) {
42
                $message = Display::return_message(get_lang('VideoConferenceAddedToTheCalendar'), 'success');
43
            } else {
44
                $message = Display::return_message(get_lang('Error'), 'error');
45
            }
46
            break;
47
        case 'copy_record_to_link_tool':
48
            $result = $om->copy_record_to_link_tool($_GET['id'], $_GET['record_id']);
0 ignored issues
show
The method copy_record_to_link_tool() does not exist on Chamilo\Plugin\OpenMeetings\OpenMeetings. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

48
            /** @scrutinizer ignore-call */ 
49
            $result = $om->copy_record_to_link_tool($_GET['id'], $_GET['record_id']);

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.

Loading history...
49
            if ($result) {
50
                $message = Display::return_message(get_lang('VideoConferenceAddedToTheLinkTool'), 'success');
51
            } else {
52
                $message = Display::return_message(get_lang('Error'), 'error');
53
            }
54
            break;
55
        case 'delete_record':
56
            /*$result = $om->delete_record($_GET['id']);
57
            if ($result) {
58
                $message = Display::return_message(get_lang('Deleted'), 'success');
59
            } else {
60
                $message = Display::return_message(get_lang('Error'), 'error');
61
            }*/
62
            break;
63
        case 'delete':
64
            $om->deleteMeeting($_GET['id']);
65
            unset($om);
66
            $message = Display::return_message(get_lang('MeetingDeleted').'<br />'.get_lang('MeetingDeletedComment'), 'success', false);
67
            header('Location: '.api_get_self());
68
            exit;
69
            break;
70
        case 'end':
71
            $om->endMeeting($_GET['id']);
72
            $message = Display::return_message(get_lang('MeetingClosed').'<br />'.get_lang('MeetingClosedComment'), 'success', false);
73
            break;
74
        case 'publish':
75
            // Not implemented yet
76
            //$result = $om->publish_meeting($_GET['id']);
77
            break;
78
        case 'unpublish':
79
            // Not implemented yet
80
            //$result = $om->unpublish_meeting($_GET['id']);
81
            break;
82
        default:
83
            break;
84
    }
85
}
86
87
$meetings = $om->getCourseMeetings();
88
$openMeeting = false;
89
$users_online = 0;
90
91
if (!empty($meetings)) {
92
    $meetings = array_reverse($meetings);
93
    foreach ($meetings as $meeting) {
94
        if ($meeting['status'] == 1) {
95
            $openMeeting = true;
96
        }
97
    }
98
    $users_online = $meetings->participantCount;
99
}
100
101
$status = $om->isServerRunning();
102
$show_join_button = false;
103
if ($openMeeting || $teacher) {
104
    $show_join_button = true;
105
}
106
107
$tpl->assign('allow_to_edit', $teacher);
108
$tpl->assign('meetings', $meetings);
109
$conference_url = api_get_path(WEB_PLUGIN_PATH).'openmeetings/start.php?launch=1&'.api_get_cidreq();
110
$tpl->assign('conference_url', $conference_url);
111
$tpl->assign('users_online', $users_online);
112
$tpl->assign('openmeetings_status', $status);
113
$tpl->assign('show_join_button', $show_join_button);
114
$tpl->assign('message', $message);
115
$listing_tpl = 'openmeetings/listing.tpl';
116
$content = $tpl->fetch($listing_tpl);
117
$tpl->assign('content', $content);
118
$tpl->display_one_col_template();
119