ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCourseXMLWriter Class Reference

XML writer class. More...

+ Inheritance diagram for ilCourseXMLWriter:
+ Collaboration diagram for ilCourseXMLWriter:

Public Member Functions

 ilCourseXMLWriter (&$course_obj)
 constructor
 setMode ($a_mode)
 getMode ()
 start ()
 getXML ()
 modifyExportIdentifier ($a_tag, $a_param, $a_value)
 __buildHeader ()
 __buildCourseStart ()
 __buildMetaData ()
 __buildAdmin ()
 __buildTutor ()
 __buildMember ()
 __buildSubscriber ()
 __buildWaitingList ()
 __buildSetting ()
 __buildObject ($a_parent_id)
 __buildFooter ()
 setAttachUsers ($value)
 write access to attach user property, if set to false no users will be attached.
- Public Member Functions inherited from ilXmlWriter
 ilXmlWriter ($version="1.0", $outEnc="utf-8", $inEnc="utf-8")
 constructor
 _ilXmlWriter ()
 destructor public
 xmlSetDtdDef ($dtdDef)
 Sets dtd definition.
 xmlSetStSheet ($stSheet)
 Sets stylesheet.
 xmlSetGenCmt ($genCmt)
 Sets generated comment.
 _xmlEscapeData ($data)
 Escapes reserved characters.
 xmlEncodeData ($data)
 Encodes text from input encoding into output encoding.
 xmlFormatData ($data)
 Indents text for better reading.
 xmlFormatElement ($array)
 Callback function for xmlFormatData; do not invoke directly.
 xmlHeader ()
 Writes xml header public.
 xmlStartTag ($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
 Writes a starttag.
 xmlEndTag ($tag)
 Writes an endtag.
 xmlComment ($comment)
 Writes a comment.
 xmlData ($data, $encode=TRUE, $escape=TRUE)
 Writes data.
 xmlElement ($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
 Writes a basic element (no children, just textual content)
 xmlDumpFile ($file, $format=TRUE)
 Dumps xml document from memory into a file.
 xmlDumpMem ($format=TRUE)
 Returns xml document from memory.
 appendXML ($a_str)
 append xml string to document
 xmlClear ()
 clears xmlStr public

Data Fields

const MODE_SOAP = 1
const MODE_EXPORT = 2
- Data Fields inherited from ilXmlWriter
 $xmlStr
 $version
 $outEnc
 $inEnc
 $dtdDef = ""
 $stSheet = ""
 $genCmt = "Generated by ILIAS XmlWriter"

Private Member Functions

 __buildAdvancedMetaData ()
 Build advanced meta data.

Private Attributes

 $mode = self::MODE_SOAP
 $ilias
 $xml
 $course_obj
 $attach_users = true

Detailed Description

XML writer class.

Class to simplify manual writing of xml documents. It only supports writing xml sequentially, because the xml document is saved in a string with no additional structure information. The author is responsible for well-formedness and validity of the xml document.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id:
class.ilCourseXMLWriter.php 25692 2010-09-15 09:44:16Z mwarkus

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

Member Function Documentation

ilCourseXMLWriter::__buildAdmin ( )

Definition at line 176 of file class.ilCourseXMLWriter.php.

References ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by start().

{
$this->course_obj->initCourseMemberObject();
foreach($this->course_obj->members_obj->getAdmins() as $id)
{
$attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$id;
$attr['notification'] = ($this->course_obj->members_obj->isNotificationEnabled($id)) ? 'Yes' : 'No';
$attr['passed'] = $this->course_obj->members_obj->hasPassed($id) ? 'Yes' : 'No';
$this->xmlStartTag('Admin',$attr);
$this->xmlEndTag('Admin');
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseXMLWriter::__buildAdvancedMetaData ( )
private

Build advanced meta data.

private

Definition at line 170 of file class.ilCourseXMLWriter.php.

References ilAdvancedMDValues\_appendXMLByObjId().

Referenced by start().

{
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
ilAdvancedMDValues::_appendXMLByObjId($this,$this->course_obj->getId());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseXMLWriter::__buildCourseStart ( )

Definition at line 145 of file class.ilCourseXMLWriter.php.

References ilXmlWriter\xmlStartTag().

Referenced by start().

{
$attrs["exportVersion"] = $this->EXPORT_VERSION;
$attrs["id"] = "il_".$this->ilias->getSetting('inst_id').'_crs_'.$this->course_obj->getId();
$attrs['showMembers'] = ($this->course_obj->getShowMembers() ? 'Yes' : 'No');
$this->xmlStartTag("Course", $attrs);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseXMLWriter::__buildFooter ( )

Definition at line 421 of file class.ilCourseXMLWriter.php.

References ilXmlWriter\xmlEndTag().

Referenced by start().

{
$this->xmlEndTag('Course');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseXMLWriter::__buildHeader ( )

Definition at line 135 of file class.ilCourseXMLWriter.php.

References ilXmlWriter\xmlHeader(), ilXmlWriter\xmlSetDtdDef(), and ilXmlWriter\xmlSetGenCmt().

Referenced by start().

{
$this->xmlSetDtdDef("<!DOCTYPE Course PUBLIC \"-//ILIAS//DTD Course//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_course_3_10.dtd\">");
$this->xmlSetGenCmt("Export of ILIAS course ". $this->course_obj->getId()." of installation ".$this->ilias->getSetting('inst_id').".");
$this->xmlHeader();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseXMLWriter::__buildMember ( )

Definition at line 207 of file class.ilCourseXMLWriter.php.

References ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by start().

{
$this->course_obj->initCourseMemberObject();
foreach($this->course_obj->members_obj->getMembers() as $id)
{
$attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$id;
$attr['blocked'] = ($this->course_obj->members_obj->isBlocked($id)) ? 'Yes' : 'No';
$attr['passed'] = $this->course_obj->members_obj->hasPassed($id) ? 'Yes' : 'No';
$this->xmlStartTag('Member',$attr);
$this->xmlEndTag('Member');
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseXMLWriter::__buildMetaData ( )

Definition at line 153 of file class.ilCourseXMLWriter.php.

References ilXmlWriter\appendXML(), and ilMD2XML\startExport().

Referenced by start().

{
include_once 'Services/MetaData/classes/class.ilMD2XML.php';
$md2xml = new ilMD2XML($this->course_obj->getId(),$this->course_obj->getId(),'crs');
$md2xml->startExport();
$this->appendXML($md2xml->getXML());
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseXMLWriter::__buildObject (   $a_parent_id)

Definition at line 383 of file class.ilCourseXMLWriter.php.

References ilObjectFactory\getInstanceByRefId(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

{
$this->course_obj->initCourseItemObject();
$this->course_obj->items_obj->setParentId($a_parent_id);
foreach($this->course_obj->items_obj->getAllItems() as $item)
{
if(!$tmp_obj =& ilObjectFactory::getInstanceByRefId($item['child'],false))
{
continue;
}
$attr = array();
$attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_'.$tmp_obj->getType().'_'.$item['child'];
$attr['type'] = $tmp_obj->getType();
$attr['Unlimited'] = $item['activation_unlimited'] ? 1 : 0;
$attr['Position'] = $item['position'];
$this->xmlStartTag('Object',$attr);
$this->xmlElement('Title',null,$item['title']);
$this->xmlElement('Description',null,$item['description']);
$this->xmlElement('Start',null,$item['activation_start']);
$this->xmlElement('End',null,$item['activation_end']);
if($item['type'] == 'file')
{
$this->xmlElement('FileType',null,$tmp_obj->getFileType());
}
$this->__buildObject($item['child']);
$this->xmlEndTag('Object');
unset($tmp_obj);
}
}

+ Here is the call graph for this function:

ilCourseXMLWriter::__buildSetting ( )

Definition at line 259 of file class.ilCourseXMLWriter.php.

References IL_CRS_ARCHIVE_DOWNLOAD, IL_CRS_SUBSCRIPTION_CONFIRMATION, IL_CRS_SUBSCRIPTION_DEACTIVATED, IL_CRS_SUBSCRIPTION_DIRECT, IL_CRS_SUBSCRIPTION_UNLIMITED, IL_CRS_VIEW_ARCHIVE, ilContainer\SORT_MANUAL, ilContainer\SORT_TITLE, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by start().

{
$this->xmlStartTag('Settings');
// Availability
$this->xmlStartTag('Availability');
if($this->course_obj->getOfflineStatus())
{
$this->xmlElement('NotAvailable');
}
elseif($this->course_obj->getActivationUnlimitedStatus())
{
$this->xmlElement('Unlimited');
}
else
{
$this->xmlStartTag('TemporarilyAvailable');
$this->xmlElement('Start',null,$this->course_obj->getActivationStart());
$this->xmlElement('End',null,$this->course_obj->getActivationEnd());
$this->xmlEndTag('TemporarilyAvailable');
}
$this->xmlEndTag('Availability');
// Syllabus
$this->xmlElement('Syllabus',null,$this->course_obj->getSyllabus());
$this->xmlElement('ImportantInformation',null,$this->course_obj->getImportantInformation());
// Contact
$this->xmlStartTag('Contact');
$this->xmlElement('Name',null,$this->course_obj->getContactName());
$this->xmlElement('Responsibility',null,$this->course_obj->getContactResponsibility());
$this->xmlElement('Phone',null,$this->course_obj->getContactPhone());
$this->xmlElement('Email',null,$this->course_obj->getContactEmail());
$this->xmlElement('Consultation',null,$this->course_obj->getContactConsultation());
$this->xmlEndTag('Contact');
// Registration
$attr = array();
if($this->course_obj->getSubscriptionType() == IL_CRS_SUBSCRIPTION_CONFIRMATION)
{
$attr['registrationType'] = 'Confirmation';
}
elseif($this->course_obj->getSubscriptionType() == IL_CRS_SUBSCRIPTION_DIRECT)
{
$attr['registrationType'] = 'Direct';
}
else
{
$attr['registrationType'] = 'Password';
}
$attr['maxMembers'] = $this->course_obj->getSubscriptionMaxMembers();
$attr['notification'] = $this->course_obj->getSubscriptionNotify() ? 'Yes' : 'No';
$attr['waitingList'] = $this->course_obj->enabledWaitingList() ? 'Yes' : 'No';
$this->xmlStartTag('Registration',$attr);
if($this->course_obj->getSubscriptionLimitationType() == IL_CRS_SUBSCRIPTION_DEACTIVATED)
{
$this->xmlElement('Disabled');
}
elseif($this->course_obj->getSubscriptionLimitationType() == IL_CRS_SUBSCRIPTION_UNLIMITED)
{
$this->xmlElement('Unlimited');
}
else
{
$this->xmlStartTag('TemporarilyAvailable');
$this->xmlElement('Start',null,$this->course_obj->getSubscriptionStart());
$this->xmlElement('End',null,$this->course_obj->getSubscriptionEnd());
$this->xmlEndTag('TemporarilyAvailable');
}
if(strlen($pwd = $this->course_obj->getSubscriptionPassword()))
{
$this->xmlElement('Password',null,$pwd);
}
$this->xmlEndTag('Registration');
// Sort
$attr = array();
if($this->course_obj->getOrderType() == ilContainer::SORT_MANUAL)
{
$attr['type'] = 'Manual';
}
elseif($this->course_obj->getOrderType() == ilContainer::SORT_TITLE)
{
$attr['type'] = 'Title';
}
else
{
$attr['type'] = 'Activation';
}
$this->xmlElement('Sort',$attr);
// Archives
$attr = array();
if($this->course_obj->getViewMode() != IL_CRS_VIEW_ARCHIVE)
{
$attr['Access'] = 'Disabled';
}
elseif($this->course_obj->getViewMode() == IL_CRS_VIEW_ARCHIVE)
{
$attr['Access'] = 'Read';
}
if($this->course_obj->getArchiveType() == IL_CRS_ARCHIVE_DOWNLOAD)
{
$attr['Access'] = 'Download';
}
$this->xmlStartTag('Archive',$attr);
$this->xmlElement('Start',null,$this->course_obj->getArchiveStart());
$this->xmlElement('End',null,$this->course_obj->getArchiveEnd());
$this->xmlEndTag('Archive');
$this->xmlEndTag('Settings');
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseXMLWriter::__buildSubscriber ( )

Definition at line 223 of file class.ilCourseXMLWriter.php.

References $data, ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by start().

{
$this->course_obj->initCourseMemberObject();
foreach($this->course_obj->members_obj->getSubscribers() as $id)
{
$data = $this->course_obj->members_obj->getSubscriberData($id);
$attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$id;
$attr['subscriptionTime'] = $data['time'];
$this->xmlStartTag('Subscriber',$attr);
$this->xmlEndTag('Subscriber');
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseXMLWriter::__buildTutor ( )

Definition at line 192 of file class.ilCourseXMLWriter.php.

References ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by start().

{
$this->course_obj->initCourseMemberObject();
foreach($this->course_obj->members_obj->getTutors() as $id)
{
$attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$id;
$attr['notification'] = ($this->course_obj->members_obj->isNotificationEnabled($id)) ? 'Yes' : 'No';
$attr['passed'] = $this->course_obj->members_obj->hasPassed($id) ? 'Yes' : 'No';
$this->xmlStartTag('Tutor',$attr);
$this->xmlEndTag('Tutor');
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseXMLWriter::__buildWaitingList ( )

Definition at line 240 of file class.ilCourseXMLWriter.php.

References $data, ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by start().

{
include_once 'Modules/Course/classes/class.ilCourseWaitingList.php';
$waiting_list = new ilCourseWaitingList($this->course_obj->getId());
foreach($waiting_list->getAllUsers() as $data)
{
$attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$data['usr_id'];
$attr['position'] = $data['position'];
$attr['subscriptionTime'] = $data['time'];
$this->xmlStartTag('WaitingList',$attr);
$this->xmlEndTag('WaitingList');
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseXMLWriter::getMode ( )

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

References $mode.

Referenced by start().

{
return $this->mode;
}

+ Here is the caller graph for this function:

ilCourseXMLWriter::getXML ( )

Definition at line 117 of file class.ilCourseXMLWriter.php.

References ilXmlWriter\xmlDumpMem().

{
#var_dump("<pre>", htmlentities($this->xmlDumpMem()),"<pre>");
return $this->xmlDumpMem(false);
}

+ Here is the call graph for this function:

ilCourseXMLWriter::ilCourseXMLWriter ( $course_obj)

constructor

Parameters
stringxml version
stringoutput encoding
stringinput encoding public

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

References $course_obj, $ilias, and ilXmlWriter\ilXmlWriter().

{
global $ilias;
$this->EXPORT_VERSION = "2";
$this->ilias =& $ilias;
$this->course_obj =& $course_obj;
}

+ Here is the call graph for this function:

ilCourseXMLWriter::modifyExportIdentifier (   $a_tag,
  $a_param,
  $a_value 
)

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

{
if ($a_tag == "Identifier" && $a_param == "Entry")
{
$a_value = "il_".$this->ilias->getSetting('inst_id')."_crs_".$this->course_obj->getId();
}
return $a_value;
}
ilCourseXMLWriter::setAttachUsers (   $value)

write access to attach user property, if set to false no users will be attached.

Parameters
unknown_type$value

Definition at line 431 of file class.ilCourseXMLWriter.php.

{
$this->attach_users = $value ? true : false;
}
ilCourseXMLWriter::setMode (   $a_mode)

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

{
$this->mode = $a_mode;
}
ilCourseXMLWriter::start ( )

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

References __buildAdmin(), __buildAdvancedMetaData(), __buildCourseStart(), __buildFooter(), __buildHeader(), __buildMember(), __buildMetaData(), __buildSetting(), __buildSubscriber(), __buildTutor(), __buildWaitingList(), and getMode().

{
if($this->getMode() == self::MODE_SOAP)
{
$this->__buildHeader();
$this->__buildMetaData();
if ($this->attach_users)
{
$this->__buildAdmin();
$this->__buildTutor();
$this->__buildMember();
}
$this->__buildSetting();
#$this->__buildObject($this->course_obj->getRefId());
$this->__buildFooter();
}
elseif($this->getMode() == self::MODE_EXPORT)
{
$this->__buildMetaData();
$this->__buildSetting();
$this->__buildFooter();
}
}

+ Here is the call graph for this function:

Field Documentation

ilCourseXMLWriter::$attach_users = true
private

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

ilCourseXMLWriter::$course_obj
private

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

Referenced by ilCourseXMLWriter().

ilCourseXMLWriter::$ilias
private

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

Referenced by ilCourseXMLWriter().

ilCourseXMLWriter::$mode = self::MODE_SOAP
private

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

Referenced by getMode().

ilCourseXMLWriter::$xml
private

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

const ilCourseXMLWriter::MODE_EXPORT = 2

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

Referenced by ilCourseExporter\getXmlRepresentation().

const ilCourseXMLWriter::MODE_SOAP = 1

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


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