Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
tool_generator_course_backend Class Reference

Backend code for the 'make large course' tool. More...

Inheritance diagram for tool_generator_course_backend:
tool_generator_backend

Public Member Functions

 __construct ( $shortname, $size, $fixeddataset=false, $filesizelimit=false, $progress=true, $fullname=null, $summary=null, $summaryformat=FORMAT_HTML, $additionalmodules=[])
 Constructs object ready to create course.
 
 dot (int $number, int $total)
 Outputs dots.
 
 end_log ()
 Ends a log string that was started using log function with $leaveopen.
 
 get_target_section ()
 Gets a section number.
 
 log (string $langstring, $a=null, bool $leaveopen=false, string $module='tool_generator')
 Displays information as part of progress.
 
 make ()
 Runs the entire 'make' process.
 

Static Public Member Functions

static check_shortname_available ($shortname)
 Checks that a shortname is available (unused).
 
static get_size_choices ()
 Gets a list of size choices supported by this backend.
 
static get_users_per_size ()
 Returns the relation between users and course sizes.
 
static size_for_name ($sizename)
 Converts a size name into the numeric constant.
 

Public Attributes

int const DEFAULT_SIZE = 3
 Default size index.
 
int const MAX_SIZE = 5
 Highest (largest) size index.
 
int const MIN_SIZE = 0
 Lowest (smallest) size index.
 

Protected Attributes

string object array int $aparam
 Optional language string parameters.
 
int bool $filesizelimit
 Maximum number of bytes for file.
 
bool $fixeddataset
 True if we want a fixed dataset or false to generate random data.
 
testing_data_generator $generator
 Data generator.
 
string $langstring
 Part of the language string.
 
string $module
 Module for the language string.
 
bool $progress
 True if displaying progress.
 
progress_bar $progressbar
 progressbar
 
int $size
 Size code (index in the above arrays)
 
int $starttime
 Epoch time at which current step (current set of dots) started.
 

Detailed Description

Backend code for the 'make large course' tool.

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

Constructor & Destructor Documentation

◆ __construct()

tool_generator_course_backend::__construct ( $shortname,
$size,
$fixeddataset = false,
$filesizelimit = false,
$progress = true,
$fullname = null,
$summary = null,
$summaryformat = FORMAT_HTML,
$additionalmodules = [] )

Constructs object ready to create course.

Parameters
string$shortnameCourse shortname
int$sizeSize as numeric index
bool$fixeddatasetTo use fixed or random data
int | bool$filesizelimitThe max number of bytes for a generated file
bool$progressTrue if progress information should be displayed
array$additionalmodulespotential additional modules to be added (quiz, bigbluebutton...)

Member Function Documentation

◆ check_shortname_available()

static tool_generator_course_backend::check_shortname_available ( $shortname)
static

Checks that a shortname is available (unused).

Parameters
string$shortnameProposed course shortname
Return values
stringAn error message if the name is unavailable or '' if OK

◆ dot()

tool_generator_backend::dot ( int $number,
int $total )
inherited

Outputs dots.

There is up to one dot per second. Once a minute, it displays a percentage.

Parameters
int$numberNumber of completed items
int$totalTotal number of items to complete

◆ get_size_choices()

static tool_generator_course_backend::get_size_choices ( )
static

Gets a list of size choices supported by this backend.

Return values
arrayList of size (int) => text description for display

◆ get_target_section()

tool_generator_course_backend::get_target_section ( )

Gets a section number.

Depends on $this->fixeddataset.

Return values
intA section number from 1 to the number of sections

◆ get_users_per_size()

static tool_generator_course_backend::get_users_per_size ( )
static

Returns the relation between users and course sizes.

Return values
array

◆ log()

tool_generator_backend::log ( string $langstring,
$a = null,
bool $leaveopen = false,
string $module = 'tool_generator' )
inherited

Displays information as part of progress.

Parameters
string$langstringPart of langstring (after progress_)
mixed$aOptional lang string parameters
bool$leaveopenIf true, doesn't close LI tag (ready for dots)
string$modulemodule for language string

◆ make()

tool_generator_course_backend::make ( )

Runs the entire 'make' process.

Return values
intCourse id

◆ size_for_name()

static tool_generator_backend::size_for_name ( $sizename)
staticinherited

Converts a size name into the numeric constant.

Parameters
string$sizenameSize name e.g. 'L'
Return values
intNumeric version
Exceptions
coding_exceptionIf the size name is not known

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