ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilQuestionResult.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
27  public const CORRECT_FULL = 1;
28  public const CORRECT_PARTIAL = 2;
29  public const CORRECT_NONE = 3;
30 
31  public function __construct(
32  protected int $id,
33  protected string $type,
34  protected string $title,
35  protected float $question_score,
36  protected float $usr_score,
37  protected string $usr_solution,
38  protected string $best_solution,
39  protected string $feedback,
40  protected bool $workedthrough,
41  protected bool $answered,
42  protected int $requested_hints,
43  protected ?string $content_for_recapitulation,
44  protected ?string $autosaved_answer,
45  protected int $position,
46  ) {
47  }
48 
49  public function getId(): int
50  {
51  return $this->id;
52  }
53  public function getType(): string
54  {
55  return $this->type;
56  }
57  public function getTitle(): string
58  {
59  return $this->title;
60  }
61  public function getUserAnswer(): string
62  {
63  return $this->usr_solution;
64  }
65  public function getBestSolution(): string
66  {
67  return $this->best_solution;
68  }
69  public function getQuestionScore(): float
70  {
71  return $this->question_score;
72  }
73  public function getUserScore(): float
74  {
75  return $this->usr_score;
76  }
77  public function getUserScorePercent(): float
78  {
79  if ($this->getQuestionScore() === 0.0) {
80  return 100;
81  }
82 
83  return 100 / $this->getQuestionScore() * $this->getUserScore();
84  }
85  public function getCorrect(): int
86  {
87  if ($this->getUserScore() === 0.0) {
88  return self::CORRECT_NONE;
89  }
90  if ($this->getUserScore() === $this->getQuestionScore()) {
91  return self::CORRECT_FULL;
92  }
93  return self::CORRECT_PARTIAL;
94  }
95  public function getFeedback(): string
96  {
97  return $this->feedback;
98  }
99  public function isWorkedThrough(): bool
100  {
101  return $this->workedthrough;
102  }
103  public function isAnswered(): bool
104  {
105  return $this->answered;
106  }
107  public function getContentForRecapitulation(): ?string
108  {
109  return $this->content_for_recapitulation;
110  }
111  public function getNumberOfRequestedHints(): int
112  {
113  return $this->requested_hints;
114  }
115  public function getAutosavedAnswer(): ?string
116  {
117  return $this->autosaved_answer;
118  }
119  public function getPosition(): int
120  {
121  return $this->position;
122  }
123 
124 }
__construct(protected int $id, protected string $type, protected string $title, protected float $question_score, protected float $usr_score, protected string $usr_solution, protected string $best_solution, protected string $feedback, protected bool $workedthrough, protected bool $answered, protected int $requested_hints, protected ?string $content_for_recapitulation, protected ?string $autosaved_answer, protected int $position,)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23