4 require_once(
'./Services/Repository/classes/class.ilObjectPlugin.php');
101 $ilBench->start(
"Core",
"ilObject_Constructor");
105 echo "<br/><font color=\"red\">type(".$this->type.
") id(".$a_id.
") referenced(".$a_reference.
")</font>";
110 $this->objDefinition = $objDefinition;
112 $this->max_title = self::TITLE_LENGTH;
113 $this->max_desc = self::DESC_LENGTH;
114 $this->add_dots =
true;
116 $this->referenced = $a_reference;
117 $this->call_by_reference = $a_reference;
121 $this->referenced =
false;
124 if ($this->referenced)
126 $this->ref_id = $a_id;
138 $ilBench->stop(
"Core",
"ilObject_Constructor");
160 $ilBench->start(
"Core",
"ilObject_read");
161 if ($this->referenced)
164 if (!isset($this->ref_id))
166 $message =
"ilObject::read(): No ref_id given! (".$this->type.
")";
167 $this->
ilias->raiseError($message,$this->
ilias->error_obj->WARNING);
171 $ilBench->start(
"Core",
"ilObject_read_readData");
173 $q =
"SELECT * FROM object_data, object_reference WHERE object_data.obj_id=object_reference.obj_id ".
174 "AND object_reference.ref_id= ".$ilDB->quote($this->ref_id,
"integer");
175 $object_set = $ilDB->query($q);
176 $ilBench->stop(
"Core",
"ilObject_read_readData");
179 if ($ilDB->numRows($object_set) == 0)
181 $message =
"ilObject::read(): Object with ref_id ".$this->ref_id.
" not found! (".$this->type.
")";
182 $this->
ilias->raiseError($message,$this->
ilias->error_obj->WARNING);
185 $obj = $ilDB->fetchAssoc($object_set);
190 if (!isset($this->
id))
192 $message =
"ilObject::read(): No obj_id given! (".$this->type.
")";
193 $this->
ilias->raiseError($message,$this->
ilias->error_obj->WARNING);
197 $q =
"SELECT * FROM object_data ".
198 "WHERE obj_id = ".$ilDB->quote($this->
id,
"integer");
199 $object_set = $ilDB->query($q);
202 if ($ilDB->numRows($object_set) == 0)
204 include_once(
"./Services/Object/exceptions/class.ilObjectNotFoundException.php");
206 " (".$this->type.
") not found!");
210 $obj = $ilDB->fetchAssoc($object_set);
213 $this->
id = $obj[
"obj_id"];
216 if ($this->type != $obj[
"type"] && $obj[
"type"] !=
"xxx")
218 $message =
"ilObject::read(): Type mismatch. Object with obj_id: ".$this->id.
" ".
219 "was instantiated by type '".$this->type.
"'. DB type is: ".$obj[
"type"];
222 $log->write($message);
225 include_once(
"./Services/Object/exceptions/class.ilObjectTypeMismatchException.php");
230 $this->type = $obj[
"type"];
231 $this->title = $obj[
"title"];
233 $this->untranslatedTitle = $obj[
"title"];
235 $this->desc = $obj[
"description"];
236 $this->owner = $obj[
"owner"];
237 $this->create_date = $obj[
"create_date"];
238 $this->last_update = $obj[
"last_update"];
239 $this->import_id = $obj[
"import_id"];
241 if($objDefinition->isRBACObject($this->getType()))
244 $query =
"SELECT * FROM object_description WHERE obj_id = ".$ilDB->quote($this->
id,
'integer');
248 if(strlen(
$row->description))
256 $ilBench->start(
"Core",
"ilObject_Constructor_getTranslation");
257 $translation_type = $objDefinition->getTranslationType($this->type);
259 if ($translation_type ==
"sys")
261 $this->title = $this->lng->txt(
"obj_".$this->type);
262 $this->
setDescription($this->lng->txt(
"obj_".$this->type.
"_desc"));
264 elseif ($translation_type ==
"db")
266 $q =
"SELECT title,description FROM object_translation ".
267 "WHERE obj_id = ".$ilDB->quote($this->
id,
'integer').
" ".
268 "AND lang_code = ".$ilDB->quote($this->
ilias->account->getCurrentLanguage(),
'text').
" ".
269 "AND NOT lang_default = 1";
270 $r = $this->
ilias->db->query($q);
274 $this->title =
$row->title;
276 #$this->desc = $row->description; 280 $ilBench->stop(
"Core",
"ilObject_Constructor_getTranslation");
282 $ilBench->stop(
"Core",
"ilObject_read");
312 $this->ref_id = $a_id;
313 $this->referenced =
true;
418 $this->long_desc = $a_desc;
431 return strlen($this->long_desc) ? $this->long_desc :
$this->desc;
453 $this->import_id = $a_import_id;
460 $query =
"SELECT * FROM object_data ".
461 "WHERE import_id = ".$ilDB->quote($a_import_id,
"text").
" ".
462 "ORDER BY create_date DESC";
464 while(
$row = $ilDB->fetchObject(
$res))
475 $query =
"SELECT import_id FROM object_data ".
476 "WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer");
479 return $row->import_id;
511 if ($a_owner_id != -1)
519 if (is_object($owner))
521 $own_name = $owner->getFullname();
525 $own_name = $lng->txt(
"unknown");
539 $this->owner = $a_owner;
593 if (!isset($this->type))
595 $message = get_class($this).
"::create(): No object type given!";
596 $this->
ilias->raiseError($message,$this->
ilias->error_obj->WARNING);
600 $log->write(
"ilObject::create(), start");
610 elseif(is_object($ilUser))
612 $owner = $ilUser->getId();
618 $this->
id = $ilDB->nextId(
"object_data");
619 $q =
"INSERT INTO object_data ".
620 "(obj_id,type,title,description,owner,create_date,last_update,import_id) ".
623 $ilDB->quote($this->
id,
"integer").
",".
624 $ilDB->quote($this->type,
"text").
",".
625 $ilDB->quote($this->
getTitle(),
"text").
",".
627 $ilDB->quote($owner,
"integer").
",".
632 $ilDB->manipulate($q);
638 if($objDefinition->isRBACObject($this->getType()))
641 'obj_id' =>
array(
'integer',$this->
id),
644 $ilDB->insert(
'object_description',$values);
651 $q =
"SELECT last_update, create_date FROM object_data".
652 " WHERE obj_id = ".$ilDB->quote($this->
id,
"integer");
653 $obj_set = $ilDB->query($q);
654 $obj_rec = $ilDB->fetchAssoc($obj_set);
655 $this->last_update = $obj_rec[
"last_update"];
656 $this->create_date = $obj_rec[
"create_date"];
662 $log->write(
"ilObject::create(), finished, obj_id: ".$this->
id.
", type: ".
663 $this->type.
", title: ".$this->getTitle());
665 $GLOBALS[
'ilAppEventHandler']->raise(
668 array(
'obj_id' => $this->
id,
'obj_type' => $this->type));
681 global $objDefinition,
$ilDB;
683 $q =
"UPDATE object_data ".
685 "title = ".$ilDB->quote($this->
getTitle(),
"text").
",".
686 "description = ".$ilDB->quote($this->
getDescription(),
"text").
", ".
687 "import_id = ".$ilDB->quote($this->
getImportId(),
"text").
",".
688 "last_update = ".$ilDB->now().
" ".
689 "WHERE obj_id = ".$ilDB->quote($this->
getId(),
"integer");
690 $ilDB->manipulate($q);
695 $q =
"SELECT last_update FROM object_data".
696 " WHERE obj_id = ".$ilDB->quote($this->
getId(),
"integer");
697 $obj_set = $ilDB->query($q);
698 $obj_rec = $ilDB->fetchAssoc($obj_set);
699 $this->last_update = $obj_rec[
"last_update"];
701 if($objDefinition->isRBACObject($this->getType()))
704 $res = $this->
ilias->db->query(
"SELECT * FROM object_description WHERE obj_id = ".
705 $ilDB->quote($this->getId(),
'integer'));
711 $ilDB->update(
'object_description',$values,
array(
'obj_id' =>
array(
'integer',$this->
getId())));
718 $ilDB->insert(
'object_description',$values);
721 $GLOBALS[
'ilAppEventHandler']->raise(
725 'obj_type' => $this->
getType(),
744 include_once
'Services/MetaData/classes/class.ilMD.php';
746 $GLOBALS[
'ilAppEventHandler']->raise(
750 'obj_type' => $this->
getType(),
759 if(!is_object($md_gen = $md->getGeneral()))
763 $this->
setTitle($md_gen->getTitle());
765 foreach($md_gen->getDescriptionIds() as
$id)
767 $md_des = $md_gen->getDescription($id);
785 include_once
'Services/MetaData/classes/class.ilMDCreator.php';
790 $md_creator->setTitle($this->
getTitle());
791 $md_creator->setTitleLanguage($ilUser->getPref(
'language'));
793 $md_creator->setDescriptionLanguage($ilUser->getPref(
'language'));
794 $md_creator->setKeywordLanguage($ilUser->getPref(
'language'));
795 $md_creator->setLanguage($ilUser->getPref(
'language'));
796 $md_creator->create();
806 include_once(
"Services/MetaData/classes/class.ilMD.php");
807 include_once(
"Services/MetaData/classes/class.ilMDGeneral.php");
808 include_once(
"Services/MetaData/classes/class.ilMDDescription.php");
811 $md_gen =& $md->getGeneral();
817 $md_gen =& $md->getGeneral();
820 $md_gen->setTitle($this->
getTitle());
823 $md_des_ids =& $md_gen->getDescriptionIds();
824 if (count($md_des_ids) > 0)
826 $md_des =& $md_gen->getDescription($md_des_ids[0]);
840 include_once(
'Services/MetaData/classes/class.ilMD.php');
855 $q =
"UPDATE object_data ".
857 "owner = ".$ilDB->quote($this->
getOwner(),
"integer").
", ".
858 "last_update = ".$ilDB->now().
" ".
859 "WHERE obj_id = ".$ilDB->quote($this->
getId(),
"integer");
860 $ilDB->manipulate($q);
862 $q =
"SELECT last_update FROM object_data".
863 " WHERE obj_id = ".$ilDB->quote($this->
getId(),
"integer");
864 $obj_set = $ilDB->query($q);
865 $obj_rec = $ilDB->fetchAssoc($obj_set);
866 $this->last_update = $obj_rec[
"last_update"];
882 $ilDB->setLimit(1,0);
883 $q =
"SELECT * FROM object_data WHERE import_id = ".$ilDB->quote($a_import_id,
"text").
884 " ORDER BY create_date DESC";
885 $obj_set = $ilDB->query($q);
887 if ($obj_rec = $ilDB->fetchAssoc($obj_set))
889 return $obj_rec[
"obj_id"];
906 $query =
"SELECT * FROM object_reference WHERE obj_id = ".
907 $ilDB->quote($a_id,
'integer');
911 while($obj_rec = $ilDB->fetchAssoc(
$res))
913 $ref[$obj_rec[
"ref_id"]] = $obj_rec[
"ref_id"];
926 global $ilObjDataCache;
928 $tit = $ilObjDataCache->lookupTitle($a_id);
940 global $ilObjDataCache;
942 $owner = $ilObjDataCache->lookupOwner($a_id);
951 ?
"SELECT obj_id FROM object_data WHERE title = ".$ilDB->quote($title,
"text")
952 :
"SELECT obj_id FROM object_data WHERE ".$ilDB->like(
"title",
"text",
'%'.$title.
'%');
955 $query .=
" AND type = ".$ilDB->quote($type,
"text");
960 $object_ids =
array();
963 $object_ids[] =
$row[
'obj_id'];
966 return is_array($object_ids) ? $object_ids :
array();
976 global $ilObjDataCache;
978 return $ilObjDataCache->lookupDescription($a_id);
988 global $ilObjDataCache;
996 return $ilObjDataCache->lookupLastUpdate($a_id);
1009 if (!is_array($a_objs))
1011 $a_objs =
array($a_objs);
1014 $set = $ilDB->query(
"SELECT max(last_update) as last_update FROM object_data ".
1015 "WHERE ".$ilDB->in(
"obj_id", $a_objs,
false,
"integer").
" ");
1016 $rec = $ilDB->fetchAssoc($set);
1018 return ($rec[
"last_update"]);
1023 global $ilObjDataCache;
1025 return (
int) $ilObjDataCache->lookupObjId($a_id);
1035 $query =
"UPDATE object_reference SET deleted= ".$ilDB->now().
' '.
1036 "WHERE ref_id = ".$ilDB->quote($a_ref_id,
'integer');
1050 $query =
'UPDATE object_reference SET deleted = '.$ilDB->now().
' '.
1051 'WHERE '.$ilDB->in(
'ref_id',(
array) $a_ref_ids,
false,
'integer');
1054 $ilDB->manipulate(
$query);
1065 $query =
"UPDATE object_reference SET deleted = ".$ilDB->quote(null,
'timestamp').
1066 " WHERE ref_id = ".$ilDB->quote($a_ref_id,
'integer');
1067 $ilDB->manipulate(
$query);
1077 $query =
"SELECT deleted FROM object_reference".
1078 " WHERE ref_id = ".$ilDB->quote($a_ref_id,
"integer");
1079 $set = $ilDB->query(
$query);
1080 $rec = $ilDB->fetchAssoc($set);
1082 return $rec[
"deleted"];
1097 $q =
"UPDATE object_data ".
1099 "title = ".$ilDB->quote($a_title,
"text").
",".
1100 "last_update = ".$ilDB->now().
" ".
1101 "WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer");
1103 $ilDB->manipulate($q);
1115 global
$ilDB,$objDefinition;
1120 $q =
"UPDATE object_data ".
1122 "description = ".$ilDB->quote($desc,
"text").
",".
1123 "last_update = ".$ilDB->now().
" ".
1124 "WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer");
1126 $ilDB->manipulate($q);
1131 $res = $ilDB->query(
"SELECT * FROM object_description WHERE obj_id = ".
1132 $ilDB->quote($a_obj_id,
'integer'));
1137 'description' =>
array(
'clob',$a_desc)
1139 $ilDB->update(
'object_description',$values,
array(
'obj_id' =>
array(
'integer',$a_obj_id)));
1144 'description' =>
array(
'clob',$a_desc),
1145 'obj_id' =>
array(
'integer',$a_obj_id));
1146 $ilDB->insert(
'object_description',$values);
1162 $q =
"UPDATE object_data ".
1164 "import_id = ".$ilDB->quote($a_import_id,
"text").
",".
1165 "last_update = ".$ilDB->now().
" ".
1166 "WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer");
1168 $ilDB->manipulate($q);
1178 global $ilObjDataCache;
1182 return $ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_id));
1184 return $ilObjDataCache->lookupType($a_id);
1194 return $tree->isSaved($a_ref_id);
1203 foreach($ref_ids as $ref_id)
1221 global $ilObjDataCache;
1223 return (
int) $ilObjDataCache->lookupObjId($a_ref_id);
1240 $q =
"SELECT * FROM object_data WHERE type = ".$ilDB->quote(
$a_type,
"text");
1241 $obj_set = $ilDB->query($q);
1244 while ($obj_rec = $ilDB->fetchAssoc($obj_set))
1248 $objects[$obj_rec[
"title"].
".".$obj_rec[
"obj_id"]] =
array(
"id" => $obj_rec[
"obj_id"],
1249 "type" => $obj_rec[
"type"],
"title" => $obj_rec[
"title"],
1250 "description" => $obj_rec[
"description"]);
1266 $tree->insertNode($this->
getRefId(), $a_parent_ref);
1269 $log->write(
"ilObject::putInTree(), parent_ref: $a_parent_ref, ref_id: ".
1293 global $rbacadmin, $rbacreview;
1295 $parent_roles = $rbacreview->getParentRoleIds($a_parent_ref);
1296 foreach((
array) $parent_roles as $parent_role)
1298 $operations = $rbacreview->getOperationsOfRole(
1299 $parent_role[
'obj_id'],
1301 $parent_role[
'parent']
1303 $rbacadmin->grantPermission(
1304 $parent_role[
'obj_id'],
1322 if (!isset($this->
id))
1324 $message =
"ilObject::createNewReference(): No obj_id given!";
1325 $this->raiseError($message,$this->
ilias->error_obj->WARNING);
1328 $next_id = $ilDB->nextId(
'object_reference');
1329 $query =
"INSERT INTO object_reference ".
1330 "(ref_id, obj_id) VALUES (".$ilDB->quote($next_id,
'integer').
','.$ilDB->quote($this->
id ,
'integer').
")";
1333 $this->ref_id = $next_id;
1334 $this->referenced =
true;
1350 if (!isset($this->
id))
1352 $message =
"ilObject::countReferences(): No obj_id given!";
1353 $this->
ilias->raiseError($message,$this->
ilias->error_obj->WARNING);
1356 $query =
"SELECT COUNT(ref_id) num FROM object_reference ".
1357 "WHERE obj_id = ".$ilDB->quote($this->
id,
'integer').
" ";
1387 if ($this->type != $db_type)
1389 $message =
"ilObject::delete(): Type mismatch. Object with obj_id: ".$this->id.
" ".
1390 "was instantiated by type '".$this->type.
"'. DB type is: ".$db_type;
1393 $log->write($message);
1396 $this->
ilias->raiseError(
"ilObject::delete(): Type mismatch. (".$this->type.
"/".$this->id.
")",$this->ilias->error_obj->WARNING);
1400 $q =
"DELETE FROM object_data ".
1401 "WHERE obj_id = ".$ilDB->quote($this->
getId(),
"integer");
1402 $ilDB->manipulate($q);
1405 $query =
"DELETE FROM object_description WHERE obj_id = ".
1406 $ilDB->quote($this->
getId(),
"integer");
1407 $ilDB->manipulate(
$query);
1410 $log->write(
"ilObject::delete(), deleted object, obj_id: ".$this->
getId().
", type: ".
1414 include_once
"Services/Object/classes/class.ilObjectDataDeletionLog.php";
1418 include_once(
"./Services/News/classes/class.ilNewsItem.php");
1420 $news_item->deleteNewsOfContext($this->
getId(), $this->
getType());
1421 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
1424 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
1440 $query =
"DELETE FROM dav_property ".
1441 "WHERE obj_id = ".$ilDB->quote($this->
getId(),
'integer');
1445 include_once
'./Services/WebServices/ECS/classes/class.ilECSImport.php';
1448 include_once(
"Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
1451 include_once(
"Services/Tracking/classes/class.ilLPObjSettings.php");
1459 $log->write(
"ilObject::delete(), object not deleted, number of references: ".
1465 if ($this->referenced)
1467 include_once
"Services/Object/classes/class.ilObjectActivation.php";
1471 $query =
"DELETE FROM object_reference ".
1472 "WHERE ref_id = ".$ilDB->quote($this->
getRefId(),
'integer');
1476 $log->write(
"ilObject::delete(), reference deleted, ref_id: ".$this->
getRefId().
1477 ", obj_id: ".$this->
getId().
", type: ".
1484 $rbacadmin->revokePermission($this->
getRefId(),0,
false);
1486 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
1490 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
1498 if ($this->referenced)
1530 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
1533 $action->setRefId($this->
getRefId());
1538 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
1540 return $a_tpl_id ? true :
false;
1558 $q =
"SELECT * FROM object_data ".
1559 "LEFT JOIN object_reference ON object_reference.obj_id=object_data.obj_id ".
1560 "WHERE object_reference.ref_id= ".$ilDB->quote($a_id,
"integer");
1564 $q =
"SELECT * FROM object_data WHERE obj_id=".$ilDB->quote($a_id,
"integer");
1568 $q .=
" AND object_data.type = ".$ilDB->quote(
$a_type,
"text");
1570 $r = $ilDB->query($q);
1572 return $ilDB->numRows(
$r) ? true :
false;
1578 $this->
register = (bool) $a_bool;
1610 $order =
" ORDER BY title";
1615 $where_clause =
"WHERE type = ".
1616 $ilDB->quote($a_obj_type,
"text");
1620 $where_clause.=
" AND owner = ".$ilDB->quote($a_owner,
"integer");
1624 $q =
"SELECT * FROM object_data ".$where_clause.$order;
1625 $r = $ilDB->query($q);
1628 if ($ilDB->numRows(
$r) > 0)
1630 while (
$row = $ilDB->fetchAssoc(
$r))
1632 $row[
"desc"] =
$row[
"description"];
1659 $query =
"SELECT obj_data.title obj_title,path_data.title path_title,child FROM tree ".
1660 "JOIN object_reference obj_ref ON child = obj_ref.ref_id ".
1661 "JOIN object_data obj_data ON obj_ref.obj_id = obj_data.obj_id ".
1662 "JOIN object_reference path_ref ON parent = path_ref.ref_id ".
1663 "JOIN object_data path_data ON path_ref.obj_id = path_data.obj_id ".
1664 "WHERE ".$ilDB->in(
"child", $a_ref_ids,
false,
"integer").
" ".
1665 "ORDER BY obj_data.title ";
1668 if (!$objDefinition->isPlugin($new_type))
1670 $options[0] = $lng->txt(
'obj_'.$new_type.
'_select');
1674 include_once(
"./Services/Component/classes/class.ilPlugin.php");
1678 while(
$row = $ilDB->fetchObject(
$res))
1680 if(strlen($title =
$row->obj_title) > 40)
1682 $title = substr($title,0,40).
'...';
1687 if(strlen(
$path =
$row->path_title) > 40)
1692 $title .=
' ('.$lng->txt(
'path').
': '.
$path.
')';
1709 public function cloneObject($a_target_id,$a_copy_id = 0, $a_omit_tree =
false)
1714 $class_name = (
'ilObj'.$objDefinition->getClassName($this->
getType()));
1716 include_once
'./Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1719 if(!
$options->isTreeCopyDisabled() && !$a_omit_tree)
1729 include_once(
$location.
"/class.".$class_name.
".php");
1730 $new_obj =
new $class_name(0,
false);
1731 $new_obj->setOwner($ilUser->getId());
1732 $new_obj->setTitle($title);
1734 $new_obj->setType($this->
getType());
1736 $new_obj->create(
true);
1738 if(!
$options->isTreeCopyDisabled() && !$a_omit_tree)
1741 $new_obj->createReference();
1742 $new_obj->putInTree($a_target_id);
1743 $new_obj->setPermissions($a_target_id);
1749 $rbacadmin->copyLocalRoles($this->
getRefId(),$new_obj->getRefId());
1757 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
1761 $query =
"INSERT INTO dav_property (obj_id,node_id,ns,name,value) ".
1762 "SELECT ".$ilDB->quote($new_obj->getId(),
'integer').
",node_id,ns,name,value ".
1763 "FROM dav_property ".
1764 "WHERE obj_id = ".$ilDB->quote($this->getId(),
'integer');
1765 $res = $ilDB->manipulate($query);
1782 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
1784 if(!$cp_options->isRootNode($this->getRefId()))
1788 $nodes = $tree->getChilds($a_target_id);
1790 $title_unique =
false;
1791 require_once
'Modules/File/classes/class.ilObjFileAccess.php';
1793 $handleExtension = ($this->
getType() ==
"file");
1795 while(!$title_unique)
1798 foreach($nodes as $node)
1800 if(($title == $node[
'title'])
and ($this->
getType() == $node[
'type']))
1831 include_once
'./Services/AccessControl/classes/class.ilConditionHandler.php' ;
1834 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
1838 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
1840 $obj = $factory->getInstanceByRefId($a_target_id, FALSE);
1843 $obj->applyDidacticTemplate($tpl_id);
1858 include_once
"./Services/MetaData/classes/class.ilMD.php";
1860 $md->cloneMD($target_obj->getId(),0,$target_obj->getType());
1877 if ($a_obj_id ==
"" &&
$a_type ==
"")
1892 if ($ilSetting->get(
"custom_icons") &&
1893 in_array(
$a_type,
array(
"cat",
"grp",
"crs",
"root",
"fold",
"prg")))
1895 require_once(
"./Services/Container/classes/class.ilContainer.php");
1900 $file_name = $cont_dir.
"/icon_custom.svg";
1901 if (is_file($file_name))
1910 if ($objDefinition->isPluginTypeName(
$a_type))
1912 if ($objDefinition->getClassName(
$a_type) !=
"")
1914 $class_name =
"il".$objDefinition->getClassName(
$a_type).
'Plugin';
1916 if (is_file(
$location.
"/class.".$class_name.
".php"))
1918 include_once(
$location.
"/class.".$class_name.
".php");
1919 return call_user_func(
array($class_name,
"_getIcon"),
$a_type, $a_size, $a_obj_id);
1929 return "./images/icon_".$a_type.
".svg";
1941 global $objDefinition, $tree;
1945 $deps[
"dep"] =
array();
1948 $deps[
"del_ids"][$a_obj_id] = $a_obj_id;
1950 if (!$objDefinition->isPluginTypeName(
$a_type))
1952 $class_name =
"ilObj".$objDefinition->getClassName(
$a_type);
1954 include_once(
$location.
"/class.".$class_name.
".php");
1955 $odeps = call_user_func(
array($class_name,
"getDeletionDependencies"), $a_obj_id);
1956 if (is_array($odeps))
1958 foreach ($odeps as $id => $message)
1960 $deps[
"dep"][
$id][$a_obj_id][] = $message;
1965 foreach ($tree->getChilds($a_ref_id) as $c)
1974 foreach ($deps[
"del_ids"] as $obj_id)
1976 unset($deps[
"dep"][$obj_id]);
1978 $deps = $deps[
"dep"];
2001 $res = $ilDB->query(
"SELECT * FROM object_description".
2002 " WHERE ".$ilDB->in(
"obj_id", $a_obj_ids,
"",
"integer"));
2004 while(
$row = $ilDB->fetchAssoc(
$res))
2006 $all[
$row[
"obj_id"]] = $row[
"description"];
2019 global
$ilDB, $objDefinition;
2024 $types = array_keys($objDefinition->getSubObjectsRecursively(
"root"));
2026 $sql =
"SELECT od.obj_id,od.type,od.title FROM object_data od".
2027 " JOIN object_reference oref ON(oref.obj_id = od.obj_id)".
2028 " JOIN tree ON (tree.child = oref.ref_id)";
2032 $sql .=
" WHERE od.owner = ".$ilDB->quote($a_user_id,
"integer");
2036 $sql .=
" LEFT JOIN usr_data ud ON (ud.usr_id = od.owner)".
2037 " WHERE (od.owner < ".$ilDB->quote(1,
"integer").
2038 " OR od.owner IS NULL OR ud.login IS NULL)".
2039 " AND od.owner <> ".$ilDB->quote(-1,
"integer");
2042 $sql .=
" AND ".$ilDB->in(
"od.type", $types,
"",
"text").
2043 " AND tree.tree > ".$ilDB->quote(0,
"integer");
2045 $res = $ilDB->query($sql);
2046 while(
$row = $ilDB->fetchAssoc(
$res))
2048 $all[
$row[
"type"]][
$row[
"obj_id"]] = $row[
"title"];
2064 if(!in_array(
$a_type,
array(
"catr",
"crsr",
"sess",
"grpr")))
2070 $missing_obj_ids =
array();
2071 foreach($a_obj_title_map as $obj_id => $title)
2075 $missing_obj_ids[] = $obj_id;
2079 if(!
sizeof($missing_obj_ids))
2089 $set = $ilDB->query(
"SELECT oref.obj_id, od.type, od.title FROM object_data od".
2090 " JOIN container_reference oref ON (od.obj_id = oref.target_obj_id)".
2091 " AND ".$ilDB->in(
"oref.obj_id", $missing_obj_ids,
"",
"integer"));
2092 while(
$row = $ilDB->fetchAssoc($set))
2094 $a_obj_title_map[
$row[
"obj_id"]] = $row[
"title"];
2099 include_once
"Modules/Session/classes/class.ilObjSession.php";
2100 foreach($missing_obj_ids as $obj_id)
2103 $a_obj_title_map[$obj_id] =
$sess->getFirstAppointment()->appointmentToString();
2119 $set = $ilDB->query(
"SELECT create_date FROM object_data ".
2120 " WHERE obj_id = ".$ilDB->quote($a_id,
"integer"));
2121 $rec = $ilDB->fetchAssoc($set);
2122 return $rec[
"create_date"];
2143 $parent_ref_id = $tree->checkForParentType($a_ref_id,
"grp");
2146 $parent_ref_id = $tree->checkForParentType($a_ref_id,
"crs");
2150 include_once
'./Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
2173 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 type $ilDB.
static getDeletionDependencies($a_obj_id)
Get deletion dependencies.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
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
static _getContainerDirectory($a_id)
Get the container directory.
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
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.
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone object permissions, put in tree ...
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
Class ilObject Basic functions for all objects.
withReferences()
determines wehter objects are referenced or not (got ref ids or not)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
setId($a_id)
set object id public
createMetaData()
create meta data entry
static _isInTrash($a_ref_id)
checks wether object is 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 _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 _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 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.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
setOwner($a_owner)
set object owner
if(!is_array($argv)) $options
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 _lookupObjId($a_id)
static add(ilObject $a_object)
setRefId($a_id)
set reference id public
static formatDate(ilDateTime $date)
Format a date 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.
Create styles array
The data for the language used.
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
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
Handles conditions for accesses to different ILIAS objects.
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.
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 _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.