143 $this->
ilias = $DIC[
"ilias"];
145 $this->db =
$DIC->database();
146 $this->log =
$DIC[
"ilLog"];
147 $this->
error = $DIC[
"ilErr"];
148 $this->tree =
$DIC->repositoryTree();
149 $this->app_event_handler =
$DIC[
"ilAppEventHandler"];
153 echo
"<br/><font color=\"red\">type(" . $this->type .
") id(" . $a_id .
") referenced(" . $a_reference .
")</font>";
156 if (isset(
$DIC[
"lng"])) {
157 $this->lng =
$DIC[
"lng"];
163 $this->add_dots =
true;
165 $this->referenced = $a_reference;
166 $this->call_by_reference = $a_reference;
169 $this->referenced =
false;
172 if ($this->referenced) {
173 $this->ref_id = $a_id;
208 }
catch (\InvalidArgumentException
$e) {
211 if ($this->referenced) {
213 if (!isset($this->ref_id)) {
214 $message =
"ilObject::read(): No ref_id given! (" . $this->type .
")";
220 $q =
"SELECT * FROM object_data, object_reference WHERE object_data.obj_id=object_reference.obj_id " .
221 "AND object_reference.ref_id= " .
$ilDB->quote($this->ref_id,
"integer");
222 $object_set =
$ilDB->query($q);
225 if (
$ilDB->numRows($object_set) == 0) {
226 $message =
"ilObject::read(): Object with ref_id " . $this->ref_id .
" not found! (" . $this->type .
")";
230 $obj =
$ilDB->fetchAssoc($object_set);
233 if (!isset($this->
id)) {
234 $message =
"ilObject::read(): No obj_id given! (" . $this->type .
")";
239 $q =
"SELECT * FROM object_data " .
240 "WHERE obj_id = " .
$ilDB->quote($this->
id,
"integer");
241 $object_set =
$ilDB->query($q);
244 if (
$ilDB->numRows($object_set) == 0) {
245 include_once(
"./Services/Object/exceptions/class.ilObjectNotFoundException.php");
247 " (" . $this->type .
") not found!");
251 $obj =
$ilDB->fetchAssoc($object_set);
254 $this->
id = $obj[
"obj_id"];
257 if ($this->type != $obj[
"type"] && $obj[
"type"] !=
"xxx") {
258 $message =
"ilObject::read(): Type mismatch. Object with obj_id: " . $this->
id .
" " .
259 "was instantiated by type '" . $this->type .
"'. DB type is: " . $obj[
"type"];
265 include_once(
"./Services/Object/exceptions/class.ilObjectTypeMismatchException.php");
270 $this->type = $obj[
"type"];
271 $this->title = $obj[
"title"];
273 $this->untranslatedTitle = $obj[
"title"];
275 $this->desc = $obj[
"description"];
276 $this->owner = $obj[
"owner"];
277 $this->create_date = $obj[
"create_date"];
278 $this->last_update = $obj[
"last_update"];
279 $this->import_id = $obj[
"import_id"];
285 $query =
"SELECT * FROM object_description WHERE obj_id = " .
$ilDB->quote($this->
id,
'integer');
288 if (strlen($row->description)) {
295 $translation_type =
$objDefinition->getTranslationType($this->type);
297 if ($translation_type ==
"sys") {
298 $this->title = $this->lng->txt(
"obj_" . $this->type);
299 $this->
setDescription($this->lng->txt(
"obj_" . $this->type .
"_desc"));
300 } elseif ($translation_type ==
"db") {
301 $q =
"SELECT title,description FROM object_translation " .
302 "WHERE obj_id = " .
$ilDB->quote($this->
id,
'integer') .
" " .
303 "AND lang_code = " .
$ilDB->quote(
$ilUser->getCurrentLanguage(),
'text');
304 $r =
$ilDB->query($q);
307 $this->title = $row->title;
309 #$this->desc = $row->description;
331 $this->
id = (int) $a_id;
341 $this->ref_id = $a_id;
342 $this->referenced =
true;
372 $this->type = $a_type;
433 return $this->desc ??
'';
447 $this->long_desc = $a_desc;
460 if (strlen($this->long_desc)) {
486 $this->import_id = $a_import_id;
495 $query =
"SELECT * FROM object_data " .
496 "WHERE import_id = " .
$ilDB->quote($a_import_id,
"text") .
" " .
497 "ORDER BY create_date DESC";
499 while ($row =
$ilDB->fetchObject(
$res)) {
511 $this->offline = $a_status;
531 return (
bool)
$DIC[
'objDefinition']->supportsOfflineHandling($this->
getType());
543 $query =
"SELECT import_id FROM object_data " .
544 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer");
547 return $row->import_id;
581 if ($a_owner_id != -1) {
588 $own_name =
$owner->getFullname();
590 $own_name =
$lng->txt(
"unknown");
604 $this->owner = $a_owner;
658 $app_event =
$DIC->event();
665 if (!isset($this->type)) {
666 $message = get_class($this) .
"::create(): No object type given!";
671 $ilLog->write(
"ilObject::create(), start");
679 } elseif (is_object(
$ilUser)) {
684 $this->
id =
$ilDB->nextId(
"object_data");
685 $q =
"INSERT INTO object_data " .
686 "(obj_id,type,title,description,offline,owner,create_date,last_update,import_id) " .
689 $ilDB->quote($this->
id,
"integer") .
"," .
690 $ilDB->quote($this->type,
"text") .
"," .
699 $ilDB->manipulate($q);
705 'obj_id' => array(
'integer',$this->
id),
707 $ilDB->insert(
'object_description', $values);
717 $q =
"SELECT last_update, create_date FROM object_data" .
718 " WHERE obj_id = " .
$ilDB->quote($this->
id,
"integer");
719 $obj_set =
$ilDB->query($q);
720 $obj_rec =
$ilDB->fetchAssoc($obj_set);
721 $this->last_update = $obj_rec[
"last_update"];
722 $this->create_date = $obj_rec[
"create_date"];
728 $ilLog->write(
"ilObject::create(), finished, obj_id: " . $this->
id .
", type: " .
729 $this->type .
", title: " . $this->
getTitle());
734 array(
'obj_id' => $this->
id,
'obj_type' => $this->type)
750 $app_event =
$DIC->event();
755 $q =
"UPDATE object_data " .
761 "last_update = " .
$ilDB->now() .
" " .
762 "WHERE obj_id = " .
$ilDB->quote($this->
getId(),
"integer");
763 $ilDB->manipulate($q);
768 $q =
"SELECT last_update FROM object_data" .
769 " WHERE obj_id = " .
$ilDB->quote($this->
getId(),
"integer");
770 $obj_set =
$ilDB->query($q);
771 $obj_rec =
$ilDB->fetchAssoc($obj_set);
772 $this->last_update = $obj_rec[
"last_update"];
776 $res =
$ilDB->query(
"SELECT * FROM object_description WHERE obj_id = " .
777 $ilDB->quote($this->getId(),
'integer'));
778 if (
$res->numRows()) {
782 $ilDB->update(
'object_description', $values, array(
'obj_id' => array(
'integer',$this->
getId())));
786 'obj_id' => array(
'integer',$this->
getId()));
787 $ilDB->insert(
'object_description', $values);
793 array(
'obj_id' => $this->
getId(),
794 'obj_type' => $this->
getType(),
816 $app_event =
$DIC->event();
818 include_once
'Services/MetaData/classes/class.ilMD.php';
823 array(
'obj_id' => $this->
getId(),
824 'obj_type' => $this->
getType(),
828 switch ($a_element) {
833 if (!is_object($md_gen = $md->getGeneral())) {
836 $this->
setTitle($md_gen->getTitle());
838 foreach ($md_gen->getDescriptionIds() as
$id) {
839 $md_des = $md_gen->getDescription(
$id);
859 include_once
'Services/MetaData/classes/class.ilMDCreator.php';
864 $md_creator->setTitle($this->
getTitle());
865 $md_creator->setTitleLanguage(
$ilUser->getPref(
'language'));
867 $md_creator->setDescriptionLanguage(
$ilUser->getPref(
'language'));
868 $md_creator->setKeywordLanguage(
$ilUser->getPref(
'language'));
869 $md_creator->setLanguage(
$ilUser->getPref(
'language'));
870 $md_creator->create();
881 $md_gen = $md->getGeneral();
886 $md_gen = $md->getGeneral();
889 $md_gen->setTitle($this->
getTitle());
892 $md_des_ids = $md_gen->getDescriptionIds();
893 if (count($md_des_ids) > 0) {
894 $md_des = $md_gen->getDescription($md_des_ids[0]);
907 include_once(
'Services/MetaData/classes/class.ilMD.php');
922 $q =
"UPDATE object_data " .
924 "owner = " .
$ilDB->quote($this->
getOwner(),
"integer") .
", " .
925 "last_update = " .
$ilDB->now() .
" " .
926 "WHERE obj_id = " .
$ilDB->quote($this->
getId(),
"integer");
927 $ilDB->manipulate($q);
929 $q =
"SELECT last_update FROM object_data" .
930 " WHERE obj_id = " .
$ilDB->quote($this->
getId(),
"integer");
931 $obj_set =
$ilDB->query($q);
932 $obj_rec =
$ilDB->fetchAssoc($obj_set);
933 $this->last_update = $obj_rec[
"last_update"];
951 $ilDB->setLimit(1, 0);
952 $q =
"SELECT * FROM object_data WHERE import_id = " .
$ilDB->quote($a_import_id,
"text") .
953 " ORDER BY create_date DESC";
954 $obj_set =
$ilDB->query($q);
956 if ($obj_rec =
$ilDB->fetchAssoc($obj_set)) {
957 return $obj_rec[
"obj_id"];
974 $query =
"SELECT * FROM object_reference WHERE obj_id = " .
975 $ilDB->quote($a_id,
'integer');
979 while ($obj_rec =
$ilDB->fetchAssoc(
$res)) {
980 $ref[$obj_rec[
"ref_id"]] = $obj_rec[
"ref_id"];
995 $ilObjDataCache =
$DIC[
"ilObjDataCache"];
997 $tit = $ilObjDataCache->lookupTitle($a_id);
1013 return $DIC[
'ilObjDataCache']->lookupOfflineStatus($a_obj_id);
1027 $ilObjDataCache =
$DIC[
"ilObjDataCache"];
1029 $owner = $ilObjDataCache->lookupOwner($a_id);
1039 $query = (!$partialmatch)
1040 ?
"SELECT obj_id FROM object_data WHERE title = " .
$ilDB->quote(
$title,
"text")
1041 :
"SELECT obj_id FROM object_data WHERE " .
$ilDB->like(
"title",
"text",
'%' .
$title .
'%');
1048 $object_ids = array();
1050 $object_ids[] = $row[
'obj_id'];
1053 return is_array($object_ids) ? $object_ids : array();
1065 $ilObjDataCache =
$DIC[
"ilObjDataCache"];
1067 return $ilObjDataCache->lookupDescription($a_id);
1079 $ilObjDataCache =
$DIC[
"ilObjDataCache"];
1084 return $ilObjDataCache->lookupLastUpdate($a_id);
1099 if (!is_array($a_objs)) {
1100 $a_objs = array($a_objs);
1103 $set =
$ilDB->query(
"SELECT max(last_update) as last_update FROM object_data " .
1104 "WHERE " .
$ilDB->in(
"obj_id", $a_objs,
false,
"integer") .
" ");
1105 $rec =
$ilDB->fetchAssoc($set);
1107 return ($rec[
"last_update"]);
1114 $ilObjDataCache =
$DIC[
"ilObjDataCache"];
1116 return (
int) $ilObjDataCache->lookupObjId($a_id);
1128 $query =
"UPDATE object_reference SET " .
1129 'deleted = ' .
$ilDB->now() .
', ' .
1131 "WHERE ref_id = " .
$ilDB->quote($a_ref_id,
'integer');
1147 $query =
'UPDATE object_reference SET ' .
1148 'deleted = ' .
$ilDB->now() .
', ' .
1164 $query =
"UPDATE object_reference SET deleted = " .
$ilDB->quote(
null,
'timestamp') .
', ' .
1166 " WHERE ref_id = " .
$ilDB->quote($a_ref_id,
'integer');
1179 $query =
"SELECT deleted FROM object_reference" .
1180 " WHERE ref_id = " .
$ilDB->quote($a_ref_id,
"integer");
1182 $rec =
$ilDB->fetchAssoc($set);
1184 return $rec[
"deleted"];
1201 $q =
"UPDATE object_data " .
1203 "title = " .
$ilDB->quote($a_title,
"text") .
"," .
1204 "last_update = " .
$ilDB->now() .
" " .
1205 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer");
1207 $ilDB->manipulate($q);
1227 $q =
"UPDATE object_data " .
1229 "description = " .
$ilDB->quote(
$desc,
"text") .
"," .
1230 "last_update = " .
$ilDB->now() .
" " .
1231 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer");
1233 $ilDB->manipulate($q);
1237 $res =
$ilDB->query(
"SELECT * FROM object_description WHERE obj_id = " .
1238 $ilDB->quote($a_obj_id,
'integer'));
1240 if (
$res->numRows()) {
1242 'description' => array(
'clob',$a_desc)
1244 $ilDB->update(
'object_description', $values, array(
'obj_id' => array(
'integer',$a_obj_id)));
1247 'description' => array(
'clob',$a_desc),
1248 'obj_id' => array(
'integer',$a_obj_id));
1249 $ilDB->insert(
'object_description', $values);
1267 $q =
"UPDATE object_data " .
1269 "import_id = " .
$ilDB->quote($a_import_id,
"text") .
"," .
1270 "last_update = " .
$ilDB->now() .
" " .
1271 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer");
1273 $ilDB->manipulate($q);
1285 $ilObjDataCache =
$DIC[
"ilObjDataCache"];
1288 return $ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_id));
1290 return $ilObjDataCache->lookupType($a_id);
1302 return $tree->isSaved($a_ref_id);
1311 foreach ($ref_ids as
$ref_id) {
1329 $ilObjDataCache =
$DIC[
"ilObjDataCache"];
1331 return (
int) $ilObjDataCache->lookupObjId($a_ref_id);
1350 $q =
"SELECT * FROM object_data WHERE type = " .
$ilDB->quote($a_type,
"text");
1351 $obj_set =
$ilDB->query($q);
1354 while ($obj_rec =
$ilDB->fetchAssoc($obj_set)) {
1356 $objects[$obj_rec[
"title"] .
"." . $obj_rec[
"obj_id"]] = array(
"id" => $obj_rec[
"obj_id"],
1357 "type" => $obj_rec[
"type"],
"title" => $obj_rec[
"title"],
1358 "description" => $obj_rec[
"description"]);
1382 $ilLog->write(
"ilObject::putInTree(), parent_ref: $a_parent_ref, ref_id: " .
1383 $this->
getRefId() .
", obj_id: " . $this->
getId() .
", type: " .
1386 $ilAppEventHandler->raise(
1391 'obj_type' => $this->
getType(),
1392 'obj_id' => $this->
getId(),
1393 'parent_ref_id' => $a_parent_ref,
1421 $parent_roles =
$rbacreview->getParentRoleIds($a_parent_ref);
1422 foreach ((array) $parent_roles as $parent_role) {
1424 $parent_role[
'obj_id'],
1426 $parent_role[
'parent']
1429 $parent_role[
'obj_id'],
1448 if (!isset($this->
id)) {
1449 $message =
"ilObject::createNewReference(): No obj_id given!";
1453 $next_id =
$ilDB->nextId(
'object_reference');
1454 $query =
"INSERT INTO object_reference " .
1455 "(ref_id, obj_id) VALUES (" .
$ilDB->quote($next_id,
'integer') .
',' .
$ilDB->quote($this->
id,
'integer') .
")";
1458 $this->ref_id = $next_id;
1459 $this->referenced =
true;
1476 if (!isset($this->
id)) {
1477 $message =
"ilObject::countReferences(): No obj_id given!";
1481 $query =
"SELECT COUNT(ref_id) num FROM object_reference " .
1482 "WHERE obj_id = " .
$ilDB->quote($this->
id,
'integer') .
" ";
1500 public function delete()
1516 if ($this->type != $db_type) {
1517 $message =
"ilObject::delete(): Type mismatch. Object with obj_id: " . $this->
id .
" " .
1518 "was instantiated by type '" . $this->type .
"'. DB type is: " . $db_type;
1524 $ilErr->raiseError(
"ilObject::delete(): Type mismatch. (" . $this->type .
"/" . $this->
id .
")",
$ilErr->WARNING);
1527 $ilAppEventHandler->raise(
'Services/Object',
'beforeDeletion', array(
'object' => $this ));
1530 $q =
"DELETE FROM object_data " .
1531 "WHERE obj_id = " .
$ilDB->quote($this->
getId(),
"integer");
1532 $ilDB->manipulate($q);
1535 $query =
"DELETE FROM object_description WHERE obj_id = " .
1540 $ilLog->write(
"ilObject::delete(), deleted object, obj_id: " . $this->
getId() .
", type: " .
1544 include_once
"Services/Object/classes/class.ilObjectDataDeletionLog.php";
1548 include_once(
"./Services/News/classes/class.ilNewsItem.php");
1550 $news_item->deleteNewsOfContext($this->
getId(), $this->
getType());
1551 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
1554 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
1558 $query =
"DELETE FROM dav_property " .
1559 "WHERE obj_id = " .
$ilDB->quote($this->
getId(),
'integer');
1563 include_once
'./Services/WebServices/ECS/classes/class.ilECSImport.php';
1566 include_once(
"Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
1569 include_once(
"Services/Tracking/classes/class.ilLPObjSettings.php");
1575 $ilLog->write(
"ilObject::delete(), object not deleted, number of references: " .
1581 if ($this->referenced) {
1582 include_once
"Services/Object/classes/class.ilObjectActivation.php";
1585 $ilAppEventHandler->raise(
'Services/Object',
'deleteReference', array(
'ref_id' => $this->
getRefId()));
1588 $query =
"DELETE FROM object_reference " .
1589 "WHERE ref_id = " .
$ilDB->quote($this->
getRefId(),
'integer');
1593 $ilLog->write(
"ilObject::delete(), reference deleted, ref_id: " . $this->
getRefId() .
1594 ", obj_id: " . $this->
getId() .
", type: " .
1603 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
1607 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
1612 if ($this->referenced) {
1642 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
1644 $action->setRefId($this->
getRefId());
1649 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
1651 return $a_tpl_id ?
true :
false;
1663 public static function _exists($a_id, $a_reference =
false, $a_type =
null)
1670 $q =
"SELECT * FROM object_data " .
1671 "LEFT JOIN object_reference ON object_reference.obj_id=object_data.obj_id " .
1672 "WHERE object_reference.ref_id= " .
$ilDB->quote($a_id,
"integer");
1674 $q =
"SELECT * FROM object_data WHERE obj_id=" .
$ilDB->quote($a_id,
"integer");
1678 $q .=
" AND object_data.type = " .
$ilDB->quote($a_type,
"text");
1681 $r =
$ilDB->query($q);
1683 return $ilDB->numRows($r) ?
true :
false;
1689 $this->
register = (bool) $a_bool;
1723 $order =
" ORDER BY title";
1727 $where_clause =
"WHERE type = " .
1728 $ilDB->quote($a_obj_type,
"text");
1730 if ($a_owner !=
"") {
1731 $where_clause .=
" AND owner = " .
$ilDB->quote($a_owner,
"integer");
1735 $q =
"SELECT * FROM object_data " . $where_clause . $order;
1736 $r =
$ilDB->query($q);
1739 if (
$ilDB->numRows($r) > 0) {
1740 while ($row =
$ilDB->fetchAssoc($r)) {
1741 $row[
"desc"] = $row[
"description"];
1742 $arr[$row[
"obj_id"]] = $row;
1769 $query =
"SELECT obj_data.title obj_title,path_data.title path_title,child FROM tree " .
1770 "JOIN object_reference obj_ref ON child = obj_ref.ref_id " .
1771 "JOIN object_data obj_data ON obj_ref.obj_id = obj_data.obj_id " .
1772 "JOIN object_reference path_ref ON parent = path_ref.ref_id " .
1773 "JOIN object_data path_data ON path_ref.obj_id = path_data.obj_id " .
1774 "WHERE " .
$ilDB->in(
"child", $a_ref_ids,
false,
"integer") .
" " .
1775 "ORDER BY obj_data.title ";
1779 $options[0] =
$lng->txt(
'obj_' . $new_type .
'_select');
1781 require_once(
"Services/Repository/classes/class.ilObjectPlugin.php");
1785 while ($row =
$ilDB->fetchObject(
$res)) {
1786 if (strlen(
$title = $row->obj_title) > 40) {
1791 if (strlen($path = $row->path_title) > 40) {
1792 $path = substr($path, 0, 40) .
'...';
1795 $title .=
' (' .
$lng->txt(
'path') .
': ' . $path .
')';
1798 $options[$row->child] =
$title;
1800 return $options ? $options : array();
1812 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree =
false)
1828 include_once
'./Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1831 if (!$options->isTreeCopyDisabled() && !$a_omit_tree) {
1838 include_once(
$location .
"/class." . $class_name .
".php");
1839 $new_obj =
new $class_name(0,
false);
1840 $new_obj->setOwner(
$ilUser->getId());
1841 $new_obj->setTitle(
$title);
1843 $new_obj->setType($this->
getType());
1846 $new_obj->create(
true);
1853 if (!$options->isTreeCopyDisabled() && !$a_omit_tree) {
1855 $new_obj->createReference();
1856 $new_obj->putInTree($a_target_id);
1857 $new_obj->setPermissions($a_target_id);
1868 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
1872 $query =
"INSERT INTO dav_property (obj_id,node_id,ns,name,value) " .
1873 "SELECT " .
$ilDB->quote($new_obj->getId(),
'integer') .
",node_id,ns,name,value " .
1874 "FROM dav_property " .
1875 "WHERE obj_id = " .
$ilDB->quote($this->
getId(),
'integer');
1880 $customIconFactory =
$DIC[
'object.customicons.factory'];
1881 $customIcon = $customIconFactory->getByObjId($this->
getId(), $this->
getType());
1882 $customIcon->copy($new_obj->getId());
1884 $tile_image =
$DIC->object()->commonSettings()->tileImage()->getByObjId($this->
getId());
1885 $tile_image->copy($new_obj->getId());
1887 $ilAppEventHandler->raise(
'Services/Object',
'cloneObject', array(
1888 'object' => $new_obj,
1889 'cloned_from_object' => $this,
1906 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
1908 if (!$cp_options->isRootNode($this->getRefId())) {
1911 $nodes =
$tree->getChilds($a_target_id);
1913 $title_unique =
false;
1914 require_once
'Modules/File/classes/class.ilObjFileAccess.php';
1916 $handleExtension = ($this->
getType() ==
"file");
1918 while (!$title_unique) {
1920 foreach ($nodes as $node) {
1921 if ((
$title == $node[
'title']) and ($this->
getType() == $node[
'type'])) {
1948 include_once
'./Services/Conditions/classes/class.ilConditionHandler.php' ;
1951 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
1954 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
1956 $obj =
$factory->getInstanceByRefId($a_target_id,
false);
1958 $obj->applyDidacticTemplate($tpl_id);
1974 $md->cloneMD($target_obj->getId(), 0, $target_obj->getType());
1986 public static function getIconForReference(
1990 string $a_type =
'',
1991 bool $a_offline =
false
1998 if ($a_obj_id ==
"" && $a_type ==
"") {
2002 if ($a_type ==
"") {
2006 if ($a_size ==
"") {
2015 $customIconFactory =
$DIC[
'object.customicons.factory'];
2016 $customIcon = $customIconFactory->getPresenterByObjId((
int) $a_obj_id, (
string) $a_type);
2017 if ($customIcon->exists()) {
2025 $path = $dtpl_icon_factory->getIconPathForReference((
int) $a_ref_id);
2027 $path = $dtpl_icon_factory->getIconPathForObject((
int) $a_obj_id);
2030 return $path .
'?tmp=' . filemtime($path);
2037 $class_name =
"il" .
$objDefinition->getClassName($a_type) .
'Plugin';
2039 if (is_file(
$location .
"/class." . $class_name .
".php")) {
2040 include_once(
$location .
"/class." . $class_name .
".php");
2041 return call_user_func(array($class_name,
"_getIcon"), $a_type, $a_size, $a_obj_id);
2049 return "./images/icon_" . $a_type .
".svg";
2067 return self::getIconForReference(
2089 if ($a_depth == 0) {
2090 $deps[
"dep"] = array();
2093 $deps[
"del_ids"][$a_obj_id] = $a_obj_id;
2098 include_once(
$location .
"/class." . $class_name .
".php");
2099 $odeps = call_user_func(array($class_name,
"getDeletionDependencies"), $a_obj_id);
2100 if (is_array($odeps)) {
2107 foreach (
$tree->getChilds($a_ref_id) as
$c) {
2113 if ($a_depth == 0) {
2114 foreach ($deps[
"del_ids"] as $obj_id) {
2115 unset($deps[
"dep"][$obj_id]);
2117 $deps = $deps[
"dep"];
2142 $res =
$ilDB->query(
"SELECT * FROM object_description" .
2143 " WHERE " .
$ilDB->in(
"obj_id", $a_obj_ids,
"",
"integer"));
2145 while ($row =
$ilDB->fetchAssoc(
$res)) {
2146 $all[$row[
"obj_id"]] = $row[
"description"];
2167 $types = array_keys(
$objDefinition->getSubObjectsRecursively(
"root"));
2169 $sql =
"SELECT od.obj_id,od.type,od.title FROM object_data od" .
2170 " JOIN object_reference oref ON(oref.obj_id = od.obj_id)" .
2171 " JOIN tree ON (tree.child = oref.ref_id)";
2174 $sql .=
" WHERE od.owner = " .
$ilDB->quote($a_user_id,
"integer");
2176 $sql .=
" LEFT JOIN usr_data ud ON (ud.usr_id = od.owner)" .
2177 " WHERE (od.owner < " .
$ilDB->quote(1,
"integer") .
2178 " OR od.owner IS NULL OR ud.login IS NULL)" .
2179 " AND od.owner <> " .
$ilDB->quote(-1,
"integer");
2182 $sql .=
" AND " .
$ilDB->in(
"od.type", $types,
"",
"text") .
2183 " AND tree.tree > " .
$ilDB->quote(0,
"integer");
2186 while ($row =
$ilDB->fetchAssoc(
$res)) {
2187 $all[$row[
"type"]][$row[
"obj_id"]] = $row[
"title"];
2205 if (!in_array($a_type, array(
"catr",
"crsr",
"sess",
"grpr",
"prgr"))) {
2210 $missing_obj_ids = array();
2211 foreach ($a_obj_title_map as $obj_id =>
$title) {
2213 $missing_obj_ids[] = $obj_id;
2217 if (!
sizeof($missing_obj_ids)) {
2226 $set =
$ilDB->query(
"SELECT oref.obj_id, od.type, od.title FROM object_data od" .
2227 " JOIN container_reference oref ON (od.obj_id = oref.target_obj_id)" .
2228 " AND " .
$ilDB->in(
"oref.obj_id", $missing_obj_ids,
"",
"integer"));
2229 while ($row =
$ilDB->fetchAssoc($set)) {
2230 $a_obj_title_map[$row[
"obj_id"]] = $row[
"title"];
2235 include_once
"Modules/Session/classes/class.ilObjSession.php";
2236 foreach ($missing_obj_ids as $obj_id) {
2238 $a_obj_title_map[$obj_id] = $sess->getFirstAppointment()->appointmentToString();
2256 $set =
$ilDB->query(
"SELECT create_date FROM object_data " .
2257 " WHERE obj_id = " .
$ilDB->quote($a_id,
"integer"));
2258 $rec =
$ilDB->fetchAssoc($set);
2259 return $rec[
"create_date"];
2276 !in_array($a_type, array(
"file",
"lm",
"wiki"))) {
2281 $parent_ref_id =
$tree->checkForParentType($a_ref_id,
"grp");
2282 if (!$parent_ref_id) {
2283 $parent_ref_id =
$tree->checkForParentType($a_ref_id,
"crs");
2285 if ($parent_ref_id) {
2286 include_once
'./Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
2310 return $this->objDefinition->getSubObjects($this->type, $a_filter);
An exception for terminatinating execution or to throw for unit testing.
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
error($a_errmsg)
set error message @access public
static _deleteByObjId($a_obj_id)
Delete by objekt id.
static _cloneValues($a_source_id, $a_target_id, $a_sub_type=null, $a_source_sub_id=null, $a_target_sub_id=null, $use_stored_record_map=false)
Clone Advanced Meta Data.
static _deleteSettingsOfBlock($a_block_id, $a_block_type)
Delete block settings of block.
INTERNAL CLASS: Please do not use in consumer code.
static cloneDependencies($a_src_ref_id, $a_target_ref_id, $a_copy_id)
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
static getActionsByTemplateId($a_tpl_id)
Get actions of one template.
static assignTemplate($a_ref_id, $a_obj_id, $a_tpl_id)
Assign template to object @global ilDB $ilDB.
static deleteByObjId($a_obj_id)
Delete by obj id @global ilDB $ilDB.
static deleteByRefId($a_ref_id)
Delete by ref_id @global ilDB $ilDB.
static lookupTemplateId($a_ref_id)
Lookup template id @global ilDB $ilDB.
static _deleteByObjId($a_obj_id)
Delete by obj_id.
static _deleteByObjId($a_obj_id)
static getLogger($a_component_id)
Get component logger.
static _appendNumberOfCopyToFilename($a_file_name, $nth_copy=null, $a_handle_extension=false)
Appends the text " - Copy" to a filename in the language of the current user.
static deleteAllEntries($a_ref_id)
Delete all db entries for ref id.
static add(ilObject $a_object)
Class ilObjectFactory This class offers methods to get instances of the type-specific object classes ...
Object not found exception.
static lookupTxtById($plugin_id, $lang_var)
const AUTO_RATING_NEW_OBJECTS
Class ilObject Basic functions for all objects.
static _lookupOwnerName($a_owner_id)
lookup owner name for owner id
static getDeletionDependencies($a_obj_id)
Get deletion dependencies.
static _writeImportId($a_obj_id, $a_import_id)
write import id to db (static)
getType()
get object type @access public
getDiskUsage()
Gets the disk usage of the object in bytes.
getOwner()
get object owner
setParentRolePermissions($a_parent_ref)
Initialize the permissions of parent roles (local roles of categories, global roles....
static hasAutoRating($a_type, $a_ref_id)
Check if auto rating is active for parent group/course.
static _lookupObjId($a_id)
createReference()
creates reference for object
setRefId($a_id)
set reference id @access public
setId($a_id)
set object id @access public
const TITLE_LENGTH
max length of object title
MDUpdateListener($a_element)
Meta data update listener.
static setDeletedDates($a_ref_ids, $a_user_id)
Set deleted date.
setOfflineStatus($a_status)
Set offline status.
update()
update object in db
static _resetDeletedDate($a_ref_id)
only called in ilObjectGUI::insertSavedNodes
static _lookupImportId($a_obj_id)
static getAllOwnedRepositoryObjects($a_user_id)
Get all ids of objects user owns.
getPossibleSubObjects($a_filter=true)
get all possible subobjects of this type the object can decide which types of subobjects are possible...
static _lookupTitle($a_id)
lookup object title
initDefaultRoles()
init default roles settings Purpose of this function is to create a local role folder and local roles...
cloneDependencies($a_target_id, $a_copy_id)
Clone object dependencies.
updateOwner()
update owner of object in db
setType($a_type)
set object type @access public
supportsOfflineHandling()
Check whether object supports offline handling.
static fixMissingTitles($a_type, array &$a_obj_title_map)
Try to fix missing object titles.
static _lookupObjectId($a_ref_id)
lookup object id
static _getObjectsByType($a_obj_type="", $a_owner="")
Get objects by type.
setTitle($a_title)
set object title
static _lookupCreationDate($a_id)
Lookup creation date.
deleteMetaData()
delete meta data entry
getLastUpdateDate()
get last update date @access public
static _lookupDescription($a_id)
lookup object description
updateMetaData()
update meta data entry
isUserRegistered($a_user_id=0)
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
setDescription($a_desc)
set object description
getOfflineStatus()
Get offline status.
createMetaData()
create meta data entry
setPermissions($a_parent_ref)
set permissions of object
withReferences()
determines wehter objects are referenced or not (got ref ids or not)
getRefId()
get reference id @access public
setOwner($a_owner)
set object owner
static lookupOfflineStatus($a_obj_id)
Lookup offline status using objectDataCache.
appendCopyInfo($a_target_id, $a_copy_id)
Prepend Copy info if object with same name exists in that container.
getLongDescription()
get object long description (stored in object_description)
static _getAllReferences($a_id)
get all reference ids of object
getDescription()
get object description
cloneMetaData($target_obj)
Copy meta data.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static _getLastUpdateOfObjects($a_objs)
Get last update for a set of media objects.
getId()
get object id @access public
getUntranslatedTitle()
get untranslated object title @access public
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
static _writeTitle($a_obj_id, $a_title)
write title to db (static)
setImportId($a_import_id)
set import id
static _lookupObjIdByImportId($a_import_id)
static _prepareCloneSelection($a_ref_ids, $new_type, $show_path=true)
Prepare copy wizard object selection.
putInTree($a_parent_ref)
maybe this method should be in tree object!?
read()
read object data from db into object
static collectDeletionDependencies(&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
Collect deletion dependencies.
static _setDeletedDate($a_ref_id, $a_deleted_by)
static _getObjectsDataForType($a_type, $a_omit_trash=false)
get all objects of a certain type
__construct($a_id=0, $a_reference=true)
Constructor @access public.
applyDidacticTemplate($a_tpl_id)
Apply template.
static _lookupDeletedDate($a_ref_id)
only called in ilObjectGUI::insertSavedNodes
static getLongDescriptions(array $a_obj_ids)
Get long description data.
static _lookupLastUpdate($a_id, $a_as_string=false)
lookup last update
static _lookupOwner($a_id)
lookup object owner
static _isInTrash($a_ref_id)
checks wether object is in trash
static _lookupType($a_id, $a_reference=false)
lookup object type
static _writeDescription($a_obj_id, $a_desc)
write description to db (static)
static _getIdsForTitle($title, $type='', $partialmatch=false)
getImportId()
get import id
getCreateDate()
get create date @access public
getTitle()
get object title @access public
static _getIdForImportId($a_import_id)
get current object id for import id (static)
countReferences()
count references of object
getPresentationTitle()
get presentation title Normally same as title Overwritten for sessions
static getInstance()
Get instance.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
redirection script todo: (a better solution should control the processing via a xml file)
foreach($_POST as $key=> $value) $res