NAME

WeBWorK::PG::Local - Use the WeBWorK::PG API to invoke a local WeBWorK::PG::Translator object.

DESCRIPTION

WeBWorK::PG::Local encapsulates the PG translation process, making multiple calls to WeBWorK::PG::Translator. Much of the flexibility of the Translator is hidden, instead making choices that are appropriate for the webwork2 system

It implements the WeBWorK::PG interface and uses a local WeBWorK::PG::Translator to perform problem rendering. See the documentation for the WeBWorK::PG module for information about the API.

OPERATION

WeBWorK::PG::Local goes through the following operations when constructed:

Create a translator

Instantiate a WeBWorK::PG::Translator object.

Set the directory hash

Set the translator's directory hash (courseScripts, macros, templates, and temp directories) from the course environment.

Evaluate PG modules

Using the module list from the course environment (pg->modules), perform a ``use''-like operation to evaluate modules at runtime.

Set the problem environment

Use data from the user, set, and problem, as well as the course environemnt and translation options, to set the problem environment. The default subroutine, &WeBWorK::PG::defineProblemEnvir, is used.

Initialize the translator

Call &WeBWorK::PG::Translator::initialize. What more do you want?

Load IO.pl, PG.pl and dangerousMacros.pl

These macros must be loaded without opcode masking, so they are loaded here.

Set the opcode mask

Set the opcode mask to the default specified by WeBWorK::PG::Translator.

Load the problem source

Give the problem source to the translator.

Install a safety filter

The safety filter is used to preprocess student input before evaluation. The default safety filter, &WeBWorK::PG::safetyFilter, is used.

Translate the problem source

Call &WeBWorK::PG::Translator::translate to render the problem source into the format given by the display mode.

Process student answers

Use form field inputs to evaluate student answers.

Load the problem state

Use values from the database to initialize the problem state, so that the grader will have a point of reference.

Determine an entry order

Use the ANSWER_ENTRY_ORDER flag to determine the order of answers in the problem. This is important for problems with dependancies among parts.

Install a grader

Use the PROBLEM_GRADER_TO_USE flag, or a default from the course environment, to install a grader.

Grade the problem

Use the selected grader to grade the problem.

AUTHOR

Written by Sam Hathaway, sh002i (at) math.rochester.edu.