ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.SurveyImportParser.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
11 {
12  protected $showQuestiontext;
13  protected $showBlocktitle;
14  protected $compressView;
15  public $path;
16  public $depth;
18  public $spl;
19  public $error_code;
20  public $error_line;
21  public $error_col;
22  public $error_msg;
23  public $has_error;
24  public $size;
25  public $elements;
26  public $attributes;
27  public $texts;
28  public $text_size;
30  public $activetag;
31  public $material;
32  public $metadata;
33  public $responses;
34  public $variables;
35  public $response_id;
36  public $matrix;
38  public $is_matrix;
39  public $adjectives;
40  public $spl_exists;
41  public $in_survey;
42  public $survey;
44  public $surveyaccess;
45  public $questions;
47  public $constraints;
48  public $textblock;
49  public $textblocks;
55 
63  public function __construct($a_spl_id, $a_xml_file = '', $spl_exists = false, $a_mapping = null)
64  {
65  parent::__construct($a_xml_file);
66  $this->spl_id = $a_spl_id;
67  $this->has_error = false;
68  $this->characterbuffer = "";
69  $this->survey_status = 0;
70  $this->activetag = "";
71  $this->material = array();
72  $this->depth = array();
73  $this->path = array();
74  $this->metadata = array();
75  $this->responses = array();
76  $this->variables = array();
77  $this->response_id = "";
78  $this->matrix = array();
79  $this->is_matrix = false;
80  $this->adjectives = array();
81  $this->spl_exists = $spl_exists;
82  $this->survey = null;
83  $this->in_survey = false;
84  $this->anonymisation = 0;
85  $this->surveyaccess = "restricted";
86  $this->questions = array();
87  $this->original_question_id = "";
88  $this->constraints = array();
89  $this->textblock = "";
90  $this->textblocks = array();
91  $this->in_questionblock = false;
92  $this->questionblocks = array();
93  $this->questionblock = array();
94  $this->showQuestiontext = 1;
95  $this->showBlocktitle = 0;
96  $this->compressView = 0;
97  $this->questionblocktitle = "";
98  $this->mapping = $a_mapping;
99  }
100 
105  public function setSurveyObject($a_svy)
106  {
107  $this->survey = $a_svy;
108  }
109 
115  public function setHandlers($a_xml_parser)
116  {
117  xml_set_object($a_xml_parser, $this);
118  xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
119  xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
120  }
121 
125  public function startParsing()
126  {
127  parent::startParsing();
128  }
129 
135  public function parse($a_xml_parser, $a_fp = null)
136  {
137  switch ($this->getInputType()) {
138  case 'file':
139 
140  while ($data = fread($a_fp, 4096)) {
141  $parseOk = xml_parse($a_xml_parser, $data, feof($a_fp));
142  }
143  break;
144 
145  case 'string':
146  $parseOk = xml_parse($a_xml_parser, $this->getXMLContent());
147  break;
148  }
149  if (!$parseOk
150  && (xml_get_error_code($a_xml_parser) != XML_ERROR_NONE)) {
151  $this->error_code = xml_get_error_code($a_xml_parser);
152  $this->error_line = xml_get_current_line_number($a_xml_parser);
153  $this->error_col = xml_get_current_column_number($a_xml_parser);
154  $this->error_msg = xml_error_string($a_xml_parser);
155  $this->has_error = true;
156  return false;
157  }
158  return true;
159  }
160 
161  public function getParent($a_xml_parser)
162  {
163  if ($this->depth[$a_xml_parser] > 0) {
164  return $this->path[$this->depth[$a_xml_parser] - 1];
165  } else {
166  return "";
167  }
168  }
169 
173  public function handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
174  {
175  $a_attribs = $this->trimAndStripAttribs($a_attribs);
176  $this->depth[$a_xml_parser]++;
177  $this->path[$this->depth[$a_xml_parser]] = strtolower($a_name);
178  $this->characterbuffer = "";
179  $this->activetag = $a_name;
180  $this->elements++;
181  $this->attributes += count($a_attribs);
182  switch ($a_name) {
183  case "questionblock":
184  $this->in_questionblock = true;
185  $this->questionblock = array();
186  $this->questionblocktitle = "";
187  $this->showQuestiontext = 1;
188  $this->showBlocktitle = 0;
189  $this->compressView = 0;
190  foreach ($a_attribs as $attrib => $value) {
191  switch ($attrib) {
192  case "showQuestiontext":
193  $this->showQuestiontext = (int) $value;
194  break;
195  case "showBlocktitle":
196  $this->showBlocktitle = (int) $value;
197  break;
198  case "compressView":
199  $this->compressView = (int) $value;
200  break;
201  }
202  }
203  break;
204  case "surveyquestions":
205  foreach ($a_attribs as $attrib => $value) {
206  switch ($attrib) {
207  case "online":
208  if ($this->spl_id > 0) {
209  $spl = new ilObjSurveyQuestionPool($this->spl_id, false);
210  $spl->setOnline($value);
211  $spl->saveToDb();
212  }
213  break;
214  }
215  }
216  break;
217  case "survey":
218  $this->in_survey = true;
219  foreach ($a_attribs as $attrib => $value) {
220  switch ($attrib) {
221  case "title":
222  if (is_object($this->survey)) {
223  $this->survey->setTitle($value);
224  $this->survey->update(true);
225  }
226  break;
227  }
228  }
229  break;
230  case "anonymisation":
231  foreach ($a_attribs as $attrib => $value) {
232  switch ($attrib) {
233  case "enabled":
234  $this->anonymisation = $value;
235  break;
236  }
237  }
238  break;
239  case "access":
240  foreach ($a_attribs as $attrib => $value) {
241  switch ($attrib) {
242  case "type":
243  $this->surveyaccess = $value;
244  break;
245  }
246  }
247  break;
248  case "constraint":
249  array_push(
250  $this->constraints,
251  array(
252  "sourceref" => $a_attribs["sourceref"],
253  "destref" => $a_attribs["destref"],
254  "relation" => $a_attribs["relation"],
255  "value" => $a_attribs["value"],
256 
257  // might be missing in old export files
258  "conjunction" => (int) $a_attribs["conjuction"]
259  )
260  );
261  break;
262  case "question":
263  // start with a new survey question
264  $type = $a_attribs["type"];
265  // patch due to changes in question types
266  switch ($type) {
267  case 'SurveyNominalQuestion':
268  $type = 'SurveyMultipleChoiceQuestion';
269  foreach ($a_attribs as $key => $value) {
270  switch ($key) {
271  case "subtype":
272  if ($value == 1) {
273  $type = 'SurveySingleChoiceQuestion';
274  } else {
275  $type = 'SurveyMultipleChoiceQuestion';
276  }
277  break;
278  }
279  }
280  break;
281  case 'SurveyOrdinalQuestion':
282  $type = 'SurveySingleChoiceQuestion';
283  break;
284  }
285  if (strlen($type)) {
287  $this->activequestion = new $type();
288 
289  // if no pool is given, question will reference survey
290  $q_obj_id = $this->spl_id;
291  if ($this->spl_id < 0) {
292  $q_obj_id = $this->survey->getId();
293  }
294 
295  $this->activequestion->setObjId($q_obj_id);
296  }
297  } else {
298  $this->activequestion = null;
299  }
300  $this->original_question_id = $a_attribs["id"];
301  if ($this->in_questionblock) {
302  array_push($this->questionblock, $this->original_question_id);
303  }
304  if (is_object($this->activequestion)) {
305  foreach ($a_attribs as $key => $value) {
306  switch ($key) {
307  case "title":
308  $this->activequestion->setTitle($value);
309  break;
310  case "subtype":
311  $this->activequestion->setSubtype($value);
312  break;
313  case "obligatory":
314  $this->activequestion->setObligatory($value);
315  break;
316  }
317  }
318  }
319  break;
320  case "material":
321  switch ($this->getParent($a_xml_parser)) {
322  case "question":
323  case "questiontext":
324  $this->material = array();
325  break;
326  }
327  array_push($this->material, array("text" => "", "image" => "", "label" => $a_attribs["label"]));
328  break;
329  case "matimage":
330  case "label":
331  if (array_key_exists("label", $a_attribs)) {
332  if (preg_match("/(il_([0-9]+)_mob_([0-9]+))/", $a_attribs["label"], $matches)) {
333  // import an mediaobject which was inserted using tiny mce
334  if (!is_array($_SESSION["import_mob_xhtml"])) {
335  $_SESSION["import_mob_xhtml"] = array();
336  }
337  array_push($_SESSION["import_mob_xhtml"], array("mob" => $a_attribs["label"], "uri" => $a_attribs["uri"], "type" => $a_attribs["type"], "id" => $a_attribs["id"]));
338  }
339  }
340  break;
341  case "metadata":
342  $this->metadata = array();
343  break;
344  case "metadatafield":
345  array_push($this->metadata, array("label" => "", "entry" => ""));
346  break;
347  case "matrix":
348  $this->is_matrix = true;
349  $this->matrix = array();
350  break;
351  case "matrixrow":
352  $this->material = array();
353  array_push($this->matrix, "");
354  $this->matrixrowattribs = array("id" => $a_attribs["id"], "label" => $a_attribs["label"], "other" => $a_attribs["other"]);
355  break;
356  case "responses":
357  $this->material = array();
358  $this->responses = array();
359  break;
360  case "variables":
361  $this->variables = array();
362  break;
363  case "response_single":
364  $this->material = array();
365  $this->responses[$a_attribs["id"]] = array("type" => "single", "id" => $a_attribs["id"], "label" => $a_attribs["label"], "other" => $a_attribs["other"], "neutral" => $a_attribs["neutral"], "scale" => $a_attribs["scale"]);
366  $this->response_id = $a_attribs["id"];
367  break;
368  case "response_multiple":
369  $this->material = array();
370  $this->responses[$a_attribs["id"]] = array("type" => "multiple", "id" => $a_attribs["id"], "label" => $a_attribs["label"], "other" => $a_attribs["other"], "neutral" => $a_attribs["neutral"], "scale" => $a_attribs["scale"]);
371  $this->response_id = $a_attribs["id"];
372  break;
373  case "response_text":
374  $this->material = array();
375  $this->responses[$a_attribs["id"]] = array("type" => "text", "id" => $a_attribs["id"], "columns" => $a_attribs["columns"], "maxlength" => $a_attribs["maxlength"], "rows" => $a_attribs["rows"], "label" => $a_attribs["label"]);
376  $this->response_id = $a_attribs["id"];
377  break;
378  case "response_num":
379  $this->material = array();
380  $this->responses[$a_attribs["id"]] = array("type" => "num", "id" => $a_attribs["id"], "format" => $a_attribs["format"], "max" => $a_attribs["max"], "min" => $a_attribs["min"], "size" => $a_attribs["size"], "label" => $a_attribs["label"]);
381  $this->response_id = $a_attribs["id"];
382  break;
383  case "response_time":
384  $this->material = array();
385  $this->responses[$a_attribs["id"]] = array("type" => "time", "id" => $a_attribs["id"], "format" => $a_attribs["format"], "max" => $a_attribs["max"], "min" => $a_attribs["min"], "label" => $a_attribs["label"]);
386  $this->response_id = $a_attribs["id"];
387  break;
388  case "bipolar_adjectives":
389  $this->adjectives = array();
390  break;
391  case "adjective":
392  array_push($this->adjectives, array("label" => $a_attribs["label"], "text" => ""));
393  break;
394  }
395  }
396 
400  public function handlerCharacterData($a_xml_parser, $a_data)
401  {
402  $this->texts++;
403  $this->text_size += strlen($a_data);
404  $this->characterbuffer .= $a_data;
405  $a_data = $this->characterbuffer;
406  }
407 
408  protected function getCharacterBuffer() : string
409  {
410  return $this->trimAndStrip((string) $this->characterbuffer);
411  }
412 
416  public function handlerEndTag($a_xml_parser, $a_name)
417  {
418  switch ($a_name) {
419  case "surveyobject":
420  if (is_object($this->survey)) {
421  $this->survey->setOfflineStatus(!$this->survey_status);
422  $this->survey->saveToDb();
423 
424  // write question blocks
425  if (count($this->questionblocks)) {
426  foreach ($this->questionblocks as $data) {
427  $questionblock = $data["questions"];
428  $title = $data["title"];
429  $qblock = array();
430  foreach ($questionblock as $question_id) {
431  array_push($qblock, $this->questions[$question_id]);
432  }
433  $this->survey->createQuestionblock(
434  $title,
435  $this->showQuestiontext,
436  $this->showBlocktitle,
437  $qblock,
438  $this->compressView
439  );
440  }
441  }
442 
443  // #13878 - write constraints
444  if (count($this->constraints)) {
445  $relations = $this->survey->getAllRelations(true);
446  foreach ($this->constraints as $constraint) {
447  $constraint_id = $this->survey->addConstraint($this->questions[$constraint["destref"]], $relations[$constraint["relation"]]["id"], $constraint["value"], $constraint["conjunction"]);
448  $this->survey->addConstraintToQuestion($this->questions[$constraint["sourceref"]], $constraint_id);
449  }
450  }
451 
452  // write textblocks
453  if (count($this->textblocks)) {
454  foreach ($this->textblocks as $original_id => $textblock) {
455  $this->survey->saveHeading($textblock, $this->questions[$original_id]);
456  }
457  }
458  }
459  break;
460  case "survey":
461  $this->in_survey = false;
462  if (is_object($this->survey)) {
463  if (strcmp($this->surveyaccess, "free") == 0) {
464  $this->survey->setAnonymize(2);
465  } else {
466  if ($this->anonymisation == 0) {
467  $this->survey->setAnonymize(0);
468  } else {
469  $this->survey->setAnonymize(1);
470  }
471  }
472  }
473  break;
474  case "startingtime":
475  if (preg_match("/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}).*/", $this->getCharacterBuffer(), $matches)) {
476  if (is_object($this->survey)) {
477  $this->survey->setStartDate(sprintf("%04d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
478  }
479  }
480  break;
481  case "endingtime":
482  if (preg_match("/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}).*/", $this->getCharacterBuffer(), $matches)) {
483  if (is_object($this->survey)) {
484  $this->survey->setEndDate(sprintf("%04d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
485  }
486  }
487  break;
488  case "description":
489  if ($this->in_survey) {
490  if (is_object($this->survey)) {
491  $this->survey->setDescription($this->getCharacterBuffer());
492  $this->survey->update(true);
493  }
494  } else {
495  if (is_object($this->activequestion)) {
496  $this->activequestion->setDescription($this->getCharacterBuffer());
497  }
498  }
499  break;
500  case "question":
501  if (is_object($this->activequestion)) {
502  if (strlen($this->textblock)) {
503  $this->textblocks[$this->original_question_id] = $this->textblock;
504  }
505  $this->activequestion->saveToDb();
506  // duplicate the question for the survey (if pool is to be used)
507  if (is_object($this->survey) &&
508  $this->spl_id > 0) {
509  $question_id = $this->activequestion->duplicate(true, "", "", "", $this->survey->getId());
510  } else {
511  $question_id = $this->activequestion->getId();
512  }
513  if (is_object($this->survey)) { // #15452
514  $this->survey->addQuestion($question_id);
515  }
516  $this->questions[$this->original_question_id] = $question_id;
517  if ($this->mapping) {
518  $this->mapping->addMapping("Modules/Survey", "svy_q", $this->original_question_id, $question_id);
519  }
520  $this->activequestion = null;
521  }
522  $this->textblock = "";
523  break;
524  case "author":
525  if ($this->in_survey) {
526  if (is_object($this->survey)) {
527  $this->survey->setAuthor($this->getCharacterBuffer());
528  }
529  } else {
530  if (is_object($this->activequestion)) {
531  $this->activequestion->setAuthor($this->getCharacterBuffer());
532  }
533  }
534  break;
535  case "mattext":
536  $this->material[count($this->material) - 1]["text"] = $this->getCharacterBuffer();
537  break;
538  case "matimage":
539  $this->material[count($this->material) - 1]["image"] = $this->getCharacterBuffer();
540  break;
541  case "material":
542  if ($this->in_survey) {
543  if (strcmp($this->getParent($a_xml_parser), "objectives") == 0) {
544  if (strcmp($this->material[0]["label"], "introduction") == 0) {
545  if (is_object($this->survey)) {
546  $this->survey->setIntroduction($this->material[0]["text"]);
547  }
548  }
549  if (strcmp($this->material[0]["label"], "outro") == 0) {
550  if (is_object($this->survey)) {
551  $this->survey->setOutro($this->material[0]["text"]);
552  }
553  }
554  $this->material = array();
555  }
556  } else {
557  if (strcmp($this->getParent($a_xml_parser), "question") == 0) {
558  $this->activequestion->setMaterial($this->material[0]["text"], true, $this->material[0]["label"]);
559  }
560  }
561  break;
562  case "questiontext":
563  if (is_object($this->activequestion)) {
564  $questiontext = "";
565  foreach ($this->material as $matarray) {
566  $questiontext .= $matarray["text"];
567  }
568  $this->activequestion->setQuestiontext($questiontext);
569  }
570  $this->material = array();
571  break;
572  case "fieldlabel":
573  $this->metadata[count($this->metadata) - 1]["label"] = $this->getCharacterBuffer();
574  break;
575  case "fieldentry":
576  $this->metadata[count($this->metadata) - 1]["entry"] = $this->characterbuffer;
577  break;
578  case "metadata":
579  if (strcmp($this->getParent($a_xml_parser), "question") == 0) {
580  if (is_object($this->activequestion)) {
581  $this->activequestion->importAdditionalMetadata($this->metadata);
582  }
583  }
584  if (strcmp($this->getParent($a_xml_parser), "survey") == 0) {
585  foreach ($this->metadata as $key => $value) {
586  switch ($value["label"]) {
587  case "SCORM":
588  if (strlen($value["entry"])) {
589  if (is_object($this->survey)) {
590  $md_sax_parser = new ilMDSaxParser();
591  $md_sax_parser->setXMLContent($value["entry"]);
592  $md_sax_parser->setMDObject($tmp = new ilMD($this->survey->getId(), 0, "svy"));
593  $md_sax_parser->enableMDParsing(true);
594  $md_sax_parser->startParsing();
595  $this->survey->MDUpdateListener("General");
596  }
597  }
598  break;
599  case "display_question_titles":
600  if ($value["entry"] == 1) {
601  $this->survey->showQuestionTitles();
602  } else {
603  $this->survey->hideQuestionTitles();
604  }
605  break;
606  case "status":
607  $this->survey_status = $value["entry"];
608  break;
609  case "evaluation_access":
610  $this->survey->setEvaluationAccess($value["entry"]);
611  break;
612  case "pool_usage":
613  $this->survey->setPoolUsage($value["entry"]);
614  break;
615  case "own_results_view":
616  $this->survey->setViewOwnResults($value["entry"]);
617  break;
618  case "own_results_mail":
619  $this->survey->setMailOwnResults($value["entry"]);
620  break;
621  case "confirmation_mail":
622  $this->survey->setMailConfirmation($value["entry"]);
623  break;
624  case "anon_user_list":
625  $this->survey->setAnonymousUserList($value["entry"]);
626  break;
627  case "mode":
628  $this->survey->setMode($value["entry"]);
629  break;
630  case "mode_360_self_eval":
631  $this->survey->set360SelfEvaluation($value["entry"]);
632  break;
633  case "mode_360_self_rate":
634  $this->survey->set360SelfRaters($value["entry"]);
635  break;
636  case "mode_360_self_appr":
637  $this->survey->set360SelfAppraisee($value["entry"]);
638  break;
639  case "mode_360_results":
640  $this->survey->set360Results($value["entry"]);
641  break;
642  case "mode_self_eval_results":
643  $this->survey->setSelfEvaluationResults($value["entry"]);
644  break;
645  case "mode_skill_service":
646  $this->survey->setSkillService($value["entry"]);
647  break;
648  }
649  }
650  }
651  if (!$this->spl_exists) {
652  if (strcmp($this->getParent($a_xml_parser), "surveyquestions") == 0) {
653  foreach ($this->metadata as $key => $value) {
654  if (strcmp($value["label"], "SCORM") == 0) {
655  if (strlen($value["entry"])) {
656  if ($this->spl_id > 0) {
657  $md_sax_parser = new ilMDSaxParser();
658  $md_sax_parser->setXMLContent($value["entry"]);
659  $md_sax_parser->setMDObject($tmp = new ilMD($this->spl_id, 0, "spl"));
660  $md_sax_parser->enableMDParsing(true);
661  $md_sax_parser->startParsing();
662  $spl = new ilObjSurveyQuestionPool($this->spl_id, false);
663  $spl->MDUpdateListener("General");
664  }
665  }
666  }
667  }
668  }
669  }
670  break;
671  case "responses":
672  if (is_object($this->activequestion)) {
673  $this->activequestion->importResponses($this->responses);
674  }
675  $this->is_matrix = false;
676  break;
677  case "variable":
678  array_push($this->variables, $this->getCharacterBuffer());
679  break;
680  case "variables":
681  if (is_object($this->activequestion)) {
682  $this->activequestion->importVariables($this->variables);
683  }
684  break;
685  case "response_single":
686  case "response_multiple":
687  case "response_text":
688  case "response_num":
689  case "response_time":
690  $this->responses[$this->response_id]["material"] = $this->material;
691  break;
692  case "adjective":
693  $this->adjectives[count($this->adjectives) - 1]["text"] = $this->getCharacterBuffer();
694  break;
695  case "bipolar_adjectives":
696  if (is_object($this->activequestion)) {
697  $this->activequestion->importAdjectives($this->adjectives);
698  }
699  break;
700  case "matrixrow":
701  $row = "";
702  foreach ($this->material as $material) {
703  $row .= $material["text"];
704  }
705  $this->matrix[count($this->matrix) - 1] = array('title' => $row, 'id' => $this->matrixrowattribs['id'], 'label' => $this->matrixrowattribs['label'], 'other' => $this->matrixrowattribs['other']);
706  break;
707  case "matrix":
708  if (is_object($this->activequestion)) {
709  $this->activequestion->importMatrix($this->matrix);
710  }
711  break;
712  case "textblock":
713  $this->textblock = $this->getCharacterBuffer();
714  break;
715  case "questionblocktitle":
716  $this->questionblocktitle = $this->getCharacterBuffer();
717  break;
718  case "questionblock":
719  $this->in_questionblock = false;
720  array_push($this->questionblocks, array("title" => $this->questionblocktitle, "questions" => $this->questionblock));
721  break;
722  }
723  $this->depth[$a_xml_parser]--;
724  }
725 
726  public function getErrorCode()
727  {
728  return $this->error_code;
729  }
730 
731  public function getErrorLine()
732  {
733  return $this->error_line;
734  }
735 
736  public function getErrorColumn()
737  {
738  return $this->error_col;
739  }
740 
741  public function getErrorMessage()
742  {
743  return $this->error_msg;
744  }
745 
746  public function getFullError()
747  {
748  return "Error: " . $this->error_msg . " at line:" . $this->error_line . " column:" . $this->error_col;
749  }
750 
751  public function getXMLSize()
752  {
753  return $this->size;
754  }
755 
756  public function getXMLElements()
757  {
758  return $this->elements;
759  }
760 
761  public function getXMLAttributes()
762  {
763  return $this->attributes;
764  }
765 
766  public function getXMLTextSections()
767  {
768  return $this->texts;
769  }
770 
771  public function getXMLTextSize()
772  {
773  return $this->text_size;
774  }
775 
776  public function hasError()
777  {
778  return $this->has_error;
779  }
780 
781  protected function trimAndStripAttribs(array $attribs) : array
782  {
783  $ret = [];
784  foreach ($attribs as $k => $v) {
785  $ret[$k] = $this->trimAndStrip((string) $v);
786  }
787  return $ret;
788  }
789 
790  protected function trimAndStrip(string $input) : string
791  {
792  return ilUtil::stripSlashes(trim($input));
793  }
794 }
$data
Definition: storeScorm.php:23
parse($a_xml_parser, $a_fp=null)
parse xml file
$_SESSION["AccountId"]
Class ilObjSurveyQuestionPool.
$type
handlerEndTag($a_xml_parser, $a_name)
handler for end of element
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
setSurveyObject($a_svy)
Sets a reference to a survey object public.
Survey Question Import Parser.
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
startParsing()
start the parser
__construct($a_spl_id, $a_xml_file='', $spl_exists=false, $a_mapping=null)
Constructor.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
trimAndStripAttribs(array $attribs)
__construct(Container $dic, ilPlugin $plugin)
$ret
Definition: parser.php:6
setHandlers($a_xml_parser)
set event handler should be overwritten by inherited class private
$attrib
Regular expression to match HTML/XML attribute pairs within a tag.
Definition: Sanitizer.php:42