| [ Index ] |
PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008] |
[Source view] [Print] [Project Stats]
(no description)
| File Size: | 818 lines (27 kb) |
| Included or required: | 2 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
qformat_default:: (37 methods):
provide_import()
provide_export()
setCategory()
setQuestions()
setCourse()
setContexts()
setFilename()
setRealfilename()
setMatchgrades()
setCatfromfile()
setContextfromfile()
setCattofile()
setContexttofile()
setStoponerror()
set_can_access_backupdata()
error()
try_importing_using_qtypes()
importpreprocess()
importprocess()
count_questions()
create_category_path()
readdata()
readquestions()
defaultquestion()
readquestion()
importpostprocess()
importimagefile()
try_exporting_using_qtypes()
export_file_extension()
exportpreprocess()
presave_process()
exportprocess()
get_category_path()
exportpostprocess()
writequestion()
question_get_export_dir()
format_question_text()
Class: qformat_default - X-Ref
Base class for question import and export formats.| provide_import() X-Ref |
| No description |
| provide_export() X-Ref |
| No description |
| setCategory( $category ) X-Ref |
| set the category param: object category the category object |
| setQuestions( $questions ) X-Ref |
| Set the specific questions to export. Should not include questions with parents (sub questions of cloze question type). Only used for question export. param: array of question objects |
| setCourse( $course ) X-Ref |
| set the course class variable param: course object Moodle course variable |
| setContexts($contexts) X-Ref |
| set an array of contexts. param: array $contexts Moodle course variable |
| setFilename( $filename ) X-Ref |
| set the filename param: string filename name of file to import/export |
| setRealfilename( $realfilename ) X-Ref |
| set the "real" filename (this is what the user typed, regardless of wha happened next) param: string realfilename name of file as typed by user |
| setMatchgrades( $matchgrades ) X-Ref |
| set matchgrades param: string matchgrades error or nearest for grades |
| setCatfromfile( $catfromfile ) X-Ref |
| set catfromfile param: bool catfromfile allow categories embedded in import file |
| setContextfromfile($contextfromfile) X-Ref |
| set contextfromfile param: bool $contextfromfile allow contexts embedded in import file |
| setCattofile( $cattofile ) X-Ref |
| set cattofile param: bool cattofile exports categories within export file |
| setContexttofile($contexttofile) X-Ref |
| set contexttofile param: bool cattofile exports categories within export file |
| setStoponerror( $stoponerror ) X-Ref |
| set stoponerror param: bool stoponerror stops database write if any errors reported |
| set_can_access_backupdata($canaccess) X-Ref |
param: boolean $canaccess Whether the current use can access the backup data folder. Determines |
| error( $message, $text='', $questionname='' ) X-Ref |
| Handle parsing error |
| try_importing_using_qtypes( $data, $question=null, $extra=null ) X-Ref |
| Import for questiontype plugins Do not override. param: data mixed The segment of data containing the question param: question object processed (so far) by standard import code if appropriate param: extra mixed any additional format specific data that may be passed by the format return: object question object suitable for save_options() or false if cannot handle |
| importpreprocess() X-Ref |
| Perform any required pre-processing return: boolean success |
| importprocess() X-Ref |
| Process the file This method should not normally be overidden return: boolean success |
| count_questions($questions) X-Ref |
| Count all non-category questions in the questions array. param: array questions An array of question objects. return: int The count. |
| create_category_path($catpath, $delimiter='/') X-Ref |
| find and/or create the category described by a delimited list e.g. $course$/tom/dick/harry or tom/dick/harry removes any context string no matter whether $getcontext is set but if $getcontext is set then ignore the context and use selected category context. param: string catpath delimited category path param: string delimiter path delimiting character param: int courseid course to search for categories return: mixed category object or null if fails |
| readdata($filename) X-Ref |
| Return complete file within an array, one item per line param: string filename name of file return: mixed contents array or false on failure |
| readquestions($lines) X-Ref |
| Parses an array of lines into an array of questions, where each item is a question object as defined by readquestion(). Questions are defined as anything between blank lines. If your format does not use blank lines as a delimiter then you will need to override this method. Even then try to use readquestion for each question param: array lines array of lines from readdata return: array array of question objects |
| defaultquestion() X-Ref |
| return an "empty" question Somewhere to specify question parameters that are not handled by import but are required db fields. This should not be overridden. return: object default question |
| readquestion($lines) X-Ref |
| Given the data known to define a question in this format, this function converts it into a question object suitable for processing and insertion into Moodle. If your format does not use blank lines to delimit questions (e.g. an XML format) you must override 'readquestions' too param: $lines mixed data that represents question return: object question object |
| importpostprocess() X-Ref |
| Override if any post-processing is required return: boolean success |
| importimagefile( $path, $base64 ) X-Ref |
| Import an image file encoded in base64 format param: string path path (in course data) to store picture param: string base64 encoded picture return: string filename (nb. collisions are handled) |
| try_exporting_using_qtypes( $name, $question, $extra=null ) X-Ref |
| Provide export functionality for plugin questiontypes Do not override param: name questiontype name param: question object data to export param: extra mixed any addition format specific data needed return: string the data to append to export or false if error (or unhandled) |
| export_file_extension() X-Ref |
| Return the files extension appropriate for this type override if you don't want .txt return: string file extension |
| exportpreprocess() X-Ref |
| Do any pre-processing that may be required param: boolean success |
| presave_process( $content ) X-Ref |
| Enable any processing to be done on the content just prior to the file being saved default is to do nothing param: string output text param: string processed output text |
| exportprocess() X-Ref |
| Do the export For most types this should not need to be overrided return: boolean success |
| get_category_path($id, $delimiter='/', $includecontext = true) X-Ref |
| get the category as a path (e.g., tom/dick/harry) param: int id the id of the most nested catgory param: string delimiter the delimiter you want return: string the path |
| exportpostprocess() X-Ref |
| Do an post-processing that may be required return: boolean success |
| writequestion($question) X-Ref |
| convert a single question object into text output in the given format. This must be overriden param: object question question object return: mixed question export text or null if not implemented |
| question_get_export_dir() X-Ref |
| get directory into which export is going return: string file path |
| format_question_text($question) X-Ref |
| where question specifies a moodle (text) format this performs the conversion. |
| Generated: Wed Jan 14 11:33:29 2009 | Cross-referenced by PHPXref 0.7 |