ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.assMark.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 require_once './Modules/Test/classes/inc.AssessmentConstants.php';
22 
31 class ASS_Mark
32 {
36  public string $short_name;
37 
41  public string $official_name;
42 
46  public float $minimum_level = 0;
47 
51  public int $passed;
52 
53  public function __construct(
54  string $short_name = "",
55  string $official_name = "",
56  float $minimum_level = 0,
57  int $passed = 0
58  ) {
59  $this->setShortName($short_name);
60  $this->setOfficialName($official_name);
61  $this->setMinimumLevel($minimum_level);
62  $this->setPassed($passed);
63  }
64 
69  public function __unserialize(array $data): void
70  {
71  $this->short_name = $data['short_name'];
72  $this->official_name = $data['short_name'];
73  $this->minimum_level = (float) $data['minimum_level'];
74  $this->passed = (int) $data['passed'];
75  }
76 
77  public function getShortName(): string
78  {
79  return $this->short_name;
80  }
81 
82  public function getPassed(): int
83  {
84  return $this->passed;
85  }
86 
87  public function getOfficialName(): string
88  {
89  return $this->official_name;
90  }
91 
92  public function getMinimumLevel(): float
93  {
94  return $this->minimum_level;
95  }
96 
97  public function setShortName(string $short_name = ""): void
98  {
99  $this->short_name = $short_name;
100  }
101 
102  public function setPassed($passed = 0): void
103  {
104  $this->passed = $passed;
105  }
106 
107  public function setOfficialName(string $official_name = ""): void
108  {
109  $this->official_name = $official_name;
110  }
111 
112  public function setMinimumLevel($minimum_level): void
113  {
114  $minimum_level = (float) $minimum_level;
115 
116  if (($minimum_level >= 0) && ($minimum_level <= 100)) {
117  $this->minimum_level = $minimum_level;
118  } else {
119  throw new Exception('Markstep: minimum level must be between 0 and 100');
120  }
121  }
122 }
__unserialize(array $data)
Stephan Kergomard, 2023-11-08: We need an explicit __unserialize function here because of changes to ...
__construct(string $short_name="", string $official_name="", float $minimum_level=0, int $passed=0)
A class defining marks for assessment test objects.
setOfficialName(string $official_name="")
setPassed($passed=0)
float $minimum_level
The minimum percentage level reaching the mark.
setShortName(string $short_name="")
string $official_name
The official name of the mark, e.g.
int $passed
The passed status of the mark.
setMinimumLevel($minimum_level)
string $short_name
The short name of the mark, e.g.