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  require_once '../../../config.php';
  19  require_once $CFG->dirroot.'/grade/export/lib.php';
  20  require_once  'grade_export_xls.php';
  21  
  22  $id = required_param('id', PARAM_INT); // course id
  23  
  24  $PAGE->set_url('/grade/export/xls/index.php', array('id'=>$id));
  25  
  26  if (!$course = $DB->get_record('course', array('id'=>$id))) {
  27      print_error('invalidcourseid');
  28  }
  29  
  30  require_login($course);
  31  $context = context_course::instance($id);
  32  
  33  require_capability('moodle/grade:export', $context);
  34  require_capability('gradeexport/xls:view', $context);
  35  
  36  print_grade_page_head($COURSE->id, 'export', 'xls', get_string('exportto', 'grades') . ' ' . get_string('pluginname', 'gradeexport_xls'));
  37  export_verify_grades($COURSE->id);
  38  
  39  if (!empty($CFG->gradepublishing)) {
  40      $CFG->gradepublishing = has_capability('gradeexport/xls:publish', $context);
  41  }
  42  
  43  $actionurl = new moodle_url('/grade/export/xls/export.php');
  44  $formoptions = array(
  45      'publishing' => true,
  46      'simpleui' => true,
  47      'multipledisplaytypes' => true
  48  );
  49  
  50  $mform = new grade_export_form($actionurl, $formoptions);
  51  
  52  $groupmode    = groups_get_course_groupmode($course);   // Groups are being used
  53  $currentgroup = groups_get_course_group($course, true);
  54  if ($groupmode == SEPARATEGROUPS and !$currentgroup and !has_capability('moodle/site:accessallgroups', $context)) {
  55      echo $OUTPUT->heading(get_string("notingroup"));
  56      echo $OUTPUT->footer();
  57      die;
  58  }
  59  
  60  groups_print_course_menu($course, 'index.php?id='.$id);
  61  echo '<div class="clearer"></div>';
  62  
  63  $mform->display();
  64  
  65  echo $OUTPUT->footer();
  66