ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilLOXmlWriter.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
13{
14 const TYPE_TST_PO = 1;
15 const TYPE_TST_ALL = 2;
16 const TYPE_TST_RND = 3;
17
18 private $ref_id = 0;
19 private $obj_id = 0;
20 private $writer = null;
21
25 protected $log = null;
26
30 public function __construct($a_ref_id)
31 {
32 $this->ref_id = $a_ref_id;
33 $this->obj_id = ilObject::_lookupObjectId($a_ref_id);
34
35 include_once './Services/Xml/classes/class.ilXmlWriter.php';
36 $this->writer = new ilXmlWriter();
37
38 $this->log = $GLOBALS['DIC']->logger()->crs();
39 }
40
45 protected function getWriter()
46 {
47 return $this->writer;
48 }
49
53 public function write()
54 {
55 global $DIC;
56
57 $ilSetting = $DIC['ilSetting'];
58
59 $this->getWriter()->xmlStartTag('Objectives');
60
61 // export settings
62 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
63 $settings = ilLOSettings::getInstanceByObjId($this->obj_id);
64 $settings->toXml($this->getWriter());
65
67 $course = $factory->getInstanceByRefId($this->ref_id, false);
68 if (!$course instanceof ilObjCourse) {
69 $this->log->warning('Cannot create course instance for ref_id: ' . $this->ref_id);
70 return;
71 }
72
73 include_once './Modules/Course/classes/class.ilCourseObjective.php';
74
75 $this->log->debug('Writing objective xml');
76 foreach (ilCourseObjective::_getObjectiveIds($this->obj_id) as $objective_id) {
77 $this->log->debug('Handling objective_id: ' . $objective_id);
78 $objective = new ilCourseObjective($course, $objective_id);
79 $objective->toXml($this->getWriter());
80 }
81
82 $this->getWriter()->xmlEndTag('Objectives');
83 }
84
89 public function getXml()
90 {
91 return $this->getWriter()->xmlDumpMem(false);
92 }
93}
$factory
Definition: metadata.php:43
An exception for terminatinating execution or to throw for unit testing.
class ilcourseobjective
static _getObjectiveIds($course_id, $a_activated_only=false)
static getInstanceByObjId($a_obj_id)
get singleton instance
Class ilLOXmlWriter.
__construct($a_ref_id)
Constructor.
getWriter()
Get writer.
Class ilObjCourse.
Class ilObjectFactory.
static _lookupObjectId($a_ref_id)
lookup object id
XML writer class.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
global $ilSetting
Definition: privfeed.php:17
global $DIC
Definition: saml.php:7