Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Contains class mod_h5pactivity\output\reportlink

Copyright: 2020 Ferran Recio
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 228 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

attempt:: (7 methods):
  __construct()
  export_for_template()
  completion_icon()
  success_icon()
  format_duration()
  format_duration_short()
  extract_duration()


Class: attempt  - X-Ref

Class to help display report link in mod_h5pactivity.

__construct(activity_attempt $attempt, stdClass $user = null, int $courseid = null)   X-Ref
Constructor.

param: activity_attempt $attempt the attempt object
param: stdClass $user a user record (default null).
param: int $courseid optional course id (default null).

export_for_template(renderer_base $output)   X-Ref
Export this data so it can be used as the context for a mustache template.

param: renderer_base $output
return: stdClass

completion_icon(renderer_base $output, int $completion = null, bool $showtext = false)   X-Ref
Return a completion icon HTML.

param: renderer_base $output the renderer base object
param: int|null $completion the current completion value
param: bool $showtext if the icon must have a text or only icon
return: string icon HTML

success_icon(renderer_base $output, int $success = null, bool $showtext = false)   X-Ref
Return a success icon

param: renderer_base $output the renderer base object
param: int|null $success the current success value
param: bool $showtext if the icon must have a text or only icon
return: string icon HTML

format_duration(stdClass $duration)   X-Ref
Return the duration in long format (localized)

param: stdClass $duration object with (h)hours, (m)minutes and (s)seconds
return: string the long format duration

format_duration_short(stdClass $duration)   X-Ref
Return the duration en short format (for example: 145' 43'')

Note: this method is used to make duration responsive.

param: stdClass $duration object with (h)hours, (m)minutes and (s)seconds
return: string the short format duration

extract_duration(int $seconds)   X-Ref
Extract hours and minutes from second duration.

Note: this function is used to generate the param for format_duration
and format_duration_short

param: int $seconds number of second
return: stdClass with (h)hours, (m)minutes and (s)seconds