| Línea 56... |
Línea 56... |
| 56 |
*
|
56 |
*
|
| 57 |
* @param activity_attempt $attempt the attempt object
|
57 |
* @param activity_attempt $attempt the attempt object
|
| 58 |
* @param stdClass $user a user record (default null).
|
58 |
* @param stdClass $user a user record (default null).
|
| 59 |
* @param int $courseid optional course id (default null).
|
59 |
* @param int $courseid optional course id (default null).
|
| 60 |
*/
|
60 |
*/
|
| 61 |
public function __construct(activity_attempt $attempt, stdClass $user = null, int $courseid = null) {
|
61 |
public function __construct(activity_attempt $attempt, ?stdClass $user = null, ?int $courseid = null) {
|
| 62 |
$this->attempt = $attempt;
|
62 |
$this->attempt = $attempt;
|
| 63 |
$this->user = $user;
|
63 |
$this->user = $user;
|
| 64 |
$this->courseid = $courseid;
|
64 |
$this->courseid = $courseid;
|
| 65 |
}
|
65 |
}
|
| Línea 121... |
Línea 121... |
| 121 |
* @param renderer_base $output the renderer base object
|
121 |
* @param renderer_base $output the renderer base object
|
| 122 |
* @param int|null $completion the current completion value
|
122 |
* @param int|null $completion the current completion value
|
| 123 |
* @param bool $showtext if the icon must have a text or only icon
|
123 |
* @param bool $showtext if the icon must have a text or only icon
|
| 124 |
* @return string icon HTML
|
124 |
* @return string icon HTML
|
| 125 |
*/
|
125 |
*/
|
| 126 |
private function completion_icon(renderer_base $output, int $completion = null, bool $showtext = false): string {
|
126 |
private function completion_icon(renderer_base $output, ?int $completion = null, bool $showtext = false): string {
|
| 127 |
if ($completion === null) {
|
127 |
if ($completion === null) {
|
| 128 |
return '';
|
128 |
return '';
|
| 129 |
}
|
129 |
}
|
| 130 |
if ($completion) {
|
130 |
if ($completion) {
|
| 131 |
$alt = get_string('attempt_completion_yes', 'mod_h5pactivity');
|
131 |
$alt = get_string('attempt_completion_yes', 'mod_h5pactivity');
|
| Línea 147... |
Línea 147... |
| 147 |
* @param renderer_base $output the renderer base object
|
147 |
* @param renderer_base $output the renderer base object
|
| 148 |
* @param int|null $success the current success value
|
148 |
* @param int|null $success the current success value
|
| 149 |
* @param bool $showtext if the icon must have a text or only icon
|
149 |
* @param bool $showtext if the icon must have a text or only icon
|
| 150 |
* @return string icon HTML
|
150 |
* @return string icon HTML
|
| 151 |
*/
|
151 |
*/
|
| 152 |
private function success_icon(renderer_base $output, int $success = null, bool $showtext = false): string {
|
152 |
private function success_icon(renderer_base $output, ?int $success = null, bool $showtext = false): string {
|
| 153 |
if ($success === null) {
|
153 |
if ($success === null) {
|
| 154 |
$alt = get_string('attempt_success_unknown', 'mod_h5pactivity');
|
154 |
$alt = get_string('attempt_success_unknown', 'mod_h5pactivity');
|
| 155 |
if ($showtext) {
|
155 |
if ($showtext) {
|
| 156 |
return $alt;
|
156 |
return $alt;
|
| 157 |
}
|
157 |
}
|