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"];
161 $this->max_title = self::TITLE_LENGTH;
162 $this->max_desc = self::DESC_LENGTH;
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;
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 "AND NOT lang_default = 1";
308 $this->title =
$row->title;
310 #$this->desc = $row->description; 342 $this->ref_id = $a_id;
343 $this->referenced =
true;
448 $this->long_desc = $a_desc;
461 return strlen($this->long_desc) ? $this->long_desc :
$this->desc;
483 $this->import_id = $a_import_id;
490 $ilDB = $DIC->database();
492 $query =
"SELECT * FROM object_data " .
493 "WHERE import_id = " .
$ilDB->quote($a_import_id,
"text") .
" " .
494 "ORDER BY create_date DESC";
508 $this->offline = $a_status;
528 return (
bool) $DIC[
'objDefinition']->supportsOfflineHandling($this->
getType());
538 $ilDB = $DIC->database();
540 $query =
"SELECT import_id FROM object_data " .
541 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer");
544 return $row->import_id;
576 $lng = $DIC->language();
578 if ($a_owner_id != -1) {
585 $own_name =
$owner->getFullname();
587 $own_name =
$lng->txt(
"unknown");
601 $this->owner = $a_owner;
655 $app_event = $DIC->event();
662 if (!isset($this->type)) {
663 $message = get_class($this) .
"::create(): No object type given!";
668 $ilLog->write(
"ilObject::create(), start");
676 } elseif (is_object(
$ilUser)) {
681 $this->
id =
$ilDB->nextId(
"object_data");
682 $q =
"INSERT INTO object_data " .
683 "(obj_id,type,title,description,offline,owner,create_date,last_update,import_id) " .
686 $ilDB->quote($this->
id,
"integer") .
"," .
687 $ilDB->quote($this->type,
"text") .
"," .
696 $ilDB->manipulate($q);
702 'obj_id' => array(
'integer',$this->
id),
714 $q =
"SELECT last_update, create_date FROM object_data" .
715 " WHERE obj_id = " .
$ilDB->quote($this->
id,
"integer");
716 $obj_set =
$ilDB->query($q);
717 $obj_rec =
$ilDB->fetchAssoc($obj_set);
718 $this->last_update = $obj_rec[
"last_update"];
719 $this->create_date = $obj_rec[
"create_date"];
725 $ilLog->write(
"ilObject::create(), finished, obj_id: " . $this->
id .
", type: " .
726 $this->type .
", title: " . $this->
getTitle());
731 array(
'obj_id' => $this->
id,
'obj_type' => $this->type)
747 $app_event = $DIC->event();
752 $q =
"UPDATE object_data " .
758 "last_update = " .
$ilDB->now() .
" " .
759 "WHERE obj_id = " .
$ilDB->quote($this->
getId(),
"integer");
760 $ilDB->manipulate($q);
765 $q =
"SELECT last_update FROM object_data" .
766 " WHERE obj_id = " .
$ilDB->quote($this->
getId(),
"integer");
767 $obj_set =
$ilDB->query($q);
768 $obj_rec =
$ilDB->fetchAssoc($obj_set);
769 $this->last_update = $obj_rec[
"last_update"];
773 $res =
$ilDB->query(
"SELECT * FROM object_description WHERE obj_id = " .
774 $ilDB->quote($this->getId(),
'integer'));
775 if (
$res->numRows()) {
779 $ilDB->update(
'object_description',
$values, array(
'obj_id' => array(
'integer',$this->
getId())));
783 'obj_id' => array(
'integer',$this->
getId()));
790 array(
'obj_id' => $this->
getId(),
791 'obj_type' => $this->
getType(),
813 $app_event = $DIC->event();
815 include_once
'Services/MetaData/classes/class.ilMD.php';
820 array(
'obj_id' => $this->
getId(),
821 'obj_type' => $this->
getType(),
825 switch ($a_element) {
830 if (!is_object($md_gen = $md->getGeneral())) {
833 $this->
setTitle($md_gen->getTitle());
835 foreach ($md_gen->getDescriptionIds() as
$id) {
836 $md_des = $md_gen->getDescription(
$id);
856 include_once
'Services/MetaData/classes/class.ilMDCreator.php';
861 $md_creator->setTitle($this->
getTitle());
862 $md_creator->setTitleLanguage(
$ilUser->getPref(
'language'));
864 $md_creator->setDescriptionLanguage(
$ilUser->getPref(
'language'));
865 $md_creator->setKeywordLanguage(
$ilUser->getPref(
'language'));
866 $md_creator->setLanguage(
$ilUser->getPref(
'language'));
867 $md_creator->create();
878 $md_gen = $md->getGeneral();
883 $md_gen = $md->getGeneral();
886 $md_gen->setTitle($this->
getTitle());
889 $md_des_ids = $md_gen->getDescriptionIds();
890 if (count($md_des_ids) > 0) {
891 $md_des = $md_gen->getDescription($md_des_ids[0]);
904 include_once(
'Services/MetaData/classes/class.ilMD.php');
919 $q =
"UPDATE object_data " .
921 "owner = " .
$ilDB->quote($this->
getOwner(),
"integer") .
", " .
922 "last_update = " .
$ilDB->now() .
" " .
923 "WHERE obj_id = " .
$ilDB->quote($this->
getId(),
"integer");
924 $ilDB->manipulate($q);
926 $q =
"SELECT last_update FROM object_data" .
927 " WHERE obj_id = " .
$ilDB->quote($this->
getId(),
"integer");
928 $obj_set =
$ilDB->query($q);
929 $obj_rec =
$ilDB->fetchAssoc($obj_set);
930 $this->last_update = $obj_rec[
"last_update"];
946 $ilDB = $DIC->database();
948 $ilDB->setLimit(1, 0);
949 $q =
"SELECT * FROM object_data WHERE import_id = " .
$ilDB->quote($a_import_id,
"text") .
950 " ORDER BY create_date DESC";
951 $obj_set =
$ilDB->query($q);
953 if ($obj_rec =
$ilDB->fetchAssoc($obj_set)) {
954 return $obj_rec[
"obj_id"];
969 $ilDB = $DIC->database();
971 $query =
"SELECT * FROM object_reference WHERE obj_id = " .
972 $ilDB->quote($a_id,
'integer');
976 while ($obj_rec =
$ilDB->fetchAssoc(
$res)) {
977 $ref[$obj_rec[
"ref_id"]] = $obj_rec[
"ref_id"];
992 $ilObjDataCache = $DIC[
"ilObjDataCache"];
994 $tit = $ilObjDataCache->lookupTitle($a_id);
1010 return $DIC[
'ilObjDataCache']->lookupOfflineStatus($a_obj_id);
1024 $ilObjDataCache = $DIC[
"ilObjDataCache"];
1026 $owner = $ilObjDataCache->lookupOwner($a_id);
1034 $ilDB = $DIC->database();
1036 $query = (!$partialmatch)
1037 ?
"SELECT obj_id FROM object_data WHERE title = " .
$ilDB->quote(
$title,
"text")
1038 :
"SELECT obj_id FROM object_data WHERE " .
$ilDB->like(
"title",
"text",
'%' .
$title .
'%');
1045 $object_ids = array();
1047 $object_ids[] =
$row[
'obj_id'];
1050 return is_array($object_ids) ? $object_ids : array();
1062 $ilObjDataCache = $DIC[
"ilObjDataCache"];
1064 return $ilObjDataCache->lookupDescription($a_id);
1076 $ilObjDataCache = $DIC[
"ilObjDataCache"];
1081 return $ilObjDataCache->lookupLastUpdate($a_id);
1094 $ilDB = $DIC->database();
1096 if (!is_array($a_objs)) {
1097 $a_objs = array($a_objs);
1100 $set =
$ilDB->query(
"SELECT max(last_update) as last_update FROM object_data " .
1101 "WHERE " .
$ilDB->in(
"obj_id", $a_objs,
false,
"integer") .
" ");
1102 $rec =
$ilDB->fetchAssoc($set);
1104 return ($rec[
"last_update"]);
1111 $ilObjDataCache = $DIC[
"ilObjDataCache"];
1113 return (
int) $ilObjDataCache->lookupObjId($a_id);
1123 $ilDB = $DIC->database();
1125 $query =
"UPDATE object_reference SET deleted= " .
$ilDB->now() .
' ' .
1126 "WHERE ref_id = " .
$ilDB->quote($a_ref_id,
'integer');
1139 $ilDB = $DIC->database();
1140 $log = $DIC->logger()->root();
1142 $query =
'UPDATE object_reference SET deleted = ' .
$ilDB->now() .
' ' .
1143 'WHERE ' .
$ilDB->in(
'ref_id', (array) $a_ref_ids,
false,
'integer');
1145 $log->debug(__METHOD__ .
': Query is ' .
$query);
1146 $ilDB->manipulate($query);
1157 $ilDB = $DIC->database();
1159 $query =
"UPDATE object_reference SET deleted = " .
$ilDB->quote(null,
'timestamp') .
1160 " WHERE ref_id = " .
$ilDB->quote($a_ref_id,
'integer');
1171 $ilDB = $DIC->database();
1173 $query =
"SELECT deleted FROM object_reference" .
1174 " WHERE ref_id = " .
$ilDB->quote($a_ref_id,
"integer");
1176 $rec =
$ilDB->fetchAssoc($set);
1178 return $rec[
"deleted"];
1193 $ilDB = $DIC->database();
1195 $q =
"UPDATE object_data " .
1197 "title = " .
$ilDB->quote($a_title,
"text") .
"," .
1198 "last_update = " .
$ilDB->now() .
" " .
1199 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer");
1201 $ilDB->manipulate($q);
1215 $ilDB = $DIC->database();
1221 $q =
"UPDATE object_data " .
1223 "description = " .
$ilDB->quote(
$desc,
"text") .
"," .
1224 "last_update = " .
$ilDB->now() .
" " .
1225 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer");
1227 $ilDB->manipulate($q);
1231 $res =
$ilDB->query(
"SELECT * FROM object_description WHERE obj_id = " .
1232 $ilDB->quote($a_obj_id,
'integer'));
1234 if (
$res->numRows()) {
1236 'description' => array(
'clob',$a_desc)
1238 $ilDB->update(
'object_description',
$values, array(
'obj_id' => array(
'integer',$a_obj_id)));
1241 'description' => array(
'clob',$a_desc),
1242 'obj_id' => array(
'integer',$a_obj_id));
1259 $ilDB = $DIC->database();
1261 $q =
"UPDATE object_data " .
1263 "import_id = " .
$ilDB->quote($a_import_id,
"text") .
"," .
1264 "last_update = " .
$ilDB->now() .
" " .
1265 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer");
1267 $ilDB->manipulate($q);
1279 $ilObjDataCache = $DIC[
"ilObjDataCache"];
1282 return $ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_id));
1284 return $ilObjDataCache->lookupType($a_id);
1294 $tree = $DIC->repositoryTree();
1296 return $tree->isSaved($a_ref_id);
1305 foreach ($ref_ids as
$ref_id) {
1323 $ilObjDataCache = $DIC[
"ilObjDataCache"];
1325 return (
int) $ilObjDataCache->lookupObjId($a_ref_id);
1342 $ilDB = $DIC->database();
1344 $q =
"SELECT * FROM object_data WHERE type = " .
$ilDB->quote(
$a_type,
"text");
1345 $obj_set =
$ilDB->query($q);
1348 while ($obj_rec =
$ilDB->fetchAssoc($obj_set)) {
1350 $objects[$obj_rec[
"title"] .
"." . $obj_rec[
"obj_id"]] = array(
"id" => $obj_rec[
"obj_id"],
1351 "type" => $obj_rec[
"type"],
"title" => $obj_rec[
"title"],
1352 "description" => $obj_rec[
"description"]);
1376 $ilLog->write(
"ilObject::putInTree(), parent_ref: $a_parent_ref, ref_id: " .
1377 $this->
getRefId() .
", obj_id: " . $this->
getId() .
", type: " .
1380 $ilAppEventHandler->raise(
1385 'obj_type' => $this->
getType(),
1386 'obj_id' => $this->
getId(),
1387 'parent_ref_id' => $a_parent_ref,
1415 $parent_roles =
$rbacreview->getParentRoleIds($a_parent_ref);
1416 foreach ((array) $parent_roles as $parent_role) {
1418 $parent_role[
'obj_id'],
1420 $parent_role[
'parent']
1423 $parent_role[
'obj_id'],
1442 if (!isset($this->
id)) {
1443 $message =
"ilObject::createNewReference(): No obj_id given!";
1447 $next_id =
$ilDB->nextId(
'object_reference');
1448 $query =
"INSERT INTO object_reference " .
1449 "(ref_id, obj_id) VALUES (" .
$ilDB->quote($next_id,
'integer') .
',' .
$ilDB->quote($this->
id,
'integer') .
")";
1452 $this->ref_id = $next_id;
1453 $this->referenced =
true;
1470 if (!isset($this->
id)) {
1471 $message =
"ilObject::countReferences(): No obj_id given!";
1475 $query =
"SELECT COUNT(ref_id) num FROM object_reference " .
1476 "WHERE obj_id = " .
$ilDB->quote($this->
id,
'integer') .
" ";
1494 public function delete()
1513 if ($this->type != $db_type) {
1514 $message =
"ilObject::delete(): Type mismatch. Object with obj_id: " . $this->
id .
" " .
1515 "was instantiated by type '" . $this->type .
"'. DB type is: " . $db_type;
1521 $ilErr->raiseError(
"ilObject::delete(): Type mismatch. (" . $this->type .
"/" . $this->
id .
")",
$ilErr->WARNING);
1524 $ilAppEventHandler->raise(
'Services/Object',
'beforeDeletion', array(
'object' => $this ));
1527 $q =
"DELETE FROM object_data " .
1528 "WHERE obj_id = " .
$ilDB->quote($this->
getId(),
"integer");
1529 $ilDB->manipulate($q);
1532 $query =
"DELETE FROM object_description WHERE obj_id = " .
1537 $ilLog->write(
"ilObject::delete(), deleted object, obj_id: " . $this->
getId() .
", type: " .
1541 include_once
"Services/Object/classes/class.ilObjectDataDeletionLog.php";
1545 include_once(
"./Services/News/classes/class.ilNewsItem.php");
1547 $news_item->deleteNewsOfContext($this->
getId(), $this->
getType());
1548 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
1551 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
1567 $query =
"DELETE FROM dav_property " .
1568 "WHERE obj_id = " .
$ilDB->quote($this->
getId(),
'integer');
1572 include_once
'./Services/WebServices/ECS/classes/class.ilECSImport.php';
1575 include_once(
"Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
1578 include_once(
"Services/Tracking/classes/class.ilLPObjSettings.php");
1584 $ilLog->write(
"ilObject::delete(), object not deleted, number of references: " .
1590 if ($this->referenced) {
1591 include_once
"Services/Object/classes/class.ilObjectActivation.php";
1595 $query =
"DELETE FROM object_reference " .
1596 "WHERE ref_id = " .
$ilDB->quote($this->
getRefId(),
'integer');
1600 $ilLog->write(
"ilObject::delete(), reference deleted, ref_id: " . $this->
getRefId() .
1601 ", obj_id: " . $this->
getId() .
", type: " .
1610 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
1614 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
1622 if ($this->referenced) {
1652 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
1654 $action->setRefId($this->
getRefId());
1659 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
1661 return $a_tpl_id ? true :
false;
1677 $ilDB = $DIC->database();
1680 $q =
"SELECT * FROM object_data " .
1681 "LEFT JOIN object_reference ON object_reference.obj_id=object_data.obj_id " .
1682 "WHERE object_reference.ref_id= " .
$ilDB->quote($a_id,
"integer");
1684 $q =
"SELECT * FROM object_data WHERE obj_id=" .
$ilDB->quote($a_id,
"integer");
1688 $q .=
" AND object_data.type = " .
$ilDB->quote(
$a_type,
"text");
1693 return $ilDB->numRows(
$r) ? true :
false;
1699 $this->
register = (bool) $a_bool;
1731 $ilDB = $DIC->database();
1733 $order =
" ORDER BY title";
1737 $where_clause =
"WHERE type = " .
1738 $ilDB->quote($a_obj_type,
"text");
1740 if ($a_owner !=
"") {
1741 $where_clause .=
" AND owner = " .
$ilDB->quote($a_owner,
"integer");
1745 $q =
"SELECT * FROM object_data " . $where_clause . $order;
1751 $row[
"desc"] =
$row[
"description"];
1775 $ilDB = $DIC->database();
1776 $lng = $DIC->language();
1779 $query =
"SELECT obj_data.title obj_title,path_data.title path_title,child FROM tree " .
1780 "JOIN object_reference obj_ref ON child = obj_ref.ref_id " .
1781 "JOIN object_data obj_data ON obj_ref.obj_id = obj_data.obj_id " .
1782 "JOIN object_reference path_ref ON parent = path_ref.ref_id " .
1783 "JOIN object_data path_data ON path_ref.obj_id = path_data.obj_id " .
1784 "WHERE " .
$ilDB->in(
"child", $a_ref_ids,
false,
"integer") .
" " .
1785 "ORDER BY obj_data.title ";
1789 $options[0] =
$lng->txt(
'obj_' . $new_type .
'_select');
1791 require_once(
"Services/Repository/classes/class.ilObjectPlugin.php");
1801 if (strlen(
$path =
$row->path_title) > 40) {
1822 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree =
false)
1838 include_once
'./Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1841 if (!
$options->isTreeCopyDisabled() && !$a_omit_tree) {
1848 include_once(
$location .
"/class." . $class_name .
".php");
1849 $new_obj =
new $class_name(0,
false);
1850 $new_obj->setOwner(
$ilUser->getId());
1851 $new_obj->setTitle(
$title);
1853 $new_obj->setType($this->
getType());
1856 $new_obj->create(
true);
1863 if (!
$options->isTreeCopyDisabled() && !$a_omit_tree) {
1865 $new_obj->createReference();
1866 $new_obj->putInTree($a_target_id);
1867 $new_obj->setPermissions($a_target_id);
1878 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
1882 $query =
"INSERT INTO dav_property (obj_id,node_id,ns,name,value) " .
1883 "SELECT " .
$ilDB->quote($new_obj->getId(),
'integer') .
",node_id,ns,name,value " .
1884 "FROM dav_property " .
1885 "WHERE obj_id = " .
$ilDB->quote($this->getId(),
'integer');
1890 $customIconFactory = $DIC[
'object.customicons.factory'];
1891 $customIcon = $customIconFactory->getByObjId($this->
getId(), $this->
getType());
1892 $customIcon->copy($new_obj->getId());
1894 $tile_image = $DIC->object()->commonSettings()->tileImage()->getByObjId($this->
getId());
1895 $tile_image->copy($new_obj->getId());
1897 $ilAppEventHandler->raise(
'Services/Object',
'cloneObject', array(
1898 'object' => $new_obj,
1899 'cloned_from_object' => $this,
1916 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
1918 if (!$cp_options->isRootNode($this->getRefId())) {
1923 $title_unique =
false;
1924 require_once
'Modules/File/classes/class.ilObjFileAccess.php';
1926 $handleExtension = ($this->
getType() ==
"file");
1928 while (!$title_unique) {
1930 foreach (
$nodes as $node) {
1958 include_once
'./Services/Conditions/classes/class.ilConditionHandler.php' ;
1961 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
1964 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
1966 $obj =
$factory->getInstanceByRefId($a_target_id,
false);
1968 $obj->applyDidacticTemplate($tpl_id);
1984 $md->cloneMD($target_obj->getId(), 0, $target_obj->getType());
1996 public static function _getIcon(
2007 if ($a_obj_id ==
"" &&
$a_type ==
"") {
2015 if ($a_size ==
"") {
2024 $customIconFactory = $DIC[
'object.customicons.factory'];
2025 $customIcon = $customIconFactory->getPresenterByObjId((
int) $a_obj_id, (
string)
$a_type);
2026 if ($customIcon->exists()) {
2037 if (is_file(
$location .
"/class." . $class_name .
".php")) {
2038 include_once(
$location .
"/class." . $class_name .
".php");
2039 return call_user_func(array($class_name,
"_getIcon"),
$a_type, $a_size, $a_obj_id);
2047 return "./images/icon_" .
$a_type .
".svg";
2062 $tree = $DIC->repositoryTree();
2064 if ($a_depth == 0) {
2065 $deps[
"dep"] = array();
2068 $deps[
"del_ids"][$a_obj_id] = $a_obj_id;
2073 include_once(
$location .
"/class." . $class_name .
".php");
2074 $odeps = call_user_func(array($class_name,
"getDeletionDependencies"), $a_obj_id);
2075 if (is_array($odeps)) {
2082 foreach (
$tree->getChilds($a_ref_id) as
$c) {
2088 if ($a_depth == 0) {
2089 foreach ($deps[
"del_ids"] as $obj_id) {
2090 unset($deps[
"dep"][$obj_id]);
2092 $deps = $deps[
"dep"];
2115 $ilDB = $DIC->database();
2117 $res =
$ilDB->query(
"SELECT * FROM object_description" .
2118 " WHERE " .
$ilDB->in(
"obj_id", $a_obj_ids,
"",
"integer"));
2121 $all[
$row[
"obj_id"]] = $row[
"description"];
2136 $ilDB = $DIC->database();
2142 $types = array_keys(
$objDefinition->getSubObjectsRecursively(
"root"));
2144 $sql =
"SELECT od.obj_id,od.type,od.title FROM object_data od" .
2145 " JOIN object_reference oref ON(oref.obj_id = od.obj_id)" .
2146 " JOIN tree ON (tree.child = oref.ref_id)";
2149 $sql .=
" WHERE od.owner = " .
$ilDB->quote($a_user_id,
"integer");
2151 $sql .=
" LEFT JOIN usr_data ud ON (ud.usr_id = od.owner)" .
2152 " WHERE (od.owner < " .
$ilDB->quote(1,
"integer") .
2153 " OR od.owner IS NULL OR ud.login IS NULL)" .
2154 " AND od.owner <> " .
$ilDB->quote(-1,
"integer");
2157 $sql .=
" AND " .
$ilDB->in(
"od.type", $types,
"",
"text") .
2158 " AND tree.tree > " .
$ilDB->quote(0,
"integer");
2162 $all[
$row[
"type"]][
$row[
"obj_id"]] = $row[
"title"];
2178 $ilDB = $DIC->database();
2180 if (!in_array(
$a_type, array(
"catr",
"crsr",
"sess",
"grpr"))) {
2185 $missing_obj_ids = array();
2186 foreach ($a_obj_title_map as $obj_id =>
$title) {
2188 $missing_obj_ids[] = $obj_id;
2192 if (!
sizeof($missing_obj_ids)) {
2200 $set =
$ilDB->query(
"SELECT oref.obj_id, od.type, od.title FROM object_data od" .
2201 " JOIN container_reference oref ON (od.obj_id = oref.target_obj_id)" .
2202 " AND " .
$ilDB->in(
"oref.obj_id", $missing_obj_ids,
"",
"integer"));
2203 while (
$row =
$ilDB->fetchAssoc($set)) {
2204 $a_obj_title_map[
$row[
"obj_id"]] = $row[
"title"];
2209 include_once
"Modules/Session/classes/class.ilObjSession.php";
2210 foreach ($missing_obj_ids as $obj_id) {
2212 $a_obj_title_map[$obj_id] =
$sess->getFirstAppointment()->appointmentToString();
2228 $ilDB = $DIC->database();
2230 $set =
$ilDB->query(
"SELECT create_date FROM object_data " .
2231 " WHERE obj_id = " .
$ilDB->quote($a_id,
"integer"));
2232 $rec =
$ilDB->fetchAssoc($set);
2233 return $rec[
"create_date"];
2247 $tree = $DIC->repositoryTree();
2250 !in_array(
$a_type, array(
"file",
"lm",
"wiki"))) {
2255 $parent_ref_id =
$tree->checkForParentType($a_ref_id,
"grp");
2256 if (!$parent_ref_id) {
2257 $parent_ref_id =
$tree->checkForParentType($a_ref_id,
"crs");
2259 if ($parent_ref_id) {
2260 include_once
'./Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
2284 return $this->objDefinition->getSubObjects($this->type, $a_filter);
static lookupTemplateId($a_ref_id)
Lookup template id ilDB $ilDB.
static setDeletedDates($a_ref_ids)
Set deleted date.
static getDeletionDependencies($a_obj_id)
Get deletion dependencies.
static _resetDeletedDate($a_ref_id)
only called in ilObjectGUI::insertSavedNodes
static _lookupDeletedDate($a_ref_id)
only called in ilObjectGUI::insertSavedNodes
static removeItemFromDesktops($a_id)
removes object from all user's desktops public
supportsOfflineHandling()
Check whether object supports offline handling.
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
static lookupTxtById($plugin_id, $lang_var)
__construct($a_id=0, $a_reference=true)
Constructor public.
static _prepareCloneSelection($a_ref_ids, $new_type, $show_path=true)
Prepare copy wizard object selection.
static getLongDescriptions(array $a_obj_ids)
Get long description data.
cloneDependencies($a_target_id, $a_copy_id)
Clone object dependencies.
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 getAllOwnedRepositoryObjects($a_user_id)
Get all ids of objects user owns.
const TITLE_LENGTH
max length of object title
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
static deleteByRefId($a_ref_id)
Delete by ref_id ilDB $ilDB.
read()
read object data from db into object
updateMetaData()
update meta data entry
withReferences()
determines wehter objects are referenced or not (got ref ids or not)
getOfflineStatus()
Get offline status.
setId($a_id)
set object id public
createMetaData()
create meta data entry
static _isInTrash($a_ref_id)
checks wether object is in trash
static _writeTitle($a_obj_id, $a_title)
write title to db (static)
getDiskUsage()
Gets the disk usage of the object in bytes.
static _lookupTitle($a_id)
lookup object title
static _getObjectsByType($a_obj_type="", $a_owner="")
Get objects by type.
getPossibleSubObjects($a_filter=true)
get all possible subobjects of this type the object can decide which types of subobjects are possible...
getCreateDate()
get create date public
getOwner()
get object owner
Object not found exception.
static _deleteByObjId($a_obj_id)
Delete by obj_id.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static _setDeletedDate($a_ref_id)
only called in ilTree::saveSubTree
static _getAllReferences($a_id)
get all reference ids of object
static _deleteByObjId($a_obj_id)
Delete by objekt id.
setTitle($a_title)
set object title
static _lookupLastUpdate($a_id, $a_as_string=false)
lookup last update
static collectDeletionDependencies(&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
Collect deletion dependencies.
static _lookupObjectId($a_ref_id)
lookup object id
static getInstance()
Get instance.
static hasAutoRating($a_type, $a_ref_id)
Check if auto rating is active for parent group/course.
createReference()
creates reference for object
static assignTemplate($a_ref_id, $a_obj_id, $a_tpl_id)
Assign template to object ilDB $ilDB.
applyDidacticTemplate($a_tpl_id)
Apply template.
catch(Exception $e) $message
static _getInstance($a_copy_id)
Get instance of copy wizard options.
setOwner($a_owner)
set object owner
foreach($_POST as $key=> $value) $res
getId()
get object id public
static _cloneValues($a_source_id, $a_target_id, $a_sub_type=null, $a_source_sub_id=null, $a_target_sub_id=null)
Clone Advanced Meta Data.
isUserRegistered($a_user_id=0)
static _lookupCreationDate($a_id)
Lookup creation date.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupDescription($a_id)
lookup object description
static lookupOfflineStatus($a_obj_id)
Lookup offline status using objectDataCache.
static _lookupObjId($a_id)
static add(ilObject $a_object)
setRefId($a_id)
set reference id public
getTitle()
get object title public
static _deleteSettingsOfBlock($a_block_id, $a_block_type)
Delete block settings of block.
updateOwner()
update owner of object in db
getDescription()
get object description
getImportId()
get import id
redirection script todo: (a better solution should control the processing via a xml file) ...
cloneMetaData($target_obj)
Copy meta data.
static _lookupOwner($a_id)
lookup object owner
initDefaultRoles()
init default roles settings Purpose of this function is to create a local role folder and local roles...
static _lookupImportId($a_obj_id)
putInTree($a_parent_ref)
maybe this method should be in tree object!?
getType()
get object type public
appendCopyInfo($a_target_id, $a_copy_id)
Prepend Copy info if object with same name exists in that container.
static _lookupType($a_id, $a_reference=false)
lookup object type
static deleteAllEntries($a_ref_id)
Delete all db entries for ref id.
const AUTO_RATING_NEW_OBJECTS
setImportId($a_import_id)
set import id
INTERNAL CLASS: Please do not use in consumer code.
static _writeDescription($a_obj_id, $a_desc)
write description to db (static)
static _getLastUpdateOfObjects($a_objs)
Get last update for a set of media objects.
static fixMissingTitles($a_type, array &$a_obj_title_map)
Try to fix missing object titles.
setOfflineStatus($a_status)
Set offline status.
static _writeImportId($a_obj_id, $a_import_id)
write import id to db (static)
getLongDescription()
get object long description (stored in object_description)
getRefId()
get reference id public
static _getIdsForTitle($title, $type='', $partialmatch=false)
countReferences()
count references of object
deleteMetaData()
delete meta data entry
static deleteByObjId($a_obj_id)
Delete by obj id ilDB $ilDB.
setDescription($a_desc)
set object description
static getLogger($a_component_id)
Get component logger.
static cloneDependencies($a_src_ref_id, $a_target_ref_id, $a_copy_id)
update()
update object in db
getLastUpdateDate()
get last update date public
static _deleteByObjId($a_obj_id)
getUntranslatedTitle()
get untranslated object title public
setType($a_type)
set object type public
static _lookupOwnerName($a_owner_id)
lookup owner name for owner id
setPermissions($a_parent_ref)
set permissions of object
static _getObjectsDataForType($a_type, $a_omit_trash=false)
get all objects of a certain type
setParentRolePermissions($a_parent_ref)
Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
static _lookupObjIdByImportId($a_import_id)
getPresentationTitle()
get presentation title Normally same as title Overwritten for sessions
static getActionsByTemplateId($a_tpl_id)
Get actions of one template.
static _getIdForImportId($a_import_id)
get current object id for import id (static)
MDUpdateListener($a_element)
Meta data update listener.