ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 251 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().

252  {
253  global $DIC;
254 
255  $objDefinition = $DIC["objDefinition"];
256 
257  $location = $objDefinition->getLocation($a_obj_type);
258  $class_name = "ilObj" . $objDefinition->getClassName($a_obj_type);
259 
260  // create instance
261  include_once($location . "/class." . $class_name . ".php");
262  return $class_name;
263  }
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
$a_obj_id
bool$stop_on_error
Returns
bool|ilObject
Exceptions
ilDatabaseException
ilObjectNotFoundException

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

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

Referenced by ilLearningProgressBaseGUI\__appendUserInfo(), ilRoleDesktopItem\__assign(), ilLocalUserGUI\__checkGlobalRoles(), ilObjCategoryGUI\__checkGlobalRoles(), ilUsersGalleryParticipants\__construct(), ilPDMailGUI\__construct(), ilCalendarUserSettings\__construct(), ilDownloadFilesBackgroundTask\__construct(), ilLocalUserGUI\__getAssignableRoles(), ilObjCategoryGUI\__getAssignableRoles(), ilLPListOfProgressGUI\__initUser(), ilLinkChecker\__sendMail(), ilLocalUserGUI\__showRolesTable(), ilSearch\__validateResults(), ilStartUpGUI\_checkGoto(), ilContainer\_exportContainerSettings(), ilObjGroup\_isMember(), ilObjContentObject\_moveLMStyles(), ilSoapObjectAdministration\addDesktopItems(), 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(), ilWorkspaceTree\cascadingDelete(), ilUserCronCheckAccounts\checkNotConfirmedUserAccounts(), ilObjPortfolioBase\cloneBasics(), ilObjWiki\cloneObject(), ilObjGlossary\cloneObject(), ilObjContentObject\cloneObject(), ilExerciseManagementCollectFilesJob\collectSubmissionFiles(), ilMailMemberSearchDataProvider\collectTableData(), ilMailFolderGUI\confirmDeleteMails(), 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(), ilContentPageImporter\finalProcessing(), ilTestImporter\finalProcessing(), ilPdfGenerator\generateFileName(), ilObjForumAccess\getCachedUserInstance(), ilCertificateMigrationJob\getCourseCertificates(), ilSoapCourseAdministration\getCoursesForUser(), ilObjCourse\getDefaultAdminRole(), ilObjCourse\getDefaultTutorRole(), ilChatroom\getDescription(), ilCertificateGUI\getEditorForm(), ilCertificateMigrationJob\getExerciseCertificates(), ilSoapExerciseAdministration\getExerciseXML(), ilSoapFileAdministration\getFileXML(), ilSoapGroupAdministration\getGroupsForUser(), ilSoapSCORMAdministration\getIMSManifestXML(), ilCertificateObjectHelper\getInstanceByObjId(), ilUserRoleStartingPointTableGUI\getItems(), ilSoapRBACAdministration\getLocalRoles(), ilAttendanceList\getNonMemberUserData(), ilSoapObjectAdministration\getObjectsByTitle(), ilSoapRBACAdministration\getObjectTreeOperations(), ilCourseMembershipGUI\getPrintMemberData(), ilUsersGalleryContacts\getRelationSequence(), ilLearningSequenceRoles\getRoleObject(), ilSoapRBACAdministration\getRoles(), ilCertificateMigrationJob\getScormCertificates(), ilCertificateMigrationJob\getTestCertificates(), ilChatroom\getTitle(), ilSoapUserAdministration\getUser(), ilSoapRBACAdministration\getUserRoles(), ilContentPageExporter\getXmlExportTailDependencies(), ilDataCollectionDataSet\getXmlNamespace(), ilChatroomExporter\getXmlRepresentation(), ilSoapRBACAdministration\grantPermissions(), ilObjSession\handleAutoFill(), ilObjGroup\handleAutoFill(), ilObjCourse\handleAutoFill(), ilECSTaskScheduler\handleDeprecatedAccounts(), ilECSAppEventListener\handleEvent(), ilCertificateAppEventListener\handleNewMigratedUserCertificate(), ilRemoteObjectBase\handleUpdate(), ilCronDeleteInactiveUserAccounts\hasCustomSettings(), ilObjTestAccess\hasFinished(), ilIndividualAssessmentMembersTableGUI\hasPublicProfile(), ilObjTestAccess\hasVisibleCertificate(), ilExternalFeedBlockGUI\importFile(), ilObjectGUI\importFileObject(), ilObjSessionGUI\importFileObject(), ilBibliographicDataSet\importRecord(), ilExternalFeedDataSet\importRecord(), ilContentPageDataSet\importRecord(), ilHTMLLearningModuleDataSet\importRecord(), ilIndividualAssessmentDataSet\importRecord(), ilMediaCastDataSet\importRecord(), ilItemGroupDataSet\importRecord(), ilPortfolioDataSet\importRecord(), ilPollDataSet\importRecord(), ilGlossaryDataSet\importRecord(), ilBlogDataSet\importRecord(), ilMediaPoolDataSet\importRecord(), ilWikiDataSet\importRecord(), ilStyleDataSet\importRecord(), ilLearningModuleDataSet\importRecord(), ilExerciseDataSet\importRecord(), ilObjStyleSheetGUI\importStyleObject(), ilChatroomImporter\importXmlRepresentation(), ilForumImporter\importXmlRepresentation(), ilSurveyQuestionPoolImporter\importXmlRepresentation(), ilFileImporter\importXmlRepresentation(), ilScormAiccImporter\importXmlRepresentation(), ilTestImporter\importXmlRepresentation(), ilTestQuestionPoolImporter\importXmlRepresentation(), ilLearningSequenceImporter\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(), ilStartingPoint\onRoleDeleted(), ilSoapMailXmlParser\parseName(), ilExerciseSubmissionTableGUI\parseRow(), ilLPTableBaseGUI\parseTitle(), ilObjContentObjectGUI\pastePage(), ilLMObject\pasteTree(), ilLocalUserGUI\performDeleteUsers(), ilObjCategoryGUI\performDeleteUsersObject(), ilObjWorkspaceFolderGUI\performPasteIntoMultipleObjects(), ilContentPageDataSet\readData(), ilParticipants\readSubscribers(), ilSoapObjectAdministration\removeDesktopItems(), ilSoapObjectAdministration\removeFromSystemByImportId(), ilPreviewGUI\renderPreview(), ilTestLP\resetCustomLPDataForUserIds(), ilSoapRBACAdministration\revokePermissions(), ilCronDeleteInactivatedUserAccounts\run(), ilObjStyleSheetGUI\saveObject(), ilPermissionGUI\savePermissions(), ilObjExercise\sendAssignment(), ilPDOAuthentication\setAuth(), ilMailSearchCoursesGUI\showMembers(), ilPasswordAssistanceGUI\submitAssignPasswordForm(), ilNotificationSystem\toUsers(), ilPermissionGUI\unblockRoles(), ilSoapExerciseAdministration\updateExercise(), ilSoapFileAdministration\updateFile(), ilECSCourseCreationHandler\updateParallelCourses(), ilECSCourseCreationHandler\updateParallelGroups(), ilRegistrationSettingsGUI\updateRoles(), ilSoapWebLinkAdministration\updateWebLink(), ilObjTestAccess\visibleUserResultExists(), and ilObjContentPage\writeStyleSheetId().

78  {
79  global $DIC;
80 
81  $objDefinition = $DIC["objDefinition"];
82  $ilDB = $DIC->database();
83 
84  // check object id
85  if (!isset($a_obj_id)) {
86  $message = "ilObjectFactory::getInstanceByObjId(): No obj_id given!";
87  if ($stop_on_error === true) {
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) {
103  }
104  return false;
105  }
106 
107  $object_rec = $object_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
108  $class_name = "ilObj" . $objDefinition->getClassName($object_rec["type"]);
109 
110  // check class
111  if ($class_name == "ilObj") {
112  $message = "ilObjectFactory::getInstanceByObjId(): Not able to determine object " .
113  "class for type" . $object_rec["type"] . ".";
114  if ($stop_on_error === true) {
116  }
117  return false;
118  }
119 
120  // get location
121  $location = $objDefinition->getLocation($object_rec["type"]);
122 
123  // create instance
124  include_once($location . "/class." . $class_name . ".php");
125  $obj = new $class_name(0, false); // this avoids reading of data
126  $obj->setId($a_obj_id);
127  $obj->read();
128 
129  return $obj;
130  }
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
$a_ref_id
bool$stop_on_error
Returns
bool|ilObject
Exceptions
ilDatabaseException
ilObjectNotFoundException

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

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

Referenced by ilConditionHandlerGUI\__construct(), ilLMEditorGUI\__construct(), ilCourseObjectivesGUI\__initCourseObject(), ilCourseContentGUI\__initCourseObject(), ilECSObjectSettings\_handleDelete(), ilForumNotification\_isParentNodeGrpCrs(), assQuestionGUI\addBackTab(), ilSoapCourseAdministration\addCourse(), ilSoapObjectAdministration\addDesktopItems(), 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(), ilContainerGUI\clipboardObject(), ilObjectGUI\cloneAllObject(), ilContainerGUI\cloneAllObject(), ilSoapUtils\cloneDependencies(), ilObjectActivation\cloneDependencies(), ilObjCourseGrouping\cloneGrouping(), ilSoapUtils\cloneNode(), ilContainerGUI\cloneNodes(), ilObjLearningSequenceContentGUI\confirmDelete(), ilObjectCopyGUI\copyContainer(), ilObjectCopyGUI\copyMultipleNonContainer(), ilSoapObjectAdministration\copyObject(), ilObjStyleSheetGUI\copyStyleObject(), ilSoapWebLinkAdministration\createWebLink(), ilOerHarvester\deleteObject(), ilSoapObjectAdministration\deleteObject(), ilContainerReferenceAppEventListener\deleteReferences(), ilForumSettingsGUI\disableHideUserToggleNoti(), ilGroupAppEventListener\doAutoFill(), 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(), ilLearningSequenceConditionController\getContainerObject(), ilSoapGroupAdministration\getGroup(), ilObjectFactoryWrapper\getInstanceByRefId(), ilLSViewFactory\getInstanceByRefId(), ilLSEventHandler\getInstanceByRefId(), ilObjLearningSequence\getInstanceByRefId(), ilRoleDesktopItemsTableGUI\getItems(), ilSoapRBACAdministration\getLocalRoles(), ilCourseObjectiveQuestion\getMaxPointsByObjective(), ilCourseObjectiveQuestion\getMaxPointsByTest(), ilSoapObjectAdministration\getObjectByReference(), ilLSItemsDB\getObjectFor(), ilPDSelectedItemsBlockMembershipsProvider\getObjectsByMembership(), ilSoapObjectAdministration\getObjectsByTitle(), ilSoapRBACAdministration\getObjectTreeOperations(), ilOrgUnitExtension\getOrgUnit(), ilCourseStartObjectsTableGUI\getPossibleObjects(), ilContainerStartObjectsTableGUI\getPossibleObjects(), ilCourseStartObjectsTableGUI\getStartObjects(), ilContainerStartObjectsTableGUI\getStartObjects(), ilSOAPStructureObjectAdministration\getStructureObjects(), ilSoapObjectAdministration\getTreeChilds(), ilLearningSequenceExporter\getWriter(), ilContainerReferenceExporter\getXmlRepresentation(), ilGroupExporter\getXmlRepresentation(), ilCategoryExporter\getXmlRepresentation(), ilCourseExporter\getXmlRepresentation(), ilSoapObjectAdministration\getXMLTree(), ilSoapRBACAdministration\grantPermissions(), ilRemoteObjectBase\handleDelete(), ilECSCategoryMapping\handleUpdate(), ilOerHarvester\harvest(), ilCourseObjective\ilClone(), ilSessionDataSet\importRecord(), ilObjStyleSheetGUI\importStyleObject(), ilSoapUserAdministration\importUsers(), ilFolderImporter\importXmlRepresentation(), ilCategoryImporter\importXmlRepresentation(), ilGroupImporter\importXmlRepresentation(), ilCourseImporter\importXmlRepresentation(), ilCourseObjectivesGUI\initFormRandom(), ilContainerReferenceImporter\initReference(), ilAssQuestionPreviewSettings\initSettingsWithTestObject(), ilDidacticTemplateAction\initSourceObject(), ilSoapUtils\internalLinkNode(), ilSoapCourseAdministration\isAssignedToCourse(), ilSoapGroupAdministration\isAssignedToGroup(), ilObjLearningSequenceAccess\isOffline(), ilObjTest\isParticipantsLastPassActive(), ilObjectGUI\isVisible(), ilSoapUtils\linkNode(), ilContainerGUI\linkObject(), ilLOUtils\lookupQplBySequence(), ilCourseObjectiveQuestionAssignmentTableGUI\parse(), ilLOTestAssignmentTableGUI\parse(), ilLearningSequenceParticipantsTableGUI\parse(), ilContainerGUI\pasteObject(), ilContainerGUI\performPasteIntoMultipleObjectsObject(), ilValidator\purgeObjects(), ilObjQuestionPoolGUI\questionsObject(), ilRepUtil\removeDeletedNodes(), ilSoapObjectAdministration\removeDesktopItems(), ilSoapObjectAdministration\removeFromSystemByImportId(), ilValidator\removeInvalidRolefolders(), ilRepUtil\removeObjectsFromSystem(), ilSoapTestAdministration\removeTestResults(), ilValidator\restoreDeletedObjects(), ilValidator\restoreMissingObjects(), ilRepUtil\restoreObjects(), ilValidator\restoreSubTrees(), ilSoapRBACAdministration\revokePermissions(), ilWebResourceCronLinkCheck\run(), ilObjStyleSheetGUI\saveObject(), ilSoapObjectAdministration\searchObjects(), ilCourseMembershipMailNotification\send(), LSItemOnlineStatus\setOnlineStatus(), 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 
148  // check reference id
149  if (!isset($a_ref_id)) {
150  if ($stop_on_error === true) {
151  $message = "ilObjectFactory::getInstanceByRefId(): No ref_id given!";
153  }
154 
155  return false;
156  }
157 
158  // read object data
159 
160  $query = "SELECT * FROM object_data,object_reference " .
161  "WHERE object_reference.obj_id = object_data.obj_id " .
162  "AND object_reference.ref_id = " . $ilDB->quote($a_ref_id, 'integer');
163  $object_set = $ilDB->query($query);
164 
165  // check number of records
166  if ($object_set->numRows() == 0) {
167  if ($stop_on_error === true) {
168  $message = "ilObjectFactory::getInstanceByRefId(): Object with ref_id " . $a_ref_id . " not found!";
170  }
171 
172  return false;
173  }
174 
175  $object_rec = $object_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
176  $class_name = "ilObj" . $objDefinition->getClassName($object_rec["type"]);
177 
178  // check class
179  if ($class_name == "ilObj") {
180  if ($stop_on_error === true) {
181  $message = "ilObjectFactory::getInstanceByRefId(): Not able to determine object " .
182  "class for type" . $object_rec["type"] . ".";
184  }
185 
186  return false;
187  }
188 
189  // get location
190  $location = $objDefinition->getLocation($object_rec["type"]);
191 
192  // create instance
193  include_once($location . "/class." . $class_name . ".php");
194  $obj = new $class_name(0, false); // this avoids reading of data
195  $obj->setId($object_rec["obj_id"]);
196  $obj->setRefId($a_ref_id);
197  $obj->read();
198  return $obj;
199  }
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, 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
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

Deprecated:
since version 5.3
Parameters
$a_ref_id
bool$stop_on_error
Returns
bool
Exceptions
ilDatabaseException
ilObjectNotFoundException

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

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

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

212  {
213  global $DIC;
214 
215  $ilDB = $DIC->database();
216 
217  // check reference id
218  if (!isset($a_ref_id)) {
219  if ($stop_on_error === true) {
220  $message = "ilObjectFactory::getTypeByRefId(): No ref_id given!";
222  }
223 
224  return false;
225  }
226 
227  // read object data
228  $q = "SELECT * FROM object_data " .
229  "LEFT JOIN object_reference ON object_data.obj_id=object_reference.obj_id " .
230  "WHERE object_reference.ref_id=" . $ilDB->quote($a_ref_id, 'integer');
231  $object_set = $ilDB->query($q);
232 
233  if ($object_set->numRows() == 0) {
234  if ($stop_on_error === true) {
235  $message = "ilObjectFactory::getTypeByRefId(): Object with ref_id " . $a_ref_id . " not found!";
237  }
238 
239  return false;
240  }
241 
242  $object_rec = $object_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
243  return $object_rec["type"];
244  }
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: