ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilObjectFactory Class Reference

Class ilObjectFactory. More...

+ Collaboration diagram for ilObjectFactory:

Public Member Functions

 ObjectIdExists ($a_obj_id)
 check if obj_id exists. More...
 
 getObjectsForOwner ($object_type, $owner_id)
 returns all objects of an owner, filtered by type, objects are not deleted! More...
 

Static Public Member Functions

static getInstanceByObjId ($a_obj_id, $stop_on_error=true)
 get an instance of an Ilias object by object id More...
 
static getInstanceByRefId ($a_ref_id, $stop_on_error=true)
 get an instance of an Ilias object by reference id More...
 
static getTypeByRefId ($a_ref_id, $stop_on_error=true)
 get object type by reference id More...
 
static getClassByType ($a_obj_type)
 Get class by type. More...
 

Detailed Description

Class ilObjectFactory.

This class offers methods to get instances of the type-specific object classes (derived from ilObject) by their object or reference id

Note: The term "Ilias objects" means all object types that are stored in the database table "object_data"

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 20 of file class.ilObjectFactory.php.

Member Function Documentation

◆ getClassByType()

static ilObjectFactory::getClassByType (   $a_obj_type)
static

Get class by type.

Returns

Definition at line 256 of file class.ilObjectFactory.php.

References $DIC, and $location.

Referenced by ilWorkspaceExplorer\__construct(), ilRepUtilGUI\confirmRemoveFromSystemObject(), ilWorkspaceTree\createTreeForUser(), ilAdministrationCommandGUI\delete(), ilObjStudyProgrammeTreeGUI\delete(), ilObject2GUI\deleteConfirmation(), ilObjectCopyGUI\saveSource(), ilObjectCopyGUI\saveTarget(), and ilRepUtilGUI\showDeleteConfirmation().

257  {
258  global $DIC;
259 
260  $objDefinition = $DIC["objDefinition"];
261 
262  $location = $objDefinition->getLocation($a_obj_type);
263  $class_name = "ilObj" . $objDefinition->getClassName($a_obj_type);
264 
265  // create instance
266  include_once($location . "/class." . $class_name . ".php");
267  return $class_name;
268  }
global $DIC
Definition: saml.php:7
$location
Definition: buildRTE.php:44
+ Here is the caller graph for this function:

◆ getInstanceByObjId()

static ilObjectFactory::getInstanceByObjId (   $a_obj_id,
  $stop_on_error = true 
)
static

get an instance of an Ilias object by object id

Parameters
int$obj_idobject id
Returns
object|bool instance of Ilias object (i.e. derived from ilObject)

Definition at line 75 of file class.ilObjectFactory.php.

References $DIC, $ilDB, $ilErr, $location, $message, exit, and ilDBConstants\FETCHMODE_ASSOC.

Referenced by ilLearningProgressBaseGUI\__appendUserInfo(), ilRoleDesktopItem\__assign(), ilLocalUserGUI\__checkGlobalRoles(), ilObjCategoryGUI\__checkGlobalRoles(), ilUsersGalleryParticipants\__construct(), ilPDMailGUI\__construct(), ilCalendarUserSettings\__construct(), ilLocalUserGUI\__getAssignableRoles(), ilObjCategoryGUI\__getAssignableRoles(), ilLPListOfProgressGUI\__initUser(), ilLinkChecker\__sendMail(), ilLocalUserGUI\__showRolesTable(), ilSearch\__validateResults(), ilStartUpGUI\_checkGoto(), ilObjGroup\_isMember(), ilObjContentObject\_moveLMStyles(), ilInfoScreenGUI\addObjectSections(), ilSoapRBACAdministration\addUserRoleEntry(), ilSoapCourseAdministration\assignCourseMember(), ilMembershipGUI\assignFromWaitingList(), ilSoapGroupAdministration\assignGroupMember(), ilExerciseMembers\assignMember(), ilCourseMembershipGUI\assignMembers(), ilObject2GUI\assignObject(), ilObjectGUI\assignObject(), ilLocalUserGUI\assignRoles(), ilObjCategoryGUI\assignRolesObject(), ilParticipants\assignSubscriber(), ilChatroom\byRoomId(), ilMailSearchGroupsGUI\cancel(), ilMailSearchCoursesGUI\cancel(), ilMailFolderGUI\cancelDeleteMails(), ilWorkspaceTree\cascadingDelete(), ilUserCronCheckAccounts\checkNotConfirmedUserAccounts(), ilObjPortfolioBase\cloneBasics(), ilObjWiki\cloneObject(), ilObjGlossary\cloneObject(), ilObjContentObject\cloneObject(), ilContentStyleSettingsGUI\confirmedDelete(), ilObjSCORM2004LearningModule\copyAuthoredContent(), ilObjStyleSheetGUI\copyStyleObject(), ilContainerXmlParser\createObject(), ilObjWorkspaceFolderGUI\cut(), ilExerciseMembers\deassignMember(), ilObject2GUI\deleteConfirmedObjects(), ilSoapUtils\deleteExpiredDualOptInUserObjects(), ilRepUtil\deleteObjects(), ilSoapRBACAdministration\deleteRole(), ilObjRoleFolderGUI\deleteRoleObject(), ilSoapUserAdministration\deleteUser(), ilSoapRBACAdministration\deleteUserRoleEntry(), ilForumModeratorsGUI\detachModeratorRole(), ilObjBlog\doCloneObject(), ilExerciseManagementGUI\downloadAllObject(), ilPublicSubmissionsTableGUI\fillRow(), ilObjectConsumerTableGUI\fillRow(), ilTestImporter\finalProcessing(), ilObjForumAccess\getCachedUserInstance(), ilSoapCourseAdministration\getCoursesForUser(), ilObjCourse\getDefaultAdminRole(), ilObjCourse\getDefaultTutorRole(), ilChatroom\getDescription(), ilSoapExerciseAdministration\getExerciseXML(), ilSoapFileAdministration\getFileXML(), ilSoapGroupAdministration\getGroupsForUser(), ilSoapSCORMAdministration\getIMSManifestXML(), ilSoapRBACAdministration\getLocalRoles(), ilAttendanceList\getNonMemberUserData(), ilSoapObjectAdministration\getObjectsByTitle(), ilSoapRBACAdministration\getObjectTreeOperations(), ilCourseMembershipGUI\getPrintMemberData(), ilUsersGalleryContacts\getRelationSequence(), ilSoapRBACAdministration\getRoles(), ilChatroom\getTitle(), ilSoapUserAdministration\getUser(), ilSoapRBACAdministration\getUserRoles(), ilDataCollectionDataSet\getXmlNamespace(), ilChatroomExporter\getXmlRepresentation(), ilSoapRBACAdministration\grantPermissions(), ilObjSession\handleAutoFill(), ilObjGroup\handleAutoFill(), ilObjCourse\handleAutoFill(), ilECSTaskScheduler\handleDeprecatedAccounts(), ilECSAppEventListener\handleEvent(), ilRemoteObjectBase\handleUpdate(), ilCronDeleteInactiveUserAccounts\hasCustomSettings(), ilObjTestAccess\hasFinished(), ilObjTestAccess\hasVisibleCertificate(), ilExternalFeedBlockGUI\importFile(), ilObjectGUI\importFileObject(), ilBibliographicDataSet\importRecord(), ilExternalFeedDataSet\importRecord(), ilHTMLLearningModuleDataSet\importRecord(), ilIndividualAssessmentDataSet\importRecord(), ilMediaCastDataSet\importRecord(), ilItemGroupDataSet\importRecord(), ilPortfolioDataSet\importRecord(), ilPollDataSet\importRecord(), ilGlossaryDataSet\importRecord(), ilSessionDataSet\importRecord(), ilBlogDataSet\importRecord(), ilWikiDataSet\importRecord(), ilMediaPoolDataSet\importRecord(), ilLearningModuleDataSet\importRecord(), ilStyleDataSet\importRecord(), ilExerciseDataSet\importRecord(), ilObjStyleSheetGUI\importStyleObject(), ilChatroomImporter\importXmlRepresentation(), ilSurveyQuestionPoolImporter\importXmlRepresentation(), ilForumImporter\importXmlRepresentation(), ilFileImporter\importXmlRepresentation(), ilScormAiccImporter\importXmlRepresentation(), ilTestImporter\importXmlRepresentation(), ilTestQuestionPoolImporter\importXmlRepresentation(), ilFolderImporter\importXmlRepresentation(), ilWebResourceImporter\importXmlRepresentation(), ilGlossaryImporter\importXmlRepresentation(), ilLearningModuleImporter\importXmlRepresentation(), ilSurveyImporter\importXmlRepresentation(), ilWebLinkXmlWriter\init(), ilFolderXmlWriter\init(), ilMimeMailNotification\initLanguage(), ilPluginLP\initPlugin(), ilRoleXmlImporter\initRole(), ilParticipants\isGroupingMember(), ilChatroom\isOwnerOfPrivateRoom(), ilObjRoleGUI\listUsersRoleObject(), ilSoapMailXmlParser\parseName(), ilExerciseSubmissionTableGUI\parseRow(), ilLPTableBaseGUI\parseTitle(), ilObjContentObjectGUI\pastePage(), ilLMObject\pasteTree(), ilLocalUserGUI\performDeleteUsers(), ilObjCategoryGUI\performDeleteUsersObject(), ilObjWorkspaceFolderGUI\performPasteIntoMultipleObjects(), ilParticipants\readSubscribers(), ilContainer\removeCustomIcon(), ilPreviewGUI\renderPreview(), ilTestLP\resetCustomLPDataForUserIds(), ilSoapRBACAdministration\revokePermissions(), ilCronDeleteInactivatedUserAccounts\run(), ilPermissionGUI\savePermissions(), ilObjExercise\sendAssignment(), ilPDOAuthentication\setAuth(), ilMailSearchCoursesGUI\showMembers(), ilNotificationSystem\toUsers(), ilPermissionGUI\unblockRoles(), ilSoapExerciseAdministration\updateExercise(), ilSoapFileAdministration\updateFile(), ilSoapObjectAdministration\updateObjects(), ilECSCourseCreationHandler\updateParallelCourses(), ilECSCourseCreationHandler\updateParallelGroups(), ilRegistrationSettingsGUI\updateRoles(), ilSoapWebLinkAdministration\updateWebLink(), and ilObjTestAccess\visibleUserResultExists().

76  {
77  global $DIC;
78 
79  $objDefinition = $DIC["objDefinition"];
80  $ilDB = $DIC->database();
81  $ilErr = $DIC["ilErr"];
82 
83  // check object id
84  if (!isset($a_obj_id)) {
85  $message = "ilObjectFactory::getInstanceByObjId(): No obj_id given!";
86  if ($stop_on_error === true) {
87  $ilErr->raiseError($message, $ilErr->WARNING);
88  exit();
89  }
90 
91  return false;
92  }
93 
94  // read object data
95  $q = "SELECT * FROM object_data " .
96  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer');
97  $object_set = $ilDB->query($q);
98  // check number of records
99  if ($object_set->numRows() == 0) {
100  $message = "ilObjectFactory::getInstanceByObjId(): Object with obj_id: " . $a_obj_id . " not found!";
101  if ($stop_on_error === true) {
102  $ilErr->raiseError($message, $ilErr->WARNING);
103  exit();
104  }
105  return false;
106  }
107 
108  $object_rec = $object_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
109  $class_name = "ilObj" . $objDefinition->getClassName($object_rec["type"]);
110 
111  // check class
112  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) {
116  $ilErr->raiseError($message, $ilErr->WARNING);
117  exit();
118  }
119  return false;
120  }
121 
122  // get location
123  $location = $objDefinition->getLocation($object_rec["type"]);
124 
125  // create instance
126  include_once($location . "/class." . $class_name . ".php");
127  $obj = new $class_name(0, false); // this avoids reading of data
128  $obj->setId($a_obj_id);
129  $obj->read();
130 
131  return $obj;
132  }
global $ilErr
Definition: raiseError.php:16
global $DIC
Definition: saml.php:7
$location
Definition: buildRTE.php:44
catch(Exception $e) $message
global $ilDB
+ Here is the caller graph for this function:

◆ getInstanceByRefId()

static ilObjectFactory::getInstanceByRefId (   $a_ref_id,
  $stop_on_error = true 
)
static

get an instance of an Ilias object by reference id

Parameters
int$obj_idobject id
Returns
object|bool instance of Ilias object (i.e. derived from ilObject)

Definition at line 141 of file class.ilObjectFactory.php.

References $DIC, $ilDB, $ilErr, $location, $message, $query, exit, and ilDBConstants\FETCHMODE_ASSOC.

Referenced by ilCourseArchives\__addHTMLFiles(), ilCourseArchives\__addZipFiles(), ilCourseArchives\__buildStructure(), ilConditionHandlerGUI\__construct(), ilLMEditorGUI\__construct(), ilCourseObjectivesGUI\__initCourseObject(), ilCourseArchivesGUI\__initCourseObject(), ilCourseContentGUI\__initCourseObject(), ilECSObjectSettings\_handleDelete(), ilForumNotification\_isParentNodeGrpCrs(), assQuestionGUI\addBackTab(), ilSoapCourseAdministration\addCourse(), ilSoapExerciseAdministration\addExercise(), ilSoapFileAdministration\addFile(), ilTestExpressPageObjectGUI\addPageOfQuestions(), ilSoapObjectAdministration\addReference(), ilSoapRBACAdministration\addRole(), ilSoapRBACAdministration\addRoleFromTemplate(), ilObjRoleGUI\askDeleteDesktopItemObject(), ilConditionHandlerGUI\assign(), ilObjCourseGroupingGUI\assignCourse(), ilSoapCourseAdministration\assignCourseMember(), ilSoapGroupAdministration\assignGroupMember(), ilObject2GUI\assignObject(), ilObjectGUI\assignObject(), assQuestionGUI\cancelSync(), ilSoapAdministration\checkObjectAccess(), ilForumNotification\checkParentNodeTree(), ilConditionHandlerGUI\chi_init(), ilContainerGUI\clipboardObject(), ilObjectGUI\cloneAllObject(), ilContainerGUI\cloneAllObject(), ilSoapUtils\cloneDependencies(), ilObjectActivation\cloneDependencies(), ilSoapUtils\cloneNode(), ilContainerGUI\cloneNodes(), ilObjectCopyGUI\copyContainer(), ilObjectCopyGUI\copyMultipleNonContainer(), ilSoapObjectAdministration\copyObject(), ilObjStyleSheetGUI\copyStyleObject(), ilSoapWebLinkAdministration\createWebLink(), ilSoapObjectAdministration\deleteObject(), ilContainerReferenceAppEventListener\deleteReferences(), ilForumSettingsGUI\disableHideUserToggleNoti(), ilContainerGUI\downloadMultipleObjects(), ilContainerGUI\downloadObject(), ilObjTest\ensureParticipantsLastActivePassFinished(), ilTestInfoScreenToolbarFactory\ensureTestObjectInitialised(), ilObjSessionGUI\eventsListObject(), ilSoapCourseAdministration\excludeCourseMember(), ilSoapGroupAdministration\excludeGroupMember(), ilTestExpressPageObjectGUI\executeCommand(), ilSessionOverviewGUI\exportCSV(), ilChatroomAdminViewGUI\forcePublicRoom(), ilSessionOverviewTableGUI\gatherEvents(), ilFolderDownloadBackgroundTaskHandler\gatherFiles(), ilForum\generatePost(), ilStudyProgrammeExpandableProgressListGUI\getAccordionContentCoursesHTML(), ilChatroomBlockGUI\getChatroomSelectionList(), ilObjCloudListGUI\getCommands(), ilSoapGroupAdministration\getGroup(), ilObjectFactoryWrapper\getInstanceByRefId(), ilRoleDesktopItemsTableGUI\getItems(), ilSoapRBACAdministration\getLocalRoles(), ilCourseObjectiveQuestion\getMaxPointsByObjective(), ilCourseObjectiveQuestion\getMaxPointsByTest(), ilSoapObjectAdministration\getObjectByReference(), ilPDSelectedItemsBlockMembershipsProvider\getObjectsByMembership(), ilSoapObjectAdministration\getObjectsByTitle(), ilSoapRBACAdministration\getObjectTreeOperations(), ilOrgUnitExtension\getOrgUnit(), ilCourseStartObjectsTableGUI\getPossibleObjects(), ilContainerStartObjectsTableGUI\getPossibleObjects(), ilCourseStartObjectsTableGUI\getStartObjects(), ilContainerStartObjectsTableGUI\getStartObjects(), ilSOAPStructureObjectAdministration\getStructureObjects(), ilSoapObjectAdministration\getTreeChilds(), ilContainerReferenceExporter\getXmlRepresentation(), ilGroupExporter\getXmlRepresentation(), ilCategoryExporter\getXmlRepresentation(), ilCourseExporter\getXmlRepresentation(), ilSoapObjectAdministration\getXMLTree(), ilSoapRBACAdministration\grantPermissions(), ilRemoteObjectBase\handleDelete(), ilECSCategoryMapping\handleUpdate(), ilCourseObjective\ilClone(), ilObjStyleSheetGUI\importStyleObject(), ilSoapUserAdministration\importUsers(), ilGroupImporter\importXmlRepresentation(), ilFolderImporter\importXmlRepresentation(), ilCategoryImporter\importXmlRepresentation(), ilCourseImporter\importXmlRepresentation(), ilCourseObjectivesGUI\initFormRandom(), ilContainerReferenceImporter\initReference(), ilAssQuestionPreviewSettings\initSettingsWithTestObject(), ilDidacticTemplateAction\initSourceObject(), ilSoapCourseAdministration\isAssignedToCourse(), ilSoapGroupAdministration\isAssignedToGroup(), ilObjTest\isParticipantsLastPassActive(), ilObjectGUI\isVisible(), ilSoapUtils\linkNode(), ilContainerGUI\linkObject(), ilLOUtils\lookupQplBySequence(), ilCourseObjectiveQuestionAssignmentTableGUI\parse(), ilLOTestAssignmentTableGUI\parse(), ilContainerGUI\pasteObject(), ilContainerGUI\performPasteIntoMultipleObjectsObject(), ilValidator\purgeObjects(), ilObjQuestionPoolGUI\questionsObject(), ilRepUtil\removeDeletedNodes(), ilSoapObjectAdministration\removeFromSystemByImportId(), ilValidator\removeInvalidRolefolders(), ilRepUtil\removeObjectsFromSystem(), ilSoapTestAdministration\removeTestResults(), ilMailGroupAddressType\resolve(), ilValidator\restoreDeletedObjects(), ilValidator\restoreMissingObjects(), ilRepUtil\restoreObjects(), ilValidator\restoreSubTrees(), ilSoapRBACAdministration\revokePermissions(), ilWebResourceCronLinkCheck\run(), ilObjStyleSheetGUI\saveObject(), ilSoapObjectAdministration\searchObjects(), ilCourseMembershipMailNotification\send(), ilMailSearchGroupsGUI\showMembers(), ilObjForumGUI\showUserObject(), assQuestionGUI\sync(), ilECSCmsTreeSynchronizer\syncCategory(), ilSoapCourseAdministration\updateCourse(), ilECSCourseCreationHandler\updateCourseData(), ilSoapGroupAdministration\updateGroup(), and ilConditionHandler\validate().

142  {
143  global $DIC;
144 
145  $objDefinition = $DIC["objDefinition"];
146  $ilDB = $DIC->database();
147  $ilErr = $DIC["ilErr"];
148 
149  // check reference id
150  if (!isset($a_ref_id)) {
151  if ($stop_on_error === true) {
152  $message = "ilObjectFactory::getInstanceByRefId(): No ref_id given!";
153  $ilErr->raiseError($message, $ilErr->WARNING);
154  exit();
155  }
156 
157  return false;
158  }
159 
160  // read object data
161 
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);
166 
167  // check number of records
168  if ($object_set->numRows() == 0) {
169  if ($stop_on_error === true) {
170  $message = "ilObjectFactory::getInstanceByRefId(): Object with ref_id " . $a_ref_id . " not found!";
171  $ilErr->raiseError($message, $ilErr->WARNING);
172  exit();
173  }
174 
175  return false;
176  }
177 
178  $object_rec = $object_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
179  $class_name = "ilObj" . $objDefinition->getClassName($object_rec["type"]);
180 
181  // check class
182  if ($class_name == "ilObj") {
183  if ($stop_on_error === true) {
184  $message = "ilObjectFactory::getInstanceByRefId(): Not able to determine object " .
185  "class for type" . $object_rec["type"] . ".";
186  $ilErr->raiseError($message, $ilErr->WARNING);
187  exit();
188  }
189 
190  return false;
191  }
192 
193  // get location
194  $location = $objDefinition->getLocation($object_rec["type"]);
195 
196  // create instance
197  include_once($location . "/class." . $class_name . ".php");
198  $obj = new $class_name(0, false); // this avoids reading of data
199  $obj->setId($object_rec["obj_id"]);
200  $obj->setRefId($a_ref_id);
201  $obj->read();
202  return $obj;
203  }
global $ilErr
Definition: raiseError.php:16
global $DIC
Definition: saml.php:7
$location
Definition: buildRTE.php:44
catch(Exception $e) $message
$query
global $ilDB
+ Here is the caller graph for this function:

◆ getObjectsForOwner()

ilObjectFactory::getObjectsForOwner (   $object_type,
  $owner_id 
)

returns all objects of an owner, filtered by type, objects are not deleted!

Parameters
unknown_type$object_type
unknown_type$owner_id
Returns
unknown

Definition at line 49 of file class.ilObjectFactory.php.

References $DIC, $ilDB, $query, $res, array, and ilDBConstants\FETCHMODE_ASSOC.

Referenced by ilSoapCourseAdministration\getCoursesForUser(), and ilSoapGroupAdministration\getGroupsForUser().

50  {
51  global $DIC;
52 
53  $ilDB = $DIC->database();
54 
55  $query = "SELECT * FROM object_data,object_reference " .
56  "WHERE object_reference.obj_id = object_data.obj_id " .
57  " AND object_data.type=" . $ilDB->quote($object_type, 'text') .
58  " AND object_data.owner = " . $ilDB->quote($owner_id, 'integer');
59  $res = $ilDB->query($query);
60 
61  $obj_ids = array();
62  while ($object_rec = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
63  $obj_ids [] = $object_rec["obj_id"];
64  }
65 
66  return $obj_ids;
67  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getTypeByRefId()

static ilObjectFactory::getTypeByRefId (   $a_ref_id,
  $stop_on_error = true 
)
static

get object type by reference id

Parameters
int$obj_idobject id
Returns
string object type
Deprecated:
since version 5.3

Definition at line 213 of file class.ilObjectFactory.php.

References $DIC, $ilDB, $ilErr, $message, exit, and ilDBConstants\FETCHMODE_ASSOC.

Referenced by ilSoapAdministration\checkObjectAccess(), ilSoapObjectAdministration\copyObject(), ilCopyWizardSettingsXMLParser\handlerBeginTag(), ilSoapObjectAdministration\moveObject(), and ilSoapGroupAdministration\updateGroup().

214  {
215  global $DIC;
216 
217  $ilErr = $DIC["ilErr"];
218  $ilDB = $DIC->database();
219 
220  // check reference id
221  if (!isset($a_ref_id)) {
222  if ($stop_on_error === true) {
223  $message = "ilObjectFactory::getTypeByRefId(): No ref_id given!";
224  $ilErr->raiseError($message, $ilErr->WARNING);
225  exit();
226  }
227 
228  return false;
229  }
230 
231  // read object data
232  $q = "SELECT * FROM object_data " .
233  "LEFT JOIN object_reference ON object_data.obj_id=object_reference.obj_id " .
234  "WHERE object_reference.ref_id=" . $ilDB->quote($a_ref_id, 'integer');
235  $object_set = $ilDB->query($q);
236 
237  if ($object_set->numRows() == 0) {
238  if ($stop_on_error === true) {
239  $message = "ilObjectFactory::getTypeByRefId(): Object with ref_id " . $a_ref_id . " not found!";
240  $ilErr->raiseError($message, $ilErr->WARNING);
241  exit();
242  }
243 
244  return false;
245  }
246 
247  $object_rec = $object_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
248  return $object_rec["type"];
249  }
global $ilErr
Definition: raiseError.php:16
global $DIC
Definition: saml.php:7
catch(Exception $e) $message
global $ilDB
+ Here is the caller graph for this function:

◆ ObjectIdExists()

ilObjectFactory::ObjectIdExists (   $a_obj_id)

check if obj_id exists.

To check for ref_ids use ilTree::isInTree()

Parameters
int$obj_idobject id
Returns
bool

Definition at line 28 of file class.ilObjectFactory.php.

References $DIC, $ilDB, $query, and $res.

29  {
30  global $DIC;
31 
32  $ilDB = $DIC->database();
33 
34  $query = "SELECT * FROM object_data " .
35  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer');
36 
37  $res = $ilDB->query($query);
38 
39  return $res->numRows() ? true : false;
40  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB

The documentation for this class was generated from the following file: