Issues (2128)

main/course_description/index.php (1 issue)

Labels
Severity
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
/**
5
 * Template (front controller in MVC pattern) used for distpaching
6
 * to the controllers depend on the current action.
7
 *
8
 * @author Christian Fasanando <[email protected]>
9
 *
10
 * @package chamilo.course_description
11
 */
12
require_once __DIR__.'/../inc/global.inc.php';
13
$current_course_tool = TOOL_COURSE_DESCRIPTION;
14
15
// defining constants
16
define('ADD_BLOCK', 8);
17
18
// current section
19
$this_section = SECTION_COURSES;
20
21
$action = !empty($_GET['action']) ? Security::remove_XSS($_GET['action']) : 'listing';
22
23
$logInfo = [
24
    'tool' => TOOL_COURSE_DESCRIPTION,
25
    'tool_id' => 0,
26
    'tool_id_detail' => 0,
27
    'action' => $action,
28
    'info' => '',
29
];
30
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

30
Event::/** @scrutinizer ignore-call */ 
31
       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...
31
32
// protect a course script
33
api_protect_course_script(true);
34
35
$description_type = '';
36
if (isset($_GET['description_type'])) {
37
    $description_type = intval($_GET['description_type']);
38
}
39
40
$id = null;
41
if (isset($_GET['id'])) {
42
    $id = intval($_GET['id']);
43
}
44
45
if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'true') {
46
    $action = 'listing';
47
}
48
49
// interbreadcrumb
50
$interbreadcrumb[] = ["url" => "index.php?".api_get_cidreq(), "name" => get_lang('CourseProgram')];
51
if ($description_type == 1) {
52
    $interbreadcrumb[] = ["url" => "#", "name" => get_lang('GeneralDescription')];
53
}
54
if ($description_type == 2) {
55
    $interbreadcrumb[] = ["url" => "#", "name" => get_lang('Objectives')];
56
}
57
if ($description_type == 3) {
58
    $interbreadcrumb[] = ["url" => "#", "name" => get_lang('Topics')];
59
}
60
if ($description_type == 4) {
61
    $interbreadcrumb[] = ["url" => "#", "name" => get_lang('Methodology')];
62
}
63
if ($description_type == 5) {
64
    $interbreadcrumb[] = ["url" => "#", "name" => get_lang('CourseMaterial')];
65
}
66
if ($description_type == 6) {
67
    $interbreadcrumb[] = ["url" => "#", "name" => get_lang('HumanAndTechnicalResources')];
68
}
69
if ($description_type == 7) {
70
    $interbreadcrumb[] = ["url" => "#", "name" => get_lang('Assessment')];
71
}
72
if ($description_type == 8) {
73
    $interbreadcrumb[] = ["url" => "#", "name" => get_lang('ThematicAdvance')];
74
}
75
if ($description_type >= 9) {
76
    $interbreadcrumb[] = ["url" => "#", "name" => get_lang('Others')];
77
}
78
79
// course description controller object
80
$descriptionController = new CourseDescriptionController();
81
82
// block access
83
if (in_array($action, ['add', 'edit', 'delete']) &&
84
    !api_is_allowed_to_edit(null, true)
85
) {
86
    api_not_allowed(true);
87
}
88
89
// Actions to controller
90
switch ($action) {
91
    case 'history':
92
        $descriptionController->listing(true);
93
        break;
94
    case 'add':
95
        $descriptionController->add();
96
        break;
97
    case 'edit':
98
        $descriptionController->edit($id, $description_type);
99
        break;
100
    case 'delete':
101
        $descriptionController->destroy($id);
102
        break;
103
    case 'listing':
104
    default:
105
        $descriptionController->listing();
106
}
107