ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSCORM2004Node Class Reference

Class. More...

+ Inheritance diagram for ilSCORM2004Node:
+ Collaboration diagram for ilSCORM2004Node:

Public Member Functions

 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.
 getSLMObject ()
 Get scorm learning module object.
 getContentObject ()
 Get Scorm Learning Module Object.
 setId ($a_id)
 Set Node ID.
 getId ()
 Get Node ID.
 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 _lookupTitle ($a_obj_id)
 Lookup Title.
static _lookupType ($a_obj_id)
 Lookup Type.
static _writeTitle ($a_obj_id, $a_title)
 Write Title.
static _writeImportId ($a_id, $a_import_id)
 Write import ID.
static putInTree ($a_obj, $a_parent_id="", $a_target_node_id="")
 put this object into content object tree
static getTree ($a_slm_obj_id)
 Get scorm module editing tree.
static clipboardCopy ($a_slm_obj_id, $a_ids)
 Copy a set of chapters/pages/scos into the clipboard.
static uniqueTypesCheck ($a_items)
 Check for unique types (all pages or all chapters or all scos)
static insertPageClip ($a_slm_obj)
 Insert pages from clipboard.
static insertScoClip ($a_slm_obj)
 Insert scos from clipboard.
static pasteTree ($a_target_slm, $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false)
 Paste item (tree) from clipboard to current scorm learning module.

Data Fields

 $slm_id
 $type
 $id
 $slm_object

Detailed Description

Class.

Base class for Scorm 2004 Nodes (Chapters, Pages, SCOs)

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Member Function Documentation

ilSCORM2004Node::_deleteAllSLMNodes (   $a_slm_object)

Delete all nodes of Scorm Learning Module.

Parameters
objectScorm 2004 Learning Module Object

Definition at line 538 of file class.ilSCORM2004Node.php.

References $ilDB, $query, and ilSCORM2004NodeFactory\getInstance().

{
global $ilDB;
$query = "SELECT * FROM sahs_sc13_tree_node ".
"WHERE slm_id = ".$ilDB->quote($a_slm_object->getId(), "integer")." ";
$obj_set = $ilDB->query($query);
require_once("./Modules/LearningModule/classes/class.ilScorm2004NodeFactory.php");
while($obj_rec = $ilDB->fetchAssoc($obj_set))
{
$node_obj = ilSCORM2004NodeFactory::getInstance($a_slm_object, $obj_rec["obj_id"],false);
if (is_object($node_obj))
{
$node_obj->delete();
}
}
return true;
}

+ Here is the call graph for this function:

ilSCORM2004Node::_exists (   $a_id)

Checks wether a node exists.

Parameters
int$idid
Returns
boolean true, if lm content object exists

Definition at line 508 of file class.ilSCORM2004Node.php.

References $ilDB, and ilInternalLink\_extractObjIdOfTarget().

{
global $ilDB;
include_once("./Services/COPage/classes/class.ilInternalLink.php");
if (is_int(strpos($a_id, "_")))
{
}
$q = "SELECT * FROM sahs_sc13_tree_node WHERE obj_id = ".
$ilDB->quote($a_id, "integer");
$obj_set = $ilDB->query($q);
if ($obj_rec = $ilDB->fetchAssoc($obj_set))
{
return true;
}
else
{
return false;
}
}

+ Here is the call graph for this function:

ilSCORM2004Node::_getIdForImportId (   $a_import_id)

Get Node ID for import ID (static)

import ids can exist multiple times (if the same learning module has been imported multiple times). we get the object id of the last imported object, that is not in trash

Parameters
int$a_import_idimport id
Returns
int id

Definition at line 478 of file class.ilSCORM2004Node.php.

References $ilDB, $slm_id, ilObject\_hasUntrashedReference(), and _lookupSLMID().

{
global $ilDB;
$ilDB->setLimit(1);
$q = "SELECT * FROM sahs_sc13_tree_node WHERE import_id = ".
$ilDB->quote($a_import_id, "text")." ".
" ORDER BY create_date DESC";
$obj_set = $ilDB->query($q);
while ($obj_rec = $ilDB->fetchAssoc($obj_set))
{
$slm_id = ilSCORM2004Node::_lookupSLMID($obj_rec["obj_id"]);
// link only in learning module, that is not trashed
{
return $obj_rec["obj_id"];
}
}
return 0;
}

+ Here is the call graph for this function:

ilSCORM2004Node::_lookupSLMID (   $a_id)

Lookup Scorm Learning Module ID for node id.

Definition at line 563 of file class.ilSCORM2004Node.php.

References $ilDB, and $query.

Referenced by _getIdForImportId(), and pasteTree().

{
global $ilDB;
$query = "SELECT * FROM sahs_sc13_tree_node WHERE obj_id = ".
$ilDB->quote($a_id, "integer")."";
$obj_set = $ilDB->query($query);
$obj_rec = $ilDB->fetchAssoc($obj_set);
return $obj_rec["slm_id"];
}

+ Here is the caller graph for this function:

static ilSCORM2004Node::_lookupTitle (   $a_obj_id)
static

Lookup Title.

Parameters
intNode ID
Returns
string Title

Definition at line 343 of file class.ilSCORM2004Node.php.

References $ilDB, and $query.

Referenced by clipboardCopy(), ilTermUsagesTableGUI\fillRow(), ilObjectivesAlignmentTableGUI\fillRow(), and ilNoteGUI\showTargets().

{
global $ilDB;
$query = "SELECT * FROM sahs_sc13_tree_node WHERE obj_id = ".
$ilDB->quote($a_obj_id, "integer");
$obj_set = $ilDB->query($query);
$obj_rec = $ilDB->fetchAssoc($obj_set);
return $obj_rec["title"];
}

+ Here is the caller graph for this function:

static ilSCORM2004Node::_lookupType (   $a_obj_id)
static

Lookup Type.

Parameters
intNode ID
Returns
string Type

Definition at line 361 of file class.ilSCORM2004Node.php.

References $ilDB, and $query.

Referenced by clipboardCopy(), ilObjSCORM2004LearningModuleGUI\frameset(), ilObjSCORM2004LearningModuleGUI\getNotesHTML(), ilObjSCORM2004LearningModuleGUI\jumpToNode(), pasteTree(), and uniqueTypesCheck().

{
global $ilDB;
$query = "SELECT * FROM sahs_sc13_tree_node WHERE obj_id = ".
$ilDB->quote($a_obj_id, "integer");
$obj_set = $ilDB->query($query);
$obj_rec = $ilDB->fetchAssoc($obj_set);
return $obj_rec["type"];
}

+ Here is the caller graph for this function:

static ilSCORM2004Node::_writeImportId (   $a_id,
  $a_import_id 
)
static

Write import ID.

Parameters
int$a_idNode ID
string$a_import_idImport ID

Definition at line 395 of file class.ilSCORM2004Node.php.

References $ilDB.

{
global $ilDB;
$q = "UPDATE sahs_sc13_tree_node ".
"SET ".
"import_id = ".$ilDB->quote($a_import_id, "text").",".
"last_update = ".$ilDB->now().
"WHERE obj_id = ".$ilDB->quote($a_id, "integer");
$ilDB->manipulate($q);
}
static ilSCORM2004Node::_writeTitle (   $a_obj_id,
  $a_title 
)
static

Write Title.

Parameters
intNode ID
stringTitle

Definition at line 379 of file class.ilSCORM2004Node.php.

References $ilDB, and $query.

Referenced by MDUpdateListener(), and ilObjSCORM2004LearningModuleGUI\saveAllTitles().

{
global $ilDB;
$query = "UPDATE sahs_sc13_tree_node SET ".
" title = ".$ilDB->quote($a_title, "text").
" WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer");
$ilDB->manipulate($query);
}

+ Here is the caller graph for this function:

static ilSCORM2004Node::clipboardCopy (   $a_slm_obj_id,
  $a_ids 
)
static

Copy a set of chapters/pages/scos into the clipboard.

Definition at line 635 of file class.ilSCORM2004Node.php.

References $id, _lookupTitle(), _lookupType(), and getTree().

Referenced by clipboardCut(), ilSCORM2004NodeGUI\copyItems(), and ilObjSCORM2004LearningModuleGUI\copyItems().

{
global $ilUser;
$tree = ilSCORM2004Node::getTree($a_slm_obj_id);
$ilUser->clipboardDeleteObjectsOfType("page");
$ilUser->clipboardDeleteObjectsOfType("chap");
$ilUser->clipboardDeleteObjectsOfType("sco");
// put them into the clipboard
$time = date("Y-m-d H:i:s", time());
foreach ($a_ids as $id)
{
$curnode = "";
if ($tree->isInTree($id))
{
$curnode = $tree->getNodeData($id);
$subnodes = $tree->getSubTree($curnode);
foreach($subnodes as $subnode)
{
if ($subnode["child"] != $id)
{
$ilUser->addObjectToClipboard($subnode["child"],
$subnode["type"], $subnode["title"],
$subnode["parent"], $time, $subnode["lft"]);
}
}
}
$order = ($curnode["lft"] > 0)
? $curnode["lft"]
: (int) ($order + 1);
$ilUser->addObjectToClipboard($id,
$order);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Node::clipboardCut (   $a_slm_obj_id,
  $a_ids 
)

Cut and copy a set of chapters/pages into the clipboard.

Definition at line 676 of file class.ilSCORM2004Node.php.

References $id, $path, clipboardCopy(), and getTree().

Referenced by ilSCORM2004NodeGUI\cutItems(), and ilObjSCORM2004LearningModuleGUI\cutItems().

{
$tree = ilSCORM2004Node::getTree($a_slm_obj_id);
if (!is_array($a_ids))
{
return false;
}
else
{
// get all "top" ids, i.e. remove ids, that have a selected parent
foreach($a_ids as $id)
{
$path = $tree->getPathId($id);
$take = true;
foreach($path as $path_id)
{
if ($path_id != $id && in_array($path_id, $a_ids))
{
$take = false;
}
}
if ($take)
{
$cut_ids[] = $id;
}
}
}
ilSCORM2004Node::clipboardCopy($a_slm_obj_id, $cut_ids);
// remove the objects from the tree
// note: we are getting chapters, scos and pages which are *not* in the tree
// we do not delete any pages/chapters here
foreach ($cut_ids as $id)
{
$curnode = $tree->getNodeData($id);
if ($tree->isInTree($id))
{
$tree->deleteTree($curnode);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Node::create (   $a_upload = false)

Create Node.

Parameters
booleanUpload Mode

Definition at line 413 of file class.ilSCORM2004Node.php.

References $id, $ilDB, $query, createMetaData(), getImportId(), getSLMId(), getTitle(), getType(), and setId().

{
global $ilDB;
// insert object data
$id = $ilDB->nextId("sahs_sc13_tree_node");
$query = "INSERT INTO sahs_sc13_tree_node (obj_id, title, type, slm_id, import_id, create_date) ".
"VALUES (".
$ilDB->quote($id, "integer").",".
$ilDB->quote($this->getTitle(), "text").",".
$ilDB->quote($this->getType(), "text").", ".
$ilDB->quote($this->getSLMId(), "integer").",".
$ilDB->quote($this->getImportId(), "text").
", ".$ilDB->now().")";
$ilDB->manipulate($query);
$this->setId($id);
if (!$a_upload)
{
$this->createMetaData();
}
}

+ Here is the call graph for this function:

ilSCORM2004Node::createMetaData ( )

create meta data entry

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

References getDescription(), getId(), getSLMId(), getTitle(), and getType().

Referenced by create().

{
global $ilUser;
include_once 'Services/MetaData/classes/class.ilMDCreator.php';
$md_creator = new ilMDCreator($this->getSLMId(), $this->getId(), $this->getType());
$md_creator->setTitle($this->getTitle());
$md_creator->setTitleLanguage($ilUser->getPref('language'));
$md_creator->setDescription($this->getDescription());
$md_creator->setDescriptionLanguage($ilUser->getPref('language'));
$md_creator->setKeywordLanguage($ilUser->getPref('language'));
$md_creator->setLanguage($ilUser->getPref('language'));
$md_creator->create();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Node::delete ( )

Delete Node.

Definition at line 456 of file class.ilSCORM2004Node.php.

References $ilDB, $query, deleteMetaData(), and getId().

Referenced by ilSCORM2004PageNode\delete(), ilSCORM2004Sco\delete_rec(), and ilSCORM2004Chapter\delete_rec().

{
global $ilDB;
$query = "DELETE FROM sahs_sc13_tree_node WHERE obj_id= ".
$ilDB->quote($this->getId(), "integer");
$ilDB->manipulate($query);
$this->deleteMetaData();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Node::deleteMetaData ( )

delete meta data entry

Definition at line 321 of file class.ilSCORM2004Node.php.

References getId(), getSLMId(), and getType().

Referenced by delete().

{
// Delete meta data
include_once('Services/MetaData/classes/class.ilMD.php');
$md = new ilMD($this->getSLMId(), $this->getId(), $this->getType());
$md->deleteAll();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Node::deleteSeqInfo ( )

Definition at line 1001 of file class.ilSCORM2004Node.php.

References getId().

Referenced by ilSCORM2004Sco\delete(), and ilSCORM2004Chapter\delete().

{
include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
$seq_item = new ilSCORM2004Item($this->getId());
$seq_item -> delete();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Node::exportAsScorm12 ( )

Definition at line 1016 of file class.ilSCORM2004Node.php.

{
//to implement
return;
}
ilSCORM2004Node::exportAsScorm13 ( )

Definition at line 1021 of file class.ilSCORM2004Node.php.

{
//to implement
return;
}
ilSCORM2004Node::getContentObject ( )

Get Scorm Learning Module Object.

Returns
int Scorm LM Object

Definition at line 168 of file class.ilSCORM2004Node.php.

References $slm_object.

{
}
ilSCORM2004Node::getDescription ( )

Get description.

Returns
string Description

Definition at line 97 of file class.ilSCORM2004Node.php.

Referenced by ilSCORM2004Sco\copy(), ilSCORM2004Chapter\copy(), ilSCORM2004PageNode\copy(), and createMetaData().

{
return $this->description;
}

+ Here is the caller graph for this function:

ilSCORM2004Node::getImportId ( )

Set Import ID.

Parameters
intImport ID

Definition at line 198 of file class.ilSCORM2004Node.php.

Referenced by create().

{
return $this->import_id;
}

+ Here is the caller graph for this function:

ilSCORM2004Node::getObjectives ( )

Definition at line 995 of file class.ilSCORM2004Node.php.

References ilSCORM2004Objective\fetchAllObjectives(), and getId().

Referenced by ilSCORM2004Sco\exportHTMLPageObjects(), and ilSCORM2004Sco\exportScorm().

{
include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Objective.php");
return ilSCORM2004Objective::fetchAllObjectives($this->slm_object,$this->getId());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Node::getSLMId ( )

Get ID of parent Scorm Learning Module Object.

Parameters
intScorm LM ID

Definition at line 138 of file class.ilSCORM2004Node.php.

References $slm_id.

Referenced by ilSCORM2004Sco\copy(), ilSCORM2004Chapter\copy(), ilSCORM2004PageNode\copy(), ilSCORM2004PageNode\create(), create(), createMetaData(), deleteMetaData(), ilSCORM2004Sco\exportHTMLPageObjects(), ilSCORM2004Sco\exportXMLMetaData(), MDUpdateListener(), update(), and updateMetaData().

{
return $this->slm_id;
}

+ Here is the caller graph for this function:

ilSCORM2004Node::getSLMObject ( )

Get scorm learning module object.

Returns
int Scorm LM Object

Definition at line 158 of file class.ilSCORM2004Node.php.

References $slm_object.

{
}
ilSCORM2004Node::getTitle ( )

Get title.

Returns
string title

Definition at line 77 of file class.ilSCORM2004Node.php.

References $title.

Referenced by ilSCORM2004Sco\copy(), ilSCORM2004Chapter\copy(), ilSCORM2004PageNode\copy(), create(), createMetaData(), ilSCORM2004Sco\exportHTMLPageObjects(), update(), and updateMetaData().

{
return $this->title;
}

+ Here is the caller graph for this function:

static ilSCORM2004Node::getTree (   $a_slm_obj_id)
static

Get scorm module editing tree.

Parameters
intscorm module object id
Returns
object tree object

Definition at line 622 of file class.ilSCORM2004Node.php.

Referenced by clipboardCopy(), clipboardCut(), insertChapterClip(), insertPageClip(), and insertScoClip().

{
$tree = new ilTree($a_slm_obj_id);
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
$tree->readRootId();
return $tree;
}

+ Here is the caller graph for this function:

ilSCORM2004Node::getType ( )
ilSCORM2004Node::ilSCORM2004Node (   $a_slm_object,
  $a_id = 0 
)
Parameters
object$a_slm_objectilObjScorm2004LearningModule object

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

References read(), setSLMId(), setSLMObject(), and ilTree\setTableNames().

Referenced by ilSCORM2004Chapter\ilSCORM2004Chapter(), ilSCORM2004PageNode\ilSCORM2004PageNode(), and ilSCORM2004Sco\ilSCORM2004Sco().

{
$this->id = $a_id;
$this->setSLMObject($a_slm_object);
$this->setSLMId($a_slm_object->getId());
$this->tree = new ilTree($a_slm_object->getId());
$this->tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$this->tree->setTreeTablePK("slm_id");
if($a_id != 0)
{
$this->read();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Node::insertChapterClip (   $a_slm_obj,
  $a_as_sub = false 
)

Insert Chapter from clipboard.

Definition at line 842 of file class.ilSCORM2004Node.php.

References $ilCtrl, $ilLog, ilEditClipboard\clear(), ilEditClipboard\getAction(), ilHierarchyFormGUI\getPostFirstChild(), ilHierarchyFormGUI\getPostNodeId(), getTree(), IL_FIRST_NODE, and pasteTree().

{
global $ilUser, $ilCtrl, $ilLog;
// @todo: move this to a service since it can be used here, too
include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
$tree = ilSCORM2004Node::getTree($a_slm_obj->getId());
if ($a_as_sub) // as subchapter
{
if (!$first_child) // insert under parent
{
$parent_id = $node_id;
$target = "";
}
else // we shouldnt end up here
{
return;
}
}
else // as chapter
{
if (!$first_child) // insert after node id
{
$parent_id = $tree->getParentId($node_id);
$target = $node_id;
}
else // insert as first child
{
$parent_id = $node_id;
$target = IL_FIRST_NODE;
// do not move a chapter in front of a sco (maybe never needed)
$childs = $tree->getChildsByType($parent_id, "sco");
if (count($childs) != 0)
{
$target = $childs[count($childs) - 1]["obj_id"];
}
}
}
// copy and paste
$chapters = $ilUser->getClipboardObjects("chap", true);
$copied_nodes = array();
foreach ($chapters as $chap)
{
$cid = ilSCORM2004Node::pasteTree($a_slm_obj, $chap["id"], $parent_id,
$target, $chap["insert_time"], $copied_nodes,
$target = $cid;
}
//ilLMObject::updateInternalLinks($copied_nodes);
{
$ilUser->clipboardDeleteObjectsOfType("page");
$ilUser->clipboardDeleteObjectsOfType("chap");
$ilUser->clipboardDeleteObjectsOfType("sco");
}
}

+ Here is the call graph for this function:

static ilSCORM2004Node::insertPageClip (   $a_slm_obj)
static

Insert pages from clipboard.

Definition at line 746 of file class.ilSCORM2004Node.php.

References $ilCtrl, ilEditClipboard\clear(), ilEditClipboard\getAction(), ilHierarchyFormGUI\getPostFirstChild(), ilHierarchyFormGUI\getPostNodeId(), getTree(), IL_FIRST_NODE, and pasteTree().

{
global $ilCtrl, $ilUser;
// @todo: move this to a service since it can be used here, too
include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
$tree = ilSCORM2004Node::getTree($a_slm_obj->getId());
if (!$first_child) // insert after node id
{
$parent_id = $tree->getParentId($node_id);
$target = $node_id;
}
else // insert as first child
{
$parent_id = $node_id;
$target = IL_FIRST_NODE;
}
// cut and paste
$pages = $ilUser->getClipboardObjects("page");
$copied_nodes = array();
foreach ($pages as $pg)
{
$cid = ilSCORM2004Node::pasteTree($a_slm_obj, $pg["id"], $parent_id, $target,
$pg["insert_time"], $copied_nodes,
$target = $cid;
}
//ilLMObject::updateInternalLinks($copied_nodes);
{
$ilUser->clipboardDeleteObjectsOfType("page");
$ilUser->clipboardDeleteObjectsOfType("chap");
$ilUser->clipboardDeleteObjectsOfType("sco");
}
}

+ Here is the call graph for this function:

static ilSCORM2004Node::insertScoClip (   $a_slm_obj)
static

Insert scos from clipboard.

Definition at line 794 of file class.ilSCORM2004Node.php.

References $ilCtrl, ilEditClipboard\clear(), ilEditClipboard\getAction(), ilHierarchyFormGUI\getPostFirstChild(), ilHierarchyFormGUI\getPostNodeId(), getTree(), IL_FIRST_NODE, and pasteTree().

{
global $ilCtrl, $ilUser;
// @todo: move this to a service since it can be used here, too
include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
$tree = ilSCORM2004Node::getTree($a_slm_obj->getId());
if (!$first_child) // insert after node id
{
$parent_id = $tree->getParentId($node_id);
$target = $node_id;
}
else // insert as first child
{
$parent_id = $node_id;
$target = IL_FIRST_NODE;
}
// cut and paste
$scos = $ilUser->getClipboardObjects("sco");
$copied_nodes = array();
foreach ($scos as $sco)
{
$cid = ilSCORM2004Node::pasteTree($a_slm_obj, $sco["id"], $parent_id, $target,
$sco["insert_time"], $copied_nodes,
$target = $cid;
}
//ilLMObject::updateInternalLinks($copied_nodes);
{
$ilUser->clipboardDeleteObjectsOfType("page");
$ilUser->clipboardDeleteObjectsOfType("chap");
$ilUser->clipboardDeleteObjectsOfType("sco");
}
}

+ Here is the call graph for this function:

ilSCORM2004Node::MDUpdateListener (   $a_element)

Meta data update listener.

Important note: Do never call create() or update() method of ilObject here. It would result in an endless loop: update object -> update meta -> update object -> ... Use static _writeTitle() ... methods instead.

Parameters
string$a_element

Definition at line 244 of file class.ilSCORM2004Node.php.

References $id, _writeTitle(), getId(), getSLMId(), and getType().

{
include_once 'Services/MetaData/classes/class.ilMD.php';
switch($a_element)
{
case 'General':
// Update Title and description
$md = new ilMD($this->getSLMId(), $this->getId(), $this->getType());
$md_gen = $md->getGeneral();
ilSCORM2004Node::_writeTitle($this->getId(), $md_gen->getTitle());
foreach($md_gen->getDescriptionIds() as $id)
{
$md_des = $md_gen->getDescription($id);
// ilLMObject::_writeDescription($this->getId(),$md_des->getDescription());
break;
}
break;
default:
}
return true;
}

+ Here is the call graph for this function:

ilSCORM2004Node::parentHasSeqTemplate ( )

Definition at line 1009 of file class.ilSCORM2004Node.php.

References getId().

{
include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Utilities.php");
$seq_util = new ilSCORM2004Utilities($this->getId());
return $seq_util -> parentHasSeqTemplate($this->slm_object);
}

+ Here is the call graph for this function:

static ilSCORM2004Node::pasteTree (   $a_target_slm,
  $a_item_id,
  $a_parent_id,
  $a_target,
  $a_insert_time,
$a_copied_nodes,
  $a_as_copy = false 
)
static

Paste item (tree) from clipboard to current scorm learning module.

Definition at line 912 of file class.ilSCORM2004Node.php.

References $ilLog, _lookupSLMID(), _lookupType(), ilMD\cloneMD(), IL_LAST_NODE, and putInTree().

Referenced by insertChapterClip(), insertPageClip(), and insertScoClip().

{
global $ilUser, $ilias, $ilLog;
$item_slm_id = ilSCORM2004Node::_lookupSLMID($a_item_id);
$item_type = ilSCORM2004Node::_lookupType($a_item_id);
$slm_obj = $ilias->obj_factory->getInstanceByObjId($item_slm_id);
if ($item_type == "chap")
{
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Chapter.php");
$item = new ilSCORM2004Chapter($slm_obj, $a_item_id);
}
else if ($item_type == "page")
{
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php");
$item = new ilSCORM2004PageNode($slm_obj, $a_item_id);
}
else if ($item_type == "sco")
{
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
$item = new ilSCORM2004Sco($slm_obj, $a_item_id);
}
$ilLog->write("Getting from clipboard type ".$item_type.", ".
"Item ID: ".$a_item_id.", of original SLM: ".$item_slm_id);
if ($item_slm_id != $a_target_slm->getId() && !$a_as_copy)
{
// @todo: check whether st is NOT in tree
// "move" metadata to new lm
include_once("Services/MetaData/classes/class.ilMD.php");
$md = new ilMD($item_slm_id, $item->getId(), $item->getType());
$new_md = $md->cloneMD($a_target_slm->getId(), $item->getId(), $item->getType());
// update lm object
$item->setSLMId($a_target_slm->getId());
$item->setSLMObject($a_target_slm);
$item->update();
// delete old meta data set
$md->deleteAll();
if ($item_type == "page")
{
$page = $item->getPageObject();
$page->buildDom();
$page->setParentId($a_target_slm->getId());
$page->update();
}
}
if ($a_as_copy)
{
$target_item = $item->copy($a_target_slm);
$a_copied_nodes[$item->getId()] = $target_item->getId();
}
else
{
$target_item = $item;
}
$ilLog->write("Putting into tree type ".$target_item->getType().
"Item ID: ".$target_item->getId().", Parent: ".$a_parent_id.", ".
"Target: ".$a_target.", Item LM:".$target_item->getContentObject()->getId());
ilSCORM2004Node::putInTree($target_item, $a_parent_id, $a_target);
$childs = $ilUser->getClipboardChilds($item->getId(), $a_insert_time);
foreach($childs as $child)
{
ilSCORM2004Node::pasteTree($a_target_slm, $child["id"], $target_item->getId(),
IL_LAST_NODE, $a_insert_time, $a_copied_nodes, $a_as_copy);
}
return $target_item->getId();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilSCORM2004Node::putInTree (   $a_obj,
  $a_parent_id = "",
  $a_target_node_id = "" 
)
static

put this object into content object tree

Definition at line 578 of file class.ilSCORM2004Node.php.

References IL_FIRST_NODE, and ilTree\setTreeTablePK().

Referenced by ilSCORM13Package\dbImportLM(), ilSCORM13Package\dbImportSco(), ilSCORM2004SeqTemplate\importTemplate(), ilObjSCORM2004LearningModuleGUI\insertChapter(), ilObjSCORM2004LearningModuleGUI\insertPage(), ilObjSCORM2004LearningModuleGUI\insertSco(), ilObjSCORM2004LearningModuleGUI\insertTemplate(), and pasteTree().

{
$tree =& new ilTree($a_obj->getSLMId());
$tree->setTreeTablePK("slm_id");
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
// determine parent
$parent_id = ($a_parent_id != "")
? $a_parent_id
: $tree->getRootId();
// determine target
if ($a_target_node_id != "")
{
$target = $a_target_node_id;
}
else
{
// determine last child that serves as predecessor
$childs =& $tree->getChilds($parent_id);
if (count($childs) == 0)
{
$target = IL_FIRST_NODE;
}
else
{
$target = $childs[count($childs) - 1]["obj_id"];
}
}
if ($tree->isInTree($parent_id) && !$tree->isInTree($a_obj->getId()))
{
$tree->insertNode($a_obj->getId(), $parent_id, $target);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Node::read ( )

Read Data of Node.

Reimplemented in ilSCORM2004PageNode.

Definition at line 216 of file class.ilSCORM2004Node.php.

References $ilBench, $ilDB, $query, setImportId(), and setTitle().

Referenced by ilSCORM2004Node().

{
global $ilBench, $ilDB;
if(!isset($this->data_record))
{
$query = "SELECT * FROM sahs_sc13_tree_node WHERE obj_id = ".
$ilDB->quote($this->id, "integer");
$obj_set = $ilDB->query($query);
$this->data_record = $ilDB->fetchAssoc($obj_set);
}
$this->type = $this->data_record["type"];
$this->setImportId($this->data_record["import_id"]);
$this->setTitle($this->data_record["title"]);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Node::setDataRecord (   $a_record)

this method should only be called by class ilSCORM2004NodeFactory

Definition at line 332 of file class.ilSCORM2004Node.php.

{
$this->data_record = $a_record;
}
ilSCORM2004Node::setDescription (   $a_description)

Set description.

Parameters
stringDescription

Definition at line 87 of file class.ilSCORM2004Node.php.

{
$this->description = $a_description;
}
ilSCORM2004Node::setId (   $a_id)

Set Node ID.

Parameters
intNode ID

Reimplemented in ilSCORM2004PageNode, and ilSCORM2004SeqTemplate.

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

Referenced by create().

{
$this->id = $a_id;
}

+ Here is the caller graph for this function:

ilSCORM2004Node::setImportId (   $a_id)

Get Import ID.

Parameters
intImport ID

Definition at line 208 of file class.ilSCORM2004Node.php.

Referenced by read().

{
$this->import_id = $a_id;
}

+ Here is the caller graph for this function:

ilSCORM2004Node::setSLMId (   $a_slm_id)

Set ID of parent Scorm Learning Module Object.

Parameters
intScorm LM ID

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

Referenced by ilSCORM2004Node().

{
$this->slm_id = $a_slm_id;
}

+ Here is the caller graph for this function:

ilSCORM2004Node::setSLMObject (   $a_slm_obj)

Set Scorm Learning Module Object.

Parameters
intScorm LM Object

Definition at line 148 of file class.ilSCORM2004Node.php.

Referenced by ilSCORM2004Node().

{
$this->slm_object = $a_slm_obj;
}

+ Here is the caller graph for this function:

ilSCORM2004Node::setTitle (   $a_title)

Set title.

Parameters
string$a_titletitle

Definition at line 67 of file class.ilSCORM2004Node.php.

Referenced by read().

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

ilSCORM2004Node::setType (   $a_type)

Set type.

Parameters
stringType

Definition at line 107 of file class.ilSCORM2004Node.php.

Referenced by ilSCORM2004Chapter\ilSCORM2004Chapter(), ilSCORM2004PageNode\ilSCORM2004PageNode(), ilSCORM2004Sco\ilSCORM2004Sco(), and ilSCORM2004SeqChapter\ilSCORM2004SeqChapter().

{
$this->type = $a_type;
}

+ Here is the caller graph for this function:

static ilSCORM2004Node::uniqueTypesCheck (   $a_items)
static

Check for unique types (all pages or all chapters or all scos)

Definition at line 724 of file class.ilSCORM2004Node.php.

References $type, and _lookupType().

Referenced by ilSCORM2004NodeGUI\copyItems(), ilObjSCORM2004LearningModuleGUI\copyItems(), ilSCORM2004NodeGUI\cutItems(), and ilObjSCORM2004LearningModuleGUI\cutItems().

{
$types = array();
if (is_array($a_items))
{
foreach($a_items as $item)
{
$types[$type] = $type;
}
}
if (count($types) > 1)
{
return false;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Node::update ( )

Update Node.

Definition at line 439 of file class.ilSCORM2004Node.php.

References $ilDB, $query, getId(), getSLMId(), getTitle(), and updateMetaData().

{
global $ilDB;
$this->updateMetaData();
$query = "UPDATE sahs_sc13_tree_node SET ".
" slm_id = ".$ilDB->quote($this->getSLMId(), "integer").
" ,title = ".$ilDB->quote($this->getTitle(), "text").
" WHERE obj_id = ".$ilDB->quote($this->getId(), "integer");
$ilDB->manipulate($query);
}

+ Here is the call graph for this function:

ilSCORM2004Node::updateMetaData ( )

update meta data entry

Definition at line 296 of file class.ilSCORM2004Node.php.

References getId(), getSLMId(), getTitle(), and getType().

Referenced by update().

{
include_once("Services/MetaData/classes/class.ilMD.php");
include_once("Services/MetaData/classes/class.ilMDGeneral.php");
include_once("Services/MetaData/classes/class.ilMDDescription.php");
$md = new ilMD($this->getSLMId(), $this->getId(), $this->getType());
$md_gen = $md->getGeneral();
$md_gen->setTitle($this->getTitle());
// sets first description
$md_des_ids = $md_gen->getDescriptionIds();
if (count($md_des_ids) > 0)
{
$md_des =& $md_gen->getDescription($md_des_ids[0]);
// $md_des->setDescription($this->getDescription());
$md_des->update();
}
$md_gen->update();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilSCORM2004Node::$id
ilSCORM2004Node::$slm_id

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

Referenced by _getIdForImportId(), and getSLMId().

ilSCORM2004Node::$slm_object

Definition at line 41 of file class.ilSCORM2004Node.php.

Referenced by getContentObject(), and getSLMObject().

ilSCORM2004Node::$type

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