Issues (2037)

main/admin/course_list.php (1 issue)

1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
/**
6
 * This script shows a list of courses and allows searching for courses codes
7
 * and names.
8
 */
9
$cidReset = true;
10
require_once __DIR__.'/../inc/global.inc.php';
11
$this_section = SECTION_PLATFORM_ADMIN;
12
api_protect_admin_script();
13
$sessionId = isset($_GET['session_id']) ? $_GET['session_id'] : null;
14
$addTeacherColumn = api_get_configuration_value('add_teachers_in_course_list');
15
16
/**
17
 * Get the number of courses which will be displayed.
18
 *
19
 * @throws Exception
20
 *
21
 * @return int The number of matching courses
22
 */
23
function get_number_of_courses()
24
{
25
    return get_course_data(0, 0, 0, 0, null, true);
26
}
27
28
/**
29
 * Get course data to display.
30
 *
31
 * @param int    $from
32
 * @param int    $number_of_items
33
 * @param int    $column
34
 * @param string $direction
35
 *
36
 * @throws Exception
37
 *
38
 * @return array
39
 */
40
function get_course_data($from, $number_of_items, $column, $direction, $dataFunctions = [], $getCount = false)
41
{
42
    $addTeacherColumn = api_get_configuration_value('add_teachers_in_course_list');
43
    $table = Database::get_main_table(TABLE_MAIN_COURSE);
44
    $from = (int) $from;
45
    $number_of_items = (int) $number_of_items;
46
    $column = (int) $column;
47
48
    if (!in_array(strtolower($direction), ['asc', 'desc'])) {
49
        $direction = 'desc';
50
    }
51
52
    $teachers = '';
53
    if ($addTeacherColumn) {
54
        $teachers = " GROUP_CONCAT(cu.user_id SEPARATOR ',') as col7, ";
55
    }
56
    $select = "SELECT
57
                code AS col0,
58
                title AS col1,
59
                code AS col2,
60
                course_language AS col3,
61
                category_code AS col4,
62
                subscribe AS col5,
63
                unsubscribe AS col6,
64
                $teachers
65
                visibility,
66
                directory,
67
                visual_code,
68
                course.code,
69
                course.id ";
70
71
    if ($getCount) {
72
        $select = 'SELECT COUNT(DISTINCT(course.id)) as count ';
73
    }
74
75
    $sql = "$select FROM $table course";
76
77
    if ((api_is_platform_admin() || api_is_session_admin()) &&
78
        api_is_multiple_url_enabled() && api_get_current_access_url_id() != -1
79
    ) {
80
        $access_url_rel_course_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
81
        $sql .= " INNER JOIN $access_url_rel_course_table url_rel_course
82
                  ON (course.id = url_rel_course.c_id)";
83
    }
84
85
    if ($addTeacherColumn) {
86
        $tableCourseRelUser = Database::get_main_table(TABLE_MAIN_COURSE_USER);
87
        $sql .= "
88
                LEFT JOIN $tableCourseRelUser cu
89
                ON (course.id = cu.c_id AND cu.status = ".COURSEMANAGER.")
90
            ";
91
    }
92
93
    if (isset($_GET['keyword'])) {
94
        $keyword = Database::escape_string("%".trim($_GET['keyword'])."%");
95
        $sql .= " WHERE (
96
            title LIKE '".$keyword."' OR
97
            code LIKE '".$keyword."' OR
98
            visual_code LIKE '".$keyword."'
99
        )
100
        ";
101
    } elseif (isset($_GET['keyword_code'])) {
102
        $keyword_code = Database::escape_string("%".$_GET['keyword_code']."%");
103
        $keyword_title = Database::escape_string("%".$_GET['keyword_title']."%");
104
        $keyword_category = isset($_GET['keyword_category'])
105
            ? Database::escape_string("%".$_GET['keyword_category']."%")
106
            : null;
107
        $keyword_language = Database::escape_string("%".$_GET['keyword_language']."%");
108
        $keyword_visibility = Database::escape_string("%".$_GET['keyword_visibility']."%");
109
        $keyword_subscribe = Database::escape_string($_GET['keyword_subscribe']);
110
        $keyword_unsubscribe = Database::escape_string($_GET['keyword_unsubscribe']);
111
112
        $sql .= " WHERE
113
                (code LIKE '".$keyword_code."' OR visual_code LIKE '".$keyword_code."') AND
114
                title LIKE '".$keyword_title."' AND
115
                course_language LIKE '".$keyword_language."' AND
116
                visibility LIKE '".$keyword_visibility."' AND
117
                subscribe LIKE '".$keyword_subscribe."' AND
118
                unsubscribe LIKE '".$keyword_unsubscribe."'";
119
120
        if (!empty($keyword_category)) {
121
            $sql .= " AND category_code LIKE '".$keyword_category."' ";
122
        }
123
    }
124
125
    // Adding the filter to see the user's only of the current access_url.
126
    if ((api_is_platform_admin() || api_is_session_admin()) &&
127
        api_is_multiple_url_enabled() && api_get_current_access_url_id() != -1
128
    ) {
129
        $sql .= " AND url_rel_course.access_url_id = ".api_get_current_access_url_id();
130
    }
131
132
    if ($addTeacherColumn) {
133
        $teachers = isset($_GET['course_teachers']) ? $_GET['course_teachers'] : [];
134
        if (!empty($teachers)) {
135
            $teachers = array_map('intval', $teachers);
136
            $addNull = '';
137
            foreach ($teachers as $key => $teacherId) {
138
                if (0 === $teacherId) {
139
                    $addNull = 'OR cu.user_id IS NULL ';
140
                    unset($key);
141
                }
142
            }
143
            $sql .= ' AND ( cu.user_id IN ("'.implode('", "', $teachers).'") '.$addNull.' ) ';
144
        }
145
146
        if (false === $getCount) {
147
            $sql .= " GROUP BY course.id ";
148
        }
149
    }
150
151
    if ($getCount) {
152
        $res = Database::query($sql);
153
        $row = Database::fetch_array($res);
154
        if ($row) {
155
            return (int) $row['count'];
156
        }
157
158
        return 0;
159
    }
160
161
    $sql .= " ORDER BY col$column $direction ";
162
    $sql .= " LIMIT $from, $number_of_items";
163
164
    $res = Database::query($sql);
165
    $courses = [];
166
    $languages = api_get_languages_to_array();
167
    $path = api_get_path(WEB_CODE_PATH);
168
    $coursePath = api_get_path(WEB_COURSE_PATH);
169
170
    while ($course = Database::fetch_array($res)) {
171
        $courseId = $course['id'];
172
        $courseCode = $course['code'];
173
174
        // Place colour icons in front of courses.
175
        $showVisualCode = $course['visual_code'] != $courseCode ? Display::label($course['visual_code'], 'info') : null;
176
        $course[1] = get_course_visibility_icon($course['visibility']).PHP_EOL
177
            .Display::url(Security::remove_XSS($course[1]), $coursePath.$course['directory'].'/index.php').PHP_EOL
178
            .$showVisualCode;
179
        $course[5] = $course[5] == SUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No');
180
        $course[6] = $course[6] == UNSUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No');
181
        $language = isset($languages[$course[3]]) ? $languages[$course[3]] : $course[3];
182
183
        $actions = [];
184
        $actions[] = Display::url(
185
            Display::return_icon('info2.png', get_lang('Info')),
186
            "course_information.php?code=$courseCode"
187
        );
188
        $actions[] = Display::url(
189
            Display::return_icon('course_home.png', get_lang('CourseHomepage')),
190
            $coursePath.$course['directory'].'/index.php'
191
        );
192
        $actions[] = Display::url(
193
            Display::return_icon('statistics.png', get_lang('Tracking')),
194
            $path.'tracking/courseLog.php?'.api_get_cidreq_params($courseCode)
195
        );
196
        $actions[] = Display::url(
197
            Display::return_icon('edit.png', get_lang('Edit')),
198
            $path.'admin/course_edit.php?id='.$courseId
199
        );
200
        $actions[] = Display::url(
201
            Display::return_icon('backup.png', get_lang('CreateBackup')),
202
            $path.'coursecopy/create_backup.php?'.api_get_cidreq_params($courseCode)
203
        );
204
        $actions[] = Display::url(
205
            Display::return_icon('delete.png', get_lang('Delete')),
206
            $path.'admin/course_list.php?'
207
                .http_build_query([
208
                    'delete_course' => $courseCode,
209
                    'sec_token' => Security::getTokenFromSession(),
210
                ]),
211
            [
212
                'onclick' => "javascript: if (!confirm('"
213
                    .addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."')) return false;",
214
            ]
215
        );
216
        $courseItem = [
217
            $course[0],
218
            $course[1],
219
            $course[2],
220
            $language,
221
            $course[4],
222
            $course[5],
223
            $course[6],
224
        ];
225
226
        if ($addTeacherColumn) {
227
            $teacherIdList = array_filter(explode(',', $course[7]));
228
            $teacherList = [];
229
            if (!empty($teacherIdList)) {
230
                foreach ($teacherIdList as $teacherId) {
231
                    $userInfo = api_get_user_info($teacherId);
232
                    if ($userInfo) {
233
                        $teacherList[] = $userInfo['complete_name'];
234
                    }
235
                }
236
            }
237
            $courseItem[] = implode(', ', $teacherList);
238
        }
239
        $courseItem[] = implode(PHP_EOL, $actions);
240
        $courses[] = $courseItem;
241
    }
242
243
    return $courses;
244
}
245
246
/**
247
 * Get course data to display filtered by session name.
248
 *
249
 * @param int    $from
250
 * @param int    $number_of_items
251
 * @param int    $column
252
 * @param string $direction
253
 *
254
 * @throws Exception
255
 *
256
 * @return array
257
 */
258
function get_course_data_by_session($from, $number_of_items, $column, $direction)
259
{
260
    $course_table = Database::get_main_table(TABLE_MAIN_COURSE);
261
    $session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
262
    $session = Database::get_main_table(TABLE_MAIN_SESSION);
263
264
    $from = (int) $from;
265
    $number_of_items = (int) $number_of_items;
266
    $column = (int) $column;
267
268
    if (!in_array(strtolower($direction), ['asc', 'desc'])) {
269
        $direction = 'desc';
270
    }
271
272
    $sql = "SELECT
273
                c.code AS col0,
274
                c.title AS col1,
275
                c.code AS col2,
276
                c.course_language AS col3,
277
                c.category_code AS col4,
278
                c.subscribe AS col5,
279
                c.unsubscribe AS col6,
280
                c.code AS col7,
281
                c.visibility AS col8,
282
                c.directory as col9,
283
                c.visual_code
284
            FROM $course_table c
285
            INNER JOIN $session_rel_course r
286
            ON c.id = r.c_id
287
            INNER JOIN $session s
288
            ON r.session_id = s.id
289
            ";
290
291
    if (isset($_GET['session_id']) && !empty($_GET['session_id'])) {
292
        $sessionId = (int) $_GET['session_id'];
293
        $sql .= " WHERE s.id = ".$sessionId;
294
    }
295
296
    $sql .= " ORDER BY col$column $direction ";
297
    $sql .= " LIMIT $from,$number_of_items";
298
    $res = Database::query($sql);
299
300
    $courseUrl = api_get_path(WEB_COURSE_PATH);
301
    $courses = [];
302
    while ($course = Database::fetch_array($res)) {
303
        // Place colour icons in front of courses.
304
        $showVisualCode = $course['visual_code'] != $course[2] ? Display::label($course['visual_code'], 'info') : null;
305
        $course[1] = get_course_visibility_icon($course[8]).
306
            '<a href="'.$courseUrl.$course[9].'/index.php">'.
307
            $course[1].
308
            '</a> '.
309
            $showVisualCode;
310
        $course[5] = $course[5] == SUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No');
311
        $course[6] = $course[6] == UNSUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No');
312
        $row = [
313
            $course[0],
314
            $course[1],
315
            $course[2],
316
            $course[3],
317
            $course[4],
318
            $course[5],
319
            $course[6],
320
            $course[7],
321
        ];
322
        $courses[] = $row;
323
    }
324
325
    return $courses;
326
}
327
328
/**
329
 * Return an icon representing the visibility of the course.
330
 *
331
 * @param string $visibility
332
 *
333
 * @return string
334
 */
335
function get_course_visibility_icon($visibility)
336
{
337
    $style = 'margin-bottom:0;margin-right:5px;';
338
    switch ($visibility) {
339
        case 0:
340
            return Display::return_icon(
341
                'bullet_red.png',
342
                get_lang('CourseVisibilityClosed'),
343
                ['style' => $style]
344
            );
345
            break;
0 ignored issues
show
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
346
        case 1:
347
            return Display::return_icon(
348
                'bullet_orange.png',
349
                get_lang('Private'),
350
                ['style' => $style]
351
            );
352
            break;
353
        case 2:
354
            return Display::return_icon(
355
                'bullet_green.png',
356
                get_lang('OpenToThePlatform'),
357
                ['style' => $style]
358
            );
359
            break;
360
        case 3:
361
            return Display::return_icon(
362
                'bullet_blue.png',
363
                get_lang('OpenToTheWorld'),
364
                ['style' => $style]
365
            );
366
            break;
367
        case 4:
368
            return Display::return_icon(
369
                'bullet_grey.png',
370
                get_lang('CourseVisibilityHidden'),
371
                ['style' => $style]
372
            );
373
            break;
374
        default:
375
            return '';
376
    }
377
}
378
379
if (isset($_POST['action']) && Security::check_token('get')) {
380
    switch ($_POST['action']) {
381
        // Delete selected courses
382
        case 'delete_courses':
383
            if (!empty($_POST['course'])) {
384
                $course_codes = $_POST['course'];
385
                if (count($course_codes) > 0) {
386
                    foreach ($course_codes as $course_code) {
387
                        CourseManager::delete_course($course_code);
388
                    }
389
                }
390
391
                Display::addFlash(Display::return_message(get_lang('Deleted')));
392
            }
393
            break;
394
    }
395
}
396
$content = '';
397
$message = '';
398
$actions = '';
399
400
if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
401
    // Get all course categories
402
    $interbreadcrumb[] = [
403
        'url' => 'index.php',
404
        'name' => get_lang('PlatformAdmin'),
405
    ];
406
    $interbreadcrumb[] = [
407
        'url' => 'course_list.php',
408
        'name' => get_lang('CourseList'),
409
    ];
410
    $tool_name = get_lang('SearchACourse');
411
    $form = new FormValidator('advanced_course_search', 'get');
412
    $form->addElement('header', $tool_name);
413
    $form->addText('keyword_code', get_lang('CourseCode'), false);
414
    $form->addText('keyword_title', get_lang('Title'), false);
415
416
    // Category code
417
    $url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_category';
418
419
    $form->addElement(
420
        'select_ajax',
421
        'keyword_category',
422
        get_lang('CourseFaculty'),
423
        null,
424
        [
425
            'url' => $url,
426
        ]
427
    );
428
429
    $el = $form->addSelectLanguage('keyword_language', get_lang('CourseLanguage'));
430
    $el->addOption(get_lang('All'), '%');
431
432
    if ($addTeacherColumn) {
433
        $form->addSelectAjax(
434
            'course_teachers',
435
            get_lang('CourseTeachers'),
436
            [0 => get_lang('None')],
437
            [
438
                'url' => api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=teacher_to_basis_course',
439
                'id' => 'course_teachers',
440
                'multiple' => 'multiple',
441
            ]
442
        );
443
        $form->addLabel('', '<button id="set_none_teacher" class="btn ">'.get_lang('None').'</button>');
444
    }
445
446
    $form->addElement('radio', 'keyword_visibility', get_lang('CourseAccess'), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
447
    $form->addElement('radio', 'keyword_visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
448
    $form->addElement('radio', 'keyword_visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED);
449
    $form->addElement('radio', 'keyword_visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED);
450
    $form->addElement('radio', 'keyword_visibility', null, get_lang('CourseVisibilityHidden'), COURSE_VISIBILITY_HIDDEN);
451
    $form->addElement('radio', 'keyword_visibility', null, get_lang('All'), '%');
452
    $form->addElement('radio', 'keyword_subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
453
    $form->addElement('radio', 'keyword_subscribe', null, get_lang('Denied'), 0);
454
    $form->addElement('radio', 'keyword_subscribe', null, get_lang('All'), '%');
455
    $form->addElement('radio', 'keyword_unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
456
    $form->addElement('radio', 'keyword_unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
457
    $form->addElement('radio', 'keyword_unsubscribe', null, get_lang('All'), '%');
458
    $form->addButtonSearch(get_lang('SearchCourse'));
459
    $defaults['keyword_language'] = '%';
460
    $defaults['keyword_visibility'] = '%';
461
    $defaults['keyword_subscribe'] = '%';
462
    $defaults['keyword_unsubscribe'] = '%';
463
    $form->setDefaults($defaults);
464
    $content .= $form->returnForm();
465
} else {
466
    $interbreadcrumb[] = [
467
        'url' => 'index.php',
468
        'name' => get_lang('PlatformAdmin'),
469
    ];
470
    $tool_name = get_lang('CourseList');
471
    if (isset($_GET['delete_course']) && Security::check_token('get')) {
472
        $result = CourseManager::delete_course($_GET['delete_course']);
473
        if ($result) {
474
            Display::addFlash(Display::return_message(get_lang('Deleted')));
475
        }
476
    }
477
    // Create a search-box
478
    $form = new FormValidator(
479
        'search_simple',
480
        'get',
481
        '',
482
        '',
483
        [],
484
        FormValidator::LAYOUT_INLINE
485
    );
486
    $form->addElement(
487
        'text',
488
        'keyword',
489
        null,
490
        ['id' => 'course-search-keyword', 'aria-label' => get_lang('SearchCourse')]
491
    );
492
    $form->addButtonSearch(get_lang('SearchCourse'));
493
    $advanced = '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/course_list.php?search=advanced">
494
        <em class="fa fa-search"></em> '.
495
        get_lang('AdvancedSearch').'</a>';
496
497
    // Create a filter by session
498
    $sessionFilter = new FormValidator(
499
        'course_filter',
500
        'get',
501
        '',
502
        '',
503
        [],
504
        FormValidator::LAYOUT_INLINE
505
    );
506
    $url = api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=search_session';
507
    $sessionSelect = $sessionFilter->addElement(
508
        'select_ajax',
509
        'session_name',
510
        get_lang('SearchCourseBySession'),
511
        null,
512
        ['id' => 'session_name', 'url' => $url]
513
    );
514
515
    if (!empty($sessionId)) {
516
        $sessionInfo = SessionManager::fetch($sessionId);
517
        $sessionSelect->addOption(
518
            $sessionInfo['name'],
519
            $sessionInfo['id'],
520
            ['selected' => 'selected']
521
        );
522
    }
523
524
    $courseListUrl = api_get_self();
525
    $actions1 = Display::url(
526
        Display::return_icon(
527
            'new_course.png',
528
            get_lang('AddCourse'),
529
            [],
530
            ICON_SIZE_MEDIUM
531
        ),
532
        api_get_path(WEB_CODE_PATH).'admin/course_add.php'
533
    );
534
535
    if (api_get_setting('course_validation') === 'true') {
536
        $actions1 .= Display::url(
537
            Display::return_icon(
538
                'course_request_pending.png',
539
                get_lang('ReviewCourseRequests'),
540
                [],
541
                ICON_SIZE_MEDIUM
542
            ),
543
            api_get_path(WEB_CODE_PATH).'admin/course_request_review.php'
544
        );
545
    }
546
547
    $actions2 = $form->returnForm();
548
    $actions3 = $sessionFilter->returnForm();
549
    $actions4 = $advanced;
550
    $actions4 .= '
551
    <script>
552
        $(function() {
553
            $("#session_name").on("change", function() {
554
                var sessionId = $(this).val();
555
                if (!sessionId) {
556
                    return;
557
                }
558
559
                window.location = "'.$courseListUrl.'?session_id="+sessionId;
560
            });
561
        });
562
    </script>';
563
564
    $actions = Display::toolbarAction(
565
        'toolbar',
566
        [$actions1, $actions2, $actions3, $actions4],
567
        [2, 4, 3, 3]
568
    );
569
570
    if (!empty($sessionId)) {
571
        // Create a sortable table with the course data filtered by session
572
        $table = new SortableTable(
573
            'courses',
574
            'get_number_of_courses',
575
            'get_course_data_by_session',
576
            2
577
        );
578
    } else {
579
        // Create a sortable table with the course data
580
        $table = new SortableTable(
581
            'courses',
582
            'get_number_of_courses',
583
            'get_course_data',
584
            2,
585
            20,
586
            'ASC',
587
            'course-list'
588
        );
589
    }
590
591
    $parameters = [];
592
    $parameters['sec_token'] = Security::get_token();
593
    if (isset($_GET['keyword'])) {
594
        $parameters = ['keyword' => Security::remove_XSS($_GET['keyword'])];
595
    } elseif (isset($_GET['keyword_code'])) {
596
        $parameters['keyword_code'] = Security::remove_XSS($_GET['keyword_code']);
597
        $parameters['keyword_title'] = Security::remove_XSS($_GET['keyword_title']);
598
        if (isset($_GET['keyword_category'])) {
599
            $parameters['keyword_category'] = Security::remove_XSS($_GET['keyword_category']);
600
        }
601
        $parameters['keyword_language'] = Security::remove_XSS($_GET['keyword_language']);
602
        $parameters['keyword_visibility'] = Security::remove_XSS($_GET['keyword_visibility']);
603
        $parameters['keyword_subscribe'] = Security::remove_XSS($_GET['keyword_subscribe']);
604
        $parameters['keyword_unsubscribe'] = Security::remove_XSS($_GET['keyword_unsubscribe']);
605
    }
606
607
    if (isset($_GET['course_teachers'])) {
608
        $parsed = array_map('intval', $_GET['course_teachers']);
609
        $parameters["course_teachers"] = '';
610
        foreach ($parsed as $key => $teacherId) {
611
            $parameters["course_teachers[$key]"] = $teacherId;
612
        }
613
    }
614
615
    $table->set_additional_parameters($parameters);
616
    $column = 0;
617
    $table->set_header($column++, '', false, 'width="8px"');
618
    $table->set_header($column++, get_lang('Title'), true, null, ['class' => 'title']);
619
    $table->set_header($column++, get_lang('Code'));
620
    $table->set_header($column++, get_lang('Language'), false, 'width="70px"');
621
    $table->set_header($column++, get_lang('Category'));
622
    $table->set_header($column++, get_lang('SubscriptionAllowed'), true, 'width="60px"');
623
    $table->set_header($column++, get_lang('UnsubscriptionAllowed'), false, 'width="50px"');
624
    if ($addTeacherColumn) {
625
        $table->set_header($column++, get_lang('Teachers'), true);
626
    }
627
    $table->set_header(
628
        $column++,
629
        get_lang('Action'),
630
        false,
631
        null,
632
        ['class' => 'td_actions']
633
    );
634
    $table->set_form_actions(
635
        ['delete_courses' => get_lang('DeleteCourse')],
636
        'course'
637
    );
638
639
    $tab = CourseManager::getCourseListTabs('simple');
640
641
    $content .= $tab.$table->return_table();
642
}
643
644
$htmlHeadXtra[] = '
645
<script>
646
$(function() {
647
    $("#set_none_teacher").on("click", function () {
648
        $("#course_teachers").val("0").trigger("change");
649
650
        return false;
651
    });
652
});
653
</script>';
654
655
$tpl = new Template($tool_name);
656
$tpl->assign('actions', $actions);
657
$tpl->assign('message', $message);
658
$tpl->assign('content', $content);
659
$tpl->display_one_col_template();
660