[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/mod/lesson/ -> renderer.php (source)

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


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1