Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403] [Versions 402 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 /** 17 * Core Report class of basic reporting plugin 18 * @package scormreport 19 * @subpackage interactions 20 * @author Dan Marsden and Ankit Kumar Agarwal 21 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 22 */ 23 24 namespace scormreport_interactions; 25 26 defined('MOODLE_INTERNAL') || die(); 27 28 require_once($CFG->dirroot.'/mod/scorm/report/interactions/responsessettings_form.php'); 29 30 class report extends \mod_scorm\report { 31 /** 32 * displays the full report 33 * @param \stdClass $scorm full SCORM object 34 * @param \stdClass $cm - full course_module object 35 * @param \stdClass $course - full course object 36 * @param string $download - type of download being requested 37 */ 38 public function display($scorm, $cm, $course, $download) { 39 global $CFG, $DB, $OUTPUT, $PAGE; 40 41 $contextmodule = \context_module::instance($cm->id); 42 $action = optional_param('action', '', PARAM_ALPHA); 43 $attemptids = optional_param_array('attemptid', array(), PARAM_RAW); 44 $attemptsmode = optional_param('attemptsmode', SCORM_REPORT_ATTEMPTS_ALL_STUDENTS, PARAM_INT); 45 $PAGE->set_url(new \moodle_url($PAGE->url, array('attemptsmode' => $attemptsmode))); 46 47 // Scorm action bar for report. 48 if ($download === '') { 49 $actionbar = new \mod_scorm\output\actionbar($cm->id, true, $attemptsmode); 50 $renderer = $PAGE->get_renderer('mod_scorm'); 51 echo $renderer->report_actionbar($actionbar); 52 } 53 54 if ($action == 'delete' && has_capability('mod/scorm:deleteresponses', $contextmodule) && confirm_sesskey()) { 55 if (scorm_delete_responses($attemptids, $scorm)) { // Delete responses. 56 echo $OUTPUT->notification(get_string('scormresponsedeleted', 'scorm'), 'notifysuccess'); 57 } 58 } 59 // Find out current groups mode. 60 $currentgroup = groups_get_activity_group($cm, true); 61 62 // Detailed report. 63 $mform = new \mod_scorm_report_interactions_settings($PAGE->url, compact('currentgroup')); 64 if ($fromform = $mform->get_data()) { 65 $pagesize = $fromform->pagesize; 66 $includeqtext = $fromform->qtext; 67 $includeresp = $fromform->resp; 68 $includeright = $fromform->right; 69 $includeresult = $fromform->result; 70 set_user_preference('scorm_report_pagesize', $pagesize); 71 set_user_preference('scorm_report_interactions_qtext', $includeqtext); 72 set_user_preference('scorm_report_interactions_resp', $includeresp); 73 set_user_preference('scorm_report_interactions_right', $includeright); 74 set_user_preference('scorm_report_interactions_result', $includeresult); 75 } else { 76 $pagesize = get_user_preferences('scorm_report_pagesize', 0); 77 $includeqtext = get_user_preferences('scorm_report_interactions_qtext', 0); 78 $includeresp = get_user_preferences('scorm_report_interactions_resp', 1); 79 $includeright = get_user_preferences('scorm_report_interactions_right', 0); 80 $includeresult = get_user_preferences('scorm_report_interactions_result', 0); 81 } 82 if ($pagesize < 1) { 83 $pagesize = SCORM_REPORT_DEFAULT_PAGE_SIZE; 84 } 85 86 // Select group menu. 87 $displayoptions = array(); 88 $displayoptions['attemptsmode'] = $attemptsmode; 89 $displayoptions['qtext'] = $includeqtext; 90 $displayoptions['resp'] = $includeresp; 91 $displayoptions['right'] = $includeright; 92 $displayoptions['result'] = $includeresult; 93 94 $mform->set_data($displayoptions + array('pagesize' => $pagesize)); 95 if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used. 96 if (!$download) { 97 groups_print_activity_menu($cm, new \moodle_url($PAGE->url, $displayoptions)); 98 } 99 } 100 $formattextoptions = array('context' => \context_course::instance($course->id)); 101 102 // We only want to show the checkbox to delete attempts 103 // if the user has permissions and if the report mode is showing attempts. 104 $candelete = has_capability('mod/scorm:deleteresponses', $contextmodule) 105 && ($attemptsmode != SCORM_REPORT_ATTEMPTS_STUDENTS_WITH_NO); 106 // Select the students. 107 $nostudents = false; 108 list($allowedlistsql, $params) = get_enrolled_sql($contextmodule, 'mod/scorm:savetrack', (int) $currentgroup); 109 if (empty($currentgroup)) { 110 // All users who can attempt scoes. 111 if (!$DB->record_exists_sql($allowedlistsql, $params)) { 112 echo $OUTPUT->notification(get_string('nostudentsyet')); 113 $nostudents = true; 114 } 115 } else { 116 // All users who can attempt scoes and who are in the currently selected group. 117 if (!$DB->record_exists_sql($allowedlistsql, $params)) { 118 echo $OUTPUT->notification(get_string('nostudentsingroup')); 119 $nostudents = true; 120 } 121 } 122 if ( !$nostudents ) { 123 // Now check if asked download of data. 124 $coursecontext = \context_course::instance($course->id); 125 if ($download) { 126 $filename = clean_filename("$course->shortname ".format_string($scorm->name, true, $formattextoptions)); 127 } 128 129 // Define table columns. 130 $columns = array(); 131 $headers = array(); 132 if (!$download && $candelete) { 133 $columns[] = 'checkbox'; 134 $headers[] = $this->generate_master_checkbox(); 135 } 136 if (!$download && $CFG->grade_report_showuserimage) { 137 $columns[] = 'picture'; 138 $headers[] = ''; 139 } 140 $columns[] = 'fullname'; 141 $headers[] = get_string('name'); 142 143 // TODO Does not support custom user profile fields (MDL-70456). 144 $extrafields = \core_user\fields::get_identity_fields($coursecontext, false); 145 foreach ($extrafields as $field) { 146 $columns[] = $field; 147 $headers[] = \core_user\fields::get_display_name($field); 148 } 149 $columns[] = 'attempt'; 150 $headers[] = get_string('attempt', 'scorm'); 151 $columns[] = 'start'; 152 $headers[] = get_string('started', 'scorm'); 153 $columns[] = 'finish'; 154 $headers[] = get_string('last', 'scorm'); 155 $columns[] = 'score'; 156 $headers[] = get_string('score', 'scorm'); 157 $scoes = $DB->get_records('scorm_scoes', array("scorm" => $scorm->id), 'sortorder, id'); 158 foreach ($scoes as $sco) { 159 if ($sco->launch != '') { 160 $columns[] = 'scograde'.$sco->id; 161 $headers[] = format_string($sco->title, '', $formattextoptions); 162 } 163 } 164 165 // Construct the SQL. 166 $select = 'SELECT DISTINCT '.$DB->sql_concat('u.id', '\'#\'', 'COALESCE(sa.attempt, 0)').' AS uniqueid, '; 167 // TODO Does not support custom user profile fields (MDL-70456). 168 $userfields = \core_user\fields::for_identity($coursecontext, false)->with_userpic()->including('idnumber'); 169 $selectfields = $userfields->get_sql('u', false, '', 'userid')->selects; 170 $select .= 'sa.scormid AS scormid, sa.attempt AS attempt ' . $selectfields . ' '; 171 172 // This part is the same for all cases - join users and user tracking tables. 173 $from = 'FROM {user} u '; 174 $from .= 'LEFT JOIN {scorm_attempt} sa ON sa.userid = u.id AND sa.scormid = '.$scorm->id; 175 switch ($attemptsmode) { 176 case SCORM_REPORT_ATTEMPTS_STUDENTS_WITH: 177 // Show only students with attempts. 178 $where = " WHERE u.id IN ({$allowedlistsql}) AND sa.userid IS NOT NULL"; 179 break; 180 case SCORM_REPORT_ATTEMPTS_STUDENTS_WITH_NO: 181 // Show only students without attempts. 182 $where = " WHERE u.id IN ({$allowedlistsql}) AND sa.userid IS NULL"; 183 break; 184 case SCORM_REPORT_ATTEMPTS_ALL_STUDENTS: 185 // Show all students with or without attempts. 186 $where = " WHERE u.id IN ({$allowedlistsql}) AND (sa.userid IS NOT NULL OR sa.userid IS NULL)"; 187 break; 188 } 189 190 $countsql = 'SELECT COUNT(DISTINCT('.$DB->sql_concat('u.id', '\'#\'', 'COALESCE(sa.attempt, 0)').')) AS nbresults, '; 191 $countsql .= 'COUNT(DISTINCT('.$DB->sql_concat('u.id', '\'#\'', 'sa.attempt').')) AS nbattempts, '; 192 $countsql .= 'COUNT(DISTINCT(u.id)) AS nbusers '; 193 $countsql .= $from.$where; 194 $questioncount = get_scorm_question_count($scorm->id); 195 $nbmaincolumns = count($columns); 196 for ($id = 0; $id < $questioncount; $id++) { 197 if ($displayoptions['qtext']) { 198 $columns[] = 'question' . $id; 199 $headers[] = get_string('questionx', 'scormreport_interactions', $id); 200 } 201 if ($displayoptions['resp']) { 202 $columns[] = 'response' . $id; 203 $headers[] = get_string('responsex', 'scormreport_interactions', $id); 204 } 205 if ($displayoptions['right']) { 206 $columns[] = 'right' . $id; 207 $headers[] = get_string('rightanswerx', 'scormreport_interactions', $id); 208 } 209 if ($displayoptions['result']) { 210 $columns[] = 'result' . $id; 211 $headers[] = get_string('resultx', 'scormreport_interactions', $id); 212 } 213 } 214 215 if (!$download) { 216 $table = new \flexible_table('mod-scorm-report'); 217 218 $table->define_columns($columns); 219 $table->define_headers($headers); 220 $table->define_baseurl($PAGE->url); 221 222 $table->sortable(true); 223 $table->collapsible(true); 224 225 // This is done to prevent redundant data, when a user has multiple attempts. 226 $table->column_suppress('picture'); 227 $table->column_suppress('fullname'); 228 foreach ($extrafields as $field) { 229 $table->column_suppress($field); 230 } 231 232 $table->no_sorting('start'); 233 $table->no_sorting('finish'); 234 $table->no_sorting('score'); 235 $table->no_sorting('checkbox'); 236 $table->no_sorting('picture'); 237 238 for ($id = 0; $id < $questioncount; $id++) { 239 if ($displayoptions['qtext']) { 240 $table->no_sorting('question'.$id); 241 } 242 if ($displayoptions['resp']) { 243 $table->no_sorting('response'.$id); 244 } 245 if ($displayoptions['right']) { 246 $table->no_sorting('right'.$id); 247 } 248 if ($displayoptions['result']) { 249 $table->no_sorting('result'.$id); 250 } 251 } 252 253 foreach ($scoes as $sco) { 254 if ($sco->launch != '') { 255 $table->no_sorting('scograde'.$sco->id); 256 } 257 } 258 259 $table->column_class('picture', 'picture'); 260 $table->column_class('fullname', 'bold'); 261 $table->column_class('score', 'bold'); 262 263 $table->set_attribute('cellspacing', '0'); 264 $table->set_attribute('id', 'attempts'); 265 $table->set_attribute('class', 'generaltable generalbox'); 266 267 // Start working -- this is necessary as soon as the niceties are over. 268 $table->setup(); 269 } else if ($download == 'ODS') { 270 require_once("$CFG->libdir/odslib.class.php"); 271 272 $filename .= ".ods"; 273 // Creating a workbook. 274 $workbook = new \MoodleODSWorkbook("-"); 275 // Sending HTTP headers. 276 $workbook->send($filename); 277 // Creating the first worksheet. 278 $sheettitle = get_string('report', 'scorm'); 279 $myxls = $workbook->add_worksheet($sheettitle); 280 // Format types. 281 $format = $workbook->add_format(); 282 $format->set_bold(0); 283 $formatbc = $workbook->add_format(); 284 $formatbc->set_bold(1); 285 $formatbc->set_align('center'); 286 $formatb = $workbook->add_format(); 287 $formatb->set_bold(1); 288 $formaty = $workbook->add_format(); 289 $formaty->set_bg_color('yellow'); 290 $formatc = $workbook->add_format(); 291 $formatc->set_align('center'); 292 $formatr = $workbook->add_format(); 293 $formatr->set_bold(1); 294 $formatr->set_color('red'); 295 $formatr->set_align('center'); 296 $formatg = $workbook->add_format(); 297 $formatg->set_bold(1); 298 $formatg->set_color('green'); 299 $formatg->set_align('center'); 300 // Here starts workshhet headers. 301 302 $colnum = 0; 303 foreach ($headers as $item) { 304 $myxls->write(0, $colnum, $item, $formatbc); 305 $colnum++; 306 } 307 $rownum = 1; 308 } else if ($download == 'Excel') { 309 require_once("$CFG->libdir/excellib.class.php"); 310 311 $filename .= ".xls"; 312 // Creating a workbook. 313 $workbook = new \MoodleExcelWorkbook("-"); 314 // Sending HTTP headers. 315 $workbook->send($filename); 316 // Creating the first worksheet. 317 $sheettitle = get_string('report', 'scorm'); 318 $myxls = $workbook->add_worksheet($sheettitle); 319 // Format types. 320 $format = $workbook->add_format(); 321 $format->set_bold(0); 322 $formatbc = $workbook->add_format(); 323 $formatbc->set_bold(1); 324 $formatbc->set_align('center'); 325 $formatb = $workbook->add_format(); 326 $formatb->set_bold(1); 327 $formaty = $workbook->add_format(); 328 $formaty->set_bg_color('yellow'); 329 $formatc = $workbook->add_format(); 330 $formatc->set_align('center'); 331 $formatr = $workbook->add_format(); 332 $formatr->set_bold(1); 333 $formatr->set_color('red'); 334 $formatr->set_align('center'); 335 $formatg = $workbook->add_format(); 336 $formatg->set_bold(1); 337 $formatg->set_color('green'); 338 $formatg->set_align('center'); 339 340 $colnum = 0; 341 foreach ($headers as $item) { 342 $myxls->write(0, $colnum, $item, $formatbc); 343 $colnum++; 344 } 345 $rownum = 1; 346 } else if ($download == 'CSV') { 347 $csvexport = new \csv_export_writer("tab"); 348 $csvexport->set_filename($filename, ".txt"); 349 $csvexport->add_data($headers); 350 } 351 352 if (!$download) { 353 $sort = $table->get_sql_sort(); 354 } else { 355 $sort = ''; 356 } 357 // Fix some wired sorting. 358 if (empty($sort)) { 359 $sort = ' ORDER BY uniqueid'; 360 } else { 361 $sort = ' ORDER BY '.$sort; 362 } 363 364 if (!$download) { 365 // Add extra limits due to initials bar. 366 list($twhere, $tparams) = $table->get_sql_where(); 367 if ($twhere) { 368 $where .= ' AND '.$twhere; // Initial bar. 369 $params = array_merge($params, $tparams); 370 } 371 372 if (!empty($countsql)) { 373 $count = $DB->get_record_sql($countsql, $params); 374 $totalinitials = $count->nbresults; 375 if ($twhere) { 376 $countsql .= ' AND '.$twhere; 377 } 378 $count = $DB->get_record_sql($countsql, $params); 379 $total = $count->nbresults; 380 } 381 382 $table->pagesize($pagesize, $total); 383 384 echo \html_writer::start_div('scormattemptcounts'); 385 if ( $count->nbresults == $count->nbattempts ) { 386 echo get_string('reportcountattempts', 'scorm', $count); 387 } else if ( $count->nbattempts > 0 ) { 388 echo get_string('reportcountallattempts', 'scorm', $count); 389 } else { 390 echo $count->nbusers.' '.get_string('users'); 391 } 392 echo \html_writer::end_div(); 393 } 394 395 // Fetch the attempts. 396 if (!$download) { 397 $attempts = $DB->get_records_sql($select.$from.$where.$sort, $params, 398 $table->get_page_start(), $table->get_page_size()); 399 echo \html_writer::start_div('', array('id' => 'scormtablecontainer')); 400 if ($candelete) { 401 // Start form. 402 $strreallydel = addslashes_js(get_string('deleteattemptcheck', 'scorm')); 403 echo \html_writer::start_tag('form', array('id' => 'attemptsform', 'method' => 'post', 404 'action' => $PAGE->url->out(false), 405 'onsubmit' => 'return confirm("'.$strreallydel.'");')); 406 echo \html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'action', 'value' => 'delete')); 407 echo \html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey())); 408 echo \html_writer::start_div('', array('style' => 'display: none;')); 409 echo \html_writer::input_hidden_params($PAGE->url); 410 echo \html_writer::end_div(); 411 echo \html_writer::start_div(); 412 } 413 $table->initialbars($totalinitials > 20); // Build table rows. 414 } else { 415 $attempts = $DB->get_records_sql($select.$from.$where.$sort, $params); 416 } 417 if ($attempts) { 418 foreach ($attempts as $scouser) { 419 $row = array(); 420 if (!empty($scouser->attempt)) { 421 $timetracks = scorm_get_sco_runtime($scorm->id, false, $scouser->userid, $scouser->attempt); 422 } else { 423 $timetracks = ''; 424 } 425 if (in_array('checkbox', $columns)) { 426 if ($candelete && !empty($timetracks->start)) { 427 $row[] = $this->generate_row_checkbox('attemptid[]', "{$scouser->userid}:{$scouser->attempt}"); 428 } else if ($candelete) { 429 $row[] = ''; 430 } 431 } 432 if (in_array('picture', $columns)) { 433 $user = new \stdClass(); 434 $additionalfields = explode(',', implode(',', \core_user\fields::get_picture_fields())); 435 $user = username_load_fields_from_object($user, $scouser, null, $additionalfields); 436 $user->id = $scouser->userid; 437 $row[] = $OUTPUT->user_picture($user, array('courseid' => $course->id)); 438 } 439 if (!$download) { 440 $url = new \moodle_url('/user/view.php', array('id' => $scouser->userid, 'course' => $course->id)); 441 $row[] = \html_writer::link($url, fullname($scouser)); 442 } else { 443 $row[] = fullname($scouser); 444 } 445 foreach ($extrafields as $field) { 446 $row[] = s($scouser->{$field}); 447 } 448 if (empty($timetracks->start)) { 449 $row[] = '-'; 450 $row[] = '-'; 451 $row[] = '-'; 452 $row[] = '-'; 453 } else { 454 if (!$download) { 455 $url = new \moodle_url('/mod/scorm/report/userreport.php', 456 array('id' => $cm->id, 457 'user' => $scouser->userid, 458 'attempt' => $scouser->attempt, 459 'mode' => 'interactions')); 460 $row[] = \html_writer::link($url, $scouser->attempt); 461 } else { 462 $row[] = $scouser->attempt; 463 } 464 if ($download == 'ODS' || $download == 'Excel' ) { 465 $row[] = userdate($timetracks->start, get_string("strftimedatetime", "langconfig")); 466 } else { 467 $row[] = userdate($timetracks->start); 468 } 469 if ($download == 'ODS' || $download == 'Excel' ) { 470 $row[] = userdate($timetracks->finish, get_string('strftimedatetime', 'langconfig')); 471 } else { 472 $row[] = userdate($timetracks->finish); 473 } 474 $row[] = scorm_grade_user_attempt($scorm, $scouser->userid, $scouser->attempt); 475 } 476 // Print out all scores of attempt. 477 $emptyrow = $download ? '' : ' '; 478 foreach ($scoes as $sco) { 479 if ($sco->launch != '') { 480 if ($trackdata = scorm_get_tracks($sco->id, $scouser->userid, $scouser->attempt)) { 481 if ($trackdata->status == '') { 482 $trackdata->status = 'notattempted'; 483 } 484 $strstatus = get_string($trackdata->status, 'scorm'); 485 // If raw score exists, print it. 486 if ($trackdata->score_raw != '') { 487 $score = $trackdata->score_raw; 488 // Add max score if it exists. 489 if (isset($trackdata->score_max)) { 490 $score .= '/'.$trackdata->score_max; 491 } 492 } else { // Else print out status. 493 $score = $strstatus; 494 } 495 if (!$download) { 496 $url = new \moodle_url('/mod/scorm/report/userreporttracks.php', array('id' => $cm->id, 497 'scoid' => $sco->id, 'user' => $scouser->userid, 'attempt' => $scouser->attempt, 498 'mode' => 'interactions')); 499 $row[] = $OUTPUT->pix_icon($trackdata->status, $strstatus, 'scorm') . '<br>' . 500 \html_writer::link($url, $score, array('title' => get_string('details', 'scorm'))); 501 } else { 502 $row[] = $score; 503 } 504 // Interaction data. 505 for ($i = 0; $i < $questioncount; $i++) { 506 if ($displayoptions['qtext']) { 507 $element = 'cmi.interactions_'.$i.'.id'; 508 if (isset($trackdata->$element)) { 509 $row[] = s($trackdata->$element); 510 } else { 511 $row[] = $emptyrow; 512 } 513 } 514 if ($displayoptions['resp']) { 515 $element = 'cmi.interactions_'.$i.'.student_response'; 516 if (isset($trackdata->$element)) { 517 $row[] = s($trackdata->$element); 518 } else { 519 $row[] = $emptyrow; 520 } 521 } 522 if ($displayoptions['right']) { 523 $j = 0; 524 $element = 'cmi.interactions_'.$i.'.correct_responses_'.$j.'.pattern'; 525 $rightans = ''; 526 if (isset($trackdata->$element)) { 527 while (isset($trackdata->$element)) { 528 if ($j > 0) { 529 $rightans .= ','; 530 } 531 $rightans .= s($trackdata->$element); 532 $j++; 533 $element = 'cmi.interactions_'.$i.'.correct_responses_'.$j.'.pattern'; 534 } 535 $row[] = $rightans; 536 } else { 537 $row[] = $emptyrow; 538 } 539 } 540 if ($displayoptions['result']) { 541 $element = 'cmi.interactions_'.$i.'.result'; 542 if (isset($trackdata->$element)) { 543 $row[] = s($trackdata->$element); 544 } else { 545 $row[] = $emptyrow; 546 } 547 } 548 } 549 // End of interaction data. 550 } else { 551 // If we don't have track data, we haven't attempted yet. 552 $strstatus = get_string('notattempted', 'scorm'); 553 if (!$download) { 554 $row[] = $OUTPUT->pix_icon('notattempted', $strstatus, 'scorm') . '<br>' . $strstatus; 555 } else { 556 $row[] = $strstatus; 557 } 558 // Complete the empty cells. 559 for ($i = 0; $i < count($columns) - $nbmaincolumns; $i++) { 560 $row[] = $emptyrow; 561 } 562 } 563 } 564 } 565 566 if (!$download) { 567 $table->add_data($row); 568 } else if ($download == 'Excel' or $download == 'ODS') { 569 $colnum = 0; 570 foreach ($row as $item) { 571 $myxls->write($rownum, $colnum, $item, $format); 572 $colnum++; 573 } 574 $rownum++; 575 } else if ($download == 'CSV') { 576 $csvexport->add_data($row); 577 } 578 } 579 if (!$download) { 580 $table->finish_output(); 581 if ($candelete) { 582 echo \html_writer::start_tag('table', array('id' => 'commands')); 583 echo \html_writer::start_tag('tr').\html_writer::start_tag('td'); 584 echo $this->generate_delete_selected_button(); 585 echo \html_writer::end_tag('td').\html_writer::end_tag('tr').\html_writer::end_tag('table'); 586 // Close form. 587 echo \html_writer::end_tag('div'); 588 echo \html_writer::end_tag('form'); 589 } 590 } 591 } else { 592 if ($candelete && !$download) { 593 echo \html_writer::end_div(); 594 echo \html_writer::end_tag('form'); 595 $table->finish_output(); 596 } 597 echo \html_writer::end_div(); 598 } 599 // Show preferences form irrespective of attempts are there to report or not. 600 if (!$download) { 601 $mform->set_data(compact('pagesize', 'attemptsmode')); 602 $mform->display(); 603 } 604 if ($download == 'Excel' or $download == 'ODS') { 605 $workbook->close(); 606 exit; 607 } else if ($download == 'CSV') { 608 $csvexport->download_file(); 609 exit; 610 } 611 } else { 612 echo $OUTPUT->notification(get_string('noactivity', 'scorm')); 613 } 614 }// Function ends. 615 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body