ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSCORM2004SeqTemplate Class Reference

Class ilSCORM2004Chapter. More...

+ Inheritance diagram for ilSCORM2004SeqTemplate:
+ Collaboration diagram for ilSCORM2004SeqTemplate:

Public Member Functions

 ilSCORM2004SeqTemplate ($a_slm_object, $a_id=0)
 Constructor public.
 ilSCORM2004SeqTemplate ($a_identifier)
 getMetadataProperties ()
 function getMetadataProperties
 getIdentifier ()
 function getIdentifier
 insertTemplateForObjectAtParent ($a_object, $a_parent, $a_target)
 importTemplate ($a_target, $a_object, $a_parent, $node)
 function import Template
 insert ($a_insert_node=false)
 getSeqNodeId ()
 getId ()
 Get Node ID.
 setSeqNodeId ($a_seqnodeid)
 setId ($a_id)
 Set Node ID.
- Public Member Functions inherited from ilSCORM2004SeqNode
 ilSCORM2004SeqNode ()
 Constructor public.
 getNodeName ()
 getTreenodeId ()
 setNodeName ($a_nodeName)
 setTreenodeId ($a_treenodeId)
 insert ()
 update ($a_seq_node_id)
- Public Member Functions inherited from ilSCORM2004Chapter
 ilSCORM2004Chapter ($a_slm_object, $a_id=0)
 Constructor public.
 delete ($a_delete_meta_data=true)
 Delete a chapter.
 copy ($a_target_slm)
 Copy chapter.
 exportXML (&$a_xml_writer, $a_inst, &$expLog)
 Export object to xml (see ilias_co.dtd)
 exportXMLMetaData (&$a_xml_writer)
 export structure objects meta data to xml (see ilias_co.dtd)
 _getPresentationTitle ($a_st_id, $a_include_numbers=false)
 get presentation title
 exportXMLPageObjects (&$a_xml_writer, $a_inst=0)
 export page objects of structure object (see ilias_co.dtd)
 exportXMLStructureObjects (&$a_xml_writer, $a_inst, &$expLog)
 export (sub)structure objects of structure object (see ilias_co.dtd)
 exportFOPageObjects (&$a_xml_writer)
 export object to fo
- Public Member Functions inherited from ilSCORM2004Node
 ilSCORM2004Node ($a_slm_object, $a_id=0)
 setTitle ($a_title)
 Set title.
 getTitle ()
 Get title.
 setDescription ($a_description)
 Set description.
 getDescription ()
 Get description.
 setType ($a_type)
 Set type.
 getType ()
 Get type.
 setSLMId ($a_slm_id)
 Set ID of parent Scorm Learning Module Object.
 getSLMId ()
 Get ID of parent Scorm Learning Module Object.
 setSLMObject ($a_slm_obj)
 Set Scorm Learning Module Object.
 getContentObject ()
 Get Scorm Learning Module Object.
 getImportId ()
 Set Import ID.
 setImportId ($a_id)
 Get Import ID.
 read ()
 Read Data of Node.
 MDUpdateListener ($a_element)
 Meta data update listener.
 createMetaData ()
 create meta data entry
 updateMetaData ()
 update meta data entry
 deleteMetaData ()
 delete meta data entry
 setDataRecord ($a_record)
 this method should only be called by class ilSCORM2004NodeFactory
 create ($a_upload=false)
 Create Node.
 update ()
 Update Node.
 delete ()
 Delete Node.
 _getIdForImportId ($a_import_id)
 Get Node ID for import ID (static)
 _exists ($a_id)
 Checks wether a node exists.
 _deleteAllSLMNodes ($a_slm_object)
 Delete all nodes of Scorm Learning Module.
 _lookupSLMID ($a_id)
 Lookup Scorm Learning Module ID for node id.
 clipboardCut ($a_slm_obj_id, $a_ids)
 Cut and copy a set of chapters/pages into the clipboard.
 insertChapterClip ($a_slm_obj, $a_as_sub=false)
 Insert Chapter from clipboard.
 getObjectives ()
 deleteSeqInfo ()
 parentHasSeqTemplate ()
 exportAsScorm12 ()
 exportAsScorm13 ()

Static Public Member Functions

static availableTemplates ()
static getFileNameForIdentifier ($a_identifier)
static templateForChapter ($a_chapter_id)

Data Fields

const SEQ_TEMPLATE_DIR = './Modules/Scorm2004/templates/sequencing/'
const SEQ_TEMPLATE_XSL = './Modules/Scorm2004/templates/xsl/seq_template.xsl'
const SEQ_TEMPLATE_XSD = './Modules/Scorm2004/templates/editor/seq_templates/xsd/seq_template.xsd'
- Data Fields inherited from ilSCORM2004Chapter
 $tree
- Data Fields inherited from ilSCORM2004Node
 $slm_id
 $type
 $id
 $slm_object

Private Member Functions

 generateObjIds ($a_dom)

Private Attributes

 $template
 $template_file
 $normalized_template
 $tree_node
 $diagnostic = array ()
 $parentchapter = true
 $importId
 $id = null
 $seqNodeId = null
 $sahs_sc13_treeId = null
 $importid

Additional Inherited Members

- Protected Attributes inherited from ilSCORM2004SeqNode
 $db = null

Detailed Description

Class ilSCORM2004Chapter.

Sequencing Template class for SCORM 2004 Editing

Author
Hendrik Holtmann holtm.nosp@m.ann@.nosp@m.me.co.nosp@m.m
Version
$Id$

Definition at line 36 of file class.ilSCORM2004SeqRule.php.

Member Function Documentation

static ilSCORM2004SeqTemplate::availableTemplates ( )
static

Definition at line 112 of file class.ilSCORM2004SeqTemplate.php.

References $ilDB, $query, $result, and $row.

Referenced by ilObjSCORM2004LearningModuleGUI\insertScenarioGUI().

{
global $ilDB;
$arr_templates = array();
$query = "SELECT * FROM sahs_sc13_seq_templts ORDER BY identifier";
$result = $ilDB->query($query);
while($row = $ilDB->fetchAssoc($result))
{
if($row['identifier']!="pretestpost") { //temporarily deactivated
array_push($arr_templates,new ilScorm2004SeqTemplate($row['identifier']));
}
}
return $arr_templates;
}

+ Here is the caller graph for this function:

ilSCORM2004SeqTemplate::generateObjIds (   $a_dom)
private

Definition at line 251 of file class.ilSCORM2004SeqTemplate.php.

{
}
static ilSCORM2004SeqTemplate::getFileNameForIdentifier (   $a_identifier)
static

Definition at line 302 of file class.ilSCORM2004SeqTemplate.php.

References $ilDB, and $query.

Referenced by ilSCORM2004SeqTemplate().

{
global $ilDB;
$query = "SELECT * FROM sahs_sc13_seq_templts WHERE identifier = ".
$ilDB->quote($a_identifier, "text");
$obj_set = $ilDB->query($query);
$obj_rec = $ilDB->fetchAssoc($obj_set);
return $obj_rec["fileName"]; // fixed, switch to all lowercase fields and tables in the future for mdb2 compliance
return $obj_rec["filename"];
}

+ Here is the caller graph for this function:

ilSCORM2004SeqTemplate::getId ( )

Get Node ID.

Parameters
intNode ID

Reimplemented from ilSCORM2004Node.

Definition at line 281 of file class.ilSCORM2004SeqTemplate.php.

References $id.

{
return $this->id;
}
ilSCORM2004SeqTemplate::getIdentifier ( )

function getIdentifier

Returns
get identifier for template
Author
Hendrik Holtmann

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

{
$seqtemplate = $this->template->getElementsByTagName("seqTemplate");
return $seqtemplate->item(0)->getAttribute("identifier");;
}
ilSCORM2004SeqTemplate::getMetadataProperties ( )

function getMetadataProperties

Returns
hash of metadata for the template
Author
Hendrik Holtmann

Definition at line 99 of file class.ilSCORM2004SeqTemplate.php.

{
$array_metad = array();
$metadata = $this->template->getElementsByTagName("metadata");
$nodes = $metadata->item(0)->childNodes;
for ($i = 0; $i < $nodes->length; $i++ ) {
$curNode = $nodes->item($i);
$array_metad[$curNode->localName] = $curNode->nodeValue;
}
return $array_metad;
}
ilSCORM2004SeqTemplate::getSeqNodeId ( )

Definition at line 276 of file class.ilSCORM2004SeqTemplate.php.

References $seqNodeId.

{
}
ilSCORM2004SeqTemplate::ilSCORM2004SeqTemplate (   $a_slm_object,
  $a_id = 0 
)

Constructor public.

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

{
parent::ilSCORM2004SeqTemplate($a_slm_object, $a_id);
}
ilSCORM2004SeqTemplate::ilSCORM2004SeqTemplate (   $a_identifier)

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

References $_SESSION, $test, getFileNameForIdentifier(), ilSCORM2004SeqNode\ilSCORM2004SeqNode(), and ilSCORM2004SeqNode\setNodeName().

{
$this->setNodeName("seqtemplate");
if ($a_identifier==null) {return;}
$t_file = self::getFileNameForIdentifier($a_identifier);
$this->template = new DOMDocument;
$this->template->async = false;
//look for template in lang_dir, fallback to en
$test = self::SEQ_TEMPLATE_DIR."/".$_SESSION["lang"]."/".$t_file;
if (file_exists($test))
{
$this->template_file = $test;
} else {
$this->template_file = self::SEQ_TEMPLATE_DIR."/en/".$t_file;
}
if (!@$this->template->load($this->template_file))
{
$this->diagnostic[] = 'Template not wellformed';
$test = $this->template->saveXML();
return false;
} else {
return true;
}
}

+ Here is the call graph for this function:

ilSCORM2004SeqTemplate::importTemplate (   $a_target,
  $a_object,
  $a_parent,
  $node 
)

function import Template

Returns
success of import
Author
Hendrik Holtmann

Definition at line 155 of file class.ilSCORM2004SeqTemplate.php.

References $ilDB, $importId, $sahs_sc13_treeId, $title, ilSCORM2004Chapter\ilSCORM2004Chapter(), and ilSCORM2004Node\putInTree().

Referenced by insertTemplateForObjectAtParent().

{
global $ilDB;
switch($node->getAttribute('type'))
{
case "lesson":
if ($this->parentchapter==true)
{
$chap = new ilSCORM2004SeqChapter($a_object);
} else {
$chap = new ilSCORM2004Chapter($a_object);
}
$chap->setTitle($node->getElementsByTagName("title")->item(0)->nodeValue);
$chap->setSLMId($a_object->getId());
$chap->create();
$this->sahs_sc13_treeId = $chap->getId();
ilSCORM2004Node::putInTree($chap, $a_parent,$a_target);
if ($this->parentchapter==true)
{
$ilDB->manipulate("INSERT INTO sahs_sc13_seq_assign (identifier, sahs_sc13_tree_node_id) VALUES ".
"(".$ilDB->quote($this->getIdentifier(), "text").",".
$ilDB->quote($this->sahs_sc13_treeId, "integer").")");
$this->parentchapter = false;
}
$new_id = $chap->getId();
break;
case "sco" :
$sco = new ilSCORM2004Sco($a_object);
$sco->setTitle($node->getElementsByTagName("title")->item(0)->nodeValue);
$sco->setSLMId($a_object->getId());
$sco->create(false,true);
$this->sahs_sc13_treeId = $sco->getId();
ilSCORM2004Node::putInTree($sco, $a_parent, $target);
$new_id = $sco->getId();
break;
}
$seq_node = $node->getElementsByTagName("sequencing")->item(0);
$obj_node = $seq_node->getElementsByTagName("objectives")->item(0);
//addtitle
if ($obj_node) {
foreach ($obj_node->childNodes as $objchild ) {
if ($objchild->nodeName === "objective" || $objchild->nodeName === "primaryObjective") {
$title = $objchild->getAttribute('objectiveID');
$objchild->setAttribute("title",$title);
$i++;
}
}
}
$seq_item = new ilSCORM2004Item();
$seq_item->setTreeNodeId($this->sahs_sc13_treeId);
$seq_item->setImportid($this->importId);
$seq_item->setNocopy($seq_node->getAttribute('nocopy'));
$seq_item->setNodelete($seq_node->getAttribute('nodelete'));
$seq_item->setNomove($seq_node->getAttribute('nomove'));
$seq_doc = new DOMDocument();
$toadd = $seq_doc->importNode($seq_node, true);
$seq_doc->appendChild($toadd);
//generate Unique ObjectiveIDs for context
//@targetObjectiveID
$xpath_obj = new DOMXPath($seq_doc);
$found_nodes = $xpath_obj->query('//@objectiveID | //@referencedObjective | //@targetObjectiveID');
for ($i=0; $i<$found_nodes->length; $i++) {
$element = null;
$val = $found_nodes->item($i)->value;
if ($found_nodes->item($i)->name == "targetObjectiveID") {
}
$val = strtolower(preg_replace('/ +/','_',$val)."_".$uid);
$element = $found_nodes->item($i)->ownerElement;
$element->setAttribute($found_nodes->item($i)->name,$val);
}
$seq_item->setDom($seq_doc);
$seq_item->insert();
foreach($node->childNodes as $child)
{ if ($child->nodeName === "item") {
$this->importTemplate($a_target,$a_object,$a_parent,$child);
}
}
return $new_id;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004SeqTemplate::insert (   $a_insert_node = false)

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

References $result, and setSeqNodeId().

{
if ($a_insert_node==true) {$this->setSeqNodeId(parent::insert());}
$sql = "INSERT INTO sahs_sc13_seq_templ (seqnodeid,id)".
" values(".
$this->db->quote($this->seqNodeId, "integer").",".
$this->db->quote($this->id, "text").");";
$result = $this->db->manipulate($sql);
return true;
}

+ Here is the call graph for this function:

ilSCORM2004SeqTemplate::insertTemplateForObjectAtParent (   $a_object,
  $a_parent,
  $a_target 
)

Definition at line 141 of file class.ilSCORM2004SeqTemplate.php.

References importTemplate().

{
$this->importId = uniqid();
return $this->importTemplate($a_target,$a_object,$a_parent, $this->template->getElementsByTagName("item")->item(0));
}

+ Here is the call graph for this function:

ilSCORM2004SeqTemplate::setId (   $a_id)

Set Node ID.

Parameters
intNode ID

Reimplemented from ilSCORM2004Node.

Definition at line 295 of file class.ilSCORM2004SeqTemplate.php.

{
$this->id = $a_id;
}
ilSCORM2004SeqTemplate::setSeqNodeId (   $a_seqnodeid)

Definition at line 290 of file class.ilSCORM2004SeqTemplate.php.

Referenced by insert().

{
$this->seqNodeId = $a_seqnodeid;
}

+ Here is the caller graph for this function:

static ilSCORM2004SeqTemplate::templateForChapter (   $a_chapter_id)
static

Definition at line 313 of file class.ilSCORM2004SeqTemplate.php.

References $ilDB, $query, and $template.

Referenced by ilSCORM2004Utilities\parentHasSeqTemplate(), and ilSCORM2004ChapterGUI\showProperties().

{
global $ilDB;
$template = null;
$query = "SELECT * FROM sahs_sc13_seq_assign WHERE sahs_sc13_tree_node_id = ".
$ilDB->quote($a_chapter_id, "integer");
$obj_set = $ilDB->query($query);
$obj_rec = $ilDB->fetchAssoc($obj_set);
if ($obj_rec['identifier']) {
$template = new ilScorm2004SeqTemplate($obj_rec['identifier']);
}
return $template;
}

+ Here is the caller graph for this function:

Field Documentation

ilSCORM2004SeqTemplate::$diagnostic = array ()
private

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

ilSCORM2004SeqTemplate::$id = null
private

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

Referenced by getId().

ilSCORM2004SeqTemplate::$importId
private

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

Referenced by importTemplate().

ilSCORM2004SeqTemplate::$importid
private

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

ilSCORM2004SeqTemplate::$normalized_template
private

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

ilSCORM2004SeqTemplate::$parentchapter = true
private

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

ilSCORM2004SeqTemplate::$sahs_sc13_treeId = null
private

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

Referenced by importTemplate().

ilSCORM2004SeqTemplate::$seqNodeId = null
private

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

Referenced by getSeqNodeId().

ilSCORM2004SeqTemplate::$template
private

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

Referenced by templateForChapter().

ilSCORM2004SeqTemplate::$template_file
private

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

ilSCORM2004SeqTemplate::$tree_node
private

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

const ilSCORM2004SeqTemplate::SEQ_TEMPLATE_DIR = './Modules/Scorm2004/templates/sequencing/'
const ilSCORM2004SeqTemplate::SEQ_TEMPLATE_XSD = './Modules/Scorm2004/templates/editor/seq_templates/xsd/seq_template.xsd'

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

const ilSCORM2004SeqTemplate::SEQ_TEMPLATE_XSL = './Modules/Scorm2004/templates/xsl/seq_template.xsl'

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


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