ILIAS  Release_5_0_x_branch Revision 61816
 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 insertAssetClip ($a_slm_obj, $a_type="ass")
 Insert assets 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, $a_from_clipboard=true)
 Paste item (tree) from clipboard or other learning module to target 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 18 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 522 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/Scorm2004/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 492 of file class.ilSCORM2004Node.php.

References $ilDB, and ilInternalLink\_extractObjIdOfTarget().

{
global $ilDB;
include_once("./Services/Link/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 462 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 547 of file class.ilSCORM2004Node.php.

References $ilDB, and $query.

Referenced by _getIdForImportId(), ilObjMediaObject\getParentObjectIdForUsage(), 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 327 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 345 of file class.ilSCORM2004Node.php.

References $ilDB, and $query.

Referenced by clipboardCopy(), ilObjSCORM2004LearningModuleGUI\editOrganization(), 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 379 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 363 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 619 of file class.ilSCORM2004Node.php.

References $id, $ilUser, _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");
$ilUser->clipboardDeleteObjectsOfType("ass");
// 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 661 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 397 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 260 of file class.ilSCORM2004Node.php.

References $ilUser, 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.

Reimplemented in ilSCORM2004Sco.

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

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

Referenced by ilSCORM2004PageNode\delete(), ilSCORM2004Chapter\delete_rec(), and ilSCORM2004Asset\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 305 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 1028 of file class.ilSCORM2004Node.php.

References getId().

Referenced by ilSCORM2004Asset\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 1043 of file class.ilSCORM2004Node.php.

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

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

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

Get Scorm Learning Module Object.

Returns
int Scorm LM Object

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

References $slm_object.

{
}
ilSCORM2004Node::getDescription ( )

Get description.

Returns
string Description

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

Referenced by ilSCORM2004Chapter\copy(), ilSCORM2004Asset\copy(), ilSCORM2004PageNode\copy(), ilSCORM2004Sco\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 182 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 1022 of file class.ilSCORM2004Node.php.

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

Referenced by ilSCORM2004Asset\exportScorm(), and ilSCORM2004Sco\getMainObjectiveText().

{
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 122 of file class.ilSCORM2004Node.php.

References $slm_id.

Referenced by ilSCORM2004Chapter\copy(), ilSCORM2004Asset\copy(), ilSCORM2004PageNode\copy(), ilSCORM2004Sco\copy(), ilSCORM2004PageNode\create(), create(), createMetaData(), deleteMetaData(), ilSCORM2004Asset\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 142 of file class.ilSCORM2004Node.php.

References $slm_object.

{
}
ilSCORM2004Node::getTitle ( )

Get title.

Returns
string title

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

Referenced by ilSCORM2004Chapter\copy(), ilSCORM2004Asset\copy(), ilSCORM2004PageNode\copy(), ilSCORM2004Sco\copy(), create(), createMetaData(), ilSCORM2004Asset\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 606 of file class.ilSCORM2004Node.php.

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

{
$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::ilSCORM2004Node (   $a_slm_object,
  $a_id = 0 
)
Parameters
object$a_slm_objectilObjScorm2004LearningModule object

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

References read(), setSLMId(), and setSLMObject().

Referenced by ilSCORM2004EntryAsset\__construct(), ilSCORM2004FinalAsset\__construct(), ilSCORM2004Asset\__construct(), ilSCORM2004Chapter\ilSCORM2004Chapter(), and ilSCORM2004PageNode\ilSCORM2004PageNode().

{
$this->id = $a_id;
$this->setSLMObject($a_slm_object);
$this->setSLMId($a_slm_object->getId());
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php");
$this->tree = new ilSCORM2004Tree($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:

static ilSCORM2004Node::insertAssetClip (   $a_slm_obj,
  $a_type = "ass" 
)
static

Insert assets from clipboard.

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

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

Referenced by insertScoClip().

{
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($a_type);
$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");
$ilUser->clipboardDeleteObjectsOfType("ass");
}
}

+ 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 838 of file class.ilSCORM2004Node.php.

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

{
// @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");
$ilUser->clipboardDeleteObjectsOfType("ass");
}
}

+ Here is the call graph for this function:

static ilSCORM2004Node::insertPageClip (   $a_slm_obj)
static

Insert pages from clipboard.

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

References $ilCtrl, $ilUser, 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");
$ilUser->clipboardDeleteObjectsOfType("ass");
}
}

+ Here is the call graph for this function:

static ilSCORM2004Node::insertScoClip (   $a_slm_obj)
static

Insert scos from clipboard.

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

References insertAssetClip().

{
self::insertAssetClip($a_slm_obj, "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 228 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 1036 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,
  $a_from_clipboard = true 
)
static

Paste item (tree) from clipboard or other learning module to target scorm learning module.

Parameters
object$a_target_slmtarget scorm 2004 learning module object
int$a_item_idid of item that should be pasted
int$a_parent_idparent id in target tree,
int$a_targetpredecessor target node, no ID means: last child
string$a_insert_timecliboard insert time (not needed, if $a_from_cliboard is false)
array$a_copied_nodesarray of IDs od copied nodes, key is ID of source node, value is ID of copied node
bool$a_as_copyif true, items are copied otherwise they are moved
bool$a_from_clipboardif true, child node information is read from clipboard, otherwise from source tree

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

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

Referenced by ilObjSCORM2004LearningModule\copyAuthoredContent(), insertAssetClip(), insertChapterClip(), and insertPageClip().

{
global $ilUser, $ilias, $ilLog;
// source lm id, item type and lm object
$item_slm_id = ilSCORM2004Node::_lookupSLMID($a_item_id);
$item_type = ilSCORM2004Node::_lookupType($a_item_id);
//$slm_obj = $ilias->obj_factory->getInstanceByObjId($item_slm_id);
include_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
$slm_obj = new ilObjSCORM2004LearningModule($item_slm_id, false);
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);
}
else if ($item_type == "ass")
{
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Asset.php");
$item = new ilSCORM2004Asset($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($a_from_clipboard);
$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);
if ($a_from_clipboard)
{
$childs = $ilUser->getClipboardChilds($item->getId(), $a_insert_time);
}
else
{
// get childs of source tree
$source_tree = $slm_obj->getTree();
$childs = $source_tree->getChilds($a_item_id);
}
foreach($childs as $child)
{
$child_id = ($a_from_clipboard)
? $child["id"]
: $child["child"];
ilSCORM2004Node::pasteTree($a_target_slm, $child_id, $target_item->getId(),
IL_LAST_NODE, $a_insert_time, $a_copied_nodes, $a_as_copy, $a_from_clipboard);
}
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 562 of file class.ilSCORM2004Node.php.

References IL_FIRST_NODE, and ilTree\setTreeTablePK().

Referenced by ilSCORM13Package\dbImportLM(), ilSCORM13Package\dbImportSco(), ilSCORM2004SeqTemplate\importTemplate(), ilObjSCORM2004LearningModuleGUI\insertAsset(), 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 ilSCORM2004Sco, and ilSCORM2004PageNode.

Definition at line 200 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 316 of file class.ilSCORM2004Node.php.

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

Set description.

Parameters
stringDescription

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

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

Set Node ID.

Parameters
intNode ID

Reimplemented in ilSCORM2004SeqTemplate, and ilSCORM2004PageNode.

Definition at line 162 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 192 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 111 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 132 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 51 of file class.ilSCORM2004Node.php.

Referenced by read().

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

ilSCORM2004Node::setType (   $a_type)
static ilSCORM2004Node::uniqueTypesCheck (   $a_items)
static

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

Definition at line 709 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.

Reimplemented in ilSCORM2004Sco.

Definition at line 423 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 280 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 20 of file class.ilSCORM2004Node.php.

Referenced by _getIdForImportId(), and getSLMId().

ilSCORM2004Node::$slm_object

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

Referenced by getContentObject(), and getSLMObject().

ilSCORM2004Node::$type

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