MDL-29479 It is now possible to set the active method to null (simple direct grading)
[moodle.git] / grade / grading / form / lib.php
CommitLineData
9b8550f8
DM
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 * @package core
20 * @subpackage grading
21 * @copyright 2011 David Mudrak <david@moodle.com>
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
25defined('MOODLE_INTERNAL') || die();
26
27/**
28 * Grading method controller encapsulates the logic of the plugin
29 *
30 * @copyright 2011 David Mudrak <david@moodle.com>
31 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
32 */
33abstract class grading_controller {
34
35 /** @var stdClass the context */
36 protected $context;
37
38 /** @var string the frankenstyle name of the component */
39 protected $component;
40
41 /** @var string the name of the gradable area */
42 protected $area;
43
44 /** @var int the id of the gradable area record */
45 protected $areaid;
46
47 /**
48 * Do not instantinate this directly, use {@link grading_manager::get_controller()}
49 *
50 * @return grading_controller instance
51 */
52 public function __construct(stdClass $context, $component, $area, $areaid) {
53 $this->context = $context;
54 $this->component = $component;
55 $this->area = $area;
56 $this->areaid = $areaid;
57 }
58
59 /**
60 * Extends the module settings navigation
61 *
62 * This function is called when the context for the page is an activity module with the
63 * FEATURE_ADVANCED_GRADING, the user has the permission moodle/grade:managegradingforms
64 * and there is an area with the active grading method set to the given plugin.
65 *
66 * @param settings_navigation $settingsnav {@link settings_navigation}
67 * @param navigation_node $node {@link navigation_node}
68 */
69 public function extend_settings_navigation(settings_navigation $settingsnav, navigation_node $node=null) {
70 // do not extend by default
71 }
72}