26 $ilDB = $DIC->database();
28 $query =
"SELECT * FROM object_data " .
29 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer');
33 return $res->numRows() ? true :
false;
46 $ilDB = $DIC->database();
48 $query =
"SELECT * FROM object_data,object_reference " .
49 "WHERE object_reference.obj_id = object_data.obj_id " .
50 " AND object_data.type=" .
$ilDB->quote($object_type,
'text') .
51 " AND object_data.owner = " .
$ilDB->quote($owner_id,
'integer');
56 $obj_ids [] = $object_rec[
"obj_id"];
74 $objDefinition = $DIC[
"objDefinition"];
75 $ilDB = $DIC->database();
78 if (!isset($a_obj_id)) {
79 $message =
"ilObjectFactory::getInstanceByObjId(): No obj_id given!";
80 if ($stop_on_error ===
true) {
88 $q =
"SELECT * FROM object_data " .
89 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer');
90 $object_set =
$ilDB->query($q);
92 if ($object_set->numRows() == 0) {
93 $message =
"ilObjectFactory::getInstanceByObjId(): Object with obj_id: " . $a_obj_id .
" not found!";
94 if ($stop_on_error ===
true) {
101 $class_name =
"ilObj" . $objDefinition->getClassName($object_rec[
"type"]);
104 if ($class_name ==
"ilObj") {
105 $message =
"ilObjectFactory::getInstanceByObjId(): Not able to determine object " .
106 "class for type" . $object_rec[
"type"] .
".";
107 if ($stop_on_error ===
true) {
113 (
new self())->includeClassIfNotExists($class_name, $object_rec[
"type"], $objDefinition);
116 $obj =
new $class_name(0,
false);
117 $obj->setId($a_obj_id);
135 $objDefinition = $DIC[
"objDefinition"];
136 $ilDB = $DIC->database();
139 if (!isset($a_ref_id)) {
140 if ($stop_on_error ===
true) {
141 $message =
"ilObjectFactory::getInstanceByRefId(): No ref_id given!";
150 $query =
"SELECT * FROM object_data,object_reference " .
151 "WHERE object_reference.obj_id = object_data.obj_id " .
152 "AND object_reference.ref_id = " .
$ilDB->quote($a_ref_id,
'integer');
156 if ($object_set->numRows() == 0) {
157 if ($stop_on_error ===
true) {
158 $message =
"ilObjectFactory::getInstanceByRefId(): Object with ref_id " . $a_ref_id .
" not found!";
166 $class_name =
"ilObj" . $objDefinition->getClassName($object_rec[
"type"]);
169 if ($class_name ==
"ilObj") {
170 if ($stop_on_error ===
true) {
171 $message =
"ilObjectFactory::getInstanceByRefId(): Not able to determine object " .
172 "class for type" . $object_rec[
"type"] .
".";
179 (
new self())->includeClassIfNotExists($class_name, $object_rec[
"type"], $objDefinition);
182 $obj =
new $class_name(0,
false);
183 $obj->setId($object_rec[
"obj_id"]);
184 $obj->setRefId($a_ref_id);
202 $ilDB = $DIC->database();
205 if (!isset($a_ref_id)) {
206 if ($stop_on_error ===
true) {
207 $message =
"ilObjectFactory::getTypeByRefId(): No ref_id given!";
215 $q =
"SELECT * FROM object_data " .
216 "LEFT JOIN object_reference ON object_data.obj_id=object_reference.obj_id " .
217 "WHERE object_reference.ref_id=" .
$ilDB->quote($a_ref_id,
'integer');
218 $object_set =
$ilDB->query($q);
220 if ($object_set->numRows() == 0) {
221 if ($stop_on_error ===
true) {
222 $message =
"ilObjectFactory::getTypeByRefId(): Object with ref_id " . $a_ref_id .
" not found!";
230 return $object_rec[
"type"];
241 $objDefinition = $DIC[
"objDefinition"];
243 $class_name =
"ilObj" . $objDefinition->getClassName($a_obj_type);
245 (
new self())->includeClassIfNotExists($class_name, $a_obj_type, $objDefinition);
264 if (!class_exists($class_name)) {
266 include_once(
$location .
"/class." . $class_name .
".php");
static getClassByType($a_obj_type)
Get class by type.
ObjectIdExists($a_obj_id)
check if obj_id exists.
Class ilObjectFactory This class offers methods to get instances of the type-specific object classes ...
includeClassIfNotExists(string $class_name, string $a_obj_type, ilObjectDefinition $objDefinition)
Ensures a class is properly included.
getLocation($a_obj_name)
get location by type
static getObjectsForOwner($object_type, $owner_id)
returns all objects of an owner, filtered by type, objects are not deleted!
Object not found exception.
parses the objects.xml it handles the xml-description of all ilias objects
foreach($_POST as $key=> $value) $res
static getTypeByRefId($a_ref_id, $stop_on_error=true)
get object type by reference id
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id