ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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  public function __construct($a_ref_id)
26  {
27  $this->ref_id = $a_ref_id;
28  $this->obj_id = ilObject::_lookupObjectId($a_ref_id);
29 
30  include_once './Services/Xml/classes/class.ilXmlWriter.php';
31  $this->writer = new ilXmlWriter();
32  }
33 
38  protected function getWriter()
39  {
40  return $this->writer;
41  }
42 
46  public function write()
47  {
48  global $ilSetting;
49 
50  $this->getWriter()->xmlStartTag('Objectives');
51 
52  // export settings
53  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
54  $settings = ilLOSettings::getInstanceByObjId($this->obj_id);
55  $settings->toXml($this->getWriter());
56 
57  $factory = new ilObjectFactory();
58  $course = $factory->getInstanceByRefId($this->ref_id,false);
59  if(!$course instanceof ilObjCourse)
60  {
61  $GLOBALS['ilLog']->write(__METHOD__.': Cannot create course instance');
62  return;
63  }
64 
65  include_once './Modules/Course/classes/class.ilCourseObjective.php';
66  foreach(ilCourseObjective::_getObjectiveIds($this->obj_id) as $objective_id)
67  {
68  $objective = new ilCourseObjective($course, $objective_id);
69  $objective->toXml($this->getWriter());
70  }
71 
72  $this->getWriter()->xmlEndTag('Objectives');
73  }
74 
79  public function getXml()
80  {
81  return $this->getWriter()->xmlDumpMem(false);
82  }
83 }
84 ?>
static getInstanceByObjId($a_obj_id)
get singleton instance
__construct($a_ref_id)
Constructor.
Class ilObjectFactory.
static _getObjectiveIds($course_id, $a_activated_only=false)
XML writer class.
getWriter()
Get writer.
static _lookupObjectId($a_ref_id)
lookup object id
write()
Write xml.
Class ilLOXmlWriter.
Class ilObjCourse.
class ilcourseobjective
global $ilSetting
Definition: privfeed.php:40
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276