Public Member Functions | Data Fields

ilCourseXMLWriter Class Reference

XML writer class. More...

Inheritance diagram for ilCourseXMLWriter:
Collaboration diagram for ilCourseXMLWriter:

Public Member Functions

 ilCourseXMLWriter (&$course_obj)
 constructor
 start ()
 getXML ()
 modifyExportIdentifier ($a_tag, $a_param, $a_value)
 __buildHeader ()
 __buildMetaData ()
 __buildAdmin ()
 __buildTutor ()
 __buildMember ()
 __buildSubscriber ()
 __buildSetting ()
 __buildObject ($a_parent_id)
 __buildFooter ()

Data Fields

 $ilias
 $xml
 $course_obj

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 <smeyer@databay.de>
Version:
Id:
class.ilCourseXMLWriter.php 4551 2004-07-28 15:18:11Z smeyer

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


Member Function Documentation

ilCourseXMLWriter::__buildAdmin (  ) 

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

References $data, $id, ilXmlWriter::xmlEndTag(), and ilXmlWriter::xmlStartTag().

Referenced by start().

        {
                $this->course_obj->initCourseMemberObject();

                foreach($this->course_obj->members_obj->getAdmins() as $id)
                {
                        $data = $this->course_obj->members_obj->getUserData($id);

                        $attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$id;
                        $attr['status'] = $data['status'];

                        $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::__buildFooter (  ) 

Definition at line 278 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 100 of file class.ilCourseXMLWriter.php.

References ilXmlWriter::xmlHeader(), ilXmlWriter::xmlSetDtdDef(), ilXmlWriter::xmlSetGenCmt(), and ilXmlWriter::xmlStartTag().

Referenced by start().

        {
                $this->xmlSetDtdDef("<!DOCTYPE Course SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_course.dtd\">");
                $this->xmlSetGenCmt("Export of ILIAS course ".
                                                        $this->course_obj->getId()." of installation ".$this->ilias->getSetting('inst_id').".");
                $this->xmlHeader();

                $attrs["exportVersion"] = $this->EXPORT_VERSION;
                $attrs["id"] = "il_".$this->ilias->getSetting('inst_id').'_course_'.$this->course_obj->getId();
                $this->xmlStartTag("Course", $attrs);

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilCourseXMLWriter::__buildMember (  ) 

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

References $data, $id, ilXmlWriter::xmlEndTag(), and ilXmlWriter::xmlStartTag().

Referenced by start().

        {
                $this->course_obj->initCourseMemberObject();

                foreach($this->course_obj->members_obj->getMembers() as $id)
                {
                        $data = $this->course_obj->members_obj->getUserData($id);

                        $attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$id;
                        $attr['status'] = $data['status'];

                        $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 113 of file class.ilCourseXMLWriter.php.

References ilXmlWriter::appendXML().

Referenced by start().

        {
                include_once "./classes/class.ilNestedSetXML.php";

                $nested = new ilNestedSetXML();
                $nested->setParameterModifier($this, "modifyExportIdentifier");
                $this->appendXML($nested->export($this->course_obj->getId(),$this->course_obj->getType()));
                
                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 240 of file class.ilCourseXMLWriter.php.

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

Referenced by start().

        {
                $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:

Here is the caller graph for this function:

ilCourseXMLWriter::__buildSetting (  ) 

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

References ilXmlWriter::xmlElement(), ilXmlWriter::xmlEndTag(), and ilXmlWriter::xmlStartTag().

Referenced by start().

        {
                $this->xmlStartTag('Settings');

                $this->xmlElement('Syllabus',null,$this->course_obj->getSyllabus());

                $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');

                $attr = array();
                $attr["Unlimited"] = $this->course_obj->getActivationUnlimitedStatus() ? 1 : 0;
                $attr["Offline"] = $this->course_obj->getOfflineStatus() ? 1 : 0;
                $this->xmlStartTag('Activation',$attr);
                $this->xmlElement('Start',null,$this->course_obj->getActivationStart());
                $this->xmlElement('End',null,$this->course_obj->getActivationEnd());
                $this->xmlEndTag('Activation');

                $attr = array();
                $attr['Unlimited'] = $this->course_obj->getSubscriptionUnlimitedStatus() ? 1 : 0;
                $attr['MaxMembers'] = $this->course_obj->getSubscriptionMaxMembers();
                $attr['Notify'] = $this->course_obj->getSubscriptionNotify() ? 1 : 0;
                $attr['Type'] = $this->course_obj->getSubscriptionType();
                $this->xmlStartTag('Subscription',$attr);
                $this->xmlElement('Start',null,$this->course_obj->getSubscriptionStart());
                $this->xmlElement('End',null,$this->course_obj->getSubscriptionEnd());
                $this->xmlElement('Password',null,$this->course_obj->getSubscriptionPassword());
                $this->xmlEndTag('Subscription');

                $attr = array();
                $attr['SortType'] = $this->course_obj->getOrderType();
                $this->xmlElement('Sort',$attr);

                $attr = array();
                $attr['Type'] = $this->course_obj->getArchiveType();
                $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');
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilCourseXMLWriter::__buildSubscriber (  ) 

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

References $data, $id, 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 141 of file class.ilCourseXMLWriter.php.

References $data, $id, ilXmlWriter::xmlEndTag(), and ilXmlWriter::xmlStartTag().

Referenced by start().

        {
                $this->course_obj->initCourseMemberObject();

                foreach($this->course_obj->members_obj->getTutors() as $id)
                {
                        $data = $this->course_obj->members_obj->getUserData($id);

                        $attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$id;
                        $attr['status'] = $data['status'];

                        $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::getXML (  ) 

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

References ilXmlWriter::xmlDumpMem().

        {
                return $this->xmlDumpMem();
        }

Here is the call graph for this function:

ilCourseXMLWriter::ilCourseXMLWriter ( &$  course_obj  ) 

constructor

Parameters:
string xml version
string output encoding
string input encoding public

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

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

        {
                global $ilias;

                parent::ilXmlWriter();

                $this->EXPORT_VERSION = 1;

                $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 89 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::start (  ) 

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

References __buildAdmin(), __buildFooter(), __buildHeader(), __buildMember(), __buildMetaData(), __buildObject(), __buildSetting(), __buildSubscriber(), and __buildTutor().

        {
                $this->__buildHeader();
                $this->__buildMetaData();
                
                $this->__buildAdmin();
                $this->__buildTutor();
                $this->__buildMember();
                $this->__buildSubscriber();

                $this->__buildSetting();

                $this->__buildObject($this->course_obj->getRefId());
                
                $this->__buildFooter();
        }

Here is the call graph for this function:


Field Documentation

ilCourseXMLWriter::$course_obj

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

Referenced by ilCourseXMLWriter().

ilCourseXMLWriter::$ilias

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

Referenced by ilCourseXMLWriter().

ilCourseXMLWriter::$xml

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


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