Search moodle.org's
Developer Documentation


  • Bug fixes for general core bugs in 2.8.x ended 9 November 2015 (12 months).
  • Bug fixes for security issues in 2.8.x ended 9 May 2016 (18 months).
  • minimum PHP 5.4.4 (always use latest PHP 5.4.x or 5.5.x on Windows - http://windows.php.net/download/), PHP 7 is NOT supported
  • Differences Between: [Versions 28 and 32] [Versions 28 and 33] [Versions 28 and 34] [Versions 28 and 35] [Versions 28 and 36] [Versions 28 and 37]

       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   * Aggregates the grades for submission and grades for assessments
      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_once(dirname(dirname(dirname(__FILE__))).'/config.php');
      27  require_once(dirname(__FILE__).'/locallib.php');
      28  
      29  $cmid       = required_param('cmid', PARAM_INT);            // course module
      30  $confirm    = optional_param('confirm', false, PARAM_BOOL); // confirmation
      31  
      32  // the params to be re-passed to view.php
      33  $page       = optional_param('page', 0, PARAM_INT);
      34  $sortby     = optional_param('sortby', 'lastname', PARAM_ALPHA);
      35  $sorthow    = optional_param('sorthow', 'ASC', PARAM_ALPHA);
      36  
      37  $cm         = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST);
      38  $course     = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
      39  $workshop   = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
      40  $workshop   = new workshop($workshop, $cm, $course);
      41  
      42  $PAGE->set_url($workshop->aggregate_url(), compact('confirm', 'page', 'sortby', 'sorthow'));
      43  
      44  require_login($course, false, $cm);
      45  require_capability('mod/workshop:overridegrades', $PAGE->context);
      46  
      47  // load and init the grading evaluator
      48  $evaluator = $workshop->grading_evaluation_instance();
      49  $settingsform = $evaluator->get_settings_form($PAGE->url);
      50  
      51  if ($settingsdata = $settingsform->get_data()) {
      52      $workshop->aggregate_submission_grades();           // updates 'grade' in {workshop_submissions}
      53      $evaluator->update_grading_grades($settingsdata);   // updates 'gradinggrade' in {workshop_assessments}
      54      $workshop->aggregate_grading_grades();              // updates 'gradinggrade' in {workshop_aggregations}
      55  }
      56  
      57  redirect(new moodle_url($workshop->view_url(), compact('page', 'sortby', 'sorthow')));
    

    Search This Site: