1<?php 2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */ 3 4require_once './Modules/Test/classes/inc.AssessmentConstants.php'; 5 6/** 7 * A class defining marks for assessment test objects 8 * 9 * @author Helmut Schottmüller <helmut.schottmueller@mac.com> 10 * 11 * @version $Id$ 12 * @ingroup ModulesTest 13 */ 14class ASS_Mark 15{ 16 /** 17 * The short name of the mark 18 * 19 * The short name of the mark, e.g. F or 3 or 1,3 20 * 21 * @var string 22 */ 23 public $short_name; 24 25 /** 26 * The official name of the mark 27 * 28 * The official name of the mark, e.g. failed, passed, befriedigend 29 * 30 * @var string 31 */ 32 public $official_name; 33 34 /** 35 * The minimum percentage level reaching the mark 36 * 37 * The minimum percentage level reaching the mark. A double value between 0 and 100 38 * 39 * @var double 40 */ 41 public $minimum_level = 0; 42 43 /** 44 * The passed status of the mark 45 * 46 * The passed status of the mark. 0 indicates that the mark is failed, 1 indicates that the mark is passed 47 * 48 * @var integer 49 */ 50 public $passed; 51 52 /** 53 * ASS_Mark constructor 54 * 55 * The constructor takes possible arguments an creates an instance of the ASS_Mark object. 56 * 57 * @param string $short_name The short name of the mark 58 * @param string $official_name The official name of the mark 59 * @param double $minimum_level The minimum percentage level reaching the mark 60 * @access public 61 */ 62 public function __construct( 63 $short_name = "", 64 $official_name = "", 65 $minimum_level = 0, 66 $passed = 0 67 ) { 68 $this->setShortName($short_name); 69 $this->setOfficialName($official_name); 70 $this->setMinimumLevel($minimum_level); 71 $this->setPassed($passed); 72 } 73 74 /** 75 * Returns the short name of the mark 76 * 77 * Returns the short name of the mark 78 * 79 * @return string The short name of the mark 80 * @access public 81 * @see $short_name 82 */ 83 public function getShortName() 84 { 85 return $this->short_name; 86 } 87 88 /** 89 * Returns passed status of the mark 90 * 91 * Returns the passed status of the mark 92 * 93 * @return string The passed status of the mark 94 * @access public 95 * @see $passed 96 */ 97 public function getPassed() 98 { 99 return $this->passed; 100 } 101 102 /** 103 * Returns the official name of the mark 104 * 105 * Returns the official name of the mark 106 * 107 * @return string The official name of the mark 108 * @access public 109 * @see $official_name 110 */ 111 public function getOfficialName() 112 { 113 return $this->official_name; 114 } 115 116 /** 117 * Returns the minimum level reaching the mark 118 * 119 * Returns the minimum level reaching the mark 120 * 121 * @return double The minimum level reaching the mark 122 * @access public 123 * @see $minimum_level 124 */ 125 public function getMinimumLevel() 126 { 127 return $this->minimum_level; 128 } 129 130 /** 131 * Sets the short name of the mark 132 * 133 * Sets the short name of the mark 134 * 135 * @param string $short_name The short name of the mark 136 * @access public 137 * @see $short_name 138 */ 139 public function setShortName($short_name = "") 140 { 141 $this->short_name = $short_name; 142 } 143 144 /** 145 * Sets the passed status the mark 146 * 147 * Sets the passed status of the mark 148 * 149 * @param integer $passed The passed status of the mark 150 * @access public 151 * @see $passed 152 */ 153 public function setPassed($passed = 0) 154 { 155 $this->passed = $passed; 156 } 157 158 /** 159 * Sets the official name of the mark 160 * 161 * Sets the official name of the mark 162 * 163 * @param string $official_name The official name of the mark 164 * @access public 165 * @see $official_name 166 */ 167 public function setOfficialName($official_name = "") 168 { 169 $this->official_name = $official_name; 170 } 171 172 /** 173 * Sets the minimum level reaching the mark 174 * 175 * Sets the minimum level reaching the mark 176 * 177 * @param string $minimum_level The minimum level reaching the mark 178 * @access public 179 * @see $minimum_level 180 */ 181 public function setMinimumLevel($minimum_level) 182 { 183 $minimum_level = (float) $minimum_level; 184 185 if (($minimum_level >= 0) && ($minimum_level <= 100)) { 186 $this->minimum_level = $minimum_level; 187 } else { 188 throw new Exception('Markstep: minimum level must be between 0 and 100'); 189 } 190 } 191} 192