[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/admin/tool/generator/classes/ -> course_backend.php (summary)

tool_generator course backend code.

Copyright: 2013 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 615 lines (20 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

tool_generator_course_backend:: (17 methods):
  __construct()
  get_users_per_size()
  get_size_choices()
  check_shortname_available()
  make()
  create_course()
  create_users()
  create_user_accounts()
  create_assignments()
  create_pages()
  create_small_files()
  get_random_binary()
  create_big_files()
  create_forum()
  get_target_section()
  get_target_user()
  limit_filesize()


Class: tool_generator_course_backend  - X-Ref

Backend code for the 'make large course' tool.

__construct($shortname,$size,$fixeddataset = false,$filesizelimit = false,$progress = true,$fullname = null,$summary = null,$summaryformat = FORMAT_HTML)   X-Ref
Constructs object ready to create course.

param: string $shortname Course shortname
param: int $size Size as numeric index
param: bool $fixeddataset To use fixed or random data
param: int|bool $filesizelimit The max number of bytes for a generated file
param: bool $progress True if progress information should be displayed

get_users_per_size()   X-Ref
Returns the relation between users and course sizes.

return: array

get_size_choices()   X-Ref
Gets a list of size choices supported by this backend.

return: array List of size (int) => text description for display

check_shortname_available($shortname)   X-Ref
Checks that a shortname is available (unused).

param: string $shortname Proposed course shortname
return: string An error message if the name is unavailable or '' if OK

make()   X-Ref
Runs the entire 'make' process.

return: int Course id

create_course()   X-Ref
Creates the actual course.

return: stdClass Course record

create_users()   X-Ref
Creates a number of user accounts and enrols them on the course.
Note: Existing user accounts that were created by this system are
reused if available.


create_user_accounts($first, $last)   X-Ref
Creates user accounts with a numeric range.

param: int $first Number of first user
param: int $last Number of last user

create_assignments()   X-Ref
Creates a number of Assignment activities.


create_pages()   X-Ref
Creates a number of Page activities.


create_small_files()   X-Ref
Creates one resource activity with a lot of small files.


get_random_binary($length)   X-Ref
Creates a string of random binary data. The start of the string includes
the current time, in an attempt to avoid large-scale repetition.

param: int $length Number of bytes
return: Random data

create_big_files()   X-Ref
Creates a number of resource activities with one big file each.


create_forum()   X-Ref
Creates one forum activity with a bunch of posts.


get_target_section()   X-Ref
Gets a section number.

Depends on $this->fixeddataset.

return: int A section number from 1 to the number of sections

get_target_user()   X-Ref
Gets a user id.

Depends on $this->fixeddataset.

return: int A user id for a random created user

limit_filesize($length)   X-Ref
Restricts the binary file size if necessary

param: int $length The total length
return: int The limited length if a limit was specified.



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1