ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 @access 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

 $db
 
 $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 @access public.

Reimplemented in ilSCORM2004Objective, and ilSCORM2004Sequencing.

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

49 {
50 global $DIC;
51
52 $this->db = $DIC->database();
53 $this->log = ilLoggerFactory::getLogger("sc13");
54
55 //different handling for organization level
56 $this->rootLevel = $a_rootlevel;
57
58 if ($a_treeid != null) {
59 $this->treeNodeId = $a_treeid;
60 $this->loadItem();
61 $this->dom = new DOMDocument();
62 $this->initDom();
63 }
64 }
static getLogger($a_component_id)
Get component logger.
loadItem()
Read data from DB into object.
global $DIC
Definition: saml.php:7

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

+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilSCORM2004Item::delete (   $a_insert_node = false)

Delete item.

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

298 {
300
301 $query = "DELETE FROM sahs_sc13_seq_item" . " WHERE (sahs_sc13_tree_node_id = " . $ilDB->quote($this->treeNodeId, "integer") .
302 " AND rootlevel=" . $ilDB->quote($this->rootLevel, "integer") . ")";
303 $obj_set = $ilDB->manipulate($query);
304 }
$query
global $ilDB

References $db, $ilDB, and $query.

◆ exportAsXML()

ilSCORM2004Item::exportAsXML (   $add_prefix = true)

Get sequencing information for export (use imsss namespace prefix)

Returns
string sequencing xml

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

247 {
248 // remove titles
249 // @todo: the objectives (titles) text should be stored outside of
250 // the sequencing information in the future
251 $xpath_obj = new DOMXPath($this->dom);
252 $obj_node_list = $xpath_obj->query('//objective | //primaryObjective');
253 for ($i = 0;$i < $obj_node_list->length;$i++) {
254 $obj_node_list->item($i)->removeAttribute("title");
255 }
256 $output = $this->dom->saveXML();
257
258 $output = preg_replace('/<\?xml version="1.0"\?>/', '', $output);
259 if ($add_prefix) {
260 $output = preg_replace('/(<)([a-z]+|[A-Z]+)/', '<imsss:$2', $output);
261 $output = preg_replace('/(<\/)([a-z]+|[A-Z]+)/', '</imsss:$2', $output);
262 }
263 $output = preg_replace('/\n/', '', $output);
264
265 return $output;
266 }
$i
Definition: disco.tpl.php:19

References $i, and Sabre\VObject\$output.

◆ getAllowedActions()

static ilSCORM2004Item::getAllowedActions (   $a_node_id)
static

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

191 {
192 global $DIC;
193
194 $ilDB = $DIC->database();
195 $ilLog = $DIC["ilLog"];
196 $query = "SELECT * FROM sahs_sc13_seq_item WHERE sahs_sc13_tree_node_id = " .
197 $ilDB->quote($a_node_id, "integer") .
198 " AND rootlevel = " . $ilDB->quote(false, "integer");
199 $obj_set = $ilDB->query($query);
200 $obj_rec = $obj_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
201 return array("copy" => !$obj_rec['nocopy'],"move" => !$obj_rec['nomove'],"delete" => !$obj_rec['nodelete']);
202 }

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

◆ getImportId()

ilSCORM2004Item::getImportId ( )

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

References $importId.

◆ getImportSeqXml()

ilSCORM2004Item::getImportSeqXml ( )

Get import seq xml.

Returns
string xml

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

121 {
122 return $this->importSeqXml;
123 }

References $importSeqXml.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getNocopy()

ilSCORM2004Item::getNocopy ( )

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

91 {
92 return $this->nocopy;
93 }

References $nocopy.

◆ getNodelete()

ilSCORM2004Item::getNodelete ( )

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

References $nodelete.

◆ getNomove()

ilSCORM2004Item::getNomove ( )

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

101 {
102 return $this->nomove;
103 }

References $nomove.

◆ getRoolLevel()

ilSCORM2004Item::getRoolLevel ( )

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

111 {
112 return $this->rootLevel;
113 }

References $rootLevel.

◆ getSeqNodeId()

ilSCORM2004Item::getSeqNodeId ( )

Reimplemented in ilSCORM2004Sequencing.

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

References $seqNodeId.

◆ getSequencingId()

ilSCORM2004Item::getSequencingId ( )

Reimplemented in ilSCORM2004Sequencing.

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

References $sequencingId.

◆ getSeqXml()

ilSCORM2004Item::getSeqXml ( )

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

106 {
107 return $this->seqXml;
108 }

References $seqXml.

Referenced by initDom().

+ Here is the caller graph for this function:

◆ getTreeNodeId()

ilSCORM2004Item::getTreeNodeId ( )

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

References $treeNodeId.

◆ initDom()

ilSCORM2004Item::initDom ( )

Init dom.

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

208 {
209 if ($this->getSeqXml() != "") {
210 $this->dom->loadXML($this->getSeqXml());
211 } else {
212 $this->setDefaultXml();
213 }
214 }
setDefaultXml($a_def_control_mode=false)
Set default xml.

References getSeqXml(), and setDefaultXml().

Referenced by __construct().

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

310 {
312
313 $ilDB->replace(
314 "sahs_sc13_seq_item",
315 array("sahs_sc13_tree_node_id" => array("integer", $this->treeNodeId),
316 "rootlevel" => array("integer", $this->rootLevel)),
317 array(
318 "importid" => array("text", $this->importId),
319 "seqnodeid" => array("integer", (int) $this->seqNodeId),
320 "sequencingid" => array("text", $this->sequencingId),
321 "nocopy" => array("integer", $this->nocopy),
322 "nodelete" => array("integer", $this->nodelete),
323 "nomove" => array("integer", $this->nomove),
324 "seqxml" => array("clob", $this->dom->saveXML()),
325 "importseqxml" => array("clob", $this->getImportSeqXml())
326 )
327 );
328 return true;
329 }
getImportSeqXml()
Get import seq xml.

References $db, $ilDB, and getImportSeqXml().

Referenced by update().

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

272 {
274 $query = "SELECT * FROM sahs_sc13_seq_item WHERE (sahs_sc13_tree_node_id = " . $ilDB->quote($this->treeNodeId, "integer") .
275 " AND rootlevel =" . $ilDB->quote($this->rootLevel, "integer") . ")";
276 $obj_set = $ilDB->query($query);
277 $obj_rec = $ilDB->fetchAssoc($obj_set);
278 $this->seqXml = $obj_rec['seqxml'];
279 $this->importSeqXml = $obj_rec['importseqxml'];
280 $this->importId = $obj_rec['importid'];
281 $this->nocopy = $obj_rec['nocopy'];
282 $this->nomove = $obj_rec['nomove'];
283 $this->nodelete = $obj_rec['nodelete'];
284 }

References $db, $ilDB, and $query.

Referenced by __construct().

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

222 {
223 while ($this->dom->hasChildNodes()) {
224 $this->dom->removeChild($this->dom->childNodes->item(0));
225 }
226
227 $element = $this->dom->createElement('sequencing');
228 $this->dom->appendChild($element);
229
230 if ($a_def_control_mode) {
231 $cm = $this->dom->createElement('controlMode');
232 $cm->setAttribute("flow", "true");
233 $cm->setAttribute("choice", "true");
234 $cm->setAttribute("forwardOnly", "false");
235 $element->appendChild($cm);
236 }
237 $this->setSeqXml($this->dom->saveXML());
238 }

References setSeqXml().

Referenced by initDom().

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

◆ setDom()

ilSCORM2004Item::setDom (   $a_dom)

Reimplemented in ilSCORM2004Objective, and ilSCORM2004Sequencing.

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

181 {
182 $this->dom = $a_dom;
183 }

◆ setImportId()

ilSCORM2004Item::setImportId (   $a_importid)

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

170 {
171 $this->importid = $a_importid;
172 }

◆ setImportSeqXml()

ilSCORM2004Item::setImportSeqXml (   $a_val)

Set import seq xml.

Parameters
string$a_valxml

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

135 {
136 $this->importSeqXml = $a_val;
137 }

◆ setNocopy()

ilSCORM2004Item::setNocopy (   $a_nocopy)

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

155 {
156 $this->nocopy = $a_nocopy;
157 }

◆ setNodelete()

ilSCORM2004Item::setNodelete (   $a_nodelete)

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

160 {
161 $this->nodelete = $a_nodelete ;
162 }

◆ setNomove()

ilSCORM2004Item::setNomove (   $a_nomove)

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

165 {
166 $this->nomove = $a_nomove;
167 }

◆ setRootLevel()

ilSCORM2004Item::setRootLevel (   $a_rootlevel)

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

186 {
187 $this->rootLevel = $a_rootlevel;
188 }

◆ setSeqNodeId()

ilSCORM2004Item::setSeqNodeId (   $a_seqnodeid)

Reimplemented in ilSCORM2004Objective, and ilSCORM2004Sequencing.

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

140 {
141 $this->seqNodeId = $a_seqnodeid;
142 }

◆ setSequencingId()

ilSCORM2004Item::setSequencingId (   $a_seq_id)

Reimplemented in ilSCORM2004Sequencing.

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

150 {
151 $this->sequencingId = $a_seq_id;
152 }

◆ setSeqXml()

ilSCORM2004Item::setSeqXml (   $a_seqxml)

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

175 {
176 $this->log->debug("seq xml: " . $a_seqxml);
177 $this->seqXml = $a_seqxml;
178 }

Referenced by setDefaultXml().

+ Here is the caller graph for this function:

◆ setTreeNodeId()

ilSCORM2004Item::setTreeNodeId (   $a_tree_node)

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

145 {
146 $this->treeNodeId = $a_tree_node;
147 }

◆ update()

ilSCORM2004Item::update ( )

Update item.

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

290 {
291 $this->insert();
292 }
insert($import=false)
Insert/replace sequencing item in db.

References insert().

+ Here is the call graph for this function:

Field Documentation

◆ $db

ilSCORM2004Item::$db
protected

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

Referenced by delete(), insert(), and loadItem().

◆ $dom

ilSCORM2004Item::$dom = null
protected

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

◆ $id

ilSCORM2004Item::$id = null
private

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

◆ $importId

ilSCORM2004Item::$importId = null
private

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

Referenced by getImportId().

◆ $importSeqXml

ilSCORM2004Item::$importSeqXml = null
private

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

Referenced by getImportSeqXml().

◆ $log

ilSCORM2004Item::$log
protected

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

◆ $nocopy

ilSCORM2004Item::$nocopy = false
private

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

Referenced by getNocopy().

◆ $nodelete

ilSCORM2004Item::$nodelete = false
private

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

Referenced by getNodelete().

◆ $nomove

ilSCORM2004Item::$nomove = false
private

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

Referenced by getNomove().

◆ $rootLevel

ilSCORM2004Item::$rootLevel = false
private

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

Referenced by getRoolLevel().

◆ $seqNodeId

ilSCORM2004Item::$seqNodeId = null
private

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

Referenced by getSeqNodeId().

◆ $sequencingId

ilSCORM2004Item::$sequencingId = null
private

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

Referenced by getSequencingId().

◆ $seqXml

ilSCORM2004Item::$seqXml = null
private

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

Referenced by getSeqXml().

◆ $treeNodeId

ilSCORM2004Item::$treeNodeId = null
private

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

Referenced by getTreeNodeId().


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