ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
SurveyImportParserPre38 Class Reference

Survey Question Import Parser. More...

+ Inheritance diagram for SurveyImportParserPre38:
+ Collaboration diagram for SurveyImportParserPre38:

Public Member Functions

 __construct ($a_spl_id, $a_xml_file='', $spl_exists=FALSE)
 Constructor. More...
 
 setSurveyObject ($a_svy)
 Sets a reference to a survey object public. More...
 
 setHandlers ($a_xml_parser)
 set event handler should be overwritten by inherited class private More...
 
 startParsing ()
 start the parser More...
 
 parse ($a_xml_parser, $a_fp=null)
 parse xml file More...
 
 getParent ($a_xml_parser)
 
 handlerBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element More...
 
 handlerCharacterData ($a_xml_parser, $a_data)
 handler for character data More...
 
 handlerEndTag ($a_xml_parser, $a_name)
 handler for end of element More...
 
 getErrorCode ()
 
 getErrorLine ()
 
 getErrorColumn ()
 
 getErrorMessage ()
 
 getFullError ()
 
 getXMLSize ()
 
 getXMLElements ()
 
 getXMLAttributes ()
 
 getXMLTextSections ()
 
 getXMLTextSize ()
 
 hasError ()
 
- Public Member Functions inherited from ilSaxParser
 __construct ($a_xml_file='', $throwException=false)
 Constructor setup ILIAS global object public. More...
 
 setXMLContent ($a_xml_content)
 
 getXMLContent ()
 
 getInputType ()
 
 startParsing ()
 stores xml data in array More...
 
 createParser ()
 create parser More...
 
 setOptions ($a_xml_parser)
 set parser options More...
 
 setHandlers ($a_xml_parser)
 set event handler should be overwritten by inherited class private More...
 
 openXMLFile ()
 open xml file More...
 
 parse ($a_xml_parser, $a_fp=null)
 parse xml file More...
 
 freeParser ($a_xml_parser)
 free xml parser handle More...
 
 setThrowException ($throwException)
 set error handling More...
 
- Public Member Functions inherited from PEAR
 __construct ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes. More...
 
 isError ($data, $code=null)
 Tell whether a value is a PEAR error. More...
 
 expectError ($code=' *')
 This method is used to tell which errors you expect to get. More...
 
 popExpect ()
 This method pops one element off the expected error codes stack. More...
 
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available. More...
 
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack. More...
 
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. More...
 
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options. More...
 
 staticPushErrorHandling ($mode, $options=null)
 
 staticPopErrorHandling ()
 
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack. More...
 
 popErrorHandling ()
 Pop the last error handler used. More...
 
 loadExtension ($ext)
 OS independant PHP extension load. More...
 

Data Fields

 $path
 
 $depth
 
 $activequestion
 
 $spl
 
 $error_code
 
 $error_line
 
 $error_col
 
 $error_msg
 
 $has_error
 
 $size
 
 $elements
 
 $attributes
 
 $texts
 
 $text_size
 
 $characterbuffer
 
 $activetag
 
 $material
 
 $metadata
 
 $responses
 
 $response_id
 
 $matrix
 
 $is_matrix
 
 $adjectives
 
 $spl_exists
 
 $in_survey
 
 $survey
 
 $anonymisation
 
 $surveyaccess
 
 $questions
 
 $original_question_id
 
 $constraints
 
 $textblock
 
 $textblocks
 
 $in_questionblock
 
 $questionblock
 
 $questionblocks
 
 $questionblocktitle
 
 $question_title
 
 $in_question
 
 $in_reponse
 
 $question_description
 
- Data Fields inherited from ilSaxParser
 $input_type = null
 
 $xml_content = ''
 
 $ilias
 
 $lng
 
 $xml_file
 
 $throwException = false
 
- Data Fields inherited from PEAR
 $_debug = false
 
 $_default_error_mode = null
 
 $_default_error_options = null
 
 $_default_error_handler = ''
 
 $_error_class = 'PEAR_Error'
 
 $_expected_errors = array()
 

Additional Inherited Members

- Static Public Member Functions inherited from PEAR
static & getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. More...
 
static setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. More...
 
- Protected Member Functions inherited from ilSaxParser
 handleError ($message, $code)
 use given error handler to handle error message or internal ilias error message handle More...
 

Detailed Description

Survey Question Import Parser.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
$Id$

Definition at line 43 of file class.SurveyImportParserPre38.php.

Constructor & Destructor Documentation

◆ __construct()

SurveyImportParserPre38::__construct (   $a_spl_id,
  $a_xml_file = '',
  $spl_exists = FALSE 
)

Constructor.

Parameters
string$a_xml_filexml file

public

Definition at line 95 of file class.SurveyImportParserPre38.php.

References $spl_exists, and array.

96  {
97  die ("Class surveyImportParserPre38 is deprecated.");
98  parent::__construct($a_xml_file);
99  $this->spl_id = $a_spl_id;
100  $this->has_error = FALSE;
101  $this->characterbuffer = "";
102  $this->activetag = "";
103  $this->material = array();
104  $this->depth = array();
105  $this->path = array();
106  $this->metadata = array();
107  $this->responses = array();
108  $this->response_id = "";
109  $this->matrix = array();
110  $this->is_matrix = FALSE;
111  $this->adjectives = array();
112  $this->spl_exists = $spl_exists;
113  $this->survey = NULL;
114  $this->in_survey = FALSE;
115  $this->anonymisation = 0;
116  $this->surveyaccess = "restricted";
117  $this->questions = array();
118  $this->original_question_id = "";
119  $this->constraints = array();
120  $this->textblock = "";
121  $this->textblocks = array();
122  $this->in_questionblock = FALSE;
123  $this->questionblocks = array();
124  $this->questionblock = array();
125  $this->questionblocktitle = "";
126  $this->question_title = "";
127  $this->in_question = FALSE;
128  $this->in_response = FALSE;
129  $this->question_description = "";
130  }
Create styles array
The data for the language used.

Member Function Documentation

◆ getErrorCode()

SurveyImportParserPre38::getErrorCode ( )

Definition at line 681 of file class.SurveyImportParserPre38.php.

References $error_code.

◆ getErrorColumn()

SurveyImportParserPre38::getErrorColumn ( )

Definition at line 691 of file class.SurveyImportParserPre38.php.

References $error_col.

◆ getErrorLine()

SurveyImportParserPre38::getErrorLine ( )

Definition at line 686 of file class.SurveyImportParserPre38.php.

References $error_line.

◆ getErrorMessage()

SurveyImportParserPre38::getErrorMessage ( )

Definition at line 696 of file class.SurveyImportParserPre38.php.

References $error_msg.

◆ getFullError()

SurveyImportParserPre38::getFullError ( )

Definition at line 701 of file class.SurveyImportParserPre38.php.

References $error_col.

702  {
703  return "Error: ".$this->error_msg." at line:".$this->error_line ." column:".$this->error_col;
704  }

◆ getParent()

SurveyImportParserPre38::getParent (   $a_xml_parser)

Definition at line 195 of file class.SurveyImportParserPre38.php.

Referenced by handlerEndTag().

196  {
197  if ($this->depth[$a_xml_parser] > 0)
198  {
199  return $this->path[$this->depth[$a_xml_parser]-1];
200  }
201  else
202  {
203  return "";
204  }
205  }
+ Here is the caller graph for this function:

◆ getXMLAttributes()

SurveyImportParserPre38::getXMLAttributes ( )

Definition at line 716 of file class.SurveyImportParserPre38.php.

References $attributes.

◆ getXMLElements()

SurveyImportParserPre38::getXMLElements ( )

Definition at line 711 of file class.SurveyImportParserPre38.php.

References $elements.

◆ getXMLSize()

SurveyImportParserPre38::getXMLSize ( )

Definition at line 706 of file class.SurveyImportParserPre38.php.

References $size.

◆ getXMLTextSections()

SurveyImportParserPre38::getXMLTextSections ( )

Definition at line 721 of file class.SurveyImportParserPre38.php.

References $texts.

◆ getXMLTextSize()

SurveyImportParserPre38::getXMLTextSize ( )

Definition at line 726 of file class.SurveyImportParserPre38.php.

References $text_size.

◆ handlerBeginTag()

SurveyImportParserPre38::handlerBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element

Definition at line 210 of file class.SurveyImportParserPre38.php.

References array.

211  {
212  $this->depth[$a_xml_parser]++;
213  $this->path[$this->depth[$a_xml_parser]] = strtolower($a_name);
214  $this->characterbuffer = "";
215  $this->activetag = $a_name;
216  $this->elements++;
217  $this->attributes+=count($a_attribs);
218  switch ($a_name)
219  {
220  case "survey":
221  $this->in_survey = TRUE;
222  if (is_object($this->survey))
223  {
224  if (strlen($a_attribs["title"]))
225  {
226  $this->survey->setTitle($a_attribs["title"]);
227  }
228  }
229  break;
230  case "section":
231  //$this->spl->setTitle($a_attribs["title"]);
232  break;
233  case "item":
234  $this->original_question_id = $a_attribs["ident"];
235  $this->question_title = $a_attribs["title"];
236  $this->in_question = TRUE;
237  break;
238  case "qtimetadata":
239  $this->metadata = array();
240  break;
241  case "qtimetadatafield":
242  array_push($this->metadata, array("label" => "", "entry" => ""));
243  break;
244  case "material":
245  $this->material = array();
246  array_push($this->material, array("text" => "", "image" => "", "label" => $a_attribs["label"]));
247  break;
248  case "render_fib":
249  if (is_object($this->activequestion))
250  {
251  if (strlen($a_attribs["minnumber"]))
252  {
253  $this->activequestion->setMinimum($a_attribs["minnumber"]);
254  }
255  if (strlen($a_attribs["maxnumber"]))
256  {
257  $this->activequestion->setMaximum($a_attribs["maxnumber"]);
258  }
259  }
260  break;
261  case "response_lid":
262  if (is_object($this->activequestion))
263  {
264  if (strcmp($this->activequestion->getQuestiontype(), "SurveyNominalQuestion") == 0)
265  {
266  switch (strtolower($a_attribs["rcardinality"]))
267  {
268  case "single":
269  $this->activequestion->setSubtype(1);
270  break;
271  case "multiple":
272  $this->activequestion->setSubtype(2);
273  break;
274  }
275  }
276  }
277  break;
278  case "response_label":
279  $this->in_response = TRUE;
280  break;
281  }
282  }
Create styles array
The data for the language used.

◆ handlerCharacterData()

SurveyImportParserPre38::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

handler for character data

Definition at line 287 of file class.SurveyImportParserPre38.php.

References $characterbuffer.

288  {
289  $this->texts++;
290  $this->text_size+=strlen($a_data);
291  $this->characterbuffer .= $a_data;
292  $a_data = $this->characterbuffer;
293  }

◆ handlerEndTag()

SurveyImportParserPre38::handlerEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element

Definition at line 298 of file class.SurveyImportParserPre38.php.

References $characterbuffer, $data, $original_question_id, $title, array, getParent(), METRIC_QUESTION_IDENTIFIER, NOMINAL_QUESTION_IDENTIFIER, ORDINAL_QUESTION_IDENTIFIER, and TEXT_QUESTION_IDENTIFIER.

299  {
300  switch ($a_name)
301  {
302  case "questestinterop":
303  if (is_object($this->survey))
304  {
305  // write constraints
306  if (count($this->constraints))
307  {
308  $relations = $this->survey->getAllRelations(TRUE);
309  foreach ($this->constraints as $constraint)
310  {
311  $this->survey->addConstraint($this->questions[$constraint["sourceref"]], $this->questions[$constraint["destref"]], $relations[$constraint["relation"]]["id"], $constraint["value"]);
312  }
313  }
314  // write question blocks
315  if (count($this->questionblocks))
316  {
317  foreach ($this->questionblocks as $data)
318  {
319  $questionblock = $data["questions"];
320  $title = $data["title"];
321  $qblock = array();
322  foreach ($questionblock as $question_id)
323  {
324  array_push($qblock, $this->questions[$question_id]);
325  }
326  $this->survey->createQuestionblock($title, TRUE, $qblock);
327  }
328  }
329  $this->survey->saveToDb();
330 
331  // write textblocks
332  if (count($this->textblocks))
333  {
334  foreach ($this->textblocks as $original_id => $textblock)
335  {
336  $this->survey->saveHeading($textblock, $this->questions[$original_id]);
337  }
338  }
339  }
340  break;
341  case "survey":
342  $this->in_survey = FALSE;
343  break;
344  case "item":
345  if (is_object($this->activequestion))
346  {
347  $this->activequestion->setTitle($this->question_title);
348  $this->activequestion->setDescription($this->question_description);
349  $this->activequestion->saveToDb();
350  if (is_object($this->survey))
351  {
352  // duplicate the question for the survey
353  $question_id = $this->activequestion->duplicate(TRUE);
354  $this->survey->addQuestion($question_id);
355  $this->questions[$this->original_question_id] = $question_id;
356  }
357  }
358  $this->in_question = FALSE;
359  $this->question_description = "";
360  $this->activequestion = NULL;
361  break;
362  case "qticomment":
363  if (strcmp($this->getParent($a_xml_parser), "item") == 0)
364  {
365  if (preg_match("/Questiontype\=(.*)/", $this->characterbuffer, $matches))
366  {
367  $questiontype = $matches[1];
368  switch ($matches[1])
369  {
371  $questiontype = "SurveyMetricQuestion";
372  break;
374  $questiontype = "SurveyMultipleChoiceQuestion";
375  break;
377  $questiontype = "SurveySingleChoiceQuestion";
378  break;
380  $questiontype = "SurveyTextQuestion";
381  break;
382  }
383  if (strlen($questiontype))
384  {
385  include_once "./Modules/SurveyQuestionPool/classes/class.$questiontype.php";
386  $this->activequestion = new $questiontype();
387  $this->activequestion->setObjId($this->spl_id);
388  }
389  else
390  {
391  $this->activequestion = NULL;
392  }
393  }
394  else if (preg_match("/Author\=(.*)/", $this->characterbuffer, $matches))
395  {
396  if (is_object($this->activequestion))
397  {
398  $this->activequestion->setAuthor($matches[1]);
399  }
400  }
401  else if (preg_match("/ILIAS Version\=(.*)/", $this->characterbuffer, $matches))
402  {
403  }
404  else
405  {
406  $this->question_description = $this->characterbuffer;
407  }
408  }
409  if (strcmp($this->getParent($a_xml_parser), "survey") == 0)
410  {
411  if (preg_match("/Author\=(.*)/", $this->characterbuffer, $matches))
412  {
413  if (is_object($this->survey))
414  {
415  $this->survey->setAuthor($matches[1]);
416  }
417  }
418  else if (preg_match("/ILIAS Version\=(.*)/", $this->characterbuffer, $matches))
419  {
420  }
421  else
422  {
423  if (is_object($this->survey))
424  {
425  $this->survey->setDescription($this->characterbuffer);
426  }
427  }
428 
429  }
430  break;
431  case "fieldlabel":
432  $this->metadata[count($this->metadata)-1]["label"] = $this->characterbuffer;
433  break;
434  case "fieldentry":
435  $this->metadata[count($this->metadata)-1]["entry"] = $this->characterbuffer;
436  break;
437  case "qtimetadata":
438  if (strcmp($this->getParent($a_xml_parser), "section") == 0)
439  {
440  foreach ($this->metadata as $meta)
441  {
442  switch ($meta["label"])
443  {
444  case "SCORM":
445  if (!$this->spl_exists)
446  {
447  include_once "./Services/MetaData/classes/class.ilMDSaxParser.php";
448  include_once "./Services/MetaData/classes/class.ilMD.php";
449  include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
450  $md_sax_parser = new ilMDSaxParser();
451  $md_sax_parser->setXMLContent($value["entry"]);
452  $md_sax_parser->setMDObject($tmp = new ilMD($this->spl_id,0, "spl"));
453  $md_sax_parser->enableMDParsing(true);
454  $md_sax_parser->startParsing();
455  $spl = new ilObjSurveyQuestionPool($this->spl_id, false);
456  $spl->MDUpdateListener("General");
457  break;
458  }
459  }
460  }
461  }
462  if (is_object($this->activequestion))
463  {
464  foreach ($this->metadata as $meta)
465  {
466  switch ($this->activequestion->getQuestionType())
467  {
468  case "SurveyMultipleQuestion":
469  switch ($meta["label"])
470  {
471  case "obligatory":
472  $this->activequestion->setObligatory($meta["entry"]);
473  break;
474  case "orientation":
475  $this->activequestion->setOrientation($meta["entry"]);
476  break;
477  }
478  break;
479  case "SurveySingleChoiceQuestion":
480  switch ($meta["label"])
481  {
482  case "obligatory":
483  $this->activequestion->setObligatory($meta["entry"]);
484  break;
485  case "orientation":
486  $this->activequestion->setOrientation($meta["entry"]);
487  break;
488  }
489  break;
490  case "SurveyMetricQuestion":
491  switch ($meta["label"])
492  {
493  case "obligatory":
494  $this->activequestion->setObligatory($meta["entry"]);
495  break;
496  case "subtype":
497  $this->activequestion->setSubtype($meta["entry"]);
498  break;
499  }
500  break;
501  case "SurveyTextQuestion":
502  switch ($meta["label"])
503  {
504  case "obligatory":
505  $this->activequestion->setObligatory($meta["entry"]);
506  break;
507  case "maxchars":
508  if (strlen($meta["entry"]))
509  {
510  $this->activequestion->setMaxChars($meta["entry"]);
511  }
512  break;
513  }
514  break;
515  }
516  }
517  }
518  if (is_object($this->survey))
519  {
520  foreach ($this->metadata as $meta)
521  {
522  switch ($meta["label"])
523  {
524  case "SCORM":
525  if (strcmp($this->getParent($a_xml_parser), "survey") == 0)
526  {
527  include_once "./Services/MetaData/classes/class.ilMDSaxParser.php";
528  include_once "./Services/MetaData/classes/class.ilMD.php";
529  $md_sax_parser = new ilMDSaxParser();
530  $md_sax_parser->setXMLContent($meta["entry"]);
531  $md_sax_parser->setMDObject($tmp = new ilMD($this->survey->getId(), 0, "svy"));
532  $md_sax_parser->enableMDParsing(TRUE);
533  $md_sax_parser->startParsing();
534  $this->survey->MDUpdateListener("General");
535  }
536  break;
537  case "author":
538  $this->survey->setAuthor($meta["entry"]);
539  break;
540  case "description":
541  $this->survey->setDescription($meta["entry"]);
542  break;
543  case "evaluation_access":
544  $this->survey->setEvaluationAccess($meta["entry"]);
545  break;
546  case "evaluation_access":
547  $this->survey->setEvaluationAccess($meta["entry"]);
548  break;
549  case "anonymize":
550  $this->survey->setAnonymize($meta["entry"]);
551  break;
552  case "status":
553  $this->survey->setStatus($meta["entry"]);
554  break;
555  case "startdate":
556  if (preg_match("/P(\d+)Y(\d+)M(\d+)DT0H0M0S/", $meta["entry"], $matches))
557  {
558  $this->survey->setStartDate(sprintf("%04d-%02d-%02d", $matches[1], $matches[2], $matches[3]));
559  $this->survey->setStartDateEnabled(1);
560  }
561  break;
562  case "enddate":
563  if (preg_match("/P(\d+)Y(\d+)M(\d+)DT0H0M0S/", $meta["entry"], $matches))
564  {
565  $this->survey->setEndDate(sprintf("%04d-%02d-%02d", $matches[1], $matches[2], $matches[3]));
566  $this->survey->setEndDateEnabled(1);
567  }
568  break;
569  case "display_question_titles":
570  if ($meta["entry"])
571  {
572  $this->survey->showQuestionTitles();
573  }
574  break;
575  }
576  if (preg_match("/questionblock_(\d+)/", $meta["label"], $matches))
577  {
578  // handle questionblocks
579  $qb = $meta["entry"];
580  preg_match("/<title>(.*?)<\/title>/", $qb, $matches);
581  $qb_title = $matches[1];
582  preg_match("/<questions>(.*?)<\/questions>/", $qb, $matches);
583  $qb_questions = $matches[1];
584  $qb_questions_array = explode(",", $qb_questions);
585  array_push($this->questionblocks, array(
586  "title" => $qb_title,
587  "questions" => $qb_questions_array
588  ));
589  }
590  if (preg_match("/constraint_(\d+)/", $meta["label"], $matches))
591  {
592  $constraint = $meta["entry"];
593  $constraint_array = explode(",", $constraint);
594  if (count($constraint_array) == 3)
595  {
596  array_push($this->constraints, array(
597  "sourceref" => $matches[1],
598  "destref" => $constraint_array[0],
599  "relation" => $constraint_array[1],
600  "value" => $constraint_array[2]
601  ));
602  }
603  }
604  if (preg_match("/heading_(\d+)/", $meta["label"], $matches))
605  {
606  $heading = $meta["entry"];
607  $this->textblocks[$matches[1]] = $heading;
608  }
609  }
610  }
611  break;
612  case "mattext":
613  $this->material[count($this->material)-1]["text"] = $this->characterbuffer;
614  break;
615  case "matimage":
616  $this->material[count($this->material)-1]["image"] = $this->characterbuffer;
617  break;
618  case "material":
619  if ($this->in_survey)
620  {
621  if (strcmp($this->getParent($a_xml_parser), "objectives") == 0)
622  {
623  if (strcmp($this->material[0]["label"], "introduction") == 0)
624  {
625  if (is_object($this->survey))
626  {
627  $this->survey->setIntroduction($this->material[0]["text"]);
628  }
629  }
630  if (strcmp($this->material[0]["label"], "outro") == 0)
631  {
632  if (is_object($this->survey))
633  {
634  $this->survey->setOutro($this->material[0]["text"]);
635  }
636  }
637  $this->material = array();
638  }
639  }
640  else
641  {
642  switch ($this->getParent($a_xml_parser))
643  {
644  case "response_num":
645  case "response_lid":
646  case "response_str":
647  if (is_object($this->activequestion))
648  {
649  $this->activequestion->setMaterial($this->material[0]["text"], TRUE, $this->material[0]["label"]);
650  }
651  break;
652  case "flow":
653  if (is_object($this->activequestion))
654  {
655  $this->activequestion->setQuestiontext($this->material[0]["text"]);
656  }
657  break;
658  }
659  if (is_object($this->activequestion))
660  {
661  if ($this->in_response)
662  {
663  switch ($this->activequestion->getQuestiontype())
664  {
665  case "SurveyMultipleChoiceQuestion":
666  case "SurveySingleChoiceQuestion":
667  $this->activequestion->categories->addCategory($this->material[0]["text"]);
668  break;
669  }
670  }
671  }
672  }
673  break;
674  case "response_label":
675  $this->in_response = FALSE;
676  break;
677  }
678  $this->depth[$a_xml_parser]--;
679  }
const NOMINAL_QUESTION_IDENTIFIER
const TEXT_QUESTION_IDENTIFIER
const METRIC_QUESTION_IDENTIFIER
Old survey question import/export identifiers.
Create styles array
The data for the language used.
const ORDINAL_QUESTION_IDENTIFIER
+ Here is the call graph for this function:

◆ hasError()

SurveyImportParserPre38::hasError ( )

Definition at line 731 of file class.SurveyImportParserPre38.php.

References $has_error.

◆ parse()

SurveyImportParserPre38::parse (   $a_xml_parser,
  $a_fp = null 
)

parse xml file

private

Definition at line 166 of file class.SurveyImportParserPre38.php.

References $data, ilSaxParser\getInputType(), and ilSaxParser\getXMLContent().

167  {
168  switch($this->getInputType())
169  {
170  case 'file':
171 
172  while($data = fread($a_fp,4096))
173  {
174  $parseOk = xml_parse($a_xml_parser,$data,feof($a_fp));
175  }
176  break;
177 
178  case 'string':
179  $parseOk = xml_parse($a_xml_parser,$this->getXMLContent());
180  break;
181  }
182  if(!$parseOk
183  && (xml_get_error_code($a_xml_parser) != XML_ERROR_NONE))
184  {
185  $this->error_code = xml_get_error_code($a_xml_parser);
186  $this->error_line = xml_get_current_line_number($a_xml_parser);
187  $this->error_col = xml_get_current_column_number($a_xml_parser);
188  $this->error_msg = xml_error_string($a_xml_parser);
189  $this->has_error = TRUE;
190  return false;
191  }
192  return true;
193  }
+ Here is the call graph for this function:

◆ setHandlers()

SurveyImportParserPre38::setHandlers (   $a_xml_parser)

set event handler should be overwritten by inherited class private

Definition at line 146 of file class.SurveyImportParserPre38.php.

147  {
148  xml_set_object($a_xml_parser,$this);
149  xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
150  xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
151  }

◆ setSurveyObject()

SurveyImportParserPre38::setSurveyObject (   $a_svy)

Sets a reference to a survey object public.

Definition at line 136 of file class.SurveyImportParserPre38.php.

137  {
138  $this->survey = $a_svy;
139  }

◆ startParsing()

SurveyImportParserPre38::startParsing ( )

start the parser

Definition at line 156 of file class.SurveyImportParserPre38.php.

157  {
158  parent::startParsing();
159  }

Field Documentation

◆ $activequestion

SurveyImportParserPre38::$activequestion

Definition at line 47 of file class.SurveyImportParserPre38.php.

◆ $activetag

SurveyImportParserPre38::$activetag

Definition at line 60 of file class.SurveyImportParserPre38.php.

◆ $adjectives

SurveyImportParserPre38::$adjectives

Definition at line 67 of file class.SurveyImportParserPre38.php.

◆ $anonymisation

SurveyImportParserPre38::$anonymisation

Definition at line 71 of file class.SurveyImportParserPre38.php.

◆ $attributes

SurveyImportParserPre38::$attributes

Definition at line 56 of file class.SurveyImportParserPre38.php.

Referenced by getXMLAttributes().

◆ $characterbuffer

SurveyImportParserPre38::$characterbuffer

Definition at line 59 of file class.SurveyImportParserPre38.php.

Referenced by handlerCharacterData(), and handlerEndTag().

◆ $constraints

SurveyImportParserPre38::$constraints

Definition at line 75 of file class.SurveyImportParserPre38.php.

◆ $depth

SurveyImportParserPre38::$depth

Definition at line 46 of file class.SurveyImportParserPre38.php.

◆ $elements

SurveyImportParserPre38::$elements

Definition at line 55 of file class.SurveyImportParserPre38.php.

Referenced by getXMLElements().

◆ $error_code

SurveyImportParserPre38::$error_code

Definition at line 49 of file class.SurveyImportParserPre38.php.

Referenced by getErrorCode().

◆ $error_col

SurveyImportParserPre38::$error_col

Definition at line 51 of file class.SurveyImportParserPre38.php.

Referenced by getErrorColumn(), and getFullError().

◆ $error_line

SurveyImportParserPre38::$error_line

Definition at line 50 of file class.SurveyImportParserPre38.php.

Referenced by getErrorLine().

◆ $error_msg

SurveyImportParserPre38::$error_msg

Definition at line 52 of file class.SurveyImportParserPre38.php.

Referenced by getErrorMessage().

◆ $has_error

SurveyImportParserPre38::$has_error

Definition at line 53 of file class.SurveyImportParserPre38.php.

Referenced by hasError().

◆ $in_question

SurveyImportParserPre38::$in_question

Definition at line 84 of file class.SurveyImportParserPre38.php.

◆ $in_questionblock

SurveyImportParserPre38::$in_questionblock

Definition at line 78 of file class.SurveyImportParserPre38.php.

◆ $in_reponse

SurveyImportParserPre38::$in_reponse

Definition at line 85 of file class.SurveyImportParserPre38.php.

◆ $in_survey

SurveyImportParserPre38::$in_survey

Definition at line 69 of file class.SurveyImportParserPre38.php.

◆ $is_matrix

SurveyImportParserPre38::$is_matrix

Definition at line 66 of file class.SurveyImportParserPre38.php.

◆ $material

SurveyImportParserPre38::$material

Definition at line 61 of file class.SurveyImportParserPre38.php.

◆ $matrix

SurveyImportParserPre38::$matrix

Definition at line 65 of file class.SurveyImportParserPre38.php.

◆ $metadata

SurveyImportParserPre38::$metadata

Definition at line 62 of file class.SurveyImportParserPre38.php.

◆ $original_question_id

SurveyImportParserPre38::$original_question_id

Definition at line 74 of file class.SurveyImportParserPre38.php.

Referenced by handlerEndTag().

◆ $path

SurveyImportParserPre38::$path

Definition at line 45 of file class.SurveyImportParserPre38.php.

◆ $question_description

SurveyImportParserPre38::$question_description

Definition at line 86 of file class.SurveyImportParserPre38.php.

◆ $question_title

SurveyImportParserPre38::$question_title

Definition at line 83 of file class.SurveyImportParserPre38.php.

◆ $questionblock

SurveyImportParserPre38::$questionblock

Definition at line 79 of file class.SurveyImportParserPre38.php.

◆ $questionblocks

SurveyImportParserPre38::$questionblocks

Definition at line 80 of file class.SurveyImportParserPre38.php.

◆ $questionblocktitle

SurveyImportParserPre38::$questionblocktitle

Definition at line 81 of file class.SurveyImportParserPre38.php.

◆ $questions

SurveyImportParserPre38::$questions

Definition at line 73 of file class.SurveyImportParserPre38.php.

◆ $response_id

SurveyImportParserPre38::$response_id

Definition at line 64 of file class.SurveyImportParserPre38.php.

◆ $responses

SurveyImportParserPre38::$responses

Definition at line 63 of file class.SurveyImportParserPre38.php.

◆ $size

SurveyImportParserPre38::$size

Definition at line 54 of file class.SurveyImportParserPre38.php.

Referenced by getXMLSize().

◆ $spl

SurveyImportParserPre38::$spl

Definition at line 48 of file class.SurveyImportParserPre38.php.

◆ $spl_exists

SurveyImportParserPre38::$spl_exists

Definition at line 68 of file class.SurveyImportParserPre38.php.

Referenced by __construct().

◆ $survey

SurveyImportParserPre38::$survey

Definition at line 70 of file class.SurveyImportParserPre38.php.

◆ $surveyaccess

SurveyImportParserPre38::$surveyaccess

Definition at line 72 of file class.SurveyImportParserPre38.php.

◆ $text_size

SurveyImportParserPre38::$text_size

Definition at line 58 of file class.SurveyImportParserPre38.php.

Referenced by getXMLTextSize().

◆ $textblock

SurveyImportParserPre38::$textblock

Definition at line 76 of file class.SurveyImportParserPre38.php.

◆ $textblocks

SurveyImportParserPre38::$textblocks

Definition at line 77 of file class.SurveyImportParserPre38.php.

◆ $texts

SurveyImportParserPre38::$texts

Definition at line 57 of file class.SurveyImportParserPre38.php.

Referenced by getXMLTextSections().


The documentation for this class was generated from the following file: