ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSCORM2004Item Class Reference

Class ilSCORM2004Condition. More...

+ Inheritance diagram for ilSCORM2004Item:
+ Collaboration diagram for ilSCORM2004Item:

Public Member Functions

 __construct ($a_treeid=null, $a_rootlevel=false)
 Constructor public. More...
 
 getSeqNodeId ()
 
 getTreeNodeId ()
 
 getSequencingId ()
 
 getImportId ()
 
 getNocopy ()
 
 getNodelete ()
 
 getNomove ()
 
 getSeqXml ()
 
 getRoolLevel ()
 
 getImportSeqXml ()
 Get import seq xml. More...
 
 setImportSeqXml ($a_val)
 Set import seq xml. More...
 
 setSeqNodeId ($a_seqnodeid)
 
 setTreeNodeId ($a_tree_node)
 
 setSequencingId ($a_seq_id)
 
 setNocopy ($a_nocopy)
 
 setNodelete ($a_nodelete)
 
 setNomove ($a_nomove)
 
 setImportId ($a_importid)
 
 setSeqXml ($a_seqxml)
 
 setDom ($a_dom)
 
 setRootLevel ($a_rootlevel)
 
 initDom ()
 Init dom. More...
 
 setDefaultXml ($a_def_control_mode=false)
 Set default xml. More...
 
 exportAsXML ($add_prefix=true)
 Get sequencing information for export (use imsss namespace prefix) More...
 
 loadItem ()
 Read data from DB into object. More...
 
 update ()
 Update item. More...
 
 delete ($a_insert_node=false)
 Delete item. More...
 
 insert ($import=false)
 Insert/replace sequencing item in db. More...
 

Static Public Member Functions

static getAllowedActions ($a_node_id)
 

Protected Attributes

 $dom = null
 
 $log
 

Private Attributes

 $id = null
 
 $seqNodeId = null
 
 $treeNodeId = null
 
 $sequencingId = null
 
 $nocopy = false
 
 $nodelete = false
 
 $nomove = false
 
 $importId = null
 
 $seqXml = null
 
 $importSeqXml = null
 
 $rootLevel = false
 

Detailed Description

Class ilSCORM2004Condition.

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 17 of file class.ilSCORM2004Item.php.

Constructor & Destructor Documentation

◆ __construct()

ilSCORM2004Item::__construct (   $a_treeid = null,
  $a_rootlevel = false 
)

Constructor public.

Definition at line 43 of file class.ilSCORM2004Item.php.

References ilLoggerFactory\getLogger(), initDom(), and loadItem().

44  {
45  $this->log = ilLoggerFactory::getLogger("sc13");
46 
47  //different handling for organization level
48  $this->rootLevel = $a_rootlevel;
49 
50  if ($a_treeid != null)
51  {
52  $this->treeNodeId = $a_treeid;
53  $this->loadItem();
54  $this->dom = new DOMDocument();
55  $this->initDom();
56  }
57  }
loadItem()
Read data from DB into object.
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilSCORM2004Item::delete (   $a_insert_node = false)

Delete item.

Definition at line 292 of file class.ilSCORM2004Item.php.

References $ilDB, and $query.

293  {
294  global $ilDB;
295 
296  $query = "DELETE FROM sahs_sc13_seq_item"." WHERE (sahs_sc13_tree_node_id = ".$ilDB->quote($this->treeNodeId, "integer").
297  " AND rootlevel=".$ilDB->quote($this->rootLevel, "integer").")";
298  $obj_set = $ilDB->manipulate($query);
299  }
global $ilDB

◆ exportAsXML()

ilSCORM2004Item::exportAsXML (   $add_prefix = true)

Get sequencing information for export (use imsss namespace prefix)

Returns
string sequencing xml

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

References $output.

241  {
242  // remove titles
243  // @todo: the objectives (titles) text should be stored outside of
244  // the sequencing information in the future
245  $xpath_obj = new DOMXPath($this->dom);
246  $obj_node_list = $xpath_obj->query('//objective | //primaryObjective');
247  for ($i=0;$i<$obj_node_list->length;$i++) {
248  $obj_node_list->item($i)->removeAttribute("title");
249  }
250  $output = $this->dom->saveXML();
251 
252  $output = preg_replace('/<\?xml version="1.0"\?>/','',$output);
253  if ($add_prefix)
254  {
255  $output = preg_replace('/(<)([a-z]+|[A-Z]+)/','<imsss:$2',$output);
256  $output = preg_replace('/(<\/)([a-z]+|[A-Z]+)/','</imsss:$2',$output);
257  }
258  $output = preg_replace('/\n/','',$output);
259 
260  return $output;
261  }
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output

◆ getAllowedActions()

static ilSCORM2004Item::getAllowedActions (   $a_node_id)
static

Definition at line 183 of file class.ilSCORM2004Item.php.

References $ilDB, $ilLog, $query, array, and ilDBConstants\FETCHMODE_ASSOC.

184  {
185  global $ilDB,$ilLog;
186  $query = "SELECT * FROM sahs_sc13_seq_item WHERE sahs_sc13_tree_node_id = ".
187  $ilDB->quote($a_node_id, "integer").
188  " AND rootlevel = ".$ilDB->quote(false, "integer");
189  $obj_set = $ilDB->query($query);
190  $obj_rec = $obj_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
191  return array("copy"=>!$obj_rec['nocopy'],"move"=>!$obj_rec['nomove'],"delete"=>!$obj_rec['nodelete']);
192  }
Create styles array
The data for the language used.
global $ilDB

◆ getImportId()

ilSCORM2004Item::getImportId ( )

Definition at line 79 of file class.ilSCORM2004Item.php.

References $importId.

80  {
81  return $this->importId;
82  }

◆ getImportSeqXml()

ilSCORM2004Item::getImportSeqXml ( )

Get import seq xml.

Returns
string xml

Definition at line 113 of file class.ilSCORM2004Item.php.

References $importSeqXml.

Referenced by insert().

114  {
115  return $this->importSeqXml;
116  }
+ Here is the caller graph for this function:

◆ getNocopy()

ilSCORM2004Item::getNocopy ( )

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

References $nocopy.

84  {
85  return $this->nocopy;
86  }

◆ getNodelete()

ilSCORM2004Item::getNodelete ( )

Definition at line 88 of file class.ilSCORM2004Item.php.

References $nodelete.

89  {
90  return $this->nodelete;
91  }

◆ getNomove()

ilSCORM2004Item::getNomove ( )

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

References $nomove.

94  {
95  return $this->nomove;
96  }

◆ getRoolLevel()

ilSCORM2004Item::getRoolLevel ( )

Definition at line 103 of file class.ilSCORM2004Item.php.

References $rootLevel.

104  {
105  return $this->rootLevel;
106  }

◆ getSeqNodeId()

ilSCORM2004Item::getSeqNodeId ( )

Definition at line 63 of file class.ilSCORM2004Item.php.

References $seqNodeId.

64  {
65  return $this->seqNodeId;
66  }

◆ getSequencingId()

ilSCORM2004Item::getSequencingId ( )

Definition at line 74 of file class.ilSCORM2004Item.php.

References $sequencingId.

75  {
76  return $this->sequencingId;
77  }

◆ getSeqXml()

ilSCORM2004Item::getSeqXml ( )

Definition at line 98 of file class.ilSCORM2004Item.php.

References $seqXml.

Referenced by initDom().

99  {
100  return $this->seqXml;
101  }
+ Here is the caller graph for this function:

◆ getTreeNodeId()

ilSCORM2004Item::getTreeNodeId ( )

Definition at line 68 of file class.ilSCORM2004Item.php.

References $treeNodeId.

69  {
70  return $this->treeNodeId;
71  }

◆ initDom()

ilSCORM2004Item::initDom ( )

Init dom.

Definition at line 197 of file class.ilSCORM2004Item.php.

References getSeqXml(), and setDefaultXml().

Referenced by __construct().

198  {
199  if ($this->getSeqXml() != "")
200  {
201  $this->dom->loadXML($this->getSeqXml());
202  }
203  else
204  {
205  $this->setDefaultXml();
206  }
207  }
setDefaultXml($a_def_control_mode=false)
Set default xml.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

ilSCORM2004Item::insert (   $import = false)

Insert/replace sequencing item in db.

Definition at line 304 of file class.ilSCORM2004Item.php.

References $ilDB, array, and getImportSeqXml().

Referenced by update().

305  {
306  global $ilDB;
307 
308  $ilDB->replace("sahs_sc13_seq_item",
309  array("sahs_sc13_tree_node_id" => array("integer", $this->treeNodeId),
310  "rootlevel" => array("integer", $this->rootLevel)),
311  array(
312  "importid" => array("text", $this->importId),
313  "seqnodeid" => array("integer", (int) $this->seqNodeId),
314  "sequencingid" => array("text", $this->sequencingId),
315  "nocopy" => array("integer", $this->nocopy),
316  "nodelete" => array("integer", $this->nodelete),
317  "nomove" => array("integer", $this->nomove),
318  "seqxml" => array("clob", $this->dom->saveXML()),
319  "importseqxml" => array("clob", $this->getImportSeqXml())
320  ));
321  return true;
322  }
Create styles array
The data for the language used.
global $ilDB
getImportSeqXml()
Get import seq xml.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadItem()

ilSCORM2004Item::loadItem ( )

Read data from DB into object.

Definition at line 266 of file class.ilSCORM2004Item.php.

References $ilDB, and $query.

Referenced by __construct().

267  {
268  global $ilDB;
269  $query = "SELECT * FROM sahs_sc13_seq_item WHERE (sahs_sc13_tree_node_id = ".$ilDB->quote($this->treeNodeId, "integer").
270  " AND rootlevel =".$ilDB->quote($this->rootLevel, "integer").")";
271  $obj_set = $ilDB->query($query);
272  $obj_rec = $ilDB->fetchAssoc($obj_set);
273  $this->seqXml = $obj_rec['seqxml'];
274  $this->importSeqXml = $obj_rec['importseqxml'];
275  $this->importId = $obj_rec['importid'];
276  $this->nocopy = $obj_rec['nocopy'];
277  $this->nomove = $obj_rec['nomove'];
278  $this->nodelete = $obj_rec['nodelete'];
279  }
global $ilDB
+ Here is the caller graph for this function:

◆ setDefaultXml()

ilSCORM2004Item::setDefaultXml (   $a_def_control_mode = false)

Set default xml.

Parameters
bool$a_def_control_mode

Definition at line 214 of file class.ilSCORM2004Item.php.

References setSeqXml().

Referenced by initDom().

215  {
216  while ($this->dom->hasChildNodes()){
217  $this->dom->removeChild($this->dom->childNodes->item(0));
218  }
219 
220  $element = $this->dom->createElement('sequencing');
221  $this->dom->appendChild($element);
222 
223  if ($a_def_control_mode)
224  {
225  $cm = $this->dom->createElement('controlMode');
226  $cm->setAttribute("flow", "true");
227  $cm->setAttribute("choice", "true");
228  $cm->setAttribute("forwardOnly", "false");
229  $element->appendChild($cm);
230  }
231  $this->setSeqXml($this->dom->saveXML());
232  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDom()

ilSCORM2004Item::setDom (   $a_dom)

Definition at line 173 of file class.ilSCORM2004Item.php.

174  {
175  $this->dom = $a_dom;
176  }

◆ setImportId()

ilSCORM2004Item::setImportId (   $a_importid)

Definition at line 162 of file class.ilSCORM2004Item.php.

163  {
164  $this->importid = $a_importid;
165  }

◆ setImportSeqXml()

ilSCORM2004Item::setImportSeqXml (   $a_val)

Set import seq xml.

Parameters
string$a_valxml

Definition at line 127 of file class.ilSCORM2004Item.php.

128  {
129  $this->importSeqXml = $a_val;
130  }

◆ setNocopy()

ilSCORM2004Item::setNocopy (   $a_nocopy)

Definition at line 147 of file class.ilSCORM2004Item.php.

148  {
149  $this->nocopy = $a_nocopy;
150  }

◆ setNodelete()

ilSCORM2004Item::setNodelete (   $a_nodelete)

Definition at line 152 of file class.ilSCORM2004Item.php.

153  {
154  $this->nodelete = $a_nodelete ;
155  }

◆ setNomove()

ilSCORM2004Item::setNomove (   $a_nomove)

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

158  {
159  $this->nomove = $a_nomove;
160  }

◆ setRootLevel()

ilSCORM2004Item::setRootLevel (   $a_rootlevel)

Definition at line 178 of file class.ilSCORM2004Item.php.

179  {
180  $this->rootLevel = $a_rootlevel;
181  }

◆ setSeqNodeId()

ilSCORM2004Item::setSeqNodeId (   $a_seqnodeid)

Definition at line 132 of file class.ilSCORM2004Item.php.

133  {
134  $this->seqNodeId = $a_seqnodeid;
135  }

◆ setSequencingId()

ilSCORM2004Item::setSequencingId (   $a_seq_id)

Definition at line 142 of file class.ilSCORM2004Item.php.

143  {
144  $this->sequencingId = $a_seq_id;
145  }

◆ setSeqXml()

ilSCORM2004Item::setSeqXml (   $a_seqxml)

Definition at line 167 of file class.ilSCORM2004Item.php.

Referenced by setDefaultXml().

168  {
169  $this->log->debug("seq xml: ".$a_seqxml);
170  $this->seqXml = $a_seqxml;
171  }
+ Here is the caller graph for this function:

◆ setTreeNodeId()

ilSCORM2004Item::setTreeNodeId (   $a_tree_node)

Definition at line 137 of file class.ilSCORM2004Item.php.

138  {
139  $this->treeNodeId = $a_tree_node;
140  }

◆ update()

ilSCORM2004Item::update ( )

Update item.

Definition at line 284 of file class.ilSCORM2004Item.php.

References insert().

285  {
286  $this->insert();
287  }
insert($import=false)
Insert/replace sequencing item in db.
+ Here is the call graph for this function:

Field Documentation

◆ $dom

ilSCORM2004Item::$dom = null
protected

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

◆ $id

ilSCORM2004Item::$id = null
private

Definition at line 20 of file class.ilSCORM2004Item.php.

◆ $importId

ilSCORM2004Item::$importId = null
private

Definition at line 27 of file class.ilSCORM2004Item.php.

Referenced by getImportId().

◆ $importSeqXml

ilSCORM2004Item::$importSeqXml = null
private

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

Referenced by getImportSeqXml().

◆ $log

ilSCORM2004Item::$log
protected

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

◆ $nocopy

ilSCORM2004Item::$nocopy = false
private

Definition at line 24 of file class.ilSCORM2004Item.php.

Referenced by getNocopy().

◆ $nodelete

ilSCORM2004Item::$nodelete = false
private

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

Referenced by getNodelete().

◆ $nomove

ilSCORM2004Item::$nomove = false
private

Definition at line 26 of file class.ilSCORM2004Item.php.

Referenced by getNomove().

◆ $rootLevel

ilSCORM2004Item::$rootLevel = false
private

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

Referenced by getRoolLevel().

◆ $seqNodeId

ilSCORM2004Item::$seqNodeId = null
private

Definition at line 21 of file class.ilSCORM2004Item.php.

Referenced by getSeqNodeId().

◆ $sequencingId

ilSCORM2004Item::$sequencingId = null
private

Definition at line 23 of file class.ilSCORM2004Item.php.

Referenced by getSequencingId().

◆ $seqXml

ilSCORM2004Item::$seqXml = null
private

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

Referenced by getSeqXml().

◆ $treeNodeId

ilSCORM2004Item::$treeNodeId = null
private

Definition at line 22 of file class.ilSCORM2004Item.php.

Referenced by getTreeNodeId().


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