1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Generator for the gradingforum_guide plugin. 19 * 20 * @package gradingform_guide 21 * @category test 22 * @copyright 2018 Adrian Greeve <adriangreeve.com> 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 26 namespace tests\gradingform_guide\generator; 27 28 /** 29 * Convenience class to create guide criterion. 30 * 31 * @package gradingform_guide 32 * @copyright 2018 Adrian Greeve <adriangreeve.com> 33 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 */ 35 class criterion { 36 /** @var string $shortname A shortened name of the criterion. */ 37 private $shortname; 38 39 /** @var string $description A description of the criterion. */ 40 private $description; 41 42 /** @var string $descriptionmarkers A description of the criterion for markers. */ 43 private $descriptionmarkers; 44 45 /** @var float Maximum score */ 46 private $maxscore = 0; 47 48 /** 49 * Constructor for this test_criterion object 50 * 51 * @param string $shortname The shortname for the criterion 52 * @param string $description The description for the criterion 53 * @param string $descriptionmarkers The description for the marker for this criterion 54 * @param float $maxscore The maximum score possible for this criterion 55 */ 56 public function __construct(string $shortname, string $description, string $descriptionmarkers, float $maxscore) { 57 $this->shortname = $shortname; 58 $this->description = $description; 59 $this->descriptionmarkers = $descriptionmarkers; 60 $this->maxscore = $maxscore; 61 } 62 63 /** 64 * Get the description for this criterion. 65 * 66 * @return string 67 */ 68 public function get_description(): string { 69 return $this->description; 70 } 71 72 /** 73 * Get the description for markers of this criterion. 74 * 75 * @return string 76 */ 77 public function get_descriptionmarkers(): string { 78 return $this->descriptionmarkers; 79 } 80 81 /** 82 * Get the shortname for this criterion. 83 * 84 * @return string 85 */ 86 public function get_shortname(): string { 87 return $this->shortname; 88 } 89 90 /** 91 * Get the maxscore for this criterion. 92 * 93 * @return float 94 */ 95 public function get_maxscore(): float { 96 return $this->maxscore; 97 } 98 99 /** 100 * Get all values in an array for use when creating a new guide. 101 * 102 * @param int $sortorder 103 * @return array 104 */ 105 public function get_all_values(int $sortorder): array { 106 return [ 107 'sortorder' => $sortorder, 108 'shortname' => $this->get_shortname(), 109 'description' => $this->get_description(), 110 'descriptionmarkers' => $this->get_descriptionmarkers(), 111 'maxscore' => $this->get_maxscore(), 112 ]; 113 } 114 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body