6 require_once(
"./Services/MetaData/classes/class.ilMDLanguageItem.php");
42 $this->db = $DIC->database();
43 $this->
user = $DIC->user();
46 $this->
setSLMId($a_slm_object->getId());
48 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php");
66 $this->title = $a_title;
86 $this->description = $a_description;
126 $this->slm_id = $a_slm_id;
146 $this->slm_object = $a_slm_obj;
196 return $this->import_id;
206 $this->import_id = $a_id;
216 if (!isset($this->data_record)) {
217 $query =
"SELECT * FROM sahs_sc13_tree_node WHERE obj_id = " .
218 $ilDB->quote($this->
id,
"integer");
220 $this->data_record =
$ilDB->fetchAssoc($obj_set);
223 $this->type = $this->data_record[
"type"];
224 $this->
setImportId($this->data_record[
"import_id"]);
225 $this->
setTitle($this->data_record[
"title"]);
241 include_once
'Services/MetaData/classes/class.ilMD.php';
243 switch ($a_element) {
248 $md_gen = $md->getGeneral();
252 foreach ($md_gen->getDescriptionIds() as
$id) {
253 $md_des = $md_gen->getDescription(
$id);
273 include_once
'Services/MetaData/classes/class.ilMDCreator.php';
275 $md_creator->setTitle($this->
getTitle());
276 $md_creator->setTitleLanguage(
$ilUser->getPref(
'language'));
278 $md_creator->setDescriptionLanguage(
$ilUser->getPref(
'language'));
279 $md_creator->setKeywordLanguage(
$ilUser->getPref(
'language'));
280 $md_creator->setLanguage(
$ilUser->getPref(
'language'));
281 $md_creator->create();
291 include_once(
"Services/MetaData/classes/class.ilMD.php");
292 include_once(
"Services/MetaData/classes/class.ilMDGeneral.php");
293 include_once(
"Services/MetaData/classes/class.ilMDDescription.php");
296 $md_gen = $md->getGeneral();
297 $md_gen->setTitle($this->
getTitle());
300 $md_des_ids = $md_gen->getDescriptionIds();
301 if (count($md_des_ids) > 0) {
302 $md_des = $md_gen->getDescription($md_des_ids[0]);
316 include_once(
'Services/MetaData/classes/class.ilMD.php');
326 $this->data_record = $a_record;
339 $ilDB = $DIC->database();
341 $query =
"SELECT * FROM sahs_sc13_tree_node WHERE obj_id = " .
342 $ilDB->quote($a_obj_id,
"integer");
344 $obj_rec =
$ilDB->fetchAssoc($obj_set);
346 return $obj_rec[
"title"];
359 $ilDB = $DIC->database();
361 $query =
"SELECT * FROM sahs_sc13_tree_node WHERE obj_id = " .
362 $ilDB->quote($a_obj_id,
"integer");
364 $obj_rec =
$ilDB->fetchAssoc($obj_set);
366 return $obj_rec[
"type"];
379 $ilDB = $DIC->database();
381 $query =
"UPDATE sahs_sc13_tree_node SET " .
382 " title = " .
$ilDB->quote($a_title,
"text") .
383 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer");
397 $ilDB = $DIC->database();
399 $q =
"UPDATE sahs_sc13_tree_node " .
401 "import_id = " .
$ilDB->quote($a_import_id,
"text") .
"," .
402 "last_update = " .
$ilDB->now() .
403 "WHERE obj_id = " .
$ilDB->quote($a_id,
"integer");
405 $ilDB->manipulate($q);
413 public function create($a_upload =
false)
418 $id =
$ilDB->nextId(
"sahs_sc13_tree_node");
419 $query =
"INSERT INTO sahs_sc13_tree_node (obj_id, title, type, slm_id, import_id, create_date) " .
421 $ilDB->quote(
$id,
"integer") .
"," .
426 ", " .
$ilDB->now() .
")";
444 $query =
"UPDATE sahs_sc13_tree_node SET " .
447 " WHERE obj_id = " .
$ilDB->quote($this->
getId(),
"integer");
455 public function delete()
459 $query =
"DELETE FROM sahs_sc13_tree_node WHERE obj_id= " .
481 $ilDB = $DIC->database();
484 $q =
"SELECT * FROM sahs_sc13_tree_node WHERE import_id = " .
485 $ilDB->quote($a_import_id,
"text") .
" " .
486 " ORDER BY create_date DESC";
487 $obj_set =
$ilDB->query($q);
488 while ($obj_rec =
$ilDB->fetchAssoc($obj_set)) {
493 return $obj_rec[
"obj_id"];
511 $ilDB = $DIC->database();
513 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
514 if (is_int(strpos($a_id,
"_"))) {
518 $q =
"SELECT * FROM sahs_sc13_tree_node WHERE obj_id = " .
519 $ilDB->quote($a_id,
"integer");
520 $obj_set =
$ilDB->query($q);
521 if ($obj_rec =
$ilDB->fetchAssoc($obj_set)) {
538 $ilDB = $DIC->database();
540 $query =
"SELECT * FROM sahs_sc13_tree_node " .
541 "WHERE slm_id = " .
$ilDB->quote($a_slm_object->getId(),
"integer") .
" ";
544 require_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
545 while ($obj_rec =
$ilDB->fetchAssoc($obj_set)) {
548 if (is_object($node_obj)) {
563 $ilDB = $DIC->database();
565 $query =
"SELECT * FROM sahs_sc13_tree_node WHERE obj_id = " .
566 $ilDB->quote($a_id,
"integer") .
"";
568 $obj_rec =
$ilDB->fetchAssoc($obj_set);
570 return $obj_rec[
"slm_id"];
576 public static function putInTree($a_obj, $a_parent_id =
"", $a_target_node_id =
"")
579 $tree->setTreeTablePK(
"slm_id");
580 $tree->setTableNames(
'sahs_sc13_tree',
'sahs_sc13_tree_node');
583 $parent_id = ($a_parent_id !=
"")
585 :
$tree->getRootId();
588 if ($a_target_node_id !=
"") {
592 $childs =
$tree->getChilds($parent_id);
594 if (count($childs) == 0) {
597 $target = $childs[count($childs) - 1][
"obj_id"];
601 if (
$tree->isInTree($parent_id) && !
$tree->isInTree($a_obj->getId())) {
602 $tree->insertNode($a_obj->getId(), $parent_id,
$target);
616 $tree->setTableNames(
'sahs_sc13_tree',
'sahs_sc13_tree_node');
617 $tree->setTreeTablePK(
"slm_id");
634 $ilUser->clipboardDeleteObjectsOfType(
"page");
635 $ilUser->clipboardDeleteObjectsOfType(
"chap");
636 $ilUser->clipboardDeleteObjectsOfType(
"sco");
637 $ilUser->clipboardDeleteObjectsOfType(
"ass");
640 $time = date(
"Y-m-d H:i:s", time());
641 foreach ($a_ids as
$id) {
643 if (
$tree->isInTree($id)) {
644 $curnode =
$tree->getNodeData($id);
645 $subnodes =
$tree->getSubTree($curnode);
646 foreach ($subnodes as $subnode) {
647 if ($subnode[
"child"] != $id) {
659 $order = ($curnode[
"lft"] > 0)
661 : (
int) ($order + 1);
680 if (!is_array($a_ids)) {
684 foreach ($a_ids as
$id) {
687 foreach (
$path as $path_id) {
688 if ($path_id != $id && in_array($path_id, $a_ids)) {
703 foreach ($cut_ids as
$id) {
704 $curnode =
$tree->getNodeData($id);
705 if (
$tree->isInTree($id)) {
706 $tree->deleteTree($curnode);
717 if (is_array($a_items)) {
718 foreach ($a_items as $item) {
724 if (count($types) > 1) {
740 include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
742 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
749 $parent_id =
$tree->getParentId($node_id);
752 $parent_id = $node_id;
757 $source_parent_type =
"";
758 if (
$ilUser->getClipboardObjects(
"page")) {
759 $pages =
$ilUser->getClipboardObjects(
"page");
760 } elseif (
$ilUser->getClipboardObjects(
"pg")) {
761 $source_parent_type =
"lm";
762 $pages =
$ilUser->getClipboardObjects(
"pg");
764 $copied_nodes = array();
766 foreach ($pages as $pg) {
783 $ilUser->clipboardDeleteObjectsOfType(
"page");
784 $ilUser->clipboardDeleteObjectsOfType(
"chap");
785 $ilUser->clipboardDeleteObjectsOfType(
"sco");
786 $ilUser->clipboardDeleteObjectsOfType(
"ass");
787 $ilUser->clipboardDeleteObjectsOfType(
"pg");
803 include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
805 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
812 $parent_id =
$tree->getParentId($node_id);
815 $parent_id = $node_id;
821 $copied_nodes = array();
822 foreach ($scos as $sco) {
837 $ilUser->clipboardDeleteObjectsOfType(
"page");
838 $ilUser->clipboardDeleteObjectsOfType(
"chap");
839 $ilUser->clipboardDeleteObjectsOfType(
"sco");
840 $ilUser->clipboardDeleteObjectsOfType(
"ass");
850 self::insertAssetClip($a_slm_obj,
"sco");
866 include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
868 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
876 $parent_id = $node_id;
883 $parent_id =
$tree->getParentId($node_id);
886 $parent_id = $node_id;
890 $childs =
$tree->getChildsByType($parent_id,
"sco");
891 if (count($childs) != 0) {
892 $target = $childs[count($childs) - 1][
"obj_id"];
898 $chapters =
$ilUser->getClipboardObjects(
"chap",
true);
899 $copied_nodes = array();
900 foreach ($chapters as $chap) {
906 $chap[
"insert_time"],
915 $ilUser->clipboardDeleteObjectsOfType(
"page");
916 $ilUser->clipboardDeleteObjectsOfType(
"chap");
917 $ilUser->clipboardDeleteObjectsOfType(
"sco");
918 $ilUser->clipboardDeleteObjectsOfType(
"ass");
943 $a_from_clipboard =
true,
944 $a_source_parent_type =
"" 953 if (in_array($a_source_parent_type, array(
"",
"sahs"))) {
958 include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
961 $ilLog->write(
"Getting from clipboard type " . $item_type .
", " .
962 "Item ID: " . $a_item_id .
", of original SLM: " . $item_slm_id);
963 } elseif (in_array($a_source_parent_type, array(
"lm"))) {
964 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
965 $item_lm_id = ilLMObject::_lookupContObjId($a_item_id);
968 include_once(
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
971 $ilLog->write(
"Getting from clipboard type " . $item_type .
", " .
972 "Item ID: " . $a_item_id .
", of original SLM: " . $item_lm_id);
977 if ($item_type ==
"chap") {
978 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Chapter.php");
980 } elseif ($item_type ==
"page") {
981 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php");
983 } elseif ($item_type ==
"sco") {
984 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
986 } elseif ($item_type ==
"ass") {
987 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Asset.php");
989 } elseif ($item_type ==
"pg") {
990 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
995 if ($item_slm_id != $a_target_slm->getId() && !$a_as_copy) {
999 include_once(
"Services/MetaData/classes/class.ilMD.php");
1000 $md =
new ilMD($item_slm_id, $item->getId(), $item->getType());
1001 $new_md = $md->
cloneMD($a_target_slm->getId(), $item->getId(), $item->getType());
1004 $item->setSLMId($a_target_slm->getId());
1005 $item->setSLMObject($a_target_slm);
1011 if ($item_type ==
"page") {
1012 $page = $item->getPageObject();
1013 $page->buildDom($a_from_clipboard);
1014 $page->setParentId($a_target_slm->getId());
1020 if ($a_source_parent_type ==
"lm") {
1021 if ($item_type =
"pg") {
1022 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php");
1026 $target_item = $item->copy($a_target_slm);
1028 $a_copied_nodes[$item->getId()] = $target_item->getId();
1030 $target_item = $item;
1033 $ilLog->write(
"Putting into tree type " . $target_item->getType() .
1034 "Item ID: " . $target_item->getId() .
", Parent: " . $a_parent_id .
", " .
1035 "Target: " . $a_target .
", Item LM:" . $target_item->getContentObject()->getId());
1039 if ($a_from_clipboard) {
1040 $childs =
$ilUser->getClipboardChilds($item->getId(), $a_insert_time);
1043 $source_tree = $slm_obj->getTree();
1044 $childs = $source_tree->getChilds($a_item_id);
1047 foreach ($childs as $child) {
1048 $child_id = ($a_from_clipboard)
1054 $target_item->getId(),
1060 $a_source_parent_type
1064 return $target_item->getId();
1072 include_once(
"./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Objective.php");
1078 include_once(
"./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
1080 $seq_item ->
delete();
& cloneMD($a_rbac_id, $a_obj_id, $a_obj_type)
Class ilSCORM2004Condition.
static _lookupTitle($a_obj_id)
Lookup Title.
Class ilSCORM2004PageNode.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
Class ilObjLearningModule.
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
static clipboardCopy($a_slm_obj_id, $a_ids)
Copy a set of chapters/pages/scos into the clipboard.
getImportId()
Set Import ID.
static _lookupSLMID($a_id)
Lookup Scorm Learning Module ID for node id.
setImportId($a_id)
Get Import ID.
setDataRecord($a_record)
this method should only be called by class ilSCORM2004NodeFactory
static clipboardCut($a_slm_obj_id, $a_ids)
Cut and copy a set of chapters/pages into the clipboard.
setTitle($a_title)
Set title.
static _extractObjIdOfTarget($a_target)
Extract object id out of target.
static copyPageFromLM($a_target_slm, $a_lm_page)
Copy page from learning module.
Class ilSCORM2004Chapter.
static insertPageClip($a_slm_obj)
Insert pages from clipboard.
setDescription($a_description)
Set description.
static insertScoClip($a_slm_obj)
Insert scos from clipboard.
deleteMetaData()
delete meta data entry
static _getIdForImportId($a_import_id)
Get Node ID for import ID (static)
getSLMId()
Get ID of parent Scorm Learning Module Object.
static _deleteAllSLMNodes($a_slm_object)
Delete all nodes of Scorm Learning Module.
static getTree($a_slm_obj_id)
Get scorm module editing tree.
__construct($a_slm_object, $a_id=0)
setSLMId($a_slm_id)
Set ID of parent Scorm Learning Module Object.
getSLMObject()
Get scorm learning module object.
static getInstance($a_slm_object, $a_id=0, $a_halt=true)
static _writeImportId($a_id, $a_import_id)
Write import ID.
static _lookupType($a_obj_id)
Lookup Type.
MDUpdateListener($a_element)
Meta data update listener.
createMetaData()
create meta data entry
static uniqueTypesCheck($a_items)
Check for unique types (all pages or all chapters or all scos)
getDescription()
Get description.
create($a_upload=false)
Create Node.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static _exists($a_id)
Checks wether a node exists.
updateMetaData()
update meta data entry
static insertChapterClip($a_slm_obj, $a_as_sub=false)
Insert Chapter from clipboard.
Class ilObjSCORM2004LearningModule.
setSLMObject($a_slm_obj)
Set Scorm Learning Module Object.
static pasteTree( $a_target_slm, $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_from_clipboard=true, $a_source_parent_type="")
Paste item (tree) from clipboard or other learning module to target scorm learning module...
static _writeTitle($a_obj_id, $a_title)
Write Title.
getContentObject()
Get Scorm Learning Module Object.
setType($a_type)
Set type.
static fetchAllObjectives($a_slm_object, $a_tree_node_id)
static insertAssetClip($a_slm_obj, $a_type="ass")
Insert assets from clipboard.