Issues (2128)

main/mySpace/session.php (1 issue)

Labels
Severity
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
ob_start();
6
$cidReset = true;
7
require_once __DIR__.'/../inc/global.inc.php';
8
9
api_block_anonymous_users();
10
11
$this_section = SECTION_TRACKING;
12
$export_csv = false;
13
if (isset($_REQUEST['export']) && 'csv' == $_REQUEST['export']) {
14
    $export_csv = true;
15
}
16
$action = isset($_GET['action']) ? $_GET['action'] : '';
17
18
$id_coach = api_get_user_id();
19
if (isset($_REQUEST['id_coach']) && '' != $_REQUEST['id_coach']) {
20
    $id_coach = (int) $_REQUEST['id_coach'];
21
}
22
23
$allowToTrack = api_is_platform_admin(true, true) || api_is_teacher();
24
25
if (!$allowToTrack) {
26
    api_not_allowed(true);
27
}
28
29
$studentId = isset($_GET['student']) ? (int) $_GET['student'] : 0;
30
$sessionId = isset($_GET['sid']) ? (int) $_GET['sid'] : 0;
31
$hideConnectionTime = isset($_REQUEST['hide_connection_time']) ? (int) $_REQUEST['hide_connection_time'] : 0;
32
$currentUrl = api_get_self().'?student='.$studentId.'&sid='.$sessionId;
33
34
switch ($action) {
35
    case 'export_to_pdf':
36
        $allStudents = isset($_GET['all_students']) && 1 === (int) $_GET['all_students'] ? true : false;
37
        $sessionToExport = isset($_GET['session_to_export']) ? (int) $_GET['session_to_export'] : 0;
38
        $type = isset($_GET['type']) ? $_GET['type'] : 'attendance';
39
        $sessionInfo = api_get_session_info($sessionToExport);
40
        if (empty($sessionInfo)) {
41
            api_not_allowed(true);
42
        }
43
        $courses = Tracking::get_courses_list_from_session($sessionToExport);
44
        $studentList = [$studentId];
45
        if ($allStudents) {
46
            $users = SessionManager::get_users_by_session($sessionToExport, 0);
47
            $studentList = array_column($users, 'user_id');
48
        }
49
50
        $totalCourses = count($courses);
51
        $scoreDisplay = ScoreDisplay::instance();
52
        $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
53
        $pdfList = [];
54
        foreach ($studentList as $studentId) {
55
            $studentInfo = api_get_user_info($studentId);
56
            $timeSpent = 0;
57
            $numberVisits = 0;
58
            $progress = 0;
59
            $timeSpentPerCourse = [];
60
            $progressPerCourse = [];
61
62
            foreach ($courses as $course) {
63
                $courseId = $course['c_id'];
64
                $courseTimeSpent = Tracking::get_time_spent_on_the_course($studentId, $courseId, $sessionToExport);
65
                $timeSpentPerCourse[$courseId] = $courseTimeSpent;
66
                $timeSpent += $courseTimeSpent;
67
                $sql = "SELECT DISTINCT count(course_access_id) as count
68
                        FROM $table
69
                        WHERE
70
                            c_id = $courseId AND
71
                            session_id = $sessionToExport AND
72
                            user_id = $studentId";
73
                $result = Database::query($sql);
74
                $row = Database::fetch_array($result);
75
                $numberVisits += $row['count'];
76
                $courseProgress = Tracking::get_avg_student_progress(
77
                    $studentId,
78
                    $course['code'],
79
                    [],
80
                    $sessionToExport
81
                );
82
                $progressPerCourse[$courseId] = $courseProgress;
83
                $progress += $courseProgress;
84
            }
85
86
            $average = round($progress / $totalCourses, 1);
87
            $average = empty($average) ? '0%' : $average.'%';
88
            $first = Tracking::get_first_connection_date($studentId);
89
            $last = Tracking::get_last_connection_date($studentId);
90
            $timeSpentContent = '';
91
            $pdfTitle = get_lang('AttestationOfAttendance');
92
            if ('attendance' === $type) {
93
                $table = new HTML_Table(['class' => 'table table-hover table-striped data_table']);
94
                $column = 0;
95
                $row = 0;
96
                $headers = [
97
                    get_lang('TimeSpent'),
98
                    get_lang('NumberOfVisits'),
99
                    get_lang('GlobalProgress'),
100
                    get_lang('FirstLogin'),
101
                    get_lang('LastConnexionDate'),
102
                ];
103
                foreach ($headers as $header) {
104
                    $table->setHeaderContents($row, $column, $header);
105
                    $column++;
106
                }
107
                $table->setCellContents(1, 0, api_time_to_hms($timeSpent));
108
                $table->setCellContents(1, 1, $numberVisits);
109
                $table->setCellContents(1, 2, $average);
110
                $table->setCellContents(1, 3, $first);
111
                $table->setCellContents(1, 4, $last);
112
                $timeSpentContent = $table->toHtml();
113
            } else {
114
                $pdfTitle = get_lang('CertificateOfAchievement');
115
            }
116
117
            $courseTable = '';
118
            if (!empty($courses)) {
119
                $courseTable .= '<table class="table table-hover table-striped data_table">';
120
                $courseTable .= '<thead>';
121
                $courseTable .= '<tr>
122
                    <th>'.get_lang('FormationUnit').'</th>';
123
124
                if (!$hideConnectionTime) {
125
                    $courseTable .= '<th>'.get_lang('ConnectionTime').'</th>';
126
                }
127
128
                $courseTable .= '<th>'.get_lang('Progress').'</th>';
129
130
                if ('attendance' === $type) {
131
                    $courseTable .= '<th>'.get_lang('Score').'</th>';
132
                }
133
                $courseTable .= '</tr>';
134
                $courseTable .= '</thead>';
135
                $courseTable .= '<tbody>';
136
137
                $totalCourseTime = 0;
138
                $totalAttendance = [0, 0];
139
                $totalScore = 0;
140
                $totalProgress = 0;
141
                $gradeBookTotal = [0, 0];
142
                $totalEvaluations = '0/0 (0%)';
143
144
                foreach ($courses as $course) {
145
                    $courseId = $course['c_id'];
146
                    $courseInfoItem = api_get_course_info_by_id($courseId);
147
                    $courseId = $courseInfoItem['real_id'];
148
                    $courseCodeItem = $courseInfoItem['code'];
149
150
                    $isSubscribed = CourseManager::is_user_subscribed_in_course(
151
                        $studentId,
152
                        $courseCodeItem,
153
                        true,
154
                        $sessionToExport
155
                    );
156
157
                    if ($isSubscribed) {
158
                        $timeInSeconds = $timeSpentPerCourse[$courseId];
159
                        $totalCourseTime += $timeInSeconds;
160
                        $time_spent_on_course = api_time_to_hms($timeInSeconds);
161
                        $progress = $progressPerCourse[$courseId];
162
                        $totalProgress += $progress;
163
164
                        $bestScore = Tracking::get_avg_student_score(
165
                            $studentId,
166
                            $courseCodeItem,
167
                            [],
168
                            $sessionToExport,
169
                            false,
170
                            false,
171
                            true
172
                        );
173
174
                        if (is_numeric($bestScore)) {
175
                            $totalScore += $bestScore;
176
                        }
177
178
                        $progress = empty($progress) ? '0%' : $progress.'%';
179
                        $score = empty($bestScore) ? '0%' : $bestScore.'%';
180
181
                        $courseTable .= '<tr>
182
                        <td>
183
                            <a href="'.$courseInfoItem['course_public_url'].'?id_session='.$sessionToExport.'">'.
184
                            $courseInfoItem['title'].'</a>
185
                        </td>';
186
                        if (!$hideConnectionTime) {
187
                            $courseTable .= '<td >'.$time_spent_on_course.'</td>';
188
                        }
189
                        $courseTable .= '<td >'.$progress.'</td>';
190
                        if ('attendance' === $type) {
191
                            $courseTable .= '<td >'.$score.'</td>';
192
                        }
193
                        $courseTable .= '</tr>';
194
                    }
195
                }
196
197
                $totalAttendanceFormatted = $scoreDisplay->display_score($totalAttendance);
198
                $totalScoreFormatted = $scoreDisplay->display_score([$totalScore / $totalCourses, 100], SCORE_AVERAGE);
199
                $totalProgressFormatted = $scoreDisplay->display_score(
200
                    [$totalProgress / $totalCourses, 100],
201
                    SCORE_AVERAGE
202
                );
203
                $totalEvaluations = $scoreDisplay->display_score($gradeBookTotal);
204
                $totalTimeFormatted = api_time_to_hms($totalCourseTime);
205
                $courseTable .= '
206
                    <tr>
207
                        <th>'.get_lang('Total').'</th>';
208
                if (!$hideConnectionTime) {
209
                    $courseTable .= '<th>'.$totalTimeFormatted.'</th>';
210
                }
211
                $courseTable .= '<th>'.$totalProgressFormatted.'</th>';
212
                if ('attendance' === $type) {
213
                    $courseTable .= '<th>'.$totalScoreFormatted.'</th>';
214
                }
215
                $courseTable .= '</tr>';
216
                $courseTable .= '</tbody></table>';
217
            }
218
219
            $tpl = new Template('', false, false, false, true, false, false);
220
            $tpl->assign('title', $pdfTitle);
221
            $tpl->assign('session_title', $sessionInfo['name']);
222
            $tpl->assign('session_info', $sessionInfo);
223
            $sessionCategoryTitle = '';
224
            if (isset($sessionInfo['session_category_id'])) {
225
                $sessionCategory = SessionManager::get_session_category($sessionInfo['session_category_id']);
226
                if ($sessionCategory) {
227
                    $sessionCategoryTitle = $sessionCategory['name'];
228
                }
229
            }
230
            $dateData = SessionManager::parseSessionDates($sessionInfo, false);
231
            $dateToString = $dateData['access'];
232
            $tpl->assign('session_display_dates', $dateToString);
233
            $tpl->assign('session_category_title', $sessionCategoryTitle);
234
            $tpl->assign('student', $studentInfo['complete_name']);
235
            $tpl->assign('student_info', $studentInfo);
236
            $tpl->assign('student_info_extra_fields', UserManager::get_extra_user_data($studentInfo['user_id']));
237
            $tpl->assign('table_progress', $timeSpentContent);
238
            $tpl->assign(
239
                'subtitle',
240
                sprintf(
241
                    get_lang('InSessionXYouHadTheFollowingResults'),
242
                    $sessionInfo['name']
243
                )
244
            );
245
            $tpl->assign('table_course', $courseTable);
246
            $template = 'pdf_export_student.tpl';
247
            if ('achievement' === $type) {
248
                $template = 'certificate_achievement.tpl';
249
            }
250
            $content = $tpl->fetch($tpl->get_template('my_space/'.$template));
251
252
            $params = [
253
                'pdf_title' => get_lang('Resume'),
254
                'session_info' => $sessionInfo,
255
                'course_info' => '',
256
                'pdf_date' => '',
257
                'student_info' => $studentInfo,
258
                'show_grade_generated_date' => true,
259
                'show_real_course_teachers' => false,
260
                'show_teacher_as_myself' => false,
261
                'orientation' => 'P',
262
            ];
263
            @$pdf = new PDF('A4', $params['orientation'], $params);
264
            $pdf->setBackground($tpl->theme);
265
            $mode = 'D';
266
267
            $pdfName = $sessionInfo['name'].'_'.$studentInfo['complete_name'];
268
            if ($allStudents) {
269
                $mode = 'F';
270
                $pdfName = $studentInfo['complete_name'];
271
            }
272
            $pdf->set_footer();
273
            $result = @$pdf->content_to_pdf(
274
                $content,
275
                '',
276
                $pdfName,
277
                null,
278
                $mode,
279
                false,
280
                null,
281
                false,
282
                true,
283
                false
284
            );
285
            $pdfList[] = $result;
286
        }
287
288
        if (empty($pdfList)) {
289
            api_not_allowed(true);
290
        }
291
292
        // Creating a ZIP file.
293
        $tempZipFile = api_get_path(SYS_ARCHIVE_PATH).uniqid('report_session_'.$sessionToExport, true).'.zip';
294
295
        $zip = new PclZip($tempZipFile);
296
        foreach ($pdfList as $file) {
297
            $zip->add(
298
                $file,
299
                PCLZIP_OPT_REMOVE_PATH,
0 ignored issues
show
The constant PCLZIP_OPT_REMOVE_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
300
                api_get_path(SYS_ARCHIVE_PATH)
301
            );
302
        }
303
        $name = $sessionInfo['name'].'_'.api_get_utc_datetime().'.zip';
304
        DocumentManager::file_send_for_download($tempZipFile, true, $name);
305
        exit;
306
        break;
307
}
308
309
$htmlHeadXtra[] = api_get_jqgrid_js();
310
$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('MySpace')];
311
Display::display_header(get_lang('Sessions'));
312
313
if (api_is_platform_admin(true, true)) {
314
    $a_sessions = SessionManager::get_sessions_followed_by_drh(api_get_user_id());
315
316
    if (!api_is_session_admin()) {
317
        $menu_items[] = Display::url(
318
            Display::return_icon('statistics.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM),
319
            api_get_path(WEB_CODE_PATH).'auth/my_progress.php'
320
        );
321
        $menu_items[] = Display::url(
322
            Display::return_icon('user.png', get_lang('Students'), [], ICON_SIZE_MEDIUM),
323
            'index.php?view=drh_students&amp;display=yourstudents'
324
        );
325
        $menu_items[] = Display::url(
326
            Display::return_icon('teacher.png', get_lang('Trainers'), [], ICON_SIZE_MEDIUM),
327
            'teachers.php'
328
        );
329
        $menu_items[] = Display::url(
330
            Display::return_icon('course.png', get_lang('Courses'), [], ICON_SIZE_MEDIUM),
331
            'course.php'
332
        );
333
        $menu_items[] = Display::url(
334
            Display::return_icon('session_na.png', get_lang('Sessions'), [], ICON_SIZE_MEDIUM),
335
            '#'
336
        );
337
    } else {
338
        $menu_items[] = Display::url(
339
            Display::return_icon('teacher.png', get_lang('Trainers'), [], ICON_SIZE_MEDIUM),
340
            'session_admin_teachers.php'
341
        );
342
    }
343
344
    $menu_items[] = Display::url(
345
        Display::return_icon('works.png', get_lang('WorksReport'), [], ICON_SIZE_MEDIUM),
346
        api_get_path(WEB_CODE_PATH).'mySpace/works_in_session_report.php'
347
    );
348
349
    $menu_items[] = Display::url(
350
        Display::return_icon('attendance_list.png', get_lang('ProgressInSessionReport'), [], ICON_SIZE_MEDIUM),
351
        api_get_path(WEB_CODE_PATH).'mySpace/progress_in_session_report.php'
352
    );
353
354
    $menu_items[] = Display::url(
355
        Display::return_icon('clock.png', get_lang('TeacherTimeReportBySession'), [], ICON_SIZE_MEDIUM),
356
        api_get_path(WEB_CODE_PATH).'admin/teachers_time_by_session_report.php'
357
    );
358
359
    if (!api_is_session_admin()) {
360
        $menu_items[] = Display::url(
361
            Display::return_icon('1day.png', get_lang('SessionsPlanCalendar'), [], ICON_SIZE_MEDIUM),
362
            api_get_path(WEB_CODE_PATH)."calendar/planification.php"
363
        );
364
    }
365
366
    if (api_is_drh()) {
367
        $menu_items[] = Display::url(
368
            Display::return_icon('session.png', get_lang('SessionFilterReport'), [], ICON_SIZE_MEDIUM),
369
            api_get_path(WEB_CODE_PATH).'mySpace/session_filter.php'
370
        );
371
    }
372
373
    $actionsLeft = '';
374
    $nb_menu_items = count($menu_items);
375
    if ($nb_menu_items > 1) {
376
        foreach ($menu_items as $key => $item) {
377
            $actionsLeft .= $item;
378
        }
379
    }
380
    $actionsRight = '';
381
    if (count($a_sessions) > 0) {
382
        $actionsRight = Display::url(
383
            Display::return_icon('printer.png', get_lang('Print'), [], 32),
384
            'javascript: void(0);',
385
            ['onclick' => 'javascript: window.print();']
386
        );
387
        $actionsRight .= Display::url(
388
            Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), [], 32),
389
            api_get_self().'?export=csv'
390
        );
391
    }
392
393
    $toolbar = Display::toolbarAction(
394
        'toolbar-session',
395
        [$actionsLeft, $actionsRight]
396
    );
397
    echo $toolbar;
398
399
    echo Display::page_header(get_lang('YourSessionsList'));
400
} elseif (api_is_teacher()) {
401
    $actionsRight = Display::url(
402
        Display::return_icon('clock.png', get_lang('TeacherTimeReportBySession'), [], ICON_SIZE_MEDIUM),
403
        api_get_path(WEB_CODE_PATH).'admin/teachers_time_by_session_report.php'
404
    );
405
406
    $toolbar = Display::toolbarAction(
407
        'toolbar-session',
408
        ['', $actionsRight]
409
    );
410
    echo $toolbar;
411
412
    echo Display::page_header(get_lang('YourSessionsList'));
413
} else {
414
    $a_sessions = Tracking::get_sessions_coached_by_user($id_coach);
415
}
416
417
$form = new FormValidator(
418
    'search_course',
419
    'post',
420
    api_get_path(WEB_CODE_PATH).'mySpace/session.php'
421
);
422
$form->addElement('text', 'keyword', get_lang('Keyword'));
423
424
$extraFieldSession = new ExtraField('session');
425
$extraFieldSession->addElements(
426
    $form,
427
    null,
428
    [],
429
    true
430
);
431
432
$form->addButtonSearch(get_lang('Search'));
433
$keyword = '';
434
$result = SessionManager::getGridColumns('my_space');
435
436
$columns = $result['columns'];
437
$columnModel = $result['column_model'];
438
439
$filterToString = '';
440
if ($form->validate()) {
441
    $values = $form->getSubmitValues();
442
    $keyword = Security::remove_XSS($form->getSubmitValue('keyword'));
443
    $extraField = new ExtraField('session');
444
    $extraFields = $extraField->get_all(null, 'option_order');
445
    $extraFields = array_column($extraFields, 'variable');
446
    $filter = new stdClass();
447
448
    foreach ($columnModel as $col) {
449
        if (isset($values[$col['index']]) && !empty($values[$col['index']]) &&
450
            in_array(str_replace('extra_', '', $col['index']), $extraFields)
451
        ) {
452
            $rule = new stdClass();
453
            $index = $col['index'];
454
            $rule->field = $index;
455
            $rule->op = 'in';
456
            $data = $values[$index];
457
            if (is_array($data) && array_key_exists($index, $data)) {
458
                $data = $data[$index];
459
            }
460
            $rule->data = Security::remove_XSS($data);
461
            $filter->rules[] = $rule;
462
            $filter->groupOp = 'AND';
463
        }
464
    }
465
    $filterToString = json_encode($filter);
466
}
467
$form->setDefaults(['keyword' => $keyword]);
468
469
$url = api_get_path(WEB_AJAX_PATH).
470
    'model.ajax.php?a=get_sessions_tracking&_search=true&_force_search=true&filters='.$filterToString.'&keyword='.$keyword;
471
472
// Column config
473
$extraParams = [
474
    'autowidth' => 'true',
475
    'height' => 'auto',
476
];
477
478
/*$extraParams['postData'] = [
479
    'filters' => [
480
        'groupOp' => 'AND',
481
        'rules' => $result['rules'],
482
    ],
483
];*/
484
485
$urlAjaxExtraField = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?1=1';
486
$allowOrder = api_get_configuration_value('session_list_order');
487
$orderUrl = api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=order';
488
489
?>
490
    <script>
491
        function setSearchSelect(columnName) {
492
            $("#sessions").jqGrid('setColProp', columnName, {
493
            });
494
        }
495
        var added_cols = [];
496
        var original_cols = [];
497
        function clean_cols(grid, added_cols) {
498
            // Cleaning
499
            for (key in added_cols) {
500
                grid.hideCol(key);
501
            }
502
            grid.showCol('name');
503
            grid.showCol('display_start_date');
504
            grid.showCol('display_end_date');
505
            grid.showCol('course_title');
506
        }
507
508
        function show_cols(grid, added_cols) {
509
            grid.showCol('name').trigger('reloadGrid');
510
            for (key in added_cols) {
511
                grid.showCol(key);
512
            }
513
        }
514
515
        var second_filters = [];
516
517
        $(function() {
518
            date_pick_today = function(elem) {
519
                $(elem).datetimepicker({dateFormat: "yy-mm-dd"});
520
                $(elem).datetimepicker('setDate', (new Date()));
521
            }
522
            date_pick_one_month = function(elem) {
523
                $(elem).datetimepicker({dateFormat: "yy-mm-dd"});
524
                next_month = Date.today().next().month();
525
                $(elem).datetimepicker('setDate', next_month);
526
            }
527
528
            // Great hack
529
            register_second_select = function(elem) {
530
                second_filters[$(elem).val()] = $(elem);
531
            }
532
533
            fill_second_select = function(elem) {
534
                $(elem).on("change", function() {
535
                    composed_id = $(this).val();
536
                    field_id = composed_id.split("#")[0];
537
                    id = composed_id.split("#")[1];
538
                    $.ajax({
539
                        url: "<?php echo $urlAjaxExtraField; ?>&a=get_second_select_options",
540
                        dataType: "json",
541
                        data: "type=session&field_id="+field_id+"&option_value_id="+id,
542
                        success: function(data) {
543
                            my_select = second_filters[field_id];
544
                            my_select.empty();
545
                            $.each(data, function(index, value) {
546
                                my_select.append($("<option/>", {
547
                                    value: index,
548
                                    text: value
549
                                }));
550
                            });
551
                        }
552
                    });
553
                });
554
            }
555
556
            <?php
557
            echo Display::grid_js(
558
                'sessions',
559
                $url,
560
                $columns,
561
                $columnModel,
562
                $extraParams,
563
                [],
564
                null,
565
                true
566
            );
567
            ?>
568
569
            setSearchSelect("status");
570
571
            var grid = $("#sessions"),
572
                prmSearch = {
573
                    multipleSearch : true,
574
                    overlay : false,
575
                    width: 'auto',
576
                    caption: '<?php echo addslashes(get_lang('Search')); ?>',
577
                    formclass:'data_table',
578
                    onSearch : function() {
579
                        var postdata = grid.jqGrid('getGridParam', 'postData');
580
                        if (postdata && postdata.filters) {
581
                            filters = jQuery.parseJSON(postdata.filters);
582
                            clean_cols(grid, added_cols);
583
                            added_cols = [];
584
                            $.each(filters, function(key, value) {
585
                                if (key == 'rules') {
586
                                    $.each(value, function(subkey, subvalue) {
587
                                        added_cols[subvalue.field] = subvalue.field;
588
                                    });
589
                                }
590
                            });
591
                            show_cols(grid, added_cols);
592
                        }
593
                    },
594
                    onReset: function() {
595
                        clean_cols(grid, added_cols);
596
                    }
597
                };
598
599
            original_cols = grid.jqGrid('getGridParam', 'colModel');
600
601
            grid.jqGrid('navGrid','#sessions_pager',
602
                {edit:false,add:false,del:false},
603
                {height:280,reloadAfterSubmit:false}, // edit options
604
                {height:280,reloadAfterSubmit:false}, // add options
605
                {reloadAfterSubmit:false},// del options
606
                prmSearch
607
            );
608
609
            <?php
610
            // Create the searching dialog.
611
            //echo 'grid.searchGrid(prmSearch);';
612
            ?>
613
            // Fixes search table.
614
            var searchDialogAll = $("#fbox_"+grid[0].id);
615
            searchDialogAll.addClass("table");
616
            var searchDialog = $("#searchmodfbox_"+grid[0].id);
617
            searchDialog.addClass("ui-jqgrid ui-widget ui-widget-content ui-corner-all");
618
            searchDialog.css({position:"adsolute", "z-index":"100", "float":"left", "top":"55%", "left" : "25%", "padding" : "5px", "border": "1px solid #CCC"})
619
            var gbox = $("#gbox_"+grid[0].id);
620
            gbox.before(searchDialog);
621
            gbox.css({clear:"left"});
622
623
            // Select first elements by default
624
            $('.input-elm').each(function() {
625
                $(this).find('option:first').attr('selected', 'selected');
626
            });
627
628
            $('.delete-rule').each(function(){
629
                $(this).click(function(){
630
                    $('.input-elm').each(function(){
631
                        $(this).find('option:first').attr('selected', 'selected');
632
                    });
633
                });
634
            });
635
        });
636
    </script>
637
<?php
638
639
$form->display();
640
echo Display::grid_html('sessions');
641
Display::display_footer();
642