ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
SurveyImportParser Class Reference

Survey Question Import Parser. More...

+ Inheritance diagram for SurveyImportParser:
+ Collaboration diagram for SurveyImportParser:

Public Member Functions

 SurveyImportParser ($a_spl_id, $a_xml_file='', $spl_exists=FALSE)
 Constructor. More...
 
 setSurveyObject (&$a_svy)
 Sets a reference to a survey object @access public. More...
 
 setHandlers ($a_xml_parser)
 set event handler should be overwritten by inherited class @access 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
 ilSaxParser ($a_xml_file='', $throwException=false)
 Constructor setup ILIAS global object @access 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 @access 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
 PEAR ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
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...
 
 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...
 
 setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. 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
 
 $variables
 
 $response_id
 
 $matrix
 
 $matrixrowattribs
 
 $is_matrix
 
 $adjectives
 
 $spl_exists
 
 $in_survey
 
 $survey
 
 $anonymisation
 
 $surveyaccess
 
 $questions
 
 $original_question_id
 
 $constraints
 
 $textblock
 
 $textblocks
 
 $survey_status
 
 $in_questionblock
 
 $questionblock
 
 $questionblocks
 
 $questionblocktitle
 
- 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

- 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 35 of file class.SurveyImportParser.php.

Member Function Documentation

◆ getErrorCode()

SurveyImportParser::getErrorCode ( )

Definition at line 822 of file class.SurveyImportParser.php.

References $error_code.

◆ getErrorColumn()

SurveyImportParser::getErrorColumn ( )

Definition at line 832 of file class.SurveyImportParser.php.

References $error_col.

◆ getErrorLine()

SurveyImportParser::getErrorLine ( )

Definition at line 827 of file class.SurveyImportParser.php.

References $error_line.

◆ getErrorMessage()

SurveyImportParser::getErrorMessage ( )

Definition at line 837 of file class.SurveyImportParser.php.

References $error_msg.

◆ getFullError()

SurveyImportParser::getFullError ( )

Definition at line 842 of file class.SurveyImportParser.php.

843 {
844 return "Error: ".$this->error_msg." at line:".$this->error_line ." column:".$this->error_col;
845 }

References $error_col.

◆ getParent()

SurveyImportParser::getParent (   $a_xml_parser)

Definition at line 183 of file class.SurveyImportParser.php.

184 {
185 if ($this->depth[$a_xml_parser] > 0)
186 {
187 return $this->path[$this->depth[$a_xml_parser]-1];
188 }
189 else
190 {
191 return "";
192 }
193 }

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the caller graph for this function:

◆ getXMLAttributes()

SurveyImportParser::getXMLAttributes ( )

Definition at line 857 of file class.SurveyImportParser.php.

References $attributes.

◆ getXMLElements()

SurveyImportParser::getXMLElements ( )

Definition at line 852 of file class.SurveyImportParser.php.

References $elements.

◆ getXMLSize()

SurveyImportParser::getXMLSize ( )

Definition at line 847 of file class.SurveyImportParser.php.

848 {
849 return $this->size;
850 }

References $size.

◆ getXMLTextSections()

SurveyImportParser::getXMLTextSections ( )

Definition at line 862 of file class.SurveyImportParser.php.

References $texts.

◆ getXMLTextSize()

SurveyImportParser::getXMLTextSize ( )

Definition at line 867 of file class.SurveyImportParser.php.

References $text_size.

◆ handlerBeginTag()

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

handler for begin of element

Definition at line 198 of file class.SurveyImportParser.php.

199 {
200 $this->depth[$a_xml_parser]++;
201 $this->path[$this->depth[$a_xml_parser]] = strtolower($a_name);
202 $this->characterbuffer = "";
203 $this->activetag = $a_name;
204 $this->elements++;
205 $this->attributes+=count($a_attribs);
206 switch ($a_name)
207 {
208 case "questionblock":
209 $this->in_questionblock = TRUE;
210 $this->questionblock = array();
211 $this->questionblocktitle = "";
212 $this->showQuestiontext = 1;
213 foreach ($a_attribs as $attrib => $value)
214 {
215 switch ($attrib)
216 {
217 case "showQuestiontext":
218 $this->showQuestiontext = $value;
219 break;
220 }
221 }
222 break;
223 case "surveyquestions":
224 foreach ($a_attribs as $attrib => $value)
225 {
226 switch ($attrib)
227 {
228 case "online":
229 if ($this->spl_id > 0)
230 {
231 include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
232 $spl = new ilObjSurveyQuestionPool($this->spl_id, false);
233 $spl->setOnline($value);
234 $spl->saveToDb();
235 }
236 break;
237 }
238 }
239 break;
240 case "survey":
241 $this->in_survey = TRUE;
242 foreach ($a_attribs as $attrib => $value)
243 {
244 switch ($attrib)
245 {
246 case "title":
247 if (is_object($this->survey))
248 {
249 $this->survey->setTitle($value);
250 }
251 break;
252 }
253 }
254 break;
255 case "anonymisation":
256 foreach ($a_attribs as $attrib => $value)
257 {
258 switch ($attrib)
259 {
260 case "enabled":
261 $this->anonymisation = $value;
262 break;
263 }
264 }
265 break;
266 case "access":
267 foreach ($a_attribs as $attrib => $value)
268 {
269 switch ($attrib)
270 {
271 case "type":
272 $this->surveyaccess = $value;
273 break;
274 }
275 }
276 break;
277 case "constraint":
278 array_push($this->constraints,
279 array(
280 "sourceref" => $a_attribs["sourceref"],
281 "destref" => $a_attribs["destref"],
282 "relation" => $a_attribs["relation"],
283 "value" => $a_attribs["value"],
284
285 // might be missing in old export files
286 "conjunction" => (int)$a_attribs["conjuction"]
287 )
288 );
289 break;
290 case "question":
291 // start with a new survey question
292 $type = $a_attribs["type"];
293 // patch due to changes in question types
294 switch ($type)
295 {
296 case 'SurveyNominalQuestion':
297 $type = 'SurveyMultipleChoiceQuestion';
298 foreach ($a_attribs as $key => $value)
299 {
300 switch ($key)
301 {
302 case "subtype":
303 if ($value == 1)
304 {
305 $type = 'SurveySingleChoiceQuestion';
306 }
307 else
308 {
309 $type = 'SurveyMultipleChoiceQuestion';
310 }
311 break;
312 }
313 }
314 break;
315 case 'SurveyOrdinalQuestion':
316 $type = 'SurveySingleChoiceQuestion';
317 break;
318 }
319 if (strlen($type))
320 {
321 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
323 {
324 $this->activequestion = new $type();
325
326 // if no pool is given, question will reference survey
327 $q_obj_id = $this->spl_id;
328 if($this->spl_id < 0)
329 {
330 $q_obj_id = $this->survey->getId();
331 }
332
333 $this->activequestion->setObjId($q_obj_id);
334 }
335 }
336 else
337 {
338 $this->activequestion = NULL;
339 }
340 $this->original_question_id = $a_attribs["id"];
341 if ($this->in_questionblock)
342 {
343 array_push($this->questionblock, $this->original_question_id);
344 }
345 if (is_object($this->activequestion))
346 {
347 foreach ($a_attribs as $key => $value)
348 {
349 switch ($key)
350 {
351 case "title":
352 $this->activequestion->setTitle($value);
353 break;
354 case "subtype":
355 $this->activequestion->setSubtype($value);
356 break;
357 case "obligatory":
358 $this->activequestion->setObligatory($value);
359 break;
360 }
361 }
362 }
363 break;
364 case "material":
365 switch ($this->getParent($a_xml_parser))
366 {
367 case "question":
368 case "questiontext":
369 $this->material = array();
370 break;
371 }
372 array_push($this->material, array("text" => "", "image" => "", "label" => $a_attribs["label"]));
373 break;
374 case "matimage":
375 case "label":
376 if (array_key_exists("label", $a_attribs))
377 {
378 if (preg_match("/(il_([0-9]+)_mob_([0-9]+))/", $a_attribs["label"], $matches))
379 {
380 // import an mediaobject which was inserted using tiny mce
381 if (!is_array($_SESSION["import_mob_xhtml"])) $_SESSION["import_mob_xhtml"] = array();
382 array_push($_SESSION["import_mob_xhtml"], array("mob" => $a_attribs["label"], "uri" => $a_attribs["uri"], "type" => $a_attribs["type"], "id" => $a_attribs["id"]));
383 }
384 }
385 break;
386 case "metadata":
387 $this->metadata = array();
388 break;
389 case "metadatafield":
390 array_push($this->metadata, array("label" => "", "entry" => ""));
391 break;
392 case "matrix":
393 $this->is_matrix = TRUE;
394 $this->matrix = array();
395 break;
396 case "matrixrow":
397 $this->material = array();
398 array_push($this->matrix, "");
399 $this->matrixrowattribs = array("id" => $a_attribs["id"], "label" => $a_attribs["label"], "other" => $a_attribs["other"]);
400 break;
401 case "responses":
402 $this->material = array();
403 $this->responses = array();
404 break;
405 case "variables":
406 $this->variables = array();
407 break;
408 case "response_single":
409 $this->material = array();
410 $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"]);
411 $this->response_id = $a_attribs["id"];
412 break;
413 case "response_multiple":
414 $this->material = array();
415 $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"]);
416 $this->response_id = $a_attribs["id"];
417 break;
418 case "response_text":
419 $this->material = array();
420 $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"]);
421 $this->response_id = $a_attribs["id"];
422 break;
423 case "response_num":
424 $this->material = array();
425 $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"]);
426 $this->response_id = $a_attribs["id"];
427 break;
428 case "response_time":
429 $this->material = array();
430 $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"]);
431 $this->response_id = $a_attribs["id"];
432 break;
433 case "bipolar_adjectives":
434 $this->adjectives = array();
435 break;
436 case "adjective":
437 array_push($this->adjectives, array("label" => $a_attribs["label"], "text" => ""));
438 break;
439 }
440 }
$attrib
Regular expression to match HTML/XML attribute pairs within a tag.
Definition: Sanitizer.php:41
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']

References $_SESSION, $attrib, $spl, SurveyQuestion\_includeClass(), and getParent().

+ Here is the call graph for this function:

◆ handlerCharacterData()

SurveyImportParser::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

handler for character data

Definition at line 445 of file class.SurveyImportParser.php.

446 {
447 $this->texts++;
448 $this->text_size+=strlen($a_data);
449 $this->characterbuffer .= $a_data;
450 $a_data = $this->characterbuffer;
451 }

References $characterbuffer.

◆ handlerEndTag()

SurveyImportParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element

Definition at line 456 of file class.SurveyImportParser.php.

457 {
458 switch ($a_name)
459 {
460 case "surveyobject":
461 if (is_object($this->survey))
462 {
463 $this->survey->setStatus($this->survey_status);
464 $this->survey->saveToDb();
465
466 // write question blocks
467 if (count($this->questionblocks))
468 {
469 foreach ($this->questionblocks as $data)
470 {
471 $questionblock = $data["questions"];
472 $title = $data["title"];
473 $qblock = array();
474 foreach ($questionblock as $question_id)
475 {
476 array_push($qblock, $this->questions[$question_id]);
477 }
478 $this->survey->createQuestionblock($title, $this->showQuestiontext, false, $qblock);
479 }
480 }
481
482 // #13878 - write constraints
483 if (count($this->constraints))
484 {
485 $relations = $this->survey->getAllRelations(TRUE);
486 foreach ($this->constraints as $constraint)
487 {
488 $constraint_id= $this->survey->addConstraint($this->questions[$constraint["destref"]], $relations[$constraint["relation"]]["id"], $constraint["value"], $constraint["conjunction"]);
489 $this->survey->addConstraintToQuestion($this->questions[$constraint["sourceref"]], $constraint_id);
490 }
491 }
492
493 // write textblocks
494 if (count($this->textblocks))
495 {
496 foreach ($this->textblocks as $original_id => $textblock)
497 {
498 $this->survey->saveHeading($textblock, $this->questions[$original_id]);
499 }
500 }
501 }
502 break;
503 case "survey":
504 $this->in_survey = FALSE;
505 if (is_object($this->survey))
506 {
507 if (strcmp($this->surveyaccess, "free") == 0)
508 {
509 $this->survey->setAnonymize(2);
510 }
511 else
512 {
513 if ($this->anonymisation == 0)
514 {
515 $this->survey->setAnonymize(0);
516 }
517 else
518 {
519 $this->survey->setAnonymize(1);
520 }
521 }
522 }
523 break;
524 case "startingtime":
525 if (preg_match("/(\d{4})-(\d{2})-(\d{2})T(\d{2})-(\d{2})-(\d{2}).*/", $this->characterbuffer, $matches))
526 {
527 if (is_object($this->survey))
528 {
529 $this->survey->setStartDate(sprintf("%04d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
530 $this->survey->setStartDateEnabled(1);
531 }
532 }
533 break;
534 case "endingtime":
535 if (preg_match("/(\d{4})-(\d{2})-(\d{2})T(\d{2})-(\d{2})-(\d{2}).*/", $this->characterbuffer, $matches))
536 {
537 if (is_object($this->survey))
538 {
539 $this->survey->setEndDate(sprintf("%04d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
540 $this->survey->setEndDateEnabled(1);
541 }
542 }
543 break;
544 case "description":
545 if ($this->in_survey)
546 {
547 if (is_object($this->survey))
548 {
549 $this->survey->setDescription($this->characterbuffer);
550 }
551 }
552 else
553 {
554 if (is_object($this->activequestion))
555 {
556 $this->activequestion->setDescription($this->characterbuffer);
557 }
558 }
559 break;
560 case "question":
561 if (is_object($this->activequestion))
562 {
563 if (strlen($this->textblock))
564 {
566 }
567 $this->activequestion->saveToDb();
568 // duplicate the question for the survey (if pool is to be used)
569 if (is_object($this->survey) &&
570 $this->spl_id > 0)
571 {
572 $question_id = $this->activequestion->duplicate(TRUE);
573 }
574 else
575 {
576 $question_id = $this->activequestion->getId();
577 }
578 if (is_object($this->survey)) // #15452
579 {
580 $this->survey->addQuestion($question_id);
581 }
582 $this->questions[$this->original_question_id] = $question_id;
583 $this->activequestion = NULL;
584 }
585 $this->textblock = "";
586 break;
587 case "author":
588 if ($this->in_survey)
589 {
590 if (is_object($this->survey))
591 {
592 $this->survey->setAuthor($this->characterbuffer);
593 }
594 }
595 else
596 {
597 if (is_object($this->activequestion))
598 {
599 $this->activequestion->setAuthor($this->characterbuffer);
600 }
601 }
602 break;
603 case "mattext":
604 $this->material[count($this->material)-1]["text"] = $this->characterbuffer;
605 break;
606 case "matimage":
607 $this->material[count($this->material)-1]["image"] = $this->characterbuffer;
608 break;
609 case "material":
610 if ($this->in_survey)
611 {
612 if (strcmp($this->getParent($a_xml_parser), "objectives") == 0)
613 {
614 if (strcmp($this->material[0]["label"], "introduction") == 0)
615 {
616 if (is_object($this->survey))
617 {
618 $this->survey->setIntroduction($this->material[0]["text"]);
619 }
620 }
621 if (strcmp($this->material[0]["label"], "outro") == 0)
622 {
623 if (is_object($this->survey))
624 {
625 $this->survey->setOutro($this->material[0]["text"]);
626 }
627 }
628 $this->material = array();
629 }
630 }
631 else
632 {
633 if (strcmp($this->getParent($a_xml_parser), "question") == 0)
634 {
635 $this->activequestion->setMaterial($this->material[0]["text"], TRUE, $this->material[0]["label"]);
636 }
637 }
638 break;
639 case "questiontext":
640 if (is_object($this->activequestion))
641 {
642 $questiontext = "";
643 foreach ($this->material as $matarray)
644 {
645 $questiontext .= $matarray["text"];
646 }
647 $this->activequestion->setQuestiontext($questiontext);
648 }
649 $this->material = array();
650 break;
651 case "fieldlabel":
652 $this->metadata[count($this->metadata)-1]["label"] = $this->characterbuffer;
653 break;
654 case "fieldentry":
655 $this->metadata[count($this->metadata)-1]["entry"] = $this->characterbuffer;
656 break;
657 case "metadata":
658 if (strcmp($this->getParent($a_xml_parser), "question") == 0)
659 {
660 if (is_object($this->activequestion))
661 {
662 $this->activequestion->importAdditionalMetadata($this->metadata);
663 }
664 }
665 if (strcmp($this->getParent($a_xml_parser), "survey") == 0)
666 {
667 foreach ($this->metadata as $key => $value)
668 {
669 switch ($value["label"])
670 {
671 case "SCORM":
672 if (strlen($value["entry"]))
673 {
674 if (is_object($this->survey))
675 {
676 include_once "./Services/MetaData/classes/class.ilMDSaxParser.php";
677 include_once "./Services/MetaData/classes/class.ilMD.php";
678 $md_sax_parser = new ilMDSaxParser();
679 $md_sax_parser->setXMLContent($value["entry"]);
680 $md_sax_parser->setMDObject($tmp = new ilMD($this->survey->getId(),0, "svy"));
681 $md_sax_parser->enableMDParsing(true);
682 $md_sax_parser->startParsing();
683 $this->survey->MDUpdateListener("General");
684 }
685 }
686 break;
687 case "display_question_titles":
688 if ($value["entry"] == 1)
689 {
690 $this->survey->showQuestionTitles();
691 }
692 else
693 {
694 $this->survey->hideQuestionTitles();
695 }
696 break;
697 case "status":
698 $this->survey_status = $value["entry"];
699 break;
700 case "evaluation_access":
701 $this->survey->setEvaluationAccess($value["entry"]);
702 break;
703 case "pool_usage":
704 $this->survey->setPoolUsage($value["entry"]);
705 break;
706 case "own_results_view":
707 $this->survey->setViewOwnResults($value["entry"]);
708 break;
709 case "own_results_mail":
710 $this->survey->setMailOwnResults($value["entry"]);
711 break;
712 case "mode_360":
713 $this->survey->set360Mode($value["entry"]);
714 break;
715 case "mode_360_self_eval":
716 $this->survey->set360SelfEvaluation($value["entry"]);
717 break;
718 case "mode_360_self_rate":
719 $this->survey->set360SelfRaters($value["entry"]);
720 break;
721 case "mode_360_self_appr":
722 $this->survey->set360SelfAppraisee($value["entry"]);
723 break;
724 case "mode_360_results":
725 $this->survey->set360Results($value["entry"]);
726 break;
727 case "mode_360_skill_service":
728 $this->survey->set360SkillService($value["entry"]);
729 break;
730 }
731 }
732 }
733 if (!$this->spl_exists)
734 {
735 if (strcmp($this->getParent($a_xml_parser), "surveyquestions") == 0)
736 {
737 foreach ($this->metadata as $key => $value)
738 {
739 if (strcmp($value["label"], "SCORM") == 0)
740 {
741 if (strlen($value["entry"]))
742 {
743 if ($this->spl_id > 0)
744 {
745 include_once "./Services/MetaData/classes/class.ilMDSaxParser.php";
746 include_once "./Services/MetaData/classes/class.ilMD.php";
747 include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
748 $md_sax_parser = new ilMDSaxParser();
749 $md_sax_parser->setXMLContent($value["entry"]);
750 $md_sax_parser->setMDObject($tmp = new ilMD($this->spl_id,0, "spl"));
751 $md_sax_parser->enableMDParsing(true);
752 $md_sax_parser->startParsing();
753 $spl = new ilObjSurveyQuestionPool($this->spl_id, false);
754 $spl->MDUpdateListener("General");
755 }
756 }
757 }
758 }
759 }
760 }
761 break;
762 case "responses":
763 if (is_object($this->activequestion))
764 {
765 $this->activequestion->importResponses($this->responses);
766 }
767 $this->is_matrix = FALSE;
768 break;
769 case "variable":
770 array_push($this->variables, $this->characterbuffer);
771 break;
772 case "variables":
773 if (is_object($this->activequestion))
774 {
775 $this->activequestion->importVariables($this->variables);
776 }
777 break;
778 case "response_single":
779 case "response_multiple":
780 case "response_text":
781 case "response_num":
782 case "response_time":
783 $this->responses[$this->response_id]["material"] = $this->material;
784 break;
785 case "adjective":
786 $this->adjectives[count($this->adjectives)-1]["text"] = $this->characterbuffer;
787 break;
788 case "bipolar_adjectives":
789 if (is_object($this->activequestion))
790 {
791 $this->activequestion->importAdjectives($this->adjectives);
792 }
793 break;
794 case "matrixrow":
795 $row = "";
796 foreach ($this->material as $material)
797 {
798 $row .= $material["text"];
799 }
800 $this->matrix[count($this->matrix)-1] = array('title' => $row, 'id' => $this->matrixrowattribs['id'], 'label' => $this->matrixrowattribs['label'], 'other' => $this->matrixrowattribs['other']);
801 break;
802 case "matrix":
803 if (is_object($this->activequestion))
804 {
805 $this->activequestion->importMatrix($this->matrix);
806 }
807 break;
808 case "textblock":
809 $this->textblock = $this->characterbuffer;
810 break;
811 case "questionblocktitle":
812 $this->questionblocktitle = $this->characterbuffer;
813 break;
814 case "questionblock":
815 $this->in_questionblock = FALSE;
816 array_push($this->questionblocks, array("title" => $this->questionblocktitle, "questions" => $this->questionblock));
817 break;
818 }
819 $this->depth[$a_xml_parser]--;
820 }

References $characterbuffer, $data, $material, $original_question_id, $questionblock, $response_id, $row, $spl, $textblock, and getParent().

+ Here is the call graph for this function:

◆ hasError()

SurveyImportParser::hasError ( )

Definition at line 872 of file class.SurveyImportParser.php.

References $has_error.

◆ parse()

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

parse xml file

@access private

Reimplemented from ilSaxParser.

Definition at line 154 of file class.SurveyImportParser.php.

155 {
156 switch($this->getInputType())
157 {
158 case 'file':
159
160 while($data = fread($a_fp,4096))
161 {
162 $parseOk = xml_parse($a_xml_parser,$data,feof($a_fp));
163 }
164 break;
165
166 case 'string':
167 $parseOk = xml_parse($a_xml_parser,$this->getXMLContent());
168 break;
169 }
170 if(!$parseOk
171 && (xml_get_error_code($a_xml_parser) != XML_ERROR_NONE))
172 {
173 $this->error_code = xml_get_error_code($a_xml_parser);
174 $this->error_line = xml_get_current_line_number($a_xml_parser);
175 $this->error_col = xml_get_current_column_number($a_xml_parser);
176 $this->error_msg = xml_error_string($a_xml_parser);
177 $this->has_error = TRUE;
178 return false;
179 }
180 return true;
181 }

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

+ Here is the call graph for this function:

◆ setHandlers()

SurveyImportParser::setHandlers (   $a_xml_parser)

set event handler should be overwritten by inherited class @access private

Reimplemented from ilSaxParser.

Definition at line 134 of file class.SurveyImportParser.php.

135 {
136 xml_set_object($a_xml_parser,$this);
137 xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
138 xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
139 }

◆ setSurveyObject()

SurveyImportParser::setSurveyObject ( $a_svy)

Sets a reference to a survey object @access public.

Definition at line 124 of file class.SurveyImportParser.php.

125 {
126 $this->survey =& $a_svy;
127 }

◆ startParsing()

SurveyImportParser::startParsing ( )

start the parser

Reimplemented from ilSaxParser.

Definition at line 144 of file class.SurveyImportParser.php.

145 {
146 parent::startParsing();
147 }

◆ SurveyImportParser()

SurveyImportParser::SurveyImportParser (   $a_spl_id,
  $a_xml_file = '',
  $spl_exists = FALSE 
)

Constructor.

Parameters
string$a_xml_filexml file

@access public

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

86 {
87 parent::ilSaxParser($a_xml_file);
88 $this->spl_id = $a_spl_id;
89 $this->has_error = FALSE;
90 $this->characterbuffer = "";
91 $this->survey_status = 0;
92 $this->activetag = "";
93 $this->material = array();
94 $this->depth = array();
95 $this->path = array();
96 $this->metadata = array();
97 $this->responses = array();
98 $this->variables = array();
99 $this->response_id = "";
100 $this->matrix = array();
101 $this->is_matrix = FALSE;
102 $this->adjectives = array();
103 $this->spl_exists = $spl_exists;
104 $this->survey = NULL;
105 $this->in_survey = FALSE;
106 $this->anonymisation = 0;
107 $this->surveyaccess = "restricted";
108 $this->questions = array();
109 $this->original_question_id = "";
110 $this->constraints = array();
111 $this->textblock = "";
112 $this->textblocks = array();
113 $this->in_questionblock = FALSE;
114 $this->questionblocks = array();
115 $this->questionblock = array();
116 $this->showQuestiontext = 1;
117 $this->questionblocktitle = "";
118 }

References $spl_exists.

Field Documentation

◆ $activequestion

SurveyImportParser::$activequestion

Definition at line 39 of file class.SurveyImportParser.php.

◆ $activetag

SurveyImportParser::$activetag

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

◆ $adjectives

SurveyImportParser::$adjectives

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

◆ $anonymisation

SurveyImportParser::$anonymisation

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

◆ $attributes

SurveyImportParser::$attributes

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

Referenced by getXMLAttributes().

◆ $characterbuffer

SurveyImportParser::$characterbuffer

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

Referenced by handlerCharacterData(), and handlerEndTag().

◆ $constraints

SurveyImportParser::$constraints

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

◆ $depth

SurveyImportParser::$depth

Definition at line 38 of file class.SurveyImportParser.php.

◆ $elements

SurveyImportParser::$elements

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

Referenced by getXMLElements().

◆ $error_code

SurveyImportParser::$error_code

Definition at line 41 of file class.SurveyImportParser.php.

Referenced by getErrorCode().

◆ $error_col

SurveyImportParser::$error_col

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

Referenced by getErrorColumn(), and getFullError().

◆ $error_line

SurveyImportParser::$error_line

Definition at line 42 of file class.SurveyImportParser.php.

Referenced by getErrorLine().

◆ $error_msg

SurveyImportParser::$error_msg

Definition at line 44 of file class.SurveyImportParser.php.

Referenced by getErrorMessage().

◆ $has_error

SurveyImportParser::$has_error

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

Referenced by hasError().

◆ $in_questionblock

SurveyImportParser::$in_questionblock

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

◆ $in_survey

SurveyImportParser::$in_survey

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

◆ $is_matrix

SurveyImportParser::$is_matrix

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

◆ $material

SurveyImportParser::$material

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

Referenced by handlerEndTag().

◆ $matrix

SurveyImportParser::$matrix

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

◆ $matrixrowattribs

SurveyImportParser::$matrixrowattribs

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

◆ $metadata

SurveyImportParser::$metadata

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

◆ $original_question_id

SurveyImportParser::$original_question_id

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

Referenced by handlerEndTag().

◆ $path

SurveyImportParser::$path

Definition at line 37 of file class.SurveyImportParser.php.

◆ $questionblock

SurveyImportParser::$questionblock

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

Referenced by handlerEndTag().

◆ $questionblocks

SurveyImportParser::$questionblocks

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

◆ $questionblocktitle

SurveyImportParser::$questionblocktitle

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

◆ $questions

SurveyImportParser::$questions

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

◆ $response_id

SurveyImportParser::$response_id

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

Referenced by handlerEndTag().

◆ $responses

SurveyImportParser::$responses

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

◆ $size

SurveyImportParser::$size

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

Referenced by getXMLSize().

◆ $spl

SurveyImportParser::$spl

Definition at line 40 of file class.SurveyImportParser.php.

Referenced by handlerBeginTag(), and handlerEndTag().

◆ $spl_exists

SurveyImportParser::$spl_exists

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

Referenced by SurveyImportParser().

◆ $survey

SurveyImportParser::$survey

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

◆ $survey_status

SurveyImportParser::$survey_status

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

◆ $surveyaccess

SurveyImportParser::$surveyaccess

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

◆ $text_size

SurveyImportParser::$text_size

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

Referenced by getXMLTextSize().

◆ $textblock

SurveyImportParser::$textblock

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

Referenced by handlerEndTag().

◆ $textblocks

SurveyImportParser::$textblocks

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

◆ $texts

SurveyImportParser::$texts

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

Referenced by getXMLTextSections().

◆ $variables

SurveyImportParser::$variables

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


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