forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
749 lines (585 loc) · 23.3 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Course completion progress report
*
* @package report
* @subpackage completion
* @copyright 2009 Catalyst IT Ltd
* @author Aaron Barnes <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(dirname(__FILE__).'/../../config.php');
require_once("{$CFG->libdir}/completionlib.php");
/**
* Configuration
*/
define('COMPLETION_REPORT_PAGE', 25);
define('COMPLETION_REPORT_COL_TITLES', true);
/*
* Setup page, check permissions
*/
// Get course
$courseid = required_param('course', PARAM_INT);
$format = optional_param('format','',PARAM_ALPHA);
$sort = optional_param('sort','',PARAM_ALPHA);
$edituser = optional_param('edituser', 0, PARAM_INT);
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$context = context_course::instance($course->id);
$url = new moodle_url('/report/completion/index.php', array('course'=>$course->id));
$PAGE->set_url($url);
$PAGE->set_pagelayout('report');
$firstnamesort = ($sort == 'firstname');
$excel = ($format == 'excelcsv');
$csv = ($format == 'csv' || $excel);
// Load CSV library
if ($csv) {
require_once("{$CFG->libdir}/csvlib.class.php");
}
// Paging
$start = optional_param('start', 0, PARAM_INT);
$sifirst = optional_param('sifirst', 'all', PARAM_ALPHA);
$silast = optional_param('silast', 'all', PARAM_ALPHA);
// Whether to show extra user identity information
$extrafields = get_extra_user_fields($context);
$leftcols = 1 + count($extrafields);
// Check permissions
require_login($course);
require_capability('report/completion:view', $context);
// Get group mode
$group = groups_get_course_group($course, true); // Supposed to verify group
if ($group === 0 && $course->groupmode == SEPARATEGROUPS) {
require_capability('moodle/site:accessallgroups',$context);
}
/**
* Load data
*/
// Retrieve course_module data for all modules in the course
$modinfo = get_fast_modinfo($course);
// Get criteria for course
$completion = new completion_info($course);
if (!$completion->has_criteria()) {
print_error('err_nocriteria', 'completion', $CFG->wwwroot.'/course/report.php?id='.$course->id);
}
// Get criteria and put in correct order
$criteria = array();
foreach ($completion->get_criteria(COMPLETION_CRITERIA_TYPE_COURSE) as $criterion) {
$criteria[] = $criterion;
}
foreach ($completion->get_criteria(COMPLETION_CRITERIA_TYPE_ACTIVITY) as $criterion) {
$criteria[] = $criterion;
}
foreach ($completion->get_criteria() as $criterion) {
if (!in_array($criterion->criteriatype, array(
COMPLETION_CRITERIA_TYPE_COURSE, COMPLETION_CRITERIA_TYPE_ACTIVITY))) {
$criteria[] = $criterion;
}
}
// Can logged in user mark users as complete?
// (if the logged in user has a role defined in the role criteria)
$allow_marking = false;
$allow_marking_criteria = null;
if (!$csv) {
// Get role criteria
$rcriteria = $completion->get_criteria(COMPLETION_CRITERIA_TYPE_ROLE);
if (!empty($rcriteria)) {
foreach ($rcriteria as $rcriterion) {
$users = get_role_users($rcriterion->role, $context, true);
// If logged in user has this role, allow marking complete
if ($users && in_array($USER->id, array_keys($users))) {
$allow_marking = true;
$allow_marking_criteria = $rcriterion->id;
break;
}
}
}
}
/*
* Setup page header
*/
if ($csv) {
$shortname = format_string($course->shortname, true, array('context' => $context));
$shortname = preg_replace('/[^a-z0-9-]/', '_',textlib::strtolower(strip_tags($shortname)));
$export = new csv_export_writer();
$export->set_filename('completion-'.$shortname);
} else {
// Navigation and header
$strcompletion = get_string('coursecompletion');
$PAGE->set_title($strcompletion);
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
$PAGE->requires->js('/report/completion/textrotate.js');
$PAGE->requires->js_function_call('textrotate_init', null, true);
// Handle groups (if enabled)
groups_print_course_menu($course, $CFG->wwwroot.'/report/completion/?course='.$course->id);
}
// Generate where clause
$where = array();
$where_params = array();
if ($sifirst !== 'all') {
$where[] = $DB->sql_like('u.firstname', ':sifirst', false);
$where_params['sifirst'] = $sifirst.'%';
}
if ($silast !== 'all') {
$where[] = $DB->sql_like('u.lastname', ':silast', false);
$where_params['silast'] = $silast.'%';
}
// Get user match count
$total = $completion->get_num_tracked_users(implode(' AND ', $where), $where_params, $group);
// Total user count
$grandtotal = $completion->get_num_tracked_users('', array(), $group);
// If no users in this course what-so-ever
if (!$grandtotal) {
echo $OUTPUT->container(get_string('err_nousers', 'completion'), 'errorbox errorboxcontent');
echo $OUTPUT->footer();
exit;
}
// Get user data
$progress = array();
if ($total) {
$progress = $completion->get_progress_all(
implode(' AND ', $where),
$where_params,
$group,
$firstnamesort ? 'u.firstname ASC' : 'u.lastname ASC',
$csv ? 0 : COMPLETION_REPORT_PAGE,
$csv ? 0 : $start,
$context
);
}
// Build link for paging
$link = $CFG->wwwroot.'/report/completion/?course='.$course->id;
if (strlen($sort)) {
$link .= '&sort='.$sort;
}
$link .= '&start=';
// Build the the page by Initial bar
$initials = array('first', 'last');
$alphabet = explode(',', get_string('alphabet', 'langconfig'));
$pagingbar = '';
foreach ($initials as $initial) {
$var = 'si'.$initial;
$othervar = $initial == 'first' ? 'silast' : 'sifirst';
$othervar = $$othervar != 'all' ? "&{$othervar}={$$othervar}" : '';
$pagingbar .= ' <div class="initialbar '.$initial.'initial">';
$pagingbar .= get_string($initial.'name').': ';
if ($$var == 'all') {
$pagingbar .= '<strong>'.get_string('all').'</strong> ';
}
else {
$pagingbar .= "<a href=\"{$link}{$othervar}\">".get_string('all').'</a> ';
}
foreach ($alphabet as $letter) {
if ($$var === $letter) {
$pagingbar .= '<strong>'.$letter.'</strong> ';
}
else {
$pagingbar .= "<a href=\"$link&$var={$letter}{$othervar}\">$letter</a> ";
}
}
$pagingbar .= '</div>';
}
// Do we need a paging bar?
if ($total > COMPLETION_REPORT_PAGE) {
// Paging bar
$pagingbar .= '<div class="paging">';
$pagingbar .= get_string('page').': ';
$sistrings = array();
if ($sifirst != 'all') {
$sistrings[] = "sifirst={$sifirst}";
}
if ($silast != 'all') {
$sistrings[] = "silast={$silast}";
}
$sistring = !empty($sistrings) ? '&'.implode('&', $sistrings) : '';
// Display previous link
if ($start > 0) {
$pstart = max($start - COMPLETION_REPORT_PAGE, 0);
$pagingbar .= "(<a class=\"previous\" href=\"{$link}{$pstart}{$sistring}\">".get_string('previous').'</a>) ';
}
// Create page links
$curstart = 0;
$curpage = 0;
while ($curstart < $total) {
$curpage++;
if ($curstart == $start) {
$pagingbar .= ' '.$curpage.' ';
}
else {
$pagingbar .= " <a href=\"{$link}{$curstart}{$sistring}\">$curpage</a> ";
}
$curstart += COMPLETION_REPORT_PAGE;
}
// Display next link
$nstart = $start + COMPLETION_REPORT_PAGE;
if ($nstart < $total) {
$pagingbar .= " (<a class=\"next\" href=\"{$link}{$nstart}{$sistring}\">".get_string('next').'</a>)';
}
$pagingbar .= '</div>';
}
/*
* Draw table header
*/
// Start of table
if (!$csv) {
print '<br class="clearer"/>'; // ugh
$total_header = ($total == $grandtotal) ? $total : "{$total}/{$grandtotal}";
echo $OUTPUT->heading(get_string('allparticipants').": {$total_header}", 3);
print $pagingbar;
if (!$total) {
echo $OUTPUT->heading(get_string('nothingtodisplay'), 2);
echo $OUTPUT->footer();
exit;
}
print '<table id="completion-progress" class="generaltable flexible boxaligncenter completionreport" style="text-align: left" cellpadding="5" border="1">';
// Print criteria group names
print PHP_EOL.'<thead><tr style="vertical-align: top">';
echo '<th scope="row" class="rowheader" colspan="' . $leftcols . '">' .
get_string('criteriagroup', 'completion') . '</th>';
$current_group = false;
$col_count = 0;
for ($i = 0; $i <= count($criteria); $i++) {
if (isset($criteria[$i])) {
$criterion = $criteria[$i];
if ($current_group && $criterion->criteriatype === $current_group->criteriatype) {
++$col_count;
continue;
}
}
// Print header cell
if ($col_count) {
print '<th scope="col" colspan="'.$col_count.'" class="colheader criteriagroup">'.$current_group->get_type_title().'</th>';
}
if (isset($criteria[$i])) {
// Move to next criteria type
$current_group = $criterion;
$col_count = 1;
}
}
// Overall course completion status
print '<th style="text-align: center;">'.get_string('course').'</th>';
print '</tr>';
// Print aggregation methods
print PHP_EOL.'<tr style="vertical-align: top">';
echo '<th scope="row" class="rowheader" colspan="' . $leftcols . '">' .
get_string('aggregationmethod', 'completion').'</th>';
$current_group = false;
$col_count = 0;
for ($i = 0; $i <= count($criteria); $i++) {
if (isset($criteria[$i])) {
$criterion = $criteria[$i];
if ($current_group && $criterion->criteriatype === $current_group->criteriatype) {
++$col_count;
continue;
}
}
// Print header cell
if ($col_count) {
$has_agg = array(
COMPLETION_CRITERIA_TYPE_COURSE,
COMPLETION_CRITERIA_TYPE_ACTIVITY,
COMPLETION_CRITERIA_TYPE_ROLE,
);
if (in_array($current_group->criteriatype, $has_agg)) {
// Try load a aggregation method
$method = $completion->get_aggregation_method($current_group->criteriatype);
$method = $method == 1 ? get_string('all') : get_string('any');
} else {
$method = '-';
}
print '<th scope="col" colspan="'.$col_count.'" class="colheader aggheader">'.$method.'</th>';
}
if (isset($criteria[$i])) {
// Move to next criteria type
$current_group = $criterion;
$col_count = 1;
}
}
// Overall course aggregation method
print '<th scope="col" class="colheader aggheader aggcriteriacourse">';
// Get course aggregation
$method = $completion->get_aggregation_method();
print $method == 1 ? get_string('all') : get_string('any');
print '</th>';
print '</tr>';
// Print criteria titles
if (COMPLETION_REPORT_COL_TITLES) {
print PHP_EOL.'<tr>';
echo '<th scope="row" class="rowheader" colspan="' . $leftcols . '">' .
get_string('criteria', 'completion') . '</th>';
foreach ($criteria as $criterion) {
// Get criteria details
$details = $criterion->get_title_detailed();
print '<th scope="col" class="colheader criterianame">';
print '<span class="completion-criterianame">'.$details.'</span>';
print '</th>';
}
// Overall course completion status
print '<th scope="col" class="colheader criterianame">';
print '<span class="completion-criterianame">'.get_string('coursecomplete', 'completion').'</span>';
print '</th></tr>';
}
// Print user heading and icons
print '<tr>';
// User heading / sort option
print '<th scope="col" class="completion-sortchoice" style="clear: both;">';
$sistring = "&silast={$silast}&sifirst={$sifirst}";
if ($firstnamesort) {
print
get_string('firstname')." / <a href=\"./?course={$course->id}{$sistring}\">".
get_string('lastname').'</a>';
} else {
print "<a href=\"./?course={$course->id}&sort=firstname{$sistring}\">".
get_string('firstname').'</a> / '.
get_string('lastname');
}
print '</th>';
// Print user identity columns
foreach ($extrafields as $field) {
echo '<th scope="col" class="completion-identifyfield">' .
get_user_field_name($field) . '</th>';
}
///
/// Print criteria icons
///
foreach ($criteria as $criterion) {
// Generate icon details
$icon = '';
$iconlink = '';
$icontitle = ''; // Required if $iconlink set
$iconalt = ''; // Required
switch ($criterion->criteriatype) {
case COMPLETION_CRITERIA_TYPE_ACTIVITY:
// Display icon
$icon = $OUTPUT->pix_url('icon', $criterion->module);
$iconlink = $CFG->wwwroot.'/mod/'.$criterion->module.'/view.php?id='.$criterion->moduleinstance;
$icontitle = $modinfo->cms[$criterion->moduleinstance]->name;
$iconalt = get_string('modulename', $criterion->module);
break;
case COMPLETION_CRITERIA_TYPE_COURSE:
// Load course
$crs = $DB->get_record('course', array('id' => $criterion->courseinstance));
// Display icon
$iconlink = $CFG->wwwroot.'/course/view.php?id='.$criterion->courseinstance;
$icontitle = format_string($crs->fullname, true, array('context' => context_course::instance($crs->id, MUST_EXIST)));
$iconalt = format_string($crs->shortname, true, array('context' => context_course::instance($crs->id)));
break;
case COMPLETION_CRITERIA_TYPE_ROLE:
// Load role
$role = $DB->get_record('role', array('id' => $criterion->role));
// Display icon
$iconalt = $role->name;
break;
}
// Print icon and cell
print '<th class="criteriaicon">';
// Create icon if not supplied
if (!$icon) {
$icon = $OUTPUT->pix_url('i/'.$COMPLETION_CRITERIA_TYPES[$criterion->criteriatype]);
}
print ($iconlink ? '<a href="'.$iconlink.'" title="'.$icontitle.'">' : '');
print '<img src="'.$icon.'" class="icon" alt="'.$iconalt.'" '.(!$iconlink ? 'title="'.$iconalt.'"' : '').' />';
print ($iconlink ? '</a>' : '');
print '</th>';
}
// Overall course completion status
print '<th class="criteriaicon">';
print '<img src="'.$OUTPUT->pix_url('i/course').'" class="icon" alt="'.get_string('course').'" title="'.get_string('coursecomplete', 'completion').'" />';
print '</th>';
print '</tr></thead>';
echo '<tbody>';
} else {
// The CSV headers
$row = array();
$row[] = get_string('id', 'report_completion');
$row[] = get_string('name', 'report_completion');
foreach ($extrafields as $field) {
$row[] = get_user_field_name($field);
}
// Add activity headers
foreach ($criteria as $criterion) {
// Handle activity completion differently
if ($criterion->criteriatype == COMPLETION_CRITERIA_TYPE_ACTIVITY) {
// Load activity
$mod = $criterion->get_mod_instance();
$row[] = $mod->name;
$row[] = $mod->name . ' - ' . get_string('completiondate', 'report_completion');
}
else {
// Handle all other criteria
$row[] = strip_tags($criterion->get_title_detailed());
}
}
$row[] = get_string('coursecomplete', 'completion');
$export->add_data($row);
}
///
/// Display a row for each user
///
foreach ($progress as $user) {
// User name
if ($csv) {
$row = array();
$row[] = $user->id;
$row[] = fullname($user);
foreach ($extrafields as $field) {
$row[] = $user->{$field};
}
} else {
print PHP_EOL.'<tr id="user-'.$user->id.'">';
if (completion_can_view_data($user->id, $course)) {
$userurl = new moodle_url('/blocks/completionstatus/details.php', array('course' => $course->id, 'user' => $user->id));
} else {
$userurl = new moodle_url('/user/view.php', array('id' => $user->id, 'course' => $course->id));
}
print '<th scope="row"><a href="'.$userurl->out().'">'.fullname($user).'</a></th>';
foreach ($extrafields as $field) {
echo '<td>'.s($user->{$field}).'</td>';
}
}
// Progress for each course completion criteria
foreach ($criteria as $criterion) {
$criteria_completion = $completion->get_user_completion($user->id, $criterion);
$is_complete = $criteria_completion->is_complete();
// Handle activity completion differently
if ($criterion->criteriatype == COMPLETION_CRITERIA_TYPE_ACTIVITY) {
// Load activity
$activity = $modinfo->cms[$criterion->moduleinstance];
// Get progress information and state
if ($is_complete) {
$date = userdate($criteria_completion->timecompleted, get_string('strftimedatetimeshort', 'langconfig'));
if (array_key_exists($activity->id, $user->progress)) {
$thisprogress = $user->progress[$activity->id];
$state = $thisprogress->completionstate;
} else {
$state = COMPLETION_COMPLETE;
}
} else {
$date = '';
$state = COMPLETION_INCOMPLETE;
}
// Work out how it corresponds to an icon
switch($state) {
case COMPLETION_INCOMPLETE : $completiontype = 'n'; break;
case COMPLETION_COMPLETE : $completiontype = 'y'; break;
case COMPLETION_COMPLETE_PASS : $completiontype = 'pass'; break;
case COMPLETION_COMPLETE_FAIL : $completiontype = 'fail'; break;
}
$auto = $activity->completion == COMPLETION_TRACKING_AUTOMATIC;
$completionicon = 'completion-'.($auto ? 'auto' : 'manual').'-'.$completiontype;
$describe = get_string('completion-'.$completiontype, 'completion');
$a = new StdClass();
$a->state = $describe;
$a->date = $date;
$a->user = fullname($user);
$a->activity = strip_tags($activity->name);
$fulldescribe = get_string('progress-title', 'completion', $a);
if ($csv) {
$row[] = $describe;
$row[] = $date;
} else {
print '<td class="completion-progresscell">';
print '<img src="'.$OUTPUT->pix_url('i/'.$completionicon).
'" alt="'.$describe.'" class="icon" title="'.$fulldescribe.'" />';
print '</td>';
}
continue;
}
// Handle all other criteria
$completiontype = $is_complete ? 'y' : 'n';
$completionicon = 'completion-auto-'.$completiontype;
$describe = get_string('completion-'.$completiontype, 'completion');
$a = new stdClass();
$a->state = $describe;
if ($is_complete) {
$a->date = userdate($criteria_completion->timecompleted, get_string('strftimedatetimeshort', 'langconfig'));
} else {
$a->date = '';
}
$a->user = fullname($user);
$a->activity = strip_tags($criterion->get_title());
$fulldescribe = get_string('progress-title', 'completion', $a);
if ($csv) {
$row[] = $a->date;
} else {
print '<td class="completion-progresscell">';
if ($allow_marking_criteria === $criterion->id) {
$describe = get_string('completion-'.$completiontype, 'completion');
$toggleurl = new moodle_url(
'/course/togglecompletion.php',
array(
'user' => $user->id,
'course' => $course->id,
'rolec' => $allow_marking_criteria,
'sesskey' => sesskey()
)
);
print '<a href="'.$toggleurl->out().'"><img src="'.$OUTPUT->pix_url('i/completion-manual-'.($is_complete ? 'y' : 'n')).
'" alt="'.$describe.'" class="icon" title="'.get_string('markcomplete', 'completion').'" /></a></td>';
} else {
print '<img src="'.$OUTPUT->pix_url('i/'.$completionicon).'" alt="'.$describe.'" class="icon" title="'.$fulldescribe.'" /></td>';
}
print '</td>';
}
}
// Handle overall course completion
// Load course completion
$params = array(
'userid' => $user->id,
'course' => $course->id
);
$ccompletion = new completion_completion($params);
$completiontype = $ccompletion->is_complete() ? 'y' : 'n';
$describe = get_string('completion-'.$completiontype, 'completion');
$a = new StdClass;
if ($ccompletion->is_complete()) {
$a->date = userdate($ccompletion->timecompleted, get_string('strftimedatetimeshort', 'langconfig'));
} else {
$a->date = '';
}
$a->state = $describe;
$a->user = fullname($user);
$a->activity = strip_tags(get_string('coursecomplete', 'completion'));
$fulldescribe = get_string('progress-title', 'completion', $a);
if ($csv) {
$row[] = $a->date;
} else {
print '<td class="completion-progresscell">';
// Display course completion status icon
print '<img src="'.$OUTPUT->pix_url('i/completion-auto-'.$completiontype).
'" alt="'.$describe.'" class="icon" title="'.$fulldescribe.'" />';
print '</td>';
}
if ($csv) {
$export->add_data($row);
} else {
print '</tr>';
}
}
if ($csv) {
$export->download_file();
} else {
echo '</tbody>';
}
print '</table>';
print $pagingbar;
$csvurl = new moodle_url('/report/completion/index.php', array('course' => $course->id, 'format' => 'csv'));
$excelurl = new moodle_url('/report/completion/index.php', array('course' => $course->id, 'format' => 'excelcsv'));
print '<ul class="export-actions">';
print '<li><a href="'.$csvurl->out().'">'.get_string('csvdownload','completion').'</a></li>';
print '<li><a href="'.$excelurl->out().'">'.get_string('excelcsvdownload','completion').'</a></li>';
print '</ul>';
echo $OUTPUT->footer($course);