ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLMObject Class Reference

Class ilLMObject. More...

+ Inheritance diagram for ilLMObject:
+ Collaboration diagram for ilLMObject:

Public Member Functions

 ilLMObject ($a_content_obj, $a_id=0)
 MDUpdateListener ($a_element)
 Meta data update listener.
 _lookupNID ($a_lm_id, $a_lm_obj_id, $a_type)
 lookup named identifier (ILIAS_NID)
 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 ilLMObjectFactory
 read ()
 setTitle ($a_title)
 set title of lm object
 getTitle ()
 get title of lm object
 _writeTitle ($a_obj_id, $a_title)
 setDescription ($a_description)
 getDescription ()
 setType ($a_type)
 getType ()
 setLMId ($a_lm_id)
 getLMId ()
 setContentObject (&$a_content_obj)
getContentObject ()
 setId ($a_id)
 getId ()
 getImportId ()
 setImportId ($a_id)
 setLayout ($a_val)
 Set layout.
 getLayout ()
 Get layout.
 _writeImportId ($a_id, $a_import_id)
 write import id to db (static)
 create ($a_upload=false)
 update ()
 update complete object
 delete ($a_delete_meta_data=true)
 delete lm object data
 _getIdForImportId ($a_import_id)
 get current object id for import id (static)
 _getAllObjectsForImportId ($a_import_id, $a_in_lm=0)
 Get all items for an import ID.
 _exists ($a_id)
 checks wether a lm content object with specified id exists or not
 getObjectList ($lm_id, $type="")
 static
 _deleteAllObjectData (&$a_cobj)
 delete all objects of content object (digi book / learning module)
 _lookupContObjID ($a_id)
 get learning module / digibook id for lm object
 clipboardCut ($a_cont_obj_id, $a_ids)
 Copy a set of chapters/pages into the clipboard.
 existsExportID ($a_lm_id, $a_exp_id, $a_type="pg")
 Does export ID exist in lm?
 getExportIDInfo ($a_lm_id, $a_exp_id, $a_type="pg")
 Does export ID exist in lm?

Static Public Member Functions

static preloadDataByLM ($a_lm_id)
 Preload data records by lm.
static _lookupTitle ($a_obj_id)
 Lookup title.
static _lookupType ($a_obj_id, $a_lm_id=0)
 Lookup type.
 _writePublicAccessStatus ($a_pages, $a_cont_obj_id)
 update public access flags in lm_data for all pages of a content object
static _isPagePublic ($a_node_id, $a_check_public_mode=false)
static putInTree ($a_obj, $a_parent_id="", $a_target_node_id="")
 put this object into content object tree
static getTree ($a_cont_obj_id)
 Get learningmodule tree.
static clipboardCopy ($a_cont_obj_id, $a_ids)
 Copy a set of chapters/pages into the clipboard.
static pasteTree ($a_target_lm, $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_source_lm=null)
 Paste item (tree) from clipboard to current lm.
static saveTitles ($a_lm, $a_titles, $a_lang="-")
 Save titles for lm objects.
static updateInternalLinks ($a_copied_nodes, $a_parent_type="lm")
 Update internal links, after multiple pages have been copied.
static uniqueTypesCheck ($a_items)
 Check for unique types (all pages or all chapters)
static writeLayout ($a_obj_id, $a_layout, $a_lm=null)
 Write layout setting.
static lookupLayout ($a_obj_id)
 Lookup type.
static getPagesOfChapter ($a_lm_id, $a_chap_id)
 Get pages of chapter.
static _getAllLMObjectsOfLM ($a_lm_id, $a_type="")
 Get all objects of learning module.
static saveExportId ($a_lm_id, $a_lmobj_id, $a_exp_id, $a_type="pg")
 Save export id.
static getExportId ($a_lm_id, $a_lmobj_id, $a_type="pg")
 Get export ID.
static getDuplicateExportIDs ($a_lm_id, $a_type="pg")
 Get duplicate export IDs (count export ID usages)
static _getPresentationTitle ($a_node, $a_mode=IL_PAGE_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-")
 Get affective title.

Data Fields

 $ilias
 $lm_id
 $type
 $id
 $meta_data
 $data_record
 $content_object
 $title
 $description
 $active = true

Static Protected Attributes

static $data_records = array()

Detailed Description

Class ilLMObject.

Base class for ilStructureObjects and ilPageObjects (see ILIAS DTD)

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilLMObject.php 59484 2015-06-15 12:51:13Z gitmgr

Definition at line 17 of file class.ilLMObject.php.

Member Function Documentation

ilLMObject::_deleteAllObjectData ( $a_cobj)

delete all objects of content object (digi book / learning module)

Definition at line 710 of file class.ilLMObject.php.

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

Referenced by ilObjContentObject\delete().

{
global $ilDB;
include_once './Services/Xml/classes/class.ilNestedSetXML.php';
$query = "SELECT * FROM lm_data ".
"WHERE lm_id= ".$ilDB->quote($a_cobj->getId(), "integer");
$obj_set = $ilDB->query($query);
require_once("./Modules/LearningModule/classes/class.ilLMObjectFactory.php");
while ($obj_rec = $ilDB->fetchAssoc($obj_set))
{
$lm_obj = ilLMObjectFactory::getInstance($a_cobj, $obj_rec["obj_id"],false);
if (is_object($lm_obj))
{
$lm_obj->delete(true);
}
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLMObject::_exists (   $a_id)

checks wether a lm content object with specified id exists or not

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

Definition at line 655 of file class.ilLMObject.php.

References $ilDB, and ilInternalLink\_extractObjIdOfTarget().

Referenced by ilLinksTableGUI\fillRow(), getDuplicateExportIDs(), ilLMPresentationGUI\ilPage(), ilHelpGUI\showHelp(), and ilLMPresentationGUI\showPrintView().

{
global $ilDB;
include_once("./Services/Link/classes/class.ilInternalLink.php");
if (is_int(strpos($a_id, "_")))
{
}
$q = "SELECT * FROM lm_data 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:

+ Here is the caller graph for this function:

static ilLMObject::_getAllLMObjectsOfLM (   $a_lm_id,
  $a_type = "" 
)
static

Get all objects of learning module.

Parameters
@return

Definition at line 1342 of file class.ilLMObject.php.

References $ilDB.

Referenced by ilLMTableOfContentsExplorerGUI\__construct(), and ilLMTracker\loadLMTrackingData().

{
global $ilDB;
$and = ($a_type != "")
? " AND type = ".$ilDB->quote($a_type, "text")
: "";
$set = $ilDB->query("SELECT obj_id FROM lm_data ".
" WHERE lm_id = ".$ilDB->quote($a_lm_id, "integer").$and);
$obj_ids = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$obj_ids[] = $rec["obj_id"];
}
return $obj_ids;
}

+ Here is the caller graph for this function:

ilLMObject::_getAllObjectsForImportId (   $a_import_id,
  $a_in_lm = 0 
)

Get all items for an import ID.

(only for items notnot in trash)

Parameters
int$a_import_idimport id
Returns
int id

Definition at line 621 of file class.ilLMObject.php.

References $ilDB, and ilObject\_hasUntrashedReference().

Referenced by updateInternalLinks().

{
global $ilDB;
$where = ($a_in_lm > 0)
? " AND lm_id = ".$ilDB->quote($a_in_lm, "integer")." "
: "";
$q = "SELECT * FROM lm_data WHERE import_id = ".
$ilDB->quote($a_import_id, "text")." ".
$where.
" ORDER BY create_date DESC";
$obj_set = $ilDB->query($q);
$items = array();
while ($obj_rec = $ilDB->fetchAssoc($obj_set))
{
// check, whether lm is not trashed
if (ilObject::_hasUntrashedReference($obj_rec["lm_id"]))
{
$items[] = $obj_rec;
}
}
return $items;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLMObject::_getIdForImportId (   $a_import_id)

get current object 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 588 of file class.ilLMObject.php.

References $ilDB, $lm_id, ilObject\_hasUntrashedReference(), _lookupContObjID(), and ilObjHelpSettings\isHelpLM().

Referenced by SurveyQuestion\_resolveInternalLink(), and assQuestion\_resolveInternalLink().

{
global $ilDB;
$q = "SELECT obj_id FROM lm_data 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))
{
$lm_id = ilLMObject::_lookupContObjID($obj_rec["obj_id"]);
// link only in learning module, that is not trashed
include_once("./Services/Help/classes/class.ilObjHelpSettings.php");
{
return $obj_rec["obj_id"];
}
}
return 0;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilLMObject::_getPresentationTitle (   $a_node,
  $a_mode = IL_PAGE_TITLE,
  $a_include_numbers = false,
  $a_time_scheduled_activation = false,
  $a_force_content = false,
  $a_lm_id = 0,
  $a_lang = "-" 
)
static

Get affective title.

Parameters
@return

Reimplemented in ilLMPageObject.

Definition at line 1503 of file class.ilLMObject.php.

Referenced by ilPublicSectionExplorerGUI\getNodeContent(), and ilLMExplorerGUI\getNodeContent().

{
if ($a_lang == "")
{
$a_lang = "-";
}
if ($a_node["type"] == "st")
{
$a_include_numbers, $a_time_scheduled_activation, $a_lm_id, $a_lang);
}
else
{
return ilLMPageObject::_getPresentationTitle($a_node["child"],
$a_mode, $a_include_numbers, $a_time_scheduled_activation,
$a_force_content, $a_lm_id, $a_lang);
}
}

+ Here is the caller graph for this function:

static ilLMObject::_isPagePublic (   $a_node_id,
  $a_check_public_mode = false 
)
static

Definition at line 529 of file class.ilLMObject.php.

References $ilDB, $ilLog, $lm_id, $row, and ilUtil\yn2tf().

Referenced by ilLMPresentationGUI\executeCommand(), ilLMPresentationGUI\getCurrentPageId(), ilLMPresentationGUI\getSuccessorPage(), ilLMPresentationGUI\ilLMNavigation(), ilLMPresentationGUI\ilPage(), ilShopPublicSectionSelector\isClickable(), ilLMTOCExplorerGUI\isNodeClickable(), ilLMPresentationGUI\showPrintView(), and ilLMPresentationGUI\showPrintViewSelection().

{
global $ilDB,$ilLog;
if (empty($a_node_id))
{
$message = sprintf('ilLMObject::_isPagePublic(): Invalid parameter! $a_node_id is empty');
$ilLog->write($message,$ilLog->WARNING);
return false;
}
if ($a_check_public_mode === true)
{
$lm_id = ilLMObject::_lookupContObjId($a_node_id);
$q = "SELECT public_access_mode FROM content_object WHERE id = ".
$ilDB->quote($lm_id, "integer");
$r = $ilDB->query($q);
$row = $ilDB->fetchAssoc($r);
if ($row["public_access_mode"] == "complete")
{
return true;
}
}
$q = "SELECT public_access FROM lm_data WHERE obj_id=".
$ilDB->quote($a_node_id, "integer");
$r = $ilDB->query($q);
$row = $ilDB->fetchAssoc($r);
return ilUtil::yn2tf($row["public_access"]);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLMObject::_lookupContObjID (   $a_id)
ilLMObject::_lookupNID (   $a_lm_id,
  $a_lm_obj_id,
  $a_type 
)

lookup named identifier (ILIAS_NID)

Definition at line 91 of file class.ilLMObject.php.

References $id.

{
include_once 'Services/MetaData/classes/class.ilMD.php';
//echo "-".$a_lm_id."-".$a_lm_obj_id."-".$a_type."-";
$md = new ilMD($a_lm_id, $a_lm_obj_id, $a_type);
$md_gen = $md->getGeneral();
if (is_object($md_gen))
{
foreach($md_gen->getIdentifierIds() as $id)
{
$md_id = $md_gen->getIdentifier($id);
if ($md_id->getCatalog() == "ILIAS_NID")
{
return $md_id->getEntry();
}
}
}
return false;
}
static ilLMObject::_lookupTitle (   $a_obj_id)
static
static ilLMObject::_lookupType (   $a_obj_id,
  $a_lm_id = 0 
)
static

Lookup type.

Parameters
intid of pg st
intid of lm object [optional]

Definition at line 275 of file class.ilLMObject.php.

References $ilDB, and $query.

Referenced by ilLMPageObject\_splitPage(), ilLMPageObject\_splitPageNext(), ilStructureObjectGUI\activatePages(), clipboardCopy(), ilLMPresentationGUI\getCurrentPageId(), ilObjLearningModuleSubItemListGUI\getHTML(), ilLMTOCExplorerGUI\getRootNode(), ilLMPresentationGUI\getSuccessorPage(), ilLMPresentationGUI\ilLMNavigation(), ilLMPresentationGUI\ilPage(), ilLMPresentationGUI\ilTOC(), ilPageObject\moveIntLinks(), pasteTree(), ilObjContentObjectGUI\saveExportIds(), ilLMPresentationGUI\showPrintView(), ilLMPresentationGUI\showTableOfContents(), uniqueTypesCheck(), updateInternalLinks(), ilCourseObjectivesGUI\updateMaterialAssignment(), and writeLayout().

{
global $ilDB;
if (isset(self::$data_records[$a_obj_id]))
{
if ($a_lm_id == 0 || self::$data_records[$a_obj_id]["lm_id"] == $a_lm_id)
{
return self::$data_records[$a_obj_id]["type"];
}
}
if($a_lm_id)
{
$and = ' AND lm_id = '.$ilDB->quote($a_lm_id,'integer');
}
$query = "SELECT type FROM lm_data WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer").$and;
$obj_set = $ilDB->query($query);
$obj_rec = $ilDB->fetchAssoc($obj_set);
return $obj_rec["type"];
}

+ Here is the caller graph for this function:

ilLMObject::_writeImportId (   $a_id,
  $a_import_id 
)

write import id to db (static)

Parameters
int$a_idlm object id
string$a_import_idimport id public

Definition at line 399 of file class.ilLMObject.php.

References $ilDB.

Referenced by ilContObjParser\handlerEndTag().

{
global $ilDB;
$q = "UPDATE lm_data ".
"SET ".
"import_id = ".$ilDB->quote($a_import_id, "text").",".
"last_update = ".$ilDB->now()." ".
"WHERE obj_id = ".$ilDB->quote($a_id, "integer");
$ilDB->manipulate($q);
}

+ Here is the caller graph for this function:

ilLMObject::_writePublicAccessStatus (   $a_pages,
  $a_cont_obj_id 
)
static

update public access flags in lm_data for all pages of a content object

public

Parameters
arraypage ids
integercontent object id
Returns
of the jedi

Definition at line 468 of file class.ilLMObject.php.

References $ilDB, $ilErr, $ilLog, and $row.

Referenced by ilObjContentObjectGUI\savePublicSection(), and ilObjContentObjectGUI\savePublicSectionPages().

{
global $ilDB,$ilLog,$ilErr,$ilTree;
if (!is_array($a_pages))
{$a_pages = array(0);
/*$message = sprintf('ilLMObject::_writePublicAccessStatus(): Invalid parameter! $a_pages must be an array');
$ilLog->write($message,$ilLog->WARNING);
$ilErr->raiseError($message,$ilErr->MESSAGE);
return false;*/
}
if (empty($a_cont_obj_id))
{
$message = sprintf('ilLMObject::_writePublicAccessStatus(): Invalid parameter! $a_cont_obj_id is empty');
$ilLog->write($message,$ilLog->WARNING);
$ilErr->raiseError($message,$ilErr->MESSAGE);
return false;
}
// update structure entries: if at least one page of a chapter is public set chapter to public too
$lm_tree = new ilTree($a_cont_obj_id);
$lm_tree->setTableNames('lm_tree','lm_data');
$lm_tree->setTreeTablePK("lm_id");
$lm_tree->readRootId();
// get all st entries of cont_obj
$q = "SELECT obj_id FROM lm_data " .
"WHERE lm_id = ".$ilDB->quote($a_cont_obj_id, "integer")." " .
"AND type = 'st'";
$r = $ilDB->query($q);
// add chapters with a public page to a_pages
while ($row = $ilDB->fetchAssoc($r))
{
$childs = $lm_tree->getChilds($row["obj_id"]);
foreach ($childs as $page)
{
if ($page["type"] == "pg" and in_array($page["obj_id"],$a_pages))
{
array_push($a_pages, $row["obj_id"]);
break;
}
}
}
// update public access status of all pages of cont_obj
$q = "UPDATE lm_data SET " .
"public_access = CASE " .
"WHEN ".$ilDB->in("obj_id", $a_pages, false, "integer")." ".
"THEN ".$ilDB->quote("y", "text").
"ELSE ".$ilDB->quote("n", "text").
"END " .
"WHERE lm_id = ".$ilDB->quote($a_cont_obj_id, "integer")." " .
"AND ".$ilDB->in("type", array("pg", "st"), false, "text");
$ilDB->manipulate($q);
return true;
}

+ Here is the caller graph for this function:

ilLMObject::_writeTitle (   $a_obj_id,
  $a_title 
)

Definition at line 300 of file class.ilLMObject.php.

References $ilDB, and $query.

Referenced by MDUpdateListener(), and saveTitles().

{
global $ilDB;
$query = "UPDATE lm_data 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 ilLMObject::clipboardCopy (   $a_cont_obj_id,
  $a_ids 
)
static

Copy a set of chapters/pages into the clipboard.

Definition at line 876 of file class.ilLMObject.php.

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

Referenced by clipboardCut(), ilStructureObjectGUI\copyItems(), ilObjContentObjectGUI\copyItems(), and ilObjContentObjectGUI\copyPage().

{
global $ilUser;
$tree = ilLMObject::getTree($a_cont_obj_id);
$ilUser->clipboardDeleteObjectsOfType("pg");
$ilUser->clipboardDeleteObjectsOfType("st");
// 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:

ilLMObject::clipboardCut (   $a_cont_obj_id,
  $a_ids 
)

Copy a set of chapters/pages into the clipboard.

Definition at line 828 of file class.ilLMObject.php.

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

Referenced by ilStructureObjectGUI\cutItems(), ilObjContentObjectGUI\cutItems(), and ilObjContentObjectGUI\movePage().

{
$tree = ilLMObject::getTree($a_cont_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;
}
}
}
ilLMObject::clipboardCopy($a_cont_obj_id, $cut_ids);
// remove the objects from the tree
// note: we are getting chapters 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:

ilLMObject::create (   $a_upload = false)

Reimplemented in ilLMPageObject, and ilStructureObject.

Definition at line 412 of file class.ilLMObject.php.

References $ilDB, $query, ilHistory\_createEntry(), createMetaData(), getId(), getImportId(), getLayout(), getLMId(), getTitle(), getType(), and setId().

{
global $ilDB;
// insert object data
$this->setId($ilDB->nextId("lm_data"));
$query = "INSERT INTO lm_data (obj_id, title, type, layout, lm_id, import_id, create_date) ".
"VALUES (".
$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote($this->getTitle(), "text").",".
$ilDB->quote($this->getType(), "text").", ".
$ilDB->quote($this->getLayout(), "text").", ".
$ilDB->quote($this->getLMId(), "integer").",".
$ilDB->quote($this->getImportId(), "text").
", ".$ilDB->now().")";
$ilDB->manipulate($query);
// create history entry
include_once("./Services/History/classes/class.ilHistory.php");
ilHistory::_createEntry($this->getId(), "create", "",
$this->content_object->getType().":".$this->getType());
if (!$a_upload)
{
$this->createMetaData();
}
}

+ Here is the call graph for this function:

ilLMObject::createMetaData ( )

create meta data entry

Definition at line 116 of file class.ilLMObject.php.

References $ilUser, getDescription(), getId(), getLMId(), getTitle(), and getType().

Referenced by create().

{
include_once 'Services/MetaData/classes/class.ilMDCreator.php';
global $ilUser;
$md_creator = new ilMDCreator($this->getLMId(), $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:

ilLMObject::delete (   $a_delete_meta_data = true)

delete lm object data

Reimplemented in ilLMPageObject, and ilStructureObject.

Definition at line 566 of file class.ilLMObject.php.

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

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

+ Here is the call graph for this function:

ilLMObject::deleteMetaData ( )

delete meta data entry

Definition at line 163 of file class.ilLMObject.php.

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

Referenced by delete().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLMObject::existsExportID (   $a_lm_id,
  $a_exp_id,
  $a_type = "pg" 
)

Does export ID exist in lm?

Parameters
@return

Definition at line 1457 of file class.ilLMObject.php.

References ilMDIdentifier\existsIdInRbacObject().

Referenced by ilLMPageObject\copy().

{
include_once("./Services/MetaData/classes/class.ilMDIdentifier.php");
return ilMDIdentifier::existsIdInRbacObject($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilLMObject::getContentObject ( )

Definition at line 347 of file class.ilLMObject.php.

References $content_object.

Referenced by ilStructureObject\exportFOPageObjects(), ilLMPageObject\exportXMLPageContent(), and ilStructureObject\exportXMLStructureObjects().

{
}

+ Here is the caller graph for this function:

ilLMObject::getDescription ( )

Definition at line 316 of file class.ilLMObject.php.

References $description.

Referenced by ilStructureObject\copy(), ilLMPageObject\copy(), ilLMPageObject\copyToOtherContObject(), and createMetaData().

{
}

+ Here is the caller graph for this function:

static ilLMObject::getDuplicateExportIDs (   $a_lm_id,
  $a_type = "pg" 
)
static

Get duplicate export IDs (count export ID usages)

Definition at line 1466 of file class.ilLMObject.php.

References $res, _exists(), and ilMDIdentifier\_getEntriesForRbacObj().

Referenced by ilExportIDTableGUI\__construct().

{
include_once("./Services/MetaData/classes/class.ilMDIdentifier.php");
$entries = ilMDIdentifier::_getEntriesForRbacObj($a_lm_id, $a_type);
$res = array();
foreach ($entries as $e)
{
if ($e["catalog"] == "ILIAS_NID")
{
if (ilLMObject::_exists($e["obj_id"]))
{
$res[trim($e["entry"])]++;
}
}
}
return $res;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilLMObject::getExportId (   $a_lm_id,
  $a_lmobj_id,
  $a_type = "pg" 
)
static

Get export ID.

Parameters
@return

Definition at line 1435 of file class.ilLMObject.php.

References ilMDIdentifier\_getEntriesForObj().

Referenced by ilLMPageObject\copy(), ilObjContentObject\exportHTMLPages(), ilExportIDTableGUI\fillRow(), ilLMPresentationGUI\getLink(), and ilLMTOCExplorerGUI\getNodeHref().

{
// look for export id
include_once("./Services/MetaData/classes/class.ilMDIdentifier.php");
$a_lm_id, $a_lmobj_id, $a_type);
foreach ($entries as $e)
{
if ($e["catalog"] == "ILIAS_NID")
{
return $e["entry"];
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLMObject::getExportIDInfo (   $a_lm_id,
  $a_exp_id,
  $a_type = "pg" 
)

Does export ID exist in lm?

Parameters
@return

Definition at line 1490 of file class.ilLMObject.php.

References ilMDIdentifier\readIdData().

{
include_once("./Services/MetaData/classes/class.ilMDIdentifier.php");
$data = ilMDIdentifier::readIdData($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
return $data;
}

+ Here is the call graph for this function:

ilLMObject::getImportId ( )

Definition at line 362 of file class.ilLMObject.php.

Referenced by create().

{
return $this->import_id;
}

+ Here is the caller graph for this function:

ilLMObject::getLayout ( )

Get layout.

Returns
string layout

Definition at line 387 of file class.ilLMObject.php.

Referenced by ilLMPageObject\copy(), create(), and update().

{
return $this->layout;
}

+ Here is the caller graph for this function:

ilLMObject::getObjectList (   $lm_id,
  $type = "" 
)

static

Definition at line 682 of file class.ilLMObject.php.

References $ilDB, $lm_id, $query, and $type.

Referenced by ilLMPageObject\getPageList(), ilHelpExporter\getXmlExportTailDependencies(), and ilObjContentObject\importFromZipFile().

{
global $ilDB;
$type_str = ($type != "")
? "AND type = ".$ilDB->quote($type, "text")." "
: "";
$query = "SELECT * FROM lm_data ".
"WHERE lm_id= ".$ilDB->quote($lm_id, "integer")." ".
$type_str." ".
"ORDER BY title";
$obj_set = $ilDB->query($query);
$obj_list = array();
while($obj_rec = $ilDB->fetchAssoc($obj_set))
{
$obj_list[] = array("obj_id" => $obj_rec["obj_id"],
"title" => $obj_rec["title"],
"import_id" => $obj_rec["import_id"],
"type" => $obj_rec["type"]);
}
return $obj_list;
}

+ Here is the caller graph for this function:

static ilLMObject::getPagesOfChapter (   $a_lm_id,
  $a_chap_id 
)
static

Get pages of chapter.

Parameters
@return

Definition at line 1323 of file class.ilLMObject.php.

Referenced by ilHelpGUI\showHelp().

{
// update structure entries: if at least one page of a chapter is public set chapter to public too
$lm_tree = new ilTree($a_lm_id);
$lm_tree->setTableNames('lm_tree','lm_data');
$lm_tree->setTreeTablePK("lm_id");
$lm_tree->readRootId();
$childs = $lm_tree->getChildsByType($a_chap_id, "pg");
return $childs;
}

+ Here is the caller graph for this function:

ilLMObject::getTitle ( )

get title of lm object

Returns
string title of chapter or page

Definition at line 241 of file class.ilLMObject.php.

References $title.

Referenced by ilStructureObject\copy(), ilLMPageObject\copy(), ilLMPageObject\copyToOtherContObject(), create(), createMetaData(), ilStructureObject\exportFO(), update(), and updateMetaData().

{
return $this->title;
}

+ Here is the caller graph for this function:

static ilLMObject::getTree (   $a_cont_obj_id)
static

Get learningmodule tree.

Parameters
intlearning module object id
Returns
object tree object

Definition at line 815 of file class.ilLMObject.php.

Referenced by clipboardCopy(), and clipboardCut().

{
$tree = new ilTree($a_cont_obj_id);
$tree->setTableNames('lm_tree', 'lm_data');
$tree->setTreeTablePK("lm_id");
$tree->readRootId();
return $tree;
}

+ Here is the caller graph for this function:

ilLMObject::ilLMObject (   $a_content_obj,
  $a_id = 0 
)
Parameters
object$a_content_objcontent object (digi book or learning module)

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

References $ilias, read(), setContentObject(), and setLMId().

Referenced by ilLMPageObject\ilLMPageObject(), and ilStructureObject\ilStructureObject().

{
global $ilias;
$this->id = $a_id;
$this->setContentObject($a_content_obj);
$this->setLMId($a_content_obj->getId());
if($a_id != 0)
{
$this->read();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilLMObject::lookupLayout (   $a_obj_id)
static

Lookup type.

Parameters
intlm object id

Definition at line 1305 of file class.ilLMObject.php.

References $ilDB, and $query.

Referenced by ilLMPresentationGUI\determineLayout(), and ilLMPagesTableGUI\fillRow().

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

+ Here is the caller graph for this function:

ilLMObject::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_elementmd element
Returns
boolean success

Definition at line 59 of file class.ilLMObject.php.

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

{
include_once 'Services/MetaData/classes/class.ilMD.php';
switch($a_element)
{
case 'General':
// Update Title and description
$md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
$md_gen = $md->getGeneral();
ilLMObject::_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:

static ilLMObject::pasteTree (   $a_target_lm,
  $a_item_id,
  $a_parent_id,
  $a_target,
  $a_insert_time,
$a_copied_nodes,
  $a_as_copy = false,
  $a_source_lm = null 
)
static

Paste item (tree) from clipboard to current lm.

Definition at line 916 of file class.ilLMObject.php.

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

Referenced by ilObjContentObject\copyAllPagesAndChapters(), ilStructureObjectGUI\insertChapterClip(), ilObjContentObjectGUI\insertChapterClip(), and ilStructureObjectGUI\insertPageClip().

{
global $ilUser, $ilias, $ilLog;
include_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
$item_lm_id = ilLMObject::_lookupContObjID($a_item_id);
$item_type = ilLMObject::_lookupType($a_item_id);
$lm_obj = $ilias->obj_factory->getInstanceByObjId($item_lm_id);
if ($item_type == "st")
{
$item = new ilStructureObject($lm_obj, $a_item_id);
}
else if ($item_type == "pg")
{
$item = new ilLMPageObject($lm_obj, $a_item_id);
}
$ilLog->write("Getting from clipboard type ".$item_type.", ".
"Item ID: ".$a_item_id.", of original LM: ".$item_lm_id);
if ($item_lm_id != $a_target_lm->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_lm_id, $item->getId(), $item->getType());
$new_md = $md->cloneMD($a_target_lm->getId(), $item->getId(), $item->getType());
// update lm object
$item->setLMId($a_target_lm->getId());
$item->setContentObject($a_target_lm);
$item->update();
// delete old meta data set
$md->deleteAll();
if ($item_type == "pg")
{
$page = $item->getPageObject();
$page->buildDom();
$page->setParentId($a_target_lm->getId());
$page->update();
}
}
if ($a_as_copy)
{
$target_item = $item->copy($a_target_lm);
$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());
ilLMObject::putInTree($target_item, $a_parent_id, $a_target);
if ($a_source_lm == null)
{
$childs = $ilUser->getClipboardChilds($item->getId(), $a_insert_time);
}
else
{
$childs = $a_source_lm->lm_tree->getChilds($item->getId());
foreach ($childs as $k => $child)
{
$childs[$k]["id"] = $childs[$k]["child"];
}
}
foreach($childs as $child)
{
ilLMObject::pasteTree($a_target_lm, $child["id"], $target_item->getId(),
IL_LAST_NODE, $a_insert_time, $a_copied_nodes, $a_as_copy, $a_source_lm);
}
return $target_item->getId();
// @todo: write history (see pastePage)
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilLMObject::preloadDataByLM (   $a_lm_id)
static

Preload data records by lm.

Parameters
integer$a_lm_idlm id
Returns
int number of preloaded records

Definition at line 211 of file class.ilLMObject.php.

References $ilDB.

Referenced by ilLMExplorerGUI\__construct().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM lm_data ".
" WHERE lm_id = ".$ilDB->quote($a_lm_id, "integer")
);
while ($rec = $ilDB->fetchAssoc($set))
{
self::$data_records[$rec["obj_id"]] = $rec;
}
return count(self::$data_records);
}

+ Here is the caller graph for this function:

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

put this object into content object tree

Definition at line 757 of file class.ilLMObject.php.

References $ilLog, IL_FIRST_NODE, and ilTree\setTableNames().

Referenced by ilObjContentObjectGUI\insertChapter(), and pasteTree().

{
global $ilLog;
$tree = new ilTree($a_obj->getContentObject()->getId());
$tree->setTableNames('lm_tree', 'lm_data');
$tree->setTreeTablePK("lm_id");
// 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
if ($a_obj->getType() == "st")
{
$s_types = array("st", "pg");
$childs =& $tree->getChildsByTypeFilter($parent_id, $s_types);
}
else
{
$s_types = "pg";
$childs =& $tree->getChildsByType($parent_id, $s_types);
}
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()))
{
$ilLog->write("LMObject::putInTree: insertNode, ID: ".$a_obj->getId().
"Parent ID: ".$parent_id.", Target: ".$target);
$tree->insertNode($a_obj->getId(), $parent_id, $target);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLMObject::read ( )

Reimplemented in ilLMPageObject.

Definition at line 181 of file class.ilLMObject.php.

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

Referenced by ilLMObject().

{
global $ilBench, $ilDB;
$ilBench->start("ContentPresentation", "ilLMObject_read");
if(!isset($this->data_record))
{
$query = "SELECT * FROM lm_data 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"]);
$this->setLayout($this->data_record["layout"]);
//$this->setActive(ilUtil::yn2tf($this->data_record["active"]));
$ilBench->stop("ContentPresentation", "ilLMObject_read");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilLMObject::saveExportId (   $a_lm_id,
  $a_lmobj_id,
  $a_exp_id,
  $a_type = "pg" 
)
static

Save export id.

Parameters
@return

Definition at line 1372 of file class.ilLMObject.php.

References $id, $ilDB, and ilMDIdentifier\_getEntriesForObj().

Referenced by ilLMPageObject\copy(), and ilObjContentObjectGUI\saveExportIds().

{
global $ilDB;
include_once("Services/MetaData/classes/class.ilMDIdentifier.php");
if (trim($a_exp_id) == "")
{
// delete export ids, if existing
$a_lm_id, $a_lmobj_id, $a_type);
foreach ($entries as $id => $e)
{
if ($e["catalog"] == "ILIAS_NID")
{
$identifier = new ilMDIdentifier();
$identifier->setMetaId($id);
$identifier->delete();
}
}
}
else
{
// update existing entry
$a_lm_id, $a_lmobj_id, $a_type);
$updated = false;
foreach ($entries as $id => $e)
{
if ($e["catalog"] == "ILIAS_NID")
{
$identifier = new ilMDIdentifier();
$identifier->setMetaId($id);
$identifier->read();
$identifier->setEntry($a_exp_id);
$identifier->update();
$updated = true;
}
}
// nothing updated? create a new one
if (!$updated)
{
include_once("./Services/MetaData/classes/class.ilMD.php");
$md = new ilMD($a_lm_id, $a_lmobj_id, $a_type);
$md_gen = $md->getGeneral();
$identifier = $md_gen->addIdentifier();
$identifier->setEntry($a_exp_id);
$identifier->setCatalog("ILIAS_NID");
$identifier->save();
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilLMObject::saveTitles (   $a_lm,
  $a_titles,
  $a_lang = "-" 
)
static

Save titles for lm objects.

Parameters
arraytitles (key is ID, value is title)

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

References $id, $title, _writeTitle(), ilMD\getGeneral(), ilLMObjectFactory\getInstance(), and ilMDBase\update().

Referenced by ilStructureObjectGUI\saveAllTitles(), and ilObjContentObjectGUI\saveAllTitles().

{
include_once("./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
if ($a_lang == "")
{
$a_lang = "-";
}
if (is_array($a_titles))
{
include_once("./Services/MetaData/classes/class.ilMD.php");
foreach($a_titles as $id => $title)
{
if ($a_lang == "-")
{
$lmobj = ilLMObjectFactory::getInstance($a_lm, $id, false);
if (is_object($lmobj))
{
// Update Title and description
$md = new ilMD($a_lm->getId(), $id, $lmobj->getType());
$md_gen = $md->getGeneral();
if (is_object($md_gen)) // see bug #0015843
{
$md_gen->setTitle($title);
$md_gen->update();
$md->update();
}
}
}
else
{
$lmobjtrans = new ilLMObjTranslation($id, $a_lang);
$lmobjtrans->setTitle($title);
$lmobjtrans->save();
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLMObject::setContentObject ( $a_content_obj)

Definition at line 342 of file class.ilLMObject.php.

Referenced by ilLMObject().

{
$this->content_object =& $a_content_obj;
}

+ Here is the caller graph for this function:

ilLMObject::setDataRecord (   $a_record)

this method should only be called by class ilLMObjectFactory

Definition at line 176 of file class.ilLMObject.php.

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

Definition at line 311 of file class.ilLMObject.php.

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

Reimplemented in ilLMPageObject.

Definition at line 352 of file class.ilLMObject.php.

Referenced by create().

{
$this->id = $a_id;
}

+ Here is the caller graph for this function:

ilLMObject::setImportId (   $a_id)

Definition at line 367 of file class.ilLMObject.php.

Referenced by read().

{
$this->import_id = $a_id;
}

+ Here is the caller graph for this function:

ilLMObject::setLayout (   $a_val)

Set layout.

Parameters
stringlayout

Definition at line 377 of file class.ilLMObject.php.

Referenced by read().

{
$this->layout = $a_val;
}

+ Here is the caller graph for this function:

ilLMObject::setLMId (   $a_lm_id)

Definition at line 331 of file class.ilLMObject.php.

Referenced by ilLMObject().

{
$this->lm_id = $a_lm_id;
}

+ Here is the caller graph for this function:

ilLMObject::setTitle (   $a_title)

set title of lm object

Parameters
string$a_titletitle of chapter or page

Definition at line 231 of file class.ilLMObject.php.

Referenced by read().

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

ilLMObject::setType (   $a_type)

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

Referenced by ilLMPageObject\ilLMPageObject(), and ilStructureObject\ilStructureObject().

{
$this->type = $a_type;
}

+ Here is the caller graph for this function:

static ilLMObject::uniqueTypesCheck (   $a_items)
static

Check for unique types (all pages or all chapters)

Definition at line 1242 of file class.ilLMObject.php.

References $type, and _lookupType().

Referenced by ilStructureObjectGUI\copyItems(), and ilStructureObjectGUI\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:

ilLMObject::update ( )

update complete object

Definition at line 444 of file class.ilLMObject.php.

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

{
global $ilDB;
$this->updateMetaData();
$query = "UPDATE lm_data SET ".
" lm_id = ".$ilDB->quote($this->getLMId(), "integer").
" ,title = ".$ilDB->quote($this->getTitle(), "text").
" ,layout = ".$ilDB->quote($this->getLayout(), "text").
" WHERE obj_id = ".$ilDB->quote($this->getId(), "integer");
$ilDB->manipulate($query);
}

+ Here is the call graph for this function:

static ilLMObject::updateInternalLinks (   $a_copied_nodes,
  $a_parent_type = "lm" 
)
static

Update internal links, after multiple pages have been copied.

Definition at line 1052 of file class.ilLMObject.php.

References $mobs, $t, ilInternalLink\_extractInstOfTarget(), ilInternalLink\_extractObjIdOfTarget(), ilInternalLink\_extractTypeOfTarget(), _getAllObjectsForImportId(), ilMapArea\_getMobsForTarget(), ilInternalLink\_getSourcesOfTarget(), _lookupContObjID(), _lookupType(), ilPageObjectFactory\getInstance(), and ilObjMediaObject\lookupUsages().

Referenced by ilObjContentObject\copyAllPagesAndChapters(), ilStructureObjectGUI\insertChapterClip(), ilObjContentObjectGUI\insertChapterClip(), ilStructureObjectGUI\insertPageClip(), and ilObjContentObjectGUI\pastePage().

{
$all_fixes = array();
foreach($a_copied_nodes as $original_id => $copied_id)
{
$copied_type = ilLMObject::_lookupType($copied_id);
$copy_lm = ilLMObject::_lookupContObjID($copied_id);
if ($copied_type == "pg")
{
//
// 1. Outgoing links from the copied page.
//
//$targets = ilInternalLink::_getTargetsOfSource($a_parent_type.":pg", $copied_id);
include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
$tpg = new ilLMPage($copied_id);
$tpg->buildDom();
$il = $tpg->getInternalLinks();
$targets = array();
foreach($il as $l)
{
$targets[] = array("type" => ilInternalLink::_extractTypeOfTarget($l["Target"]),
"id" => (int) ilInternalLink::_extractObjIdOfTarget($l["Target"]),
"inst" => (int) ilInternalLink::_extractInstOfTarget($l["Target"]));
}
$fix = array();
foreach($targets as $target)
{
if (($target["inst"] == 0 || $target["inst"] = IL_INST_ID) &&
($target["type"] == "pg" || $target["type"] == "st"))
{
// first check, whether target is also within the copied set
if ($a_copied_nodes[$target["id"]] > 0)
{
$fix[$target["id"]] = $a_copied_nodes[$target["id"]];
}
else
{
// now check, if a copy if the target is already in the same lm
// only if target is not already in the same lm!
$trg_lm = ilLMObject::_lookupContObjID($target["id"]);
if ($trg_lm != $copy_lm)
{
$lm_data = ilLMObject::_getAllObjectsForImportId("il__".$target["type"]."_".$target["id"]);
$found = false;
foreach($lm_data as $item)
{
if (!$found && ($item["lm_id"] == $copy_lm))
{
$fix[$target["id"]] = $item["obj_id"];
$found = true;
}
}
}
}
}
}
// outgoing links to be fixed
if (count($fix) > 0)
{
//echo "<br>--".$copied_id;
//var_dump($fix);
if (is_array($all_fixes[$t.":".$copied_id]))
{
$all_fixes[$t.":".$copied_id] += $fix;
}
else
{
$all_fixes[$t.":".$copied_id] = $fix;
}
}
}
if ($copied_type == "pg" ||
$copied_type == "st")
{
//
// 2. Incoming links to the original pages
//
// A->B A2 (A+B currently copied)
// A->C B2
// B->A
// C->A C2->A (C already copied)
$original_lm = ilLMObject::_lookupContObjID($original_id);
$original_type = ilObject::_lookupType($original_lm);
if ($original_lm != $copy_lm)
{
// This gets sources that link to A+B (so we have C here)
// (this also does already the trick when instance map areas are given in C)
// int_link, where target_type, target_id, target_inst -> ok
$sources = ilInternalLink::_getSourcesOfTarget($copied_type,
$original_id, 0);
// mobs linking to $original_id
// map_area, where link_type, target -> ok
$mobs = ilMapArea::_getMobsForTarget("int", "il__".$copied_type.
"_".$original_id);
// pages using these mobs
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
foreach($mobs as $mob)
{
// mob_usage, where id -> ok
// mep_item, where foreign_id, type -> ok
// mep_tree, where child -> already existed
// il_news_item, where mob_id -> ok
// map_area, where link_type, target -> aready existed
// media_item, where id -> already existed
// personal_clipboard, where item_id, type -> ok
foreach($usages as $usage)
{
if ($usage["type"] == "lm:pg" | $usage["type"] == "lm:st")
{
$sources[] = $usage;
}
}
}
$fix = array();
foreach($sources as $source)
{
$stype = explode(":", $source["type"]);
$source_type = $stype[1];
if ($source_type == "pg" || $source_type == "st")
{
// first of all: source must be in original lm
$src_lm = ilLMObject::_lookupContObjID($source["id"]);
if ($src_lm == $original_lm)
{
// check, if a copy if the source is already in the same lm
// now we look for the latest copy of C in LM2
$lm_data = ilLMObject::_getAllObjectsForImportId("il__".$source_type."_".$source["id"],
$copy_lm);
$found = false;
foreach ($lm_data as $item)
{
if (!$found)
{
$fix[$item["obj_id"]][$original_id] = $copied_id;
$found = true;
}
}
}
}
}
// outgoing links to be fixed
if (count($fix) > 0)
{
foreach ($fix as $page_id => $fix_array)
{
if (is_array($all_fixes[$t.":".$page_id]))
{
$all_fixes[$t.":".$page_id] += $fix_array;
}
else
{
$all_fixes[$t.":".$page_id] = $fix_array;
}
}
}
}
}
}
foreach ($all_fixes as $pg => $fixes)
{
$pg = explode(":", $pg);
include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
$page = ilPageObjectFactory::getInstance($pg[0], $pg[1]);
if ($page->moveIntLinks($fixes))
{
$page->update(true, true);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLMObject::updateMetaData ( )

update meta data entry

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

References getId(), getLMId(), 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->getLMId(), $this->getId(), $this->getType());
$md_gen =& $md->getGeneral();
$md_gen->setTitle($this->getTitle());
// sets first description (maybe not appropriate)
$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:

static ilLMObject::writeLayout (   $a_obj_id,
  $a_layout,
  $a_lm = null 
)
static

Write layout setting.

Parameters
intlm object id
stringlayout

Definition at line 1267 of file class.ilLMObject.php.

References $ilDB, $query, $t, and _lookupType().

Referenced by ilLMPageObjectGUI\saveLayout(), ilStructureObjectGUI\savePageLayout(), and ilObjContentObjectGUI\savePageLayout().

{
global $ilDB;
if ($t == "pg")
{
$query = "UPDATE lm_data SET ".
" layout = ".$ilDB->quote($a_layout, "text").
" WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer");
$ilDB->manipulate($query);
}
else if ($t == "st" && is_object($a_lm))
{
$node = $a_lm->getLMTree()->getNodeData($a_obj_id);
$child_nodes = $a_lm->getLMTree()->getSubTree($node);
if (is_array($child_nodes) && count($child_nodes) > 0)
{
foreach ($child_nodes as $c)
{
if ($c["type"] == "pg")
{
$query = "UPDATE lm_data SET ".
" layout = ".$ilDB->quote($a_layout, "text").
" WHERE obj_id = ".$ilDB->quote($c["child"], "integer");
$ilDB->manipulate($query);
}
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilLMObject::$active = true

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

Referenced by ilLMPageObject\_getPresentationTitle().

ilLMObject::$content_object

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

Referenced by getContentObject().

ilLMObject::$data_record

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

ilLMObject::$data_records = array()
staticprotected

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

ilLMObject::$description

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

Referenced by getDescription().

ilLMObject::$id
ilLMObject::$ilias

Definition at line 19 of file class.ilLMObject.php.

Referenced by ilLMObject(), and pasteTree().

ilLMObject::$meta_data

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


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