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

Static Public Member Functions

static availableTemplates ()
 
static getFileNameForIdentifier ($a_identifier)
 
static templateForChapter ($a_chapter_id)
 
- Static Public Member Functions inherited from ilSCORM2004Node
static _lookupTitle ($a_obj_id)
 Lookup Title. More...
 
static _lookupType ($a_obj_id)
 Lookup Type. More...
 
static _writeTitle ($a_obj_id, $a_title)
 Write Title. More...
 
static _writeImportId ($a_id, $a_import_id)
 Write import ID. More...
 
static putInTree ($a_obj, $a_parent_id="", $a_target_node_id="")
 put this object into content object tree More...
 
static getTree ($a_slm_obj_id)
 Get scorm module editing tree. More...
 
static clipboardCopy ($a_slm_obj_id, $a_ids)
 Copy a set of chapters/pages/scos into the clipboard. More...
 
static uniqueTypesCheck ($a_items)
 Check for unique types (all pages or all chapters or all scos) More...
 
static insertPageClip ($a_slm_obj)
 Insert pages from clipboard. More...
 
static insertAssetClip ($a_slm_obj, $a_type="ass")
 Insert assets from clipboard. More...
 
static insertScoClip ($a_slm_obj)
 Insert scos from clipboard. More...
 
static pasteTree ($a_target_slm, $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_from_clipboard=true, $a_source_parent_type="")
 Paste item (tree) from clipboard or other learning module to target scorm learning module. More...
 

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

◆ availableTemplates()

static ilSCORM2004SeqTemplate::availableTemplates ( )
static

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

94 {
95 global $ilDB;
96 $arr_templates = array();
97 $query = "SELECT * FROM sahs_sc13_seq_templts ORDER BY identifier";
98 $result = $ilDB->query($query);
99 while($row = $ilDB->fetchAssoc($result))
100 {
101 if($row['identifier']!="pretestpost") { //temporarily deactivated
102 array_push($arr_templates,new ilScorm2004SeqTemplate($row['identifier']));
103 }
104 }
105 return $arr_templates;
106 }
$result
global $ilDB

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

Referenced by ilObjSCORM2004LearningModuleGUI\insertScenarioGUI().

+ Here is the caller graph for this function:

◆ generateObjIds()

ilSCORM2004SeqTemplate::generateObjIds (   $a_dom)
private

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

232 {
233
234 }

◆ getFileNameForIdentifier()

static ilSCORM2004SeqTemplate::getFileNameForIdentifier (   $a_identifier)
static

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

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

References $ilDB, and $query.

Referenced by ilSCORM2004SeqTemplate().

+ Here is the caller graph for this function:

◆ getId()

ilSCORM2004SeqTemplate::getId ( )

Get Node ID.

Parameters
intNode ID

Reimplemented from ilSCORM2004Node.

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

References $id.

◆ getIdentifier()

ilSCORM2004SeqTemplate::getIdentifier ( )

function getIdentifier

Returns
get identifier for template
Author
Hendrik Holtmann

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

116 {
117 $seqtemplate = $this->template->getElementsByTagName("seqTemplate");
118 return $seqtemplate->item(0)->getAttribute("identifier");;
119 }

◆ getMetadataProperties()

ilSCORM2004SeqTemplate::getMetadataProperties ( )

function getMetadataProperties

Returns
hash of metadata for the template
Author
Hendrik Holtmann

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

81 {
82 $array_metad = array();
83 $metadata = $this->template->getElementsByTagName("metadata");
84 $nodes = $metadata->item(0)->childNodes;
85 for ($i = 0; $i < $nodes->length; $i++ ) {
86 $curNode = $nodes->item($i);
87 $array_metad[$curNode->localName] = $curNode->nodeValue;
88 }
89 return $array_metad;
90 }

◆ getSeqNodeId()

ilSCORM2004SeqTemplate::getSeqNodeId ( )

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

References $seqNodeId.

◆ ilSCORM2004SeqTemplate() [1/2]

ilSCORM2004SeqTemplate::ilSCORM2004SeqTemplate (   $a_identifier)

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

43 {
44
45 parent::ilSCORM2004SeqNode();
46 $this->setNodeName("seqtemplate");
47
48 if ($a_identifier==null) {return;}
49 $t_file = self::getFileNameForIdentifier($a_identifier);
50
51 $this->template = new DOMDocument;
52 $this->template->async = false;
53
54
55 //look for template in lang_dir, fallback to en
56 $test = self::SEQ_TEMPLATE_DIR."/".$_SESSION["lang"]."/".$t_file;
57 if (file_exists($test))
58 {
59 $this->template_file = $test;
60 } else {
61 $this->template_file = self::SEQ_TEMPLATE_DIR."/en/".$t_file;
62 }
63 if (!@$this->template->load($this->template_file))
64 {
65 $this->diagnostic[] = 'Template not wellformed';
66 $test = $this->template->saveXML();
67 return false;
68 } else {
69 return true;
70 }
71 }
$test
Definition: Utf8Test.php:85
$_SESSION["AccountId"]
static getFileNameForIdentifier($a_identifier)

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

+ Here is the call graph for this function:

◆ ilSCORM2004SeqTemplate() [2/2]

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

Constructor @access public.

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

47 {
48 parent::ilSCORM2004SeqTemplate($a_slm_object, $a_id);
49 }

◆ importTemplate()

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

function import Template

Returns
success of import
Author
Hendrik Holtmann

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

136 {
137 global $ilDB;
138
139 switch($node->getAttribute('type'))
140 {
141 case "lesson":
142 if ($this->parentchapter==true)
143 {
144 $chap = new ilSCORM2004SeqChapter($a_object);
145 } else {
146 $chap = new ilSCORM2004Chapter($a_object);
147 }
148 $chap->setTitle($node->getElementsByTagName("title")->item(0)->nodeValue);
149 $chap->setSLMId($a_object->getId());
150 $chap->create();
151 $this->sahs_sc13_treeId = $chap->getId();
152 ilSCORM2004Node::putInTree($chap, $a_parent,$a_target);
153 $a_parent = $this->sahs_sc13_treeId;
154 if ($this->parentchapter==true)
155 {
156 $ilDB->manipulate("INSERT INTO sahs_sc13_seq_assign (identifier, sahs_sc13_tree_node_id) VALUES ".
157 "(".$ilDB->quote($this->getIdentifier(), "text").",".
158 $ilDB->quote($this->sahs_sc13_treeId, "integer").")");
159 $this->parentchapter = false;
160 }
161 $new_id = $chap->getId();
162 break;
163 case "sco" :
164 $sco = new ilSCORM2004Sco($a_object);
165 $sco->setTitle($node->getElementsByTagName("title")->item(0)->nodeValue);
166 $sco->setSLMId($a_object->getId());
167 $sco->create(false,true);
168 $this->sahs_sc13_treeId = $sco->getId();
169 ilSCORM2004Node::putInTree($sco, $a_parent, $target);
170 $new_id = $sco->getId();
171 break;
172 }
173
174 $seq_node = $node->getElementsByTagName("sequencing")->item(0);
175
176 $obj_node = $seq_node->getElementsByTagName("objectives")->item(0);
177 //addtitle
178 if ($obj_node) {
179 foreach ($obj_node->childNodes as $objchild ) {
180 if ($objchild->nodeName === "objective" || $objchild->nodeName === "primaryObjective") {
181 $title = $objchild->getAttribute('objectiveID');
182 $objchild->setAttribute("title",$title);
183 $i++;
184 }
185 }
186 }
187
188 $seq_item = new ilSCORM2004Item();
189 $seq_item->setTreeNodeId($this->sahs_sc13_treeId);
190 $seq_item->setImportid($this->importId);
191 $seq_item->setNocopy($seq_node->getAttribute('nocopy'));
192 $seq_item->setNodelete($seq_node->getAttribute('nodelete'));
193 $seq_item->setNomove($seq_node->getAttribute('nomove'));
194
195 $seq_doc = new DOMDocument();
196 $toadd = $seq_doc->importNode($seq_node, true);
197 $seq_doc->appendChild($toadd);
198
199 //generate Unique ObjectiveIDs for context
200
201 //@targetObjectiveID
202 $xpath_obj = new DOMXPath($seq_doc);
203
204 $found_nodes = $xpath_obj->query('//@objectiveID | //@referencedObjective | //@targetObjectiveID');
205 for ($i=0; $i<$found_nodes->length; $i++) {
206 $element = null;
207 $val = $found_nodes->item($i)->value;
209 if ($found_nodes->item($i)->name == "targetObjectiveID") {
210 $uid = $this->importId;
211 }
212 $val = strtolower(preg_replace('/ +/','_',$val)."_".$uid);
213 $element = $found_nodes->item($i)->ownerElement;
214 $element->setAttribute($found_nodes->item($i)->name,$val);
215 }
216
217 $seq_item->setDom($seq_doc);
218
219 $seq_item->insert();
220
221 foreach($node->childNodes as $child)
222 { if ($child->nodeName === "item") {
223 $this->importTemplate($a_target,$a_object,$a_parent,$child);
224 }
225 }
226
227 return $new_id;
228 }
ilSCORM2004Chapter($a_slm_object, $a_id=0)
Constructor @access public.
Class ilSCORM2004Condition.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
Class ilSCORM2004Sco.
Class ilSCORM2004Chapter.
importTemplate($a_target, $a_object, $a_parent, $node)
function import Template

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

Referenced by importTemplate(), and insertTemplateForObjectAtParent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

ilSCORM2004SeqTemplate::insert (   $a_insert_node = false)

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

241 {
242 if ($a_insert_node==true) {$this->setSeqNodeId(parent::insert());}
243 $sql = "INSERT INTO sahs_sc13_seq_templ (seqnodeid,id)".
244 " values(".
245 $this->db->quote($this->seqNodeId, "integer").",".
246 $this->db->quote($this->id, "text").");";
247 $result = $this->db->manipulate($sql);
248 return true;
249 }

References $result, and setSeqNodeId().

+ Here is the call graph for this function:

◆ insertTemplateForObjectAtParent()

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

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

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

References importTemplate().

+ Here is the call graph for this function:

◆ setId()

ilSCORM2004SeqTemplate::setId (   $a_id)

Set Node ID.

Parameters
intNode ID

Reimplemented from ilSCORM2004Node.

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

277 {
278 $this->id = $a_id;
279 }

◆ setSeqNodeId()

ilSCORM2004SeqTemplate::setSeqNodeId (   $a_seqnodeid)

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

272 {
273 $this->seqNodeId = $a_seqnodeid;
274 }

Referenced by insert().

+ Here is the caller graph for this function:

◆ templateForChapter()

static ilSCORM2004SeqTemplate::templateForChapter (   $a_chapter_id)
static

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

295 {
296 global $ilDB;
297 $template = null;
298 $query = "SELECT * FROM sahs_sc13_seq_assign WHERE sahs_sc13_tree_node_id = ".
299 $ilDB->quote($a_chapter_id, "integer");
300 $obj_set = $ilDB->query($query);
301 $obj_rec = $ilDB->fetchAssoc($obj_set);
302 if ($obj_rec['identifier']) {
303 $template = new ilScorm2004SeqTemplate($obj_rec['identifier']);
304 }
305 return $template;
306 }

References $ilDB, $query, and $template.

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

+ Here is the caller graph for this function:

Field Documentation

◆ $diagnostic

ilSCORM2004SeqTemplate::$diagnostic = array ()
private

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

◆ $id

ilSCORM2004SeqTemplate::$id = null
private

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

Referenced by getId().

◆ $importId

ilSCORM2004SeqTemplate::$importId
private

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

Referenced by importTemplate().

◆ $importid

ilSCORM2004SeqTemplate::$importid
private

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

◆ $normalized_template

ilSCORM2004SeqTemplate::$normalized_template
private

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

◆ $parentchapter

ilSCORM2004SeqTemplate::$parentchapter = true
private

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

◆ $sahs_sc13_treeId

ilSCORM2004SeqTemplate::$sahs_sc13_treeId = null
private

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

Referenced by importTemplate().

◆ $seqNodeId

ilSCORM2004SeqTemplate::$seqNodeId = null
private

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

Referenced by getSeqNodeId().

◆ $template

ilSCORM2004SeqTemplate::$template
private

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

Referenced by templateForChapter().

◆ $template_file

ilSCORM2004SeqTemplate::$template_file
private

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

◆ $tree_node

ilSCORM2004SeqTemplate::$tree_node
private

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

◆ SEQ_TEMPLATE_DIR

const ilSCORM2004SeqTemplate::SEQ_TEMPLATE_DIR = './Modules/Scorm2004/templates/sequencing/'

◆ SEQ_TEMPLATE_XSD

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

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

◆ SEQ_TEMPLATE_XSL

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: