com-tecnick-tcexam-admin

# Class: CustomQuestionImporter Source Location: /admin/code/tce_import_custom.php
### Class Overview
This PHP Class imports question data directly from a custom file. #### Author(s): Nicola Asuni [www.tecnick.com] #### Version: 1.0.000 #### Copyright: Copyright (c) 2004-2009 - Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) - Via della Pace n.11 - 09044 Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com | ### Variables $current_data $current_element $ids $level $questionhash $xid $xmlfile | ### Methods __construct __destruct addAnswer addModule addQuestion addSubject endElementHandler html2TCECode segContentHandler startElementHandler utrim
### Class Details [line 66] This PHP Class imports question data directly from a custom file. #### Tags:
author: | Nicola Asuni [www.tecnick.com]
version: | 1.0.000
copyright: | Copyright (c) 2004-2009 - Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) - Via della Pace n.11 - 09044 Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
abstract: | question importer from a custom file format
name: | CustomQuestionImporter
license: | GPL
[ Top ] ### Class Variables #### $current_data = '' [line 84] #### Tags:
var: | data value.
access: | private
Type: | Current
[ Top ] #### $current_element = '' [line 90] #### Tags:
var: | data element.
access: | private
Type: | Current
[ Top ] #### $ids = array() [line 96] #### Tags:
var: | to map XML indexes with database indexes.
access: | private
Type: | Array
[ Top ] #### $level = array() [line 78] #### Tags:
var: | to store current level data.
access: | private
Type: | Array
[ Top ] #### $questionhash = array() [line 109] #### Tags:
var: | hash values of question descriptions. This is used to avoid the 255 chars limitation for string indexes on MySQL
access: | private
Type: | store
[ Top ] #### $xid = 0 [line 102] #### Tags:
var: | index for XML indexes.
access: | private
Type: | current
[ Top ] #### $xmlfile = 0 [line 72] #### Tags:
var: | file
access: | private
Type: | XML
[ Top ] ### Class Methods ### constructor __construct [line 117]
`true __construct( string $xmlfile, string $subject_id)`
Class constructor. #### Tags:
return: | or die for parsing error
access: | public
#### Parameters:
string | $xmlfile | xml (XML) file name
string | $subject_id | subject ID
[ Top ] ### destructor __destruct [line 146]
`void __destruct( )`
Class destructor; #### Tags:
access: | public
[ Top ] ### method addAnswer [line 453]
`void addAnswer( )`
Add a new answer if not exist. #### Tags:
access: | private
[ Top ] ### method addModule [line 290]
`void addModule( )`
Add a new module if not exist. #### Tags:
access: | private
[ Top ] ### method addQuestion [line 377]
`void addQuestion( )`
Add a new question if not exist. #### Tags:
access: | private
[ Top ] ### method addSubject [line 330]
`void addSubject( )`
Add a new subject if not exist. #### Tags:
access: | private
[ Top ] ### method endElementHandler [line 238]
`void endElementHandler( resource $parser, string $name)`
Sets the end element handler function for the XML parser parser.end_element_handler. #### Tags:
access: | private
#### Parameters:
resource | $parser | The first parameter, parser, is a reference to the XML parser calling the handler.
string | $name | The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.
[ Top ] ### method html2TCECode [line 505]
`string html2TCECode( string $html)`
Convert HTML string to TCECode (BBCode) #### Tags:
return: | converted
access: | private
#### Parameters:
string | $html | string to convert
[ Top ] ### method segContentHandler [line 279]
`void segContentHandler( resource $parser, string $data)`
Sets the character data handler function for the XML parser parser.handler. #### Tags:
access: | private
#### Parameters:
resource | $parser | The first parameter, parser, is a reference to the XML parser calling the handler.
string | $data | The second parameter, data, contains the character data as a string.
[ Top ] ### method startElementHandler [line 158]
`void startElementHandler( resource $parser, string $name, array $attribs)`
Sets the start element handler function for the XML parser parser.start_element_handler. #### Tags:
access: | private
#### Parameters:
resource | $parser | The first parameter, parser, is a reference to the XML parser calling the handler.
string | $name | The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.
array | $attribs | The third parameter, attribs, contains an associative array with the element's attributes (if any). The keys of this array are the attribute names, the values are the attribute values. Attribute names are case-folded on the same criteria as element names. Attribute values are not case-folded. The original order of the attributes can be retrieved by walking through attribs the normal way, using each(). The first key in the array was the first attribute, and so on.
[ Top ] ### method utrim [line 550]
`string utrim( string $txt)`
Strip whitespace (or other characters) from the beginning and end of a string (works with UTF-8 strings) #### Tags:
return: | The trimmed string.
access: | private
#### Parameters:
string | $txt | The string that will be trimmed.
[ Top ] Documentation generated on Thu, 05 Nov 2009 15:58:23 +0100 by phpDocumentor 1.4.3