Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 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.

Differences Between: [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: 863 lines (38 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 1 class

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

Defines 8 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

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