32 $query =
"SELECT * FROM object_data ".
33 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,
'integer');
37 return $res->numRows() ?
true :
false;
51 $query =
"SELECT * FROM object_data,object_reference ".
52 "WHERE object_reference.obj_id = object_data.obj_id ".
53 " AND object_data.type=".$ilDB->quote($object_type,
'text').
54 " AND object_data.owner = ".$ilDB->quote($owner_id,
'integer');
59 $obj_ids [] = $object_rec[
"obj_id"];
74 global $ilias, $objDefinition,
$ilDB;
77 if (!isset($a_obj_id))
79 $message =
"ilObjectFactory::getInstanceByObjId(): No obj_id given!";
80 if ($stop_on_error ===
true)
82 $ilias->raiseError($message,$ilias->error_obj->WARNING);
85 #var_dump("<pre>",$message,"<pre>");
91 $q =
"SELECT * FROM object_data ".
92 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,
'integer');
93 $object_set = $ilias->db->query($q);
95 if ($object_set->numRows() == 0)
97 $message =
"ilObjectFactory::getInstanceByObjId(): Object with obj_id: ".$a_obj_id.
" not found!";
98 if ($stop_on_error ===
true)
100 $ilias->raiseError($message,$ilias->error_obj->WARNING);
103 #var_dump("<pre>",$message,"<pre>");
108 $class_name =
"ilObj".$objDefinition->getClassName($object_rec[
"type"]);
111 if ($class_name ==
"ilObj")
113 $message =
"ilObjectFactory::getInstanceByObjId(): Not able to determine object ".
114 "class for type".$object_rec[
"type"].
".";
115 if ($stop_on_error ===
true)
117 $ilias->raiseError($message,$ilias->error_obj->WARNING);
124 $location = $objDefinition->getLocation($object_rec[
"type"]);
127 include_once(
$location.
"/class.".$class_name.
".php");
128 $obj =
new $class_name(0,
false);
129 $obj->setId($a_obj_id);
130 $obj->setObjDataRecord($object_rec);
145 global $ilias, $objDefinition,
$ilDB;
148 if (!isset($a_ref_id))
150 if ($stop_on_error ===
true)
152 $message =
"ilObjectFactory::getInstanceByRefId(): No ref_id given!";
153 $ilias->raiseError($message,$ilias->error_obj->WARNING);
162 $query =
"SELECT * FROM object_data,object_reference ".
163 "WHERE object_reference.obj_id = object_data.obj_id ".
164 "AND object_reference.ref_id = ".$ilDB->quote($a_ref_id,
'integer');
165 $object_set = $ilDB->query(
$query);
168 if ($object_set->numRows() == 0)
170 if ($stop_on_error ===
true)
172 $message =
"ilObjectFactory::getInstanceByRefId(): Object with ref_id ".$a_ref_id.
" not found!";
173 $ilias->raiseError($message,$ilias->error_obj->WARNING);
181 $class_name =
"ilObj".$objDefinition->getClassName($object_rec[
"type"]);
184 if ($class_name ==
"ilObj")
186 if ($stop_on_error ===
true)
188 $message =
"ilObjectFactory::getInstanceByRefId(): Not able to determine object ".
189 "class for type".$object_rec[
"type"].
".";
190 $ilias->raiseError($message,$ilias->error_obj->WARNING);
198 $location = $objDefinition->getLocation($object_rec[
"type"]);
201 include_once(
$location.
"/class.".$class_name.
".php");
202 $obj =
new $class_name(0,
false);
203 $obj->setId($object_rec[
"obj_id"]);
204 $obj->setRefId($a_ref_id);
205 $obj->setObjDataRecord($object_rec);
218 global $ilias, $objDefinition,
$ilDB;
221 if (!isset($a_ref_id))
223 if ($stop_on_error ===
true)
225 $message =
"ilObjectFactory::getTypeByRefId(): No ref_id given!";
226 $ilias->raiseError($message,$ilias->error_obj->WARNING);
234 $q =
"SELECT * FROM object_data ".
235 "LEFT JOIN object_reference ON object_data.obj_id=object_reference.obj_id ".
236 "WHERE object_reference.ref_id=".$ilDB->quote($a_ref_id,
'integer');
237 $object_set = $ilias->db->query($q);
239 if ($object_set->numRows() == 0)
241 if ($stop_on_error ===
true)
243 $message =
"ilObjectFactory::getTypeByRefId(): Object with ref_id ".$a_ref_id.
" not found!";
244 $ilias->raiseError($message,$ilias->error_obj->WARNING);
252 return $object_rec[
"type"];
262 global $objDefinition;
264 $location = $objDefinition->getLocation($a_obj_type);
265 $class_name =
"ilObj".$objDefinition->getClassName($a_obj_type);
268 include_once(
$location.
"/class.".$class_name.
".php");