Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
core_user\output\status_field Class Reference

Class containing the data for the status field. More...

Inheritance diagram for core_user\output\status_field:
renderable templatable

Public Member Functions

 __construct ($enrolinstancename, $coursename, $fullname, $status, $timestart=null, $timeend=null, $enrolactions=[], $timeenrolled=null)
 status_field constructor.
 
 export_for_template (renderer_base $output)
 Function to export the renderer data in a format that is suitable for a mustache template.
 
 set_status ($status=self::STATUS_ACTIVE)
 Status setter.
 

Public Attributes

const STATUS_ACTIVE = 0
 Active user enrolment status constant.
 
const STATUS_NOT_CURRENT = 2
 Not current user enrolment status constant.
 
const STATUS_SUSPENDED = 1
 Suspended user enrolment status constant.
 

Protected Attributes

string $coursename
 $coursename The course's full name.
 
user_enrolment_action[] $enrolactions
 $enrolactions Array of enrol action objects for the given enrolment method.
 
string $enrolinstancename
 $enrolinstancename The enrolment instance name.
 
string $fullname
 $fullname The user's full name.
 
string $status
 $status The user enrolment status.
 
bool $statusactive = false
 $statusactive Indicates whether a user enrolment status should be rendered as active.
 
bool $statusnotcurrent = false
 $statusactive Indicates whether a user enrolment status should be rendered as not current.
 
bool $statussuspended = false
 $statusactive Indicates whether a user enrolment status should be rendered as suspended.
 
int $timeend
 $timeend The timestamp when the user's enrolment ends.
 
int $timeenrolled
 $timeenrolled The timestamp when the user was enrolled.
 
int $timestart
 $timestart The timestamp when the user's enrolment starts.
 

Detailed Description

Class containing the data for the status field.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core_user\output\status_field::__construct ( $enrolinstancename,
$coursename,
$fullname,
$status,
$timestart = null,
$timeend = null,
$enrolactions = [],
$timeenrolled = null )

status_field constructor.

Parameters
string$enrolinstancenameThe enrolment instance name.
string$coursenameThe course's full name.
string$fullnameThe user's full name.
string$statusThe user enrolment status.
int | null$timestartThe timestamp when the user's enrolment starts.
int | null$timeendThe timestamp when the user's enrolment ends.
user_enrolment_action[]$enrolactionsArray of enrol action objects for the given enrolment method.
int | null$timeenrolledThe timestamp when the user was enrolled.

Member Function Documentation

◆ export_for_template()

core_user\output\status_field::export_for_template ( renderer_base $output)

Function to export the renderer data in a format that is suitable for a mustache template.

This means:

  1. No complex types - only stdClass, array, int, string, float, bool
  2. Any additional info that is required for the template is pre-calculated (e.g. capability checks).
Parameters
renderer_base$outputUsed to do a final render of any components that need to be rendered for export.
Return values
stdClass|array

Implements templatable.

◆ set_status()

core_user\output\status_field::set_status ( $status = self::STATUS_ACTIVE)

Status setter.

Parameters
int$statusThe user enrolment status representing one of this class' STATUS_* constants.
Return values
status_fieldThis class' instance. Useful for chaining.

The documentation for this class was generated from the following file: