Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 39 and 311]

Web CT question importer.

Copyright: 2004 ASP Consulting http://www.asp-consulting.net
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 875 lines (39 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

qformat_webct:: (9 methods):
  provide_import()
  can_import_file()
  mime_type()
  validate_file()
  store_file_for_text_field()
  text_field()
  importpostprocess()
  readdata()
  readquestions()

Defines 9 functions


Class: qformat_webct  - X-Ref

Web CT question importer.

provide_import()   X-Ref
This plugin provide import

return: bool true

can_import_file($file)   X-Ref
No description

mime_type()   X-Ref
No description

validate_file(stored_file $file)   X-Ref
Validate the given file.

For more expensive or detailed integrity checks.

param: stored_file $file the file to check
return: string the error message that occurred while validating the given file

store_file_for_text_field(&$text, $tempdir, $filepathinsidetempdir, $filename)   X-Ref
Store an image file in a draft filearea

param: array $text, if itemid element don't exists it will be created
param: string tempdir path to root of image tree
param: string filepathinsidetempdir path to image in the tree
param: string filename image's name
return: string new name of the image as it was stored

text_field($text)   X-Ref
Given an HTML text with references to images files,
store all images in a draft filearea,
and return an array with all urls in text recoded,
format set to FORMAT_HTML, and itemid set to filearea itemid

param: string text text to parse and recode
return: array with keys text, format, itemid.

importpostprocess()   X-Ref
Does any post-processing that may be desired
Clean the temporary directory if a zip file was imported

return: bool success

readdata($filename)   X-Ref
Return content of all files containing questions,
as an array one element for each file found,
For each file, the corresponding element is an array of lines.

param: string filename name of file
return: mixed contents array or false on failure

readquestions($lines)   X-Ref
No description

Functions that are not part of a class:

unhtmlentities($string)   X-Ref
Manipulate HTML editites in a string. Used by WebCT import.

param: string $string
return: string

qformat_webct_convert_formula($formula)   X-Ref
Helper function for WebCT import.

param: unknown_type $formula