|
| __construct (private readonly int $active_id, private readonly int $attempt_id, private readonly ResultPresentationSettings $settings, private readonly string $exam_id='', private readonly float $reached_points=0.0, private readonly float $available_points=0.0, private readonly ?Mark $mark=null, private readonly int $nr_of_answered_questions=0, private readonly int $nr_of_questions_in_attempt=0, private readonly int $time_on_task=0, private readonly int $total_time_on_task=0, private readonly ?\DateTimeImmutable $attempt_started_date=null, private readonly ?\DateTimeImmutable $last_access=null, private readonly int $nr_of_attempts=0, private readonly ?int $scored_attempt=null, private readonly ?int $rank=0, private readonly StatusOfAttempt $status_of_attempt=StatusOfAttempt::NOT_YET_STARTED) |
|
| getActiveId () |
|
| getAttempt () |
|
| getExamId () |
|
| getStartedDate () |
|
| getNrOfAnsweredQuestions () |
|
| getNrOfTotalQuestions () |
|
| hasAnsweredQuestions () |
|
| getMark () |
|
| hasPassingMark () |
|
| getReachedPoints () |
|
| getAvailablePoints () |
|
| getReachedPointsInPercent () |
|
| getStatusOfAttempt () |
|
| getNrOfAttempts () |
|
| getTotalTimeOnTask () |
|
| getAsDescriptiveListing (Language $lng, UIFactory $ui_factory, array $environment) |
|
| getHumanReadableTotalTimeOnTask () |
|
Definition at line 30 of file AttemptOverview.php.
◆ __construct()
ILIAS\Test\Results\Data\AttemptOverview::__construct |
( |
private readonly int |
$active_id, |
|
|
private readonly int |
$attempt_id, |
|
|
private readonly ResultPresentationSettings |
$settings, |
|
|
private readonly string |
$exam_id = '' , |
|
|
private readonly float |
$reached_points = 0.0 , |
|
|
private readonly float |
$available_points = 0.0 , |
|
|
private readonly ?Mark |
$mark = null , |
|
|
private readonly int |
$nr_of_answered_questions = 0 , |
|
|
private readonly int |
$nr_of_questions_in_attempt = 0 , |
|
|
private readonly int |
$time_on_task = 0 , |
|
|
private readonly int |
$total_time_on_task = 0 , |
|
|
private readonly ?\DateTimeImmutable |
$attempt_started_date = null , |
|
|
private readonly ?\DateTimeImmutable |
$last_access = null , |
|
|
private readonly int |
$nr_of_attempts = 0 , |
|
|
private readonly ?int |
$scored_attempt = null , |
|
|
private readonly ?int |
$rank = 0 , |
|
|
private readonly StatusOfAttempt |
$status_of_attempt = StatusOfAttempt::NOT_YET_STARTED |
|
) |
| |
◆ buildHumanReadableTime()
ILIAS\Test\Results\Data\AttemptOverview::buildHumanReadableTime |
( |
int |
$time | ) |
|
|
private |
Definition at line 164 of file AttemptOverview.php.
164 : string
165 {
166 $diff_seconds = $time;
167 $diff_hours = floor($diff_seconds / 3600);
168 $diff_seconds -= $diff_hours * 3600;
169 $diff_minutes = floor($diff_seconds / 60);
170 $diff_seconds -= $diff_minutes * 60;
171 return sprintf("%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
172 }
◆ getActiveId()
ILIAS\Test\Results\Data\AttemptOverview::getActiveId |
( |
| ) |
|
◆ getAsDescriptiveListing()
ILIAS\Test\Results\Data\AttemptOverview::getAsDescriptiveListing |
( |
Language |
$lng, |
|
|
UIFactory |
$ui_factory, |
|
|
array |
$environment |
|
) |
| |
Definition at line 131 of file AttemptOverview.php.
135 : DescriptiveListing {
136 $items = [
137 $lng->txt(
'tst_stat_result_resultspoints') => $this->reached_points
138 .
' ' . strtolower(
$lng->txt(
'of')) .
' ' . $this->available_points
140 $lng->
txt(
'tst_stat_result_resultsmarks') => $this->mark?->getShortName() ??
''
141 ];
142
143 return $ui_factory->listing()->descriptive(
144 $items + [
145 $lng->txt(
'tst_stat_result_timeontask') => $this->buildHumanReadableTime($this->time_on_task),
146 $lng->txt(
'tst_stat_result_firstvisit') => $this->attempt_started_date
147 ?->setTimezone($environment['timezone'])
148 ->format($environment['datetimeformat']) ?? '',
149 $lng->txt(
'tst_stat_result_lastvisit') => $this->last_access
150 ?->setTimezone($environment['timezone'])
151 ->format($environment['datetimeformat']) ?? '',
152 $lng->txt(
'tst_nr_of_passes') => (
string) $this->nr_of_attempts,
153 $lng->txt(
'scored_pass') => (
string) ($this->scored_attempt + 1),
154 $lng->txt(
'tst_stat_result_rank_participant') => (
string) $this->rank
155 ]
156 );
157 }
getReachedPointsInPercent()
txt(string $a_topic, string $a_default_lang_fallback_mod="")
◆ getAttempt()
ILIAS\Test\Results\Data\AttemptOverview::getAttempt |
( |
| ) |
|
◆ getAvailablePoints()
ILIAS\Test\Results\Data\AttemptOverview::getAvailablePoints |
( |
| ) |
|
Definition at line 103 of file AttemptOverview.php.
103 : float
104 {
105 return $this->available_points;
106 }
◆ getExamId()
ILIAS\Test\Results\Data\AttemptOverview::getExamId |
( |
| ) |
|
◆ getHumanReadableTotalTimeOnTask()
ILIAS\Test\Results\Data\AttemptOverview::getHumanReadableTotalTimeOnTask |
( |
| ) |
|
Definition at line 159 of file AttemptOverview.php.
159 : string
160 {
162 }
buildHumanReadableTime(int $time)
◆ getMark()
ILIAS\Test\Results\Data\AttemptOverview::getMark |
( |
| ) |
|
Definition at line 88 of file AttemptOverview.php.
88 : ?string
89 {
90 return $this->mark?->getShortName();
91 }
◆ getNrOfAnsweredQuestions()
ILIAS\Test\Results\Data\AttemptOverview::getNrOfAnsweredQuestions |
( |
| ) |
|
Definition at line 73 of file AttemptOverview.php.
73 : int
74 {
75 return $this->nr_of_answered_questions;
76 }
◆ getNrOfAttempts()
ILIAS\Test\Results\Data\AttemptOverview::getNrOfAttempts |
( |
| ) |
|
◆ getNrOfTotalQuestions()
ILIAS\Test\Results\Data\AttemptOverview::getNrOfTotalQuestions |
( |
| ) |
|
Definition at line 78 of file AttemptOverview.php.
78 : int
79 {
80 return $this->nr_of_questions_in_attempt;
81 }
◆ getReachedPoints()
ILIAS\Test\Results\Data\AttemptOverview::getReachedPoints |
( |
| ) |
|
Definition at line 98 of file AttemptOverview.php.
98 : float
99 {
100 return $this->reached_points;
101 }
◆ getReachedPointsInPercent()
ILIAS\Test\Results\Data\AttemptOverview::getReachedPointsInPercent |
( |
| ) |
|
Definition at line 108 of file AttemptOverview.php.
108 : float
109 {
110 if ($this->reached_points === 0.0 || $this->available_points === 0.0) {
111 return 0.0;
112 }
113 return $this->reached_points / $this->available_points * 100;
114 }
◆ getStartedDate()
ILIAS\Test\Results\Data\AttemptOverview::getStartedDate |
( |
| ) |
|
Definition at line 68 of file AttemptOverview.php.
68 : ?\DateTimeImmutable
69 {
70 return $this->attempt_started_date;
71 }
◆ getStatusOfAttempt()
ILIAS\Test\Results\Data\AttemptOverview::getStatusOfAttempt |
( |
| ) |
|
◆ getTotalTimeOnTask()
ILIAS\Test\Results\Data\AttemptOverview::getTotalTimeOnTask |
( |
| ) |
|
Definition at line 126 of file AttemptOverview.php.
126 : int
127 {
128 return $this->total_time_on_task;
129 }
◆ hasAnsweredQuestions()
ILIAS\Test\Results\Data\AttemptOverview::hasAnsweredQuestions |
( |
| ) |
|
Definition at line 83 of file AttemptOverview.php.
83 : bool
84 {
85 return $this->nr_of_answered_questions > 0;
86 }
◆ hasPassingMark()
ILIAS\Test\Results\Data\AttemptOverview::hasPassingMark |
( |
| ) |
|
Definition at line 93 of file AttemptOverview.php.
93 : bool
94 {
95 return $this->mark?->getPassed() ?? false;
96 }
The documentation for this class was generated from the following file: