Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]
1 <?php 2 3 // This file is part of Moodle - http://moodle.org/ 4 // 5 // Moodle is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // Moodle is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 17 18 /** 19 * Moodle renderer used to display special elements of the lesson module 20 * 21 * @package mod_lesson 22 * @copyright 2009 Sam Hemelryk 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 **/ 25 26 defined('MOODLE_INTERNAL') || die(); 27 28 class mod_lesson_renderer extends plugin_renderer_base { 29 /** 30 * Returns the header for the lesson module 31 * 32 * @param lesson $lesson a lesson object. 33 * @param string $currenttab current tab that is shown. 34 * @param bool $extraeditbuttons if extra edit buttons should be displayed. 35 * @param int $lessonpageid id of the lesson page that needs to be displayed. 36 * @param string $extrapagetitle String to appent to the page title. 37 * @return string 38 */ 39 public function header($lesson, $cm, $currenttab = '', $extraeditbuttons = false, $lessonpageid = null, $extrapagetitle = null) { 40 global $CFG, $USER; 41 42 $activityname = format_string($lesson->name, true, $lesson->course); 43 if (empty($extrapagetitle)) { 44 $title = $this->page->course->shortname.": ".$activityname; 45 } else { 46 $title = $this->page->course->shortname.": ".$activityname.": ".$extrapagetitle; 47 } 48 49 // Build the buttons 50 $context = context_module::instance($cm->id); 51 52 // Header setup. 53 $this->page->set_title($title); 54 $this->page->set_heading($this->page->course->fullname); 55 lesson_add_header_buttons($cm, $context, $extraeditbuttons, $lessonpageid); 56 $output = $this->output->header(); 57 58 $cminfo = cm_info::create($cm); 59 $completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id); 60 $activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id); 61 if (has_capability('mod/lesson:manage', $context)) { 62 $output .= $this->output->heading_with_help($activityname, 'overview', 'lesson'); 63 $output .= $this->output->activity_information($cminfo, $completiondetails, $activitydates); 64 65 // Info box. 66 if ($lesson->intro) { 67 $output .= $this->output->box(format_module_intro('lesson', $lesson, $cm->id), 'generalbox', 'intro'); 68 } 69 if (!empty($currenttab)) { 70 ob_start(); 71 include($CFG->dirroot.'/mod/lesson/tabs.php'); 72 $output .= ob_get_contents(); 73 ob_end_clean(); 74 } 75 } else { 76 $output .= $this->output->heading($activityname); 77 $output .= $this->output->activity_information($cminfo, $completiondetails, $activitydates); 78 79 // Info box. 80 if ($lesson->intro) { 81 $output .= $this->output->box(format_module_intro('lesson', $lesson, $cm->id), 'generalbox', 'intro'); 82 } 83 } 84 85 foreach ($lesson->messages as $message) { 86 $output .= $this->output->notification($message[0], $message[1], $message[2]); 87 } 88 89 return $output; 90 } 91 92 /** 93 * Returns the footer 94 * @return string 95 */ 96 public function footer() { 97 return $this->output->footer(); 98 } 99 100 /** 101 * Returns HTML for a lesson inaccessible message 102 * 103 * @param string $message 104 * @return <type> 105 */ 106 public function lesson_inaccessible($message) { 107 global $CFG; 108 $output = $this->output->box_start('generalbox boxaligncenter'); 109 $output .= $this->output->box_start('center'); 110 $output .= $message; 111 $output .= $this->output->box('<a href="'.$CFG->wwwroot.'/course/view.php?id='. $this->page->course->id .'">'. get_string('returnto', 'lesson', format_string($this->page->course->fullname, true)) .'</a>', 'lessonbutton standardbutton'); 112 $output .= $this->output->box_end(); 113 $output .= $this->output->box_end(); 114 return $output; 115 } 116 117 /** 118 * Returns HTML to prompt the user to log in 119 * @param lesson $lesson 120 * @param bool $failedattempt 121 * @return string 122 */ 123 public function login_prompt(lesson $lesson, $failedattempt = false) { 124 global $CFG; 125 $output = $this->output->box_start('password-form'); 126 $output .= $this->output->box_start('generalbox boxaligncenter'); 127 $output .= '<form id="password" method="post" action="'.$CFG->wwwroot.'/mod/lesson/view.php" autocomplete="off">'; 128 $output .= '<fieldset class="invisiblefieldset center">'; 129 $output .= '<input type="hidden" name="id" value="'. $this->page->cm->id .'" />'; 130 $output .= '<input type="hidden" name="sesskey" value="'.sesskey().'" />'; 131 if ($failedattempt) { 132 $output .= $this->output->notification(get_string('loginfail', 'lesson')); 133 } 134 $output .= get_string('passwordprotectedlesson', 'lesson', format_string($lesson->name)).'<br /><br />'; 135 $output .= get_string('enterpassword', 'lesson')." <input type=\"password\" name=\"userpassword\" /><br /><br />"; 136 $output .= "<div class='lessonbutton standardbutton submitbutton'><input type='submit' value='".get_string('continue', 'lesson')."' /></div>"; 137 $output .= " <div class='lessonbutton standardbutton submitbutton'><input type='submit' name='backtocourse' value='".get_string('cancel', 'lesson')."' /></div>"; 138 $output .= '</fieldset></form>'; 139 $output .= $this->output->box_end(); 140 $output .= $this->output->box_end(); 141 return $output; 142 } 143 144 /** 145 * Returns HTML to display dependancy errors 146 * 147 * @param object $dependentlesson 148 * @param array $errors 149 * @return string 150 */ 151 public function dependancy_errors($dependentlesson, $errors) { 152 $output = $this->output->box_start('generalbox boxaligncenter'); 153 $output .= get_string('completethefollowingconditions', 'lesson', $dependentlesson->name); 154 $output .= $this->output->box(implode('<br />'.get_string('and', 'lesson').'<br />', $errors),'center'); 155 $output .= $this->output->box_end(); 156 return $output; 157 } 158 159 /** 160 * Returns HTML to display a message 161 * @param string $message 162 * @param single_button $button 163 * @return string 164 */ 165 public function message($message, single_button $button = null) { 166 $output = $this->output->box_start('generalbox boxaligncenter'); 167 $output .= $message; 168 if ($button !== null) { 169 $output .= $this->output->box($this->output->render($button), 'lessonbutton standardbutton'); 170 } 171 $output .= $this->output->box_end(); 172 return $output; 173 } 174 175 /** 176 * Returns HTML to display a continue button 177 * @param lesson $lesson 178 * @param int $lastpageseen 179 * @return string 180 */ 181 public function continue_links(lesson $lesson, $lastpageseenid) { 182 global $CFG; 183 $output = $this->output->box(get_string('youhaveseen','lesson'), 'generalbox boxaligncenter'); 184 $output .= $this->output->box_start('center'); 185 186 $yeslink = html_writer::link(new moodle_url('/mod/lesson/view.php', array('id' => $this->page->cm->id, 187 'pageid' => $lastpageseenid, 'startlastseen' => 'yes')), get_string('yes'), array('class' => 'btn btn-primary')); 188 $output .= html_writer::tag('span', $yeslink, array('class'=>'lessonbutton standardbutton')); 189 $output .= ' '; 190 191 $nolink = html_writer::link(new moodle_url('/mod/lesson/view.php', array('id' => $this->page->cm->id, 192 'pageid' => $lesson->firstpageid, 'startlastseen' => 'no')), get_string('no'), array('class' => 'btn btn-secondary')); 193 $output .= html_writer::tag('span', $nolink, array('class'=>'lessonbutton standardbutton')); 194 195 $output .= $this->output->box_end(); 196 return $output; 197 } 198 199 /** 200 * Returns HTML to display a page to the user 201 * @param lesson $lesson 202 * @param lesson_page $page 203 * @param object $attempt 204 * @return string 205 */ 206 public function display_page(lesson $lesson, lesson_page $page, $attempt) { 207 // We need to buffer here as there is an mforms display call 208 ob_start(); 209 echo $page->display($this, $attempt); 210 $output = ob_get_contents(); 211 ob_end_clean(); 212 return $output; 213 } 214 215 /** 216 * Returns HTML to display a collapsed edit form 217 * 218 * @param lesson $lesson 219 * @param int $pageid 220 * @return string 221 */ 222 public function display_edit_collapsed(lesson $lesson, $pageid) { 223 global $DB, $CFG; 224 225 $manager = lesson_page_type_manager::get($lesson); 226 $qtypes = $manager->get_page_type_strings(); 227 $npages = count($lesson->load_all_pages()); 228 229 $table = new html_table(); 230 $table->head = array(get_string('pagetitle', 'lesson'), get_string('qtype', 'lesson'), get_string('jumps', 'lesson'), get_string('actions', 'lesson')); 231 $table->align = array('left', 'left', 'left', 'center'); 232 $table->data = array(); 233 234 $canedit = has_capability('mod/lesson:edit', context_module::instance($this->page->cm->id)); 235 236 while ($pageid != 0) { 237 $page = $lesson->load_page($pageid); 238 $data = array(); 239 $url = new moodle_url('/mod/lesson/edit.php', array( 240 'id' => $this->page->cm->id, 241 'mode' => 'single', 242 'pageid' => $page->id 243 )); 244 $data[] = html_writer::link($url, format_string($page->title, true), array('id' => 'lesson-' . $page->id)); 245 $data[] = $qtypes[$page->qtype]; 246 $data[] = implode("<br />\n", $page->jumps); 247 if ($canedit) { 248 $data[] = $this->page_action_links($page, $npages, true); 249 } else { 250 $data[] = ''; 251 } 252 $table->data[] = $data; 253 $pageid = $page->nextpageid; 254 } 255 256 return html_writer::div(html_writer::table($table), 'table-responsive'); 257 } 258 259 /** 260 * Returns HTML to display the full edit page 261 * 262 * @param lesson $lesson 263 * @param int $pageid 264 * @param int $prevpageid 265 * @param bool $single 266 * @return string 267 */ 268 public function display_edit_full(lesson $lesson, $pageid, $prevpageid, $single=false) { 269 global $DB, $CFG; 270 271 $manager = lesson_page_type_manager::get($lesson); 272 $qtypes = $manager->get_page_type_strings(); 273 $npages = count($lesson->load_all_pages()); 274 $canedit = has_capability('mod/lesson:edit', context_module::instance($this->page->cm->id)); 275 276 $content = ''; 277 if ($canedit) { 278 $content = $this->add_page_links($lesson, $prevpageid); 279 } 280 281 $options = new stdClass; 282 $options->noclean = true; 283 284 while ($pageid != 0 && $single!=='stop') { 285 $page = $lesson->load_page($pageid); 286 287 $pagetable = new html_table(); 288 $pagetable->align = array('right','left'); 289 $pagetable->width = '100%'; 290 $pagetable->tablealign = 'center'; 291 $pagetable->cellspacing = 0; 292 $pagetable->cellpadding = '5px'; 293 $pagetable->data = array(); 294 295 $pageheading = new html_table_cell(); 296 297 $pageheading->text = html_writer::tag('a', '', array('id' => 'lesson-' . $pageid)) . format_string($page->title); 298 if ($canedit) { 299 $pageheading->text .= ' '.$this->page_action_links($page, $npages); 300 } 301 $pageheading->style = 'text-align:center'; 302 $pageheading->colspan = 2; 303 $pageheading->scope = 'col'; 304 $pagetable->head = array($pageheading); 305 306 $cell = new html_table_cell(); 307 $cell->colspan = 2; 308 $cell->style = 'text-align:left'; 309 $cell->text = $page->contents; 310 $pagetable->data[] = new html_table_row(array($cell)); 311 312 $cell = new html_table_cell(); 313 $cell->colspan = 2; 314 $cell->style = 'text-align:center'; 315 $cell->text = '<strong>'.$qtypes[$page->qtype] . $page->option_description_string().'</strong>'; 316 $pagetable->data[] = new html_table_row(array($cell)); 317 318 $pagetable = $page->display_answers($pagetable); 319 320 $content .= html_writer::start_tag('div'); 321 $content .= html_writer::table($pagetable); 322 $content .= html_writer::end_tag('div'); 323 324 if ($canedit) { 325 $content .= $this->add_page_links($lesson, $pageid); 326 } 327 328 // check the prev links - fix (silently) if necessary - there was a bug in 329 // versions 1 and 2 when add new pages. Not serious then as the backwards 330 // links were not used in those versions 331 if ($page->prevpageid != $prevpageid) { 332 // fix it 333 $DB->set_field("lesson_pages", "prevpageid", $prevpageid, array("id" => $page->id)); 334 debugging("<p>***prevpageid of page $page->id set to $prevpageid***"); 335 } 336 337 $prevpageid = $page->id; 338 $pageid = $page->nextpageid; 339 340 if ($single === true) { 341 $single = 'stop'; 342 } 343 344 } 345 346 return $this->output->box($content, 'edit_pages_box'); 347 } 348 349 /** 350 * Returns HTML to display the add page links 351 * 352 * @param lesson $lesson 353 * @param int $prevpageid 354 * @return string 355 */ 356 public function add_page_links(lesson $lesson, $prevpageid=false) { 357 global $CFG; 358 359 $links = array(); 360 361 $importquestionsurl = new moodle_url('/mod/lesson/import.php',array('id'=>$this->page->cm->id, 'pageid'=>$prevpageid)); 362 $links[] = html_writer::link($importquestionsurl, get_string('importquestions', 'lesson')); 363 364 $manager = lesson_page_type_manager::get($lesson); 365 foreach($manager->get_add_page_type_links($prevpageid) as $link) { 366 $links[] = html_writer::link($link['addurl'], $link['name']); 367 } 368 369 $addquestionurl = new moodle_url('/mod/lesson/editpage.php', array('id'=>$this->page->cm->id, 'pageid'=>$prevpageid)); 370 $links[] = html_writer::link($addquestionurl, get_string('addaquestionpagehere', 'lesson')); 371 372 return $this->output->box(implode(" | \n", $links), 'addlinks'); 373 } 374 375 /** 376 * Return HTML to display add first page links 377 * @param lesson $lesson 378 * @return string 379 */ 380 public function add_first_page_links(lesson $lesson) { 381 global $CFG; 382 $prevpageid = 0; 383 384 $output = $this->output->heading(get_string("whatdofirst", "lesson"), 3); 385 $links = array(); 386 387 $importquestionsurl = new moodle_url('/mod/lesson/import.php',array('id'=>$this->page->cm->id, 'pageid'=>$prevpageid)); 388 $links[] = html_writer::link($importquestionsurl, get_string('importquestions', 'lesson')); 389 390 $manager = lesson_page_type_manager::get($lesson); 391 foreach ($manager->get_add_page_type_links($prevpageid) as $link) { 392 $link['addurl']->param('firstpage', 1); 393 $links[] = html_writer::link($link['addurl'], $link['name']); 394 } 395 396 $addquestionurl = new moodle_url('/mod/lesson/editpage.php', array('id'=>$this->page->cm->id, 'pageid'=>$prevpageid, 'firstpage'=>1)); 397 $links[] = html_writer::link($addquestionurl, get_string('addaquestionpage', 'lesson')); 398 399 return $this->output->box($output.'<p>'.implode('</p><p>', $links).'</p>', 'generalbox firstpageoptions'); 400 } 401 402 /** 403 * Returns HTML to display action links for a page 404 * 405 * @param lesson_page $page 406 * @param bool $printmove 407 * @param bool $printaddpage 408 * @return string 409 */ 410 public function page_action_links(lesson_page $page, $printmove, $printaddpage=false) { 411 global $CFG; 412 413 $actions = array(); 414 415 if ($printmove) { 416 $url = new moodle_url('/mod/lesson/lesson.php', 417 array('id' => $this->page->cm->id, 'action' => 'move', 'pageid' => $page->id, 'sesskey' => sesskey())); 418 $label = get_string('movepagenamed', 'lesson', format_string($page->title)); 419 $img = $this->output->pix_icon('t/move', $label); 420 $actions[] = html_writer::link($url, $img, array('title' => $label)); 421 } 422 $url = new moodle_url('/mod/lesson/editpage.php', array('id' => $this->page->cm->id, 'pageid' => $page->id, 'edit' => 1)); 423 $label = get_string('updatepagenamed', 'lesson', format_string($page->title)); 424 $img = $this->output->pix_icon('t/edit', $label); 425 $actions[] = html_writer::link($url, $img, array('title' => $label)); 426 427 // Duplicate action. 428 $url = new moodle_url('/mod/lesson/lesson.php', array('id' => $this->page->cm->id, 'pageid' => $page->id, 429 'action' => 'duplicate', 'sesskey' => sesskey())); 430 $label = get_string('duplicatepagenamed', 'lesson', format_string($page->title)); 431 $img = $this->output->pix_icon('e/copy', $label, 'mod_lesson'); 432 $actions[] = html_writer::link($url, $img, array('title' => $label)); 433 434 $url = new moodle_url('/mod/lesson/view.php', array('id' => $this->page->cm->id, 'pageid' => $page->id)); 435 $label = get_string('previewpagenamed', 'lesson', format_string($page->title)); 436 $img = $this->output->pix_icon('t/preview', $label); 437 $actions[] = html_writer::link($url, $img, array('title' => $label)); 438 439 $url = new moodle_url('/mod/lesson/lesson.php', 440 array('id' => $this->page->cm->id, 'action' => 'confirmdelete', 'pageid' => $page->id, 'sesskey' => sesskey())); 441 $label = get_string('deletepagenamed', 'lesson', format_string($page->title)); 442 $img = $this->output->pix_icon('t/delete', $label); 443 $actions[] = html_writer::link($url, $img, array('title' => $label)); 444 445 if ($printaddpage) { 446 $options = array(); 447 $manager = lesson_page_type_manager::get($page->lesson); 448 $links = $manager->get_add_page_type_links($page->id); 449 foreach ($links as $link) { 450 $options[$link['type']] = $link['name']; 451 } 452 $options[0] = get_string('addaquestionpage', 'lesson'); 453 454 $addpageurl = new moodle_url('/mod/lesson/editpage.php', array('id'=>$this->page->cm->id, 'pageid'=>$page->id, 'sesskey'=>sesskey())); 455 $addpageselect = new single_select($addpageurl, 'qtype', $options, null, array(''=>get_string('addanewpage', 'lesson').'...'), 'addpageafter'.$page->id); 456 $addpageselect->attributes = ['aria-label' => get_string('actions', 'lesson')]; 457 $addpageselector = $this->output->render($addpageselect); 458 } 459 460 if (isset($addpageselector)) { 461 $actions[] = $addpageselector; 462 } 463 464 return implode(' ', $actions); 465 } 466 467 /** 468 * Prints the on going message to the user. 469 * 470 * With custom grading On, displays points 471 * earned out of total points possible thus far. 472 * With custom grading Off, displays number of correct 473 * answers out of total attempted. 474 * 475 * @param object $lesson The lesson that the user is taking. 476 * @return void 477 **/ 478 479 /** 480 * Prints the on going message to the user. 481 * 482 * With custom grading On, displays points 483 * earned out of total points possible thus far. 484 * With custom grading Off, displays number of correct 485 * answers out of total attempted. 486 * 487 * @param lesson $lesson 488 * @return string 489 */ 490 public function ongoing_score(lesson $lesson) { 491 return $this->output->box($lesson->get_ongoing_score_message(), "ongoing center"); 492 } 493 494 /** 495 * Returns HTML to display a progress bar of progression through a lesson 496 * 497 * @param lesson $lesson 498 * @param int $progress optional, if empty it will be calculated 499 * @return string 500 */ 501 public function progress_bar(lesson $lesson, $progress = null) { 502 $context = context_module::instance($this->page->cm->id); 503 504 // lesson setting to turn progress bar on or off 505 if (!$lesson->progressbar) { 506 return ''; 507 } 508 509 // catch teachers 510 if (has_capability('mod/lesson:manage', $context)) { 511 return $this->output->notification(get_string('progressbarteacherwarning2', 'lesson')); 512 } 513 514 if ($progress === null) { 515 $progress = $lesson->calculate_progress(); 516 } 517 518 $content = html_writer::start_tag('div'); 519 $content .= html_writer::start_tag('div', array('class' => 'progress')); 520 $content .= html_writer::start_tag('div', array('class' => 'progress-bar bar', 'role' => 'progressbar', 521 'style' => 'width: ' . $progress .'%', 'aria-valuenow' => $progress, 'aria-valuemin' => 0, 'aria-valuemax' => 100)); 522 $content .= $progress . "%"; 523 $content .= html_writer::end_tag('div'); 524 $content .= html_writer::end_tag('div'); 525 $printprogress = html_writer::tag('div', get_string('progresscompleted', 'lesson', $progress) . $content); 526 return $this->output->box($printprogress, 'progress_bar'); 527 } 528 529 /** 530 * Returns HTML to show the start of a slideshow 531 * @param lesson $lesson 532 */ 533 public function slideshow_start(lesson $lesson) { 534 $attributes = array(); 535 $attributes['class'] = 'slideshow'; 536 $attributes['style'] = 'background-color:'.$lesson->properties()->bgcolor.';height:'. 537 $lesson->properties()->height.'px;width:'.$lesson->properties()->width.'px;'; 538 $output = html_writer::start_tag('div', $attributes); 539 return $output; 540 } 541 /** 542 * Returns HTML to show the end of a slideshow 543 */ 544 public function slideshow_end() { 545 $output = html_writer::end_tag('div'); 546 return $output; 547 } 548 /** 549 * Returns a P tag containing contents 550 * @param string $contents 551 * @param string $class 552 */ 553 public function paragraph($contents, $class='') { 554 $attributes = array(); 555 if ($class !== '') { 556 $attributes['class'] = $class; 557 } 558 $output = html_writer::tag('p', $contents, $attributes); 559 return $output; 560 } 561 562 /** 563 * Returns the HTML for displaying the end of lesson page. 564 * 565 * @param lesson $lesson lesson instance 566 * @param stdclass $data lesson data to be rendered 567 * @return string HTML contents 568 */ 569 public function display_eol_page(lesson $lesson, $data) { 570 571 $output = ''; 572 $canmanage = $lesson->can_manage(); 573 $course = $lesson->courserecord; 574 575 if ($lesson->custom && !$canmanage && (($data->gradeinfo->nquestions < $lesson->minquestions))) { 576 $output .= $this->box_start('generalbox boxaligncenter'); 577 } 578 579 if ($data->gradelesson) { 580 // We are using level 3 header because the page title is a sub-heading of lesson title (MDL-30911). 581 $output .= $this->heading(get_string("congratulations", "lesson"), 3); 582 $output .= $this->box_start('generalbox boxaligncenter'); 583 } 584 585 if ($data->notenoughtimespent !== false) { 586 $output .= $this->paragraph(get_string("notenoughtimespent", "lesson", $data->notenoughtimespent), 'center'); 587 } 588 589 if ($data->numberofpagesviewed !== false) { 590 $output .= $this->paragraph(get_string("numberofpagesviewed", "lesson", $data->numberofpagesviewed), 'center'); 591 } 592 if ($data->youshouldview !== false) { 593 $output .= $this->paragraph(get_string("youshouldview", "lesson", $data->youshouldview), 'center'); 594 } 595 if ($data->numberofcorrectanswers !== false) { 596 $output .= $this->paragraph(get_string("numberofcorrectanswers", "lesson", $data->numberofcorrectanswers), 'center'); 597 } 598 599 if ($data->displayscorewithessays !== false) { 600 $output .= $this->box(get_string("displayscorewithessays", "lesson", $data->displayscorewithessays), 'center'); 601 } else if ($data->displayscorewithoutessays !== false) { 602 $output .= $this->box(get_string("displayscorewithoutessays", "lesson", $data->displayscorewithoutessays), 'center'); 603 } 604 605 if ($data->yourcurrentgradeisoutof !== false) { 606 $output .= $this->paragraph(get_string("yourcurrentgradeisoutof", "lesson", $data->yourcurrentgradeisoutof), 'center'); 607 } 608 if ($data->yourcurrentgradeis !== false) { 609 $output .= $this->paragraph(get_string("yourcurrentgradeis", "lesson", $data->yourcurrentgradeis), 'center'); 610 } 611 if ($data->eolstudentoutoftimenoanswers !== false) { 612 $output .= $this->paragraph(get_string("eolstudentoutoftimenoanswers", "lesson")); 613 } 614 if ($data->welldone !== false) { 615 $output .= $this->paragraph(get_string("welldone", "lesson")); 616 } 617 618 if ($data->progresscompleted !== false) { 619 $output .= $this->progress_bar($lesson, $data->progresscompleted); 620 } 621 622 if ($data->displayofgrade !== false) { 623 $output .= $this->paragraph(get_string("displayofgrade", "lesson"), 'center'); 624 } 625 626 $output .= $this->box_end(); // End of Lesson button to Continue. 627 628 if ($data->reviewlesson !== false) { 629 $output .= html_writer::link($data->reviewlesson, get_string('reviewlesson', 'lesson'), 630 array('class' => 'centerpadded lessonbutton standardbutton pr-3')); 631 } 632 if ($data->modattemptsnoteacher !== false) { 633 $output .= $this->paragraph(get_string("modattemptsnoteacher", "lesson"), 'centerpadded'); 634 } 635 636 if ($data->activitylink !== false) { 637 $output .= $data->activitylink; 638 } 639 640 $url = new moodle_url('/course/view.php', array('id' => $course->id)); 641 $output .= html_writer::link($url, get_string('returnto', 'lesson', format_string($course->fullname, true)), 642 array('class' => 'centerpadded lessonbutton standardbutton pr-3')); 643 644 if (has_capability('gradereport/user:view', context_course::instance($course->id)) 645 && $course->showgrades && $lesson->grade != 0 && !$lesson->practice) { 646 $url = new moodle_url('/grade/index.php', array('id' => $course->id)); 647 $output .= html_writer::link($url, get_string('viewgrades', 'lesson'), 648 array('class' => 'centerpadded lessonbutton standardbutton pr-3')); 649 } 650 return $output; 651 } 652 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body