Issues (2029)

plugin/zoom/start.php (1 issue)

1
<?php
2
3
/* For license terms, see /license.txt */
4
5
$course_plugin = 'zoom'; // needed in order to load the plugin lang variables
6
7
require_once __DIR__.'/config.php';
8
9
api_protect_course_script(true);
10
11
$this_section = SECTION_COURSES;
12
$logInfo = [
13
    'tool' => 'Videoconference Zoom',
14
];
15
Event::registerLog($logInfo);
0 ignored issues
show
The method registerLog() does not exist on Event. ( Ignorable by Annotation )

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

15
Event::/** @scrutinizer ignore-call */ 
16
       registerLog($logInfo);

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...
16
17
$course = api_get_course_entity();
18
if (null === $course) {
19
    api_not_allowed(true);
20
}
21
22
$group = api_get_group_entity();
23
$session = api_get_session_entity();
24
$plugin = ZoomPlugin::create();
25
26
if (null !== $group) {
27
    $interbreadcrumb[] = [
28
        'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(),
29
        'name' => get_lang('Groups'),
30
    ];
31
    $interbreadcrumb[] = [
32
        'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
33
        'name' => get_lang('GroupSpace').' '.$group->getName(),
34
    ];
35
}
36
37
$url = api_get_self().'?'.api_get_cidreq(true, false).'&gidReq=';
38
$htmlHeadXtra[] = '<script>
39
 $(function() {
40
    $("#group_select").on("change", function() {
41
        var groupId = $(this).find("option:selected").val();
42
        var url = "'.$url.'";
43
        window.location.replace(url+groupId);
44
    });
45
});
46
</script>';
47
48
$tool_name = $plugin->get_lang('ZoomVideoConferences');
49
$tpl = new Template($tool_name);
50
51
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
52
53
$isManager = $plugin->userIsCourseConferenceManager();
54
if ($isManager) {
55
    $groupId = api_get_group_id();
56
    $groups = GroupManager::get_groups();
57
    if (!empty($groups)) {
58
        $form = new FormValidator('group_filter');
59
        $groupList[0] = get_lang('Select');
60
        foreach ($groups as $groupData) {
61
            $itemGroupId = $groupData['iid'];
62
            /*if (isset($meetingsGroup[$itemGroupId]) && $meetingsGroup[$itemGroupId] == 1) {
63
                $groupData['name'] .= ' ('.get_lang('Active').')';
64
            }*/
65
            $groupList[$itemGroupId] = $groupData['name'];
66
        }
67
        $form->addSelect('group_id', get_lang('Groups'), $groupList, ['id' => 'group_select']);
68
        $form->setDefaults(['group_id' => $groupId]);
69
        $formToString = $form->returnForm();
70
71
        $tpl->assign('group_form', $formToString);
72
    }
73
74
    switch ($action) {
75
        case 'delete':
76
            $meeting = $plugin->getMeetingRepository()->findOneBy(['meetingId' => $_REQUEST['meetingId']]);
77
            if ($meeting && $meeting->isCourseMeeting()) {
78
                $plugin->deleteMeeting($meeting, api_get_self().'?'.api_get_cidreq());
79
            }
80
            break;
81
    }
82
83
    $user = api_get_user_entity(api_get_user_id());
84
85
    $tpl->assign(
86
        'instant_meeting_form',
87
        $plugin->getCreateInstantMeetingForm(
88
            $user,
89
            $course,
90
            $group,
91
            $session
92
        )->returnForm()
93
    );
94
    $tpl->assign(
95
        'schedule_meeting_form',
96
        $plugin->getScheduleMeetingForm(
97
            $user,
98
            $course,
99
            $group,
100
            $session
101
        )->returnForm()
102
    );
103
}
104
105
try {
106
    $tpl->assign(
107
        'meetings',
108
        $plugin->getMeetingRepository()->courseMeetings($course, $group, $session)
109
    );
110
} catch (Exception $exception) {
111
    Display::addFlash(
112
        Display::return_message('Could not retrieve scheduled meeting list: '.$exception->getMessage(), 'error')
113
    );
114
}
115
116
$tpl->assign('is_manager', $isManager);
117
$tpl->assign('content', $tpl->fetch('zoom/view/start.tpl'));
118
$tpl->display_one_col_template();
119