Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]

   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   * Preview the assessment form.
  20   *
  21   * @package    mod_workshop
  22   * @copyright  2009 David Mudrak <david.mudrak@gmail.com>
  23   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   */
  25  
  26  require(__DIR__.'/../../config.php');
  27  require_once (__DIR__.'/locallib.php');
  28  
  29  $cmid     = required_param('cmid', PARAM_INT);
  30  $cm       = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST);
  31  $course   = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
  32  $workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
  33  
  34  require_login($course, false, $cm);
  35  if (isguestuser()) {
  36      print_error('guestsarenotallowed');
  37  }
  38  $workshop = new workshop($workshop, $cm, $course);
  39  
  40  require_capability('mod/workshop:editdimensions', $workshop->context);
  41  $PAGE->set_url($workshop->previewform_url());
  42  $PAGE->set_title($workshop->name);
  43  $PAGE->set_heading($course->fullname);
  44  $PAGE->navbar->add(get_string('editingassessmentform', 'workshop'), $workshop->editform_url(), navigation_node::TYPE_CUSTOM);
  45  $PAGE->navbar->add(get_string('previewassessmentform', 'workshop'));
  46  $currenttab = 'editform';
  47  
  48  // load the grading strategy logic
  49  $strategy = $workshop->grading_strategy_instance();
  50  
  51  // load the assessment form
  52  $mform = $strategy->get_assessment_form($workshop->editform_url(), 'preview');
  53  
  54  // output starts here
  55  echo $OUTPUT->header();
  56  echo $OUTPUT->heading(format_string($workshop->name));
  57  echo $OUTPUT->heading(get_string('assessmentform', 'workshop'), 3);
  58  $mform->display();
  59  echo $OUTPUT->footer();