Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Public Attributes | Protected Attributes | List of all members
workshop_allocation_result Class Reference

Stores the information about the allocation process. More...

Inheritance diagram for workshop_allocation_result:
renderable

Public Member Functions

 __construct (workshop_allocator $allocator)
 Creates new instance of the object. More...
 
 get_logs ()
 Returns list of logged messages. More...
 
 get_message ()
 
 get_status ()
 
 get_timeend ()
 
 log ($message, $type='ok', $indent=0)
 Appends a new message to the log. More...
 
 set_status ($status, $message=null)
 Sets the result status of the allocation. More...
 

Public Attributes

const STATUS_CONFIGURED = 3
 scheduled allocation was configured (to be executed later, for example)
 
const STATUS_EXECUTED = 1
 allocation was successfully executed
 
const STATUS_FAILED = 2
 a serious error has occurred during the allocation (as a hole)
 
const STATUS_VOID = 0
 the init() called successfully but no actual allocation was done
 

Protected Attributes

workshop_allocator $allocator
 the instance of the allocator that produced this result
 
array $logs = array()
 of log message objects, { More...
 
null string $message = null
 optional result message to display
 
null int $status = null
 the status of the init() call
 
int $timeend = null
 the timestamp of when the final status was set
 
int $timestart = null
 the timestamp of when the allocation process started
 

Detailed Description

Stores the information about the allocation process.

Allocator's method init() returns instance of this class.

Constructor & Destructor Documentation

◆ __construct()

workshop_allocation_result::__construct ( workshop_allocator  $allocator)

Creates new instance of the object.

Parameters
workshop_allocator$allocator

Member Function Documentation

◆ get_logs()

workshop_allocation_result::get_logs ( )

Returns list of logged messages.

Each object in the list has public properties message string, text to display type string, the type of the message indent int, indentation level

See also
self::log()
Return values
arrayof log objects

◆ get_message()

workshop_allocation_result::get_message ( )
Return values
string|nullstatus message

◆ get_status()

workshop_allocation_result::get_status ( )
Return values
int|nullthe result status

◆ get_timeend()

workshop_allocation_result::get_timeend ( )
Return values
int|nullthe timestamp of when the final status was set

◆ log()

workshop_allocation_result::log (   $message,
  $type = 'ok',
  $indent = 0 
)

Appends a new message to the log.

The available levels are ok - success, eg. new allocation was created info - informational message error - error message, eg. no more peers available debug - debugging info

Parameters
string$messagemessage text to display
string$typethe type of the message
int$indenteventual indentation level (the message is related to the previous one with the lower indent)

◆ set_status()

workshop_allocation_result::set_status (   $status,
  $message = null 
)

Sets the result status of the allocation.

Parameters
int$statusthe status code, eg self::STATUS_OK
string$messageoptional status message

Member Data Documentation

◆ $logs

array workshop_allocation_result::$logs = array()
protected

of log message objects, {

See also
self::log()}

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