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