Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Code for the submissions allocation support is defined here

Copyright: 2009 David Mudrak <david.mudrak@gmail.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 182 lines (6 kb)
Included or required: 4 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

workshop_allocator:: (3 methods):
  init()
  ui()
  delete_instance()

workshop_allocation_result:: (7 methods):
  __construct()
  set_status()
  get_status()
  get_message()
  get_timeend()
  log()
  get_logs()


Interface: workshop_allocator  - X-Ref

Allocators are responsible for assigning submissions to reviewers for assessments

The task of the allocator is to assign the correct number of submissions to reviewers
for assessment. Several allocation methods are expected and they can be combined. For
example, teacher can allocate several submissions manually (by 'manual' allocator) and
then let the other submissions being allocated randomly (by 'random' allocator).
Allocation is actually done by creating an initial assessment record in the
workshop_assessments table.
init()   X-Ref
Initialize the allocator and eventually process submitted data

This method is called soon after the allocator is constructed and before any output
is generated. Therefore it may process any data submitted and do other tasks.
It must not produce any output.

return: workshop_allocation_result

ui()   X-Ref
Print HTML to be displayed as the user interface

If a form is part of the UI, the caller should have called $PAGE->set_url(...)

param: stdClass $wsoutput workshop module renderer can be used
return: string HTML code to be echoed

delete_instance($workshopid)   X-Ref
Delete all data related to a given workshop module instance

This is called from {@link workshop_delete_instance()}.

param: int $workshopid id of the workshop module instance being deleted
return: void

Class: workshop_allocation_result  - X-Ref

Stores the information about the allocation process

Allocator's method init() returns instance of this class.
__construct(workshop_allocator $allocator)   X-Ref
Creates new instance of the object

param: workshop_allocator $allocator

set_status($status, $message = null)   X-Ref
Sets the result status of the allocation

param: int $status the status code, eg {@link self::STATUS_OK}
param: string $message optional status message

get_status()   X-Ref

return: int|null the result status

get_message()   X-Ref

return: string|null status message

get_timeend()   X-Ref

return: int|null the timestamp of when the final status was set

log($message, $type = 'ok', $indent = 0)   X-Ref
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

param: string $message message text to display
param: string $type the type of the message
param: int $indent eventual indentation level (the message is related to the previous one with the lower indent)

get_logs()   X-Ref
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

return: array of log objects