ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilObjOrgUnit Class Reference

Class ilObjOrgUnit. More...

+ Inheritance diagram for ilObjOrgUnit:
+ Collaboration diagram for ilObjOrgUnit:

Public Member Functions

 __construct ($a_id=0, $a_call_by_reference=true)
 
 create ()
 Create. More...
 
 update ()
 Update. More...
 
 getOrgUnitTypeId ()
 
 getOrgUnitType ()
 
 setOrgUnitTypeId ($a_id)
 
 assignUsersToEmployeeRole ($user_ids)
 
 assignUsersToSuperiorRole ($user_ids)
 
 deassignUserFromEmployeeRole ($user_id)
 
 deassignUserFromSuperiorRole ($user_id)
 
 assignUserToLocalRole ($role_id, $user_id)
 Assign a given user to a given local role. More...
 
 deassignUserFromLocalRole ($role_id, $user_id)
 Deassign a given user to a given local role. More...
 
 setEmployeeRole ($employee_role)
 
 getEmployeeRole ()
 
 setSuperiorRole ($superior_role)
 
 getSuperiorRole ()
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) @access public More...
 
 getTitle ()
 Return title. More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getTranslations ()
 
 delete ()
 delete category and all related data More...
 
 removeTranslations ()
 
 deleteTranslation ($a_lang)
 
 addTranslation ($a_title, $a_desc, $a_lang, $a_lang_default)
 
 updateTranslation ($a_title, $a_desc, $a_lang, $a_lang_default)
 
- Public Member Functions inherited from ilContainer
 ilContainer ($a_id=0, $a_call_by_reference=true)
 Constructor @access public. More...
 
 createContainerDirectory ()
 Create directory for the container. More...
 
 getContainerDirectory ()
 Get the container directory. More...
 
 _getContainerDirectory ($a_id)
 Get the container directory. More...
 
 getBigIconPath ()
 Get path for big icon. More...
 
 getSmallIconPath ()
 Get path for small icon. More...
 
 getTinyIconPath ()
 Get path for tiny icon. More...
 
 getCustomIconPath ()
 Get path for custom icon. More...
 
 setHiddenFilesFound ($a_hiddenfilesfound)
 Set Found hidden files (set by getSubItems). More...
 
 getHiddenFilesFound ()
 Get Found hidden files (set by getSubItems). More...
 
 getStyleSheetId ()
 get ID of assigned style sheet object More...
 
 setStyleSheetId ($a_style_id)
 set ID of assigned style sheet object More...
 
 _lookupContainerSetting ($a_id, $a_keyword, $a_default_value=NULL)
 Lookup a container setting. More...
 
 _writeContainerSetting ($a_id, $a_keyword, $a_value)
 
 _lookupIconPath ($a_id, $a_size="big")
 lookup icon path More...
 
 saveIcons ($a_custom_icon)
 save container icons More...
 
 removeCustomIcon ()
 remove small icon More...
 
 cloneObject ($a_target_id, $a_copy_id=0)
 Clone container settings. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies (container sorting) More...
 
 cloneAllObject ($session_id, $client_id, $new_type, $ref_id, $clone_source, $options, $soap_call=false, $a_submode=1)
 clone all objects according to this container More...
 
 getViewMode ()
 Get container view mode. More...
 
 getOrderType ()
 Get order type default implementation. More...
 
 setOrderType ($a_value)
 
 getSubItems ($a_admin_panel_enabled=false, $a_include_side_block=false, $a_get_single=0)
 Get subitems of container. More...
 
 gotItems ()
 Check whether we got any items. More...
 
 addAdditionalSubItemInformation (&$object)
 Add additional information to sub item, e.g. More...
 
 getGroupedObjTypes ()
 Get grouped repository object types. More...
 
 enablePageEditing ()
 Check whether page editing is allowed for container. More...
 
 create ()
 Create. More...
 
 update ()
 Update. More...
 
 read ()
 read More...
 
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor @access public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ($a_force_db=false)
 read object data from db into object More...
 
 getId ()
 get object id @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 getDiskUsage ()
 
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class) More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _lookupOwner ($a_id)
 lookup object owner More...
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
 _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 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. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) @access public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static getRootOrgRefId ()
 
static getRootOrgId ()
 
static _exists ($a_id, $a_reference=false)
 
- Static Public Member Functions inherited from ilContainer
static _getContainerSettings ($a_id)
 
static _deleteContainerSettings ($a_id, $a_keyword=null, $a_keyword_like=false)
 
static _exportContainerSettings (ilXmlWriter $a_xml, $a_obj_id)
 
static getCompleteDescriptions (array $objects)
 overwrites description fields to long or short description in an assoc array keys needed (obj_id and description) More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupObjId ($a_id)
 
static setDeletedDates ($a_ref_ids)
 Set deleted date @global type $ilDB. More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data@access public More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Data Fields

const TABLE_NAME = 'orgu_data'
 
- Data Fields inherited from ilContainer
const VIEW_SESSIONS = 0
 
const VIEW_OBJECTIVE = 1
 
const VIEW_TIMING = 2
 
const VIEW_ARCHIVE = 3
 
const VIEW_SIMPLE = 4
 
const VIEW_BY_TYPE = 5
 
const VIEW_INHERIT = 6
 
const VIEW_DEFAULT = self::VIEW_BY_TYPE
 
const SORT_TITLE = 0
 
const SORT_MANUAL = 1
 
const SORT_ACTIVATION = 2
 
const SORT_INHERIT = 3
 
const SORT_CREATION = 4
 
const SORT_DIRECTION_ASC = 0
 
const SORT_DIRECTION_DESC = 1
 
const SORT_NEW_ITEMS_POSITION_TOP = 0
 
const SORT_NEW_ITEMS_POSITION_BOTTOM = 1
 
const SORT_NEW_ITEMS_ORDER_TITLE = 0
 
const SORT_NEW_ITEMS_ORDER_CREATION = 1
 
const SORT_NEW_ITEMS_ORDER_ACTIVATION = 2
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $ilias
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 
 $obj_data_record
 object_data record More...
 

Protected Attributes

 $employee_role
 
 $superior_role
 
 $orgu_type_id = 0
 
 $amd_data
 
- Protected Attributes inherited from ilContainer
 $order_type = 0
 
 $hiddenfilesfound = false
 

Static Protected Attributes

static $root_ref_id
 
static $root_id
 
static $icons_cache
 

Private Member Functions

 loadRoles ()
 
 doLoadRoles ()
 

Static Private Member Functions

static loadRootOrgRefIdAndId ()
 

Additional Inherited Members

- Static Public Attributes inherited from ilContainer
static $data_preloaded = false
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjOrgUnit::__construct (   $a_id = 0,
  $a_call_by_reference = true 
)
Parameters
int$a_id
bool$a_call_by_reference

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

49 {
50 $this->type = "orgu";
51 $this->ilContainer($a_id, $a_call_by_reference);
52 }
ilContainer($a_id=0, $a_call_by_reference=true)
Constructor @access public.

References ilContainer\ilContainer().

+ Here is the call graph for this function:

Member Function Documentation

◆ _exists()

static ilObjOrgUnit::_exists (   $a_id,
  $a_reference = false 
)
static

Definition at line 396 of file class.ilObjOrgUnit.php.

396 {
397 return parent::_exists($a_id, $a_reference, "orgu");
398 }

Referenced by ilOrgUnitImporter\buildRef().

+ Here is the caller graph for this function:

◆ addTranslation()

ilObjOrgUnit::addTranslation (   $a_title,
  $a_desc,
  $a_lang,
  $a_lang_default 
)

Definition at line 585 of file class.ilObjOrgUnit.php.

585 {
586 global $ilDB;
587
588 if (empty($a_title)) {
589 $a_title = "NO TITLE";
590 }
591
592 $query = "INSERT INTO object_translation "
593 . "(obj_id,title,description,lang_code,lang_default) " . "VALUES " . "("
594 . $ilDB->quote($this->getId(), 'integer') . "," . $ilDB->quote($a_title, 'text')
595 . "," . $ilDB->quote($a_desc, 'text') . "," . $ilDB->quote($a_lang, 'text') . ","
596 . $ilDB->quote($a_lang_default, 'integer') . ")";
597 $res = $ilDB->manipulate($query);
598
599 return true;
600 }
getId()
get object id @access public
global $ilDB

References $ilDB, $query, $res, and ilObject\getId().

Referenced by getTranslations().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignUsersToEmployeeRole()

ilObjOrgUnit::assignUsersToEmployeeRole (   $user_ids)

Definition at line 270 of file class.ilObjOrgUnit.php.

270 {
271 global $rbacadmin, $ilAppEventHandler;
272 foreach ($user_ids as $user_id) {
273 $rbacadmin->assignUser($this->getEmployeeRole(), $user_id);
274
275 $ilAppEventHandler->raise('Modules/OrgUnit', 'assignUsersToEmployeeRole', array(
276 'object' => $this,
277 'obj_id' => $this->getId(),
278 'ref_id' => $this->getRefId(),
279 'role_id' => $this->getEmployeeRole(),
280 'user_id' => $user_id,
281 ));
282 }
283 }
getRefId()
get reference id @access public

References getEmployeeRole(), ilObject\getId(), and ilObject\getRefId().

+ Here is the call graph for this function:

◆ assignUsersToSuperiorRole()

ilObjOrgUnit::assignUsersToSuperiorRole (   $user_ids)

Definition at line 286 of file class.ilObjOrgUnit.php.

286 {
287 global $rbacadmin, $ilAppEventHandler;
288 foreach ($user_ids as $user_id) {
289 $rbacadmin->assignUser($this->getSuperiorRole(), $user_id);
290
291 $ilAppEventHandler->raise('Modules/OrgUnit', 'assignUsersToSuperiorRole', array(
292 'object' => $this,
293 'obj_id' => $this->getId(),
294 'ref_id' => $this->getRefId(),
295 'role_id' => $this->getSuperiorRole(),
296 'user_id' => $user_id,
297 ));
298 }
299 }

References ilObject\getId(), ilObject\getRefId(), and getSuperiorRole().

+ Here is the call graph for this function:

◆ assignUserToLocalRole()

ilObjOrgUnit::assignUserToLocalRole (   $role_id,
  $user_id 
)

Assign a given user to a given local role.

Parameters
int$role_id
int$user_id
Returns
bool

Definition at line 337 of file class.ilObjOrgUnit.php.

337 {
338 global $rbacreview, $rbacadmin, $ilAppEventHandler;
339
340 $arrLocalRoles = $rbacreview->getLocalRoles($this->getRefId());
341 if (!in_array($role_id, $arrLocalRoles)) {
342 return false;
343 }
344
345 $return = $rbacadmin->assignUser($role_id, $user_id);
346
347 $ilAppEventHandler->raise('Modules/OrgUnit', 'assignUserToLocalRole', array(
348 'object' => $this,
349 'obj_id' => $this->getId(),
350 'ref_id' => $this->getRefId(),
351 'role_id' => $role_id,
352 'user_id' => $user_id,
353 ));
354
355 return $return;
356 }

References ilObject\getId(), and ilObject\getRefId().

+ Here is the call graph for this function:

◆ create()

ilObjOrgUnit::create ( )

Create.

Reimplemented from ilContainer.

Definition at line 69 of file class.ilObjOrgUnit.php.

69 {
70 global $ilDB;
71 parent::create();
72 $ilDB->insert(self::TABLE_NAME, array(
73 'orgu_type_id' => array( 'integer', $this->getOrgUnitTypeId() ),
74 'orgu_id' => array( 'integer', $this->getId() ),
75 ));
76 }

References $ilDB, ilObject\getId(), and getOrgUnitTypeId().

+ Here is the call graph for this function:

◆ deassignUserFromEmployeeRole()

ilObjOrgUnit::deassignUserFromEmployeeRole (   $user_id)

Definition at line 302 of file class.ilObjOrgUnit.php.

302 {
303 global $rbacadmin, $ilAppEventHandler;
304 $rbacadmin->deassignUser($this->getEmployeeRole(), $user_id);
305
306 $ilAppEventHandler->raise('Modules/OrgUnit', 'deassignUserFromEmployeeRole', array(
307 'object' => $this,
308 'obj_id' => $this->getId(),
309 'ref_id' => $this->getRefId(),
310 'role_id' => $this->getEmployeeRole(),
311 'user_id' => $user_id,
312 ));
313 }

References getEmployeeRole(), ilObject\getId(), and ilObject\getRefId().

+ Here is the call graph for this function:

◆ deassignUserFromLocalRole()

ilObjOrgUnit::deassignUserFromLocalRole (   $role_id,
  $user_id 
)

Deassign a given user to a given local role.

Parameters
int$role_id
int$user_id
Returns
bool

Definition at line 366 of file class.ilObjOrgUnit.php.

366 {
367 global $rbacreview, $rbacadmin, $ilAppEventHandler;
368
369 $arrLocalRoles = $rbacreview->getLocalRoles($this->getRefId());
370 if (!in_array($role_id, $arrLocalRoles)) {
371 return false;
372 }
373
374 $return = $rbacadmin->deassignUser($role_id, $user_id);
375
376 $ilAppEventHandler->raise('Modules/OrgUnit', 'deassignUserFromLocalRole', array(
377 'object' => $this,
378 'obj_id' => $this->getId(),
379 'ref_id' => $this->getRefId(),
380 'role_id' => $role_id,
381 'user_id' => $user_id,
382 ));
383
384 return $return;
385 }

References ilObject\getId(), and ilObject\getRefId().

+ Here is the call graph for this function:

◆ deassignUserFromSuperiorRole()

ilObjOrgUnit::deassignUserFromSuperiorRole (   $user_id)

Definition at line 316 of file class.ilObjOrgUnit.php.

316 {
317 global $rbacadmin, $ilAppEventHandler;
318 $rbacadmin->deassignUser($this->getSuperiorRole(), $user_id);
319
320 $ilAppEventHandler->raise('Modules/OrgUnit', 'deassignUserFromSuperiorRole', array(
321 'object' => $this,
322 'obj_id' => $this->getId(),
323 'ref_id' => $this->getRefId(),
324 'role_id' => $this->getSuperiorRole(),
325 'user_id' => $user_id,
326 ));
327 }

References ilObject\getId(), ilObject\getRefId(), and getSuperiorRole().

+ Here is the call graph for this function:

◆ delete()

ilObjOrgUnit::delete ( )

delete category and all related data

@access public

Returns
boolean true if all object data were removed; false if only a references were removed

Reimplemented from ilObject.

Definition at line 524 of file class.ilObjOrgUnit.php.

524 {
525 global $ilDB, $ilAppEventHandler;
526
527 // always call parent delete function first!!
528 if (!parent::delete()) {
529 return false;
530 }
531
532 // put here category specific stuff
533 include_once('./Services/User/classes/class.ilObjUserFolder.php');
535
536 $query = "DELETE FROM object_translation WHERE obj_id = "
537 . $ilDB->quote($this->getId(), 'integer');
538 $ilDB->manipulate($query);
539
540 $ilAppEventHandler->raise('Modules/OrgUnit', 'delete', array(
541 'object' => $this,
542 'obj_id' => $this->getId(),
543 ));
544
545 $sql = 'DELETE FROM ' . self::TABLE_NAME . ' WHERE orgu_id = '
546 . $ilDB->quote($this->getId(), 'integer');
547 $ilDB->manipulate($sql);
548
549 if (!$this->employee_role || !$this->superior_role) {
550 $this->doLoadRoles();
551 }
552 $emp = new ilObjRole($this->employee_role);
553 $emp->setParent($this->getRefId());
554 $emp->delete();
555 $sup = new ilObjRole($this->superior_role);
556 $sup->setParent($this->getRefId());
557 $sup->delete();
558
559 return true;
560 }
const USER_FOLDER_ID
Class ilObjUserFolder.
Class ilObjRole.
static _updateUserFolderAssignment($a_old_id, $a_new_id)
Update user folder assignment Typically called after deleting a category with local user accounts.

References $ilDB, $query, ilObjUserFolder\_updateUserFolderAssignment(), doLoadRoles(), ilObject\getId(), ilObject\getRefId(), and USER_FOLDER_ID.

+ Here is the call graph for this function:

◆ deleteTranslation()

ilObjOrgUnit::deleteTranslation (   $a_lang)

Definition at line 574 of file class.ilObjOrgUnit.php.

574 {
575 global $ilDB;
576
577 $query = "DELETE FROM object_translation WHERE obj_id= "
578 . $ilDB->quote($this->getId(), 'integer') . " AND lang_code = "
579 . $ilDB->quote($a_lang, 'text');
580 $res = $ilDB->manipulate($query);
581 }

References $ilDB, $query, $res, and ilObject\getId().

+ Here is the call graph for this function:

◆ doLoadRoles()

ilObjOrgUnit::doLoadRoles ( )
private

Definition at line 247 of file class.ilObjOrgUnit.php.

247 {
248 global $ilDB;
249 if (!$this->employee_role || !$this->superior_role) {
250 $q = "SELECT obj_id, title FROM object_data WHERE title LIKE 'il_orgu_employee_"
251 . $ilDB->quote($this->getRefId(), "integer") . "' OR title LIKE 'il_orgu_superior_"
252 . $ilDB->quote($this->getRefId(), "integer") . "'";
253 $set = $ilDB->query($q);
254 while ($res = $ilDB->fetchAssoc($set)) {
255 if ($res["title"] == "il_orgu_employee_" . $this->getRefId()) {
256 $this->employee_role = $res["obj_id"];
257 } elseif ($res["title"] == "il_orgu_superior_" . $this->getRefId()) {
258 $this->superior_role = $res["obj_id"];
259 }
260 }
261
262 if (!$this->employee_role || !$this->superior_role) {
263 throw new Exception("The standard roles the orgu object with id: " . $this->getId()
264 . " aren't initialized or have been deleted!");
265 }
266 }
267 }

References $ilDB, $res, ilObject\getId(), and ilObject\getRefId().

Referenced by delete(), and loadRoles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEmployeeRole()

ilObjOrgUnit::getEmployeeRole ( )
Returns
int

Definition at line 404 of file class.ilObjOrgUnit.php.

404 {
405 $this->loadRoles();
406
408 }

References $employee_role, and loadRoles().

Referenced by assignUsersToEmployeeRole(), and deassignUserFromEmployeeRole().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLongDescription()

ilObjOrgUnit::getLongDescription ( )

get object long description (stored in object_description)

@access public

Returns
string object description

Reimplemented from ilObject.

Definition at line 471 of file class.ilObjOrgUnit.php.

471 {
472 if (parent::getTitle() == "__OrgUnitAdministration") {
473 return $this->lng->txt("obj_orgu_description");
474 } else {
475 return parent::getLongDescription();
476 }
477 }

◆ getOrgUnitType()

ilObjOrgUnit::getOrgUnitType ( )
Returns
ilOrgUnitType|null

Definition at line 119 of file class.ilObjOrgUnit.php.

119 {
121 }
static getInstance($a_id)
Public.

References ilOrgUnitType\getInstance(), and getOrgUnitTypeId().

Referenced by update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOrgUnitTypeId()

ilObjOrgUnit::getOrgUnitTypeId ( )
Returns
int

Definition at line 111 of file class.ilObjOrgUnit.php.

111 {
112 return $this->orgu_type_id;
113 }

References $orgu_type_id.

Referenced by create(), getOrgUnitType(), and update().

+ Here is the caller graph for this function:

◆ getRootOrgId()

static ilObjOrgUnit::getRootOrgId ( )
static

Definition at line 205 of file class.ilObjOrgUnit.php.

205 {
207
208 return self::$root_id;
209 }
static loadRootOrgRefIdAndId()

References $root_id, and loadRootOrgRefIdAndId().

Referenced by ilOrgUnitExporter\sendAndCreateSimpleExportFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRootOrgRefId()

◆ getSuperiorRole()

ilObjOrgUnit::getSuperiorRole ( )
Returns
int

Definition at line 422 of file class.ilObjOrgUnit.php.

422 {
423 $this->loadRoles();
424
426 }

References $superior_role, and loadRoles().

Referenced by assignUsersToSuperiorRole(), and deassignUserFromSuperiorRole().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ilObjOrgUnit::getTitle ( )

Return title.

Returns
string

Reimplemented from ilObject.

Definition at line 456 of file class.ilObjOrgUnit.php.

456 {
457 if (parent::getTitle() != "__OrgUnitAdministration") {
458 return parent::getTitle();
459 } else {
460 return $this->lng->txt("objs_orgu");
461 }
462 }

Referenced by getTranslations().

+ Here is the caller graph for this function:

◆ getTranslations()

ilObjOrgUnit::getTranslations ( )
Returns
array This catches if by some means there is no translation.

Definition at line 483 of file class.ilObjOrgUnit.php.

483 {
484 global $lng, $ilDB;
485
486 $q = "SELECT * FROM object_translation WHERE obj_id = "
487 . $ilDB->quote($this->getId(), 'integer') . " ORDER BY lang_default DESC";
488 $r = $this->ilias->db->query($q);
489
490 $num = 0;
491 $data = array();
492 while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT)) {
493 $data["Fobject"][$num] = array(
494 "title" => $row->title,
495 "desc" => $row->description,
496 "lang" => $row->lang_code,
497 'lang_default' => $row->lang_default,
498 );
499 $num ++;
500 }
501
502 $translations = $data;
503
504 if (!count($translations["Fobject"])) {
505 $this->addTranslation($this->getTitle(), "", $lng->getDefaultLanguage(), true);
506 $translations["Fobject"][] = array(
507 "title" => $this->getTitle(),
508 "desc" => "",
509 "lang" => $lng->getDefaultLanguage(),
510 );
511 }
512
513 return $translations;
514 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
getTitle()
Return title.
addTranslation($a_title, $a_desc, $a_lang, $a_lang_default)
$data
$r
Definition: example_031.php:79
redirection script todo: (a better solution should control the processing via a xml file)

References $data, $ilDB, ilObject\$lng, $r, $row, addTranslation(), DB_FETCHMODE_OBJECT, ilObject\getId(), and getTitle().

+ Here is the call graph for this function:

◆ initDefaultRoles()

ilObjOrgUnit::initDefaultRoles ( )

init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) @access public

Returns
array empty array

Reimplemented from ilObject.

Definition at line 429 of file class.ilObjOrgUnit.php.

429 {
430 global $ilAppEventHandler;
431
432 include_once './Services/AccessControl/classes/class.ilObjRole.php';
433 $role_emp = ilObjRole::createDefaultRole('il_orgu_employee_'
434 . $this->getRefId(), "Emplyee of org unit obj_no."
435 . $this->getId(), 'il_orgu_employee', $this->getRefId());
436
437 $role_sup = ilObjRole::createDefaultRole('il_orgu_superior_'
438 . $this->getRefId(), "Superior of org unit obj_no."
439 . $this->getId(), 'il_orgu_superior', $this->getRefId());
440
441 $ilAppEventHandler->raise('Modules/OrgUnit', 'initDefaultRoles', array(
442 'object' => $this,
443 'obj_id' => $this->getId(),
444 'ref_id' => $this->getRefId(),
445 'role_superior_id' => $role_sup->getId(),
446 'role_employee_id' => $role_emp->getId(),
447 ));
448 }
static createDefaultRole($a_title, $a_description, $a_tpl_name, $a_ref_id)

References ilObjRole\createDefaultRole(), ilObject\getId(), and ilObject\getRefId().

Referenced by loadRoles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadRoles()

ilObjOrgUnit::loadRoles ( )
private

Definition at line 226 of file class.ilObjOrgUnit.php.

226 {
227 global $ilLog;
228 if (!$this->employee_role || !$this->superior_role) {
229 $this->doLoadRoles();
230 }
231
232 if (!$this->employee_role || !$this->superior_role) {
233 $this->initDefaultRoles();
234 $this->doLoadRoles();
235 if (!$this->employee_role || !$this->superior_role) {
236 throw new Exception("The standard roles the orgu object with id: " . $this->getId()
237 . " aren't initialized or have been deleted, newly creating them didn't work!");
238 } else {
239 $ilLog->write("[" . __FILE__ . ":" . __LINE__
240 . "] The standard roles for the orgu obj with id: " . $this->getId()
241 . " were newly created as they couldnt be found.");
242 }
243 }
244 }
initDefaultRoles()
init default roles settings Purpose of this function is to create a local role folder and local roles...

References $ilLog, doLoadRoles(), ilObject\getId(), and initDefaultRoles().

Referenced by getEmployeeRole(), and getSuperiorRole().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadRootOrgRefIdAndId()

static ilObjOrgUnit::loadRootOrgRefIdAndId ( )
staticprivate

Definition at line 212 of file class.ilObjOrgUnit.php.

212 {
213 if (self::$root_ref_id === null || self::$root_id === null) {
214 global $ilDB;
215 $q = "SELECT o.obj_id, r.ref_id FROM object_data o
216 INNER JOIN object_reference r ON r.obj_id = o.obj_id
217 WHERE title = " . $ilDB->quote('__OrgUnitAdministration', 'text') . "";
218 $set = $ilDB->query($q);
219 $res = $ilDB->fetchAssoc($set);
220 self::$root_id = $res["obj_id"];
221 self::$root_ref_id = $res["ref_id"];
222 }
223 }

References $ilDB, and $res.

Referenced by getRootOrgId(), and getRootOrgRefId().

+ Here is the caller graph for this function:

◆ removeTranslations()

ilObjOrgUnit::removeTranslations ( )

Definition at line 564 of file class.ilObjOrgUnit.php.

564 {
565 global $ilDB;
566
567 $query = "DELETE FROM object_translation WHERE obj_id= "
568 . $ilDB->quote($this->getId(), 'integer');
569 $res = $ilDB->manipulate($query);
570 }

References $ilDB, $query, $res, and ilObject\getId().

+ Here is the call graph for this function:

◆ setEmployeeRole()

ilObjOrgUnit::setEmployeeRole (   $employee_role)
Parameters
int$employee_role

Definition at line 391 of file class.ilObjOrgUnit.php.

391 {
392 $this->employee_role = $employee_role;
393 }

References $employee_role.

◆ setOrgUnitTypeId()

ilObjOrgUnit::setOrgUnitTypeId (   $a_id)
Parameters
$a_id

Definition at line 127 of file class.ilObjOrgUnit.php.

127 {
128 $this->orgu_type_id = $a_id;
129 }

◆ setSuperiorRole()

ilObjOrgUnit::setSuperiorRole (   $superior_role)
Parameters
int$superior_role

Definition at line 414 of file class.ilObjOrgUnit.php.

414 {
415 $this->superior_role = $superior_role;
416 }

References $superior_role.

◆ update()

ilObjOrgUnit::update ( )

Update.

Reimplemented from ilContainer.

Definition at line 79 of file class.ilObjOrgUnit.php.

79 {
80 global $ilDB;
81 parent::update();
82 $sql = 'SELECT * FROM ' . self::TABLE_NAME . ' WHERE orgu_id = '
83 . $ilDB->quote($this->getId(), 'integer');
84 $set = $ilDB->query($sql);
85 if ($ilDB->numRows($set)) {
86 $ilDB->update(self::TABLE_NAME, array(
87 'orgu_type_id' => array( 'integer', $this->getOrgUnitTypeId() ),
88 ), array(
89 'orgu_id' => array( 'integer', $this->getId() ),
90 ));
91 } else {
92 $ilDB->insert(self::TABLE_NAME, array(
93 'orgu_type_id' => array( 'integer', $this->getOrgUnitTypeId() ),
94 'orgu_id' => array( 'integer', $this->getId() ),
95 ));
96 }
97 // Update selection for advanced meta data of the type
98 if ($this->getOrgUnitTypeId()) {
100 ->getAssignedAdvancedMDRecordIds());
101 } else {
102 // If no type is assigned, delete relations by passing an empty array
103 ilAdvancedMDRecord::saveObjRecSelection($this->getId(), 'orgu_type', array());
104 }
105 }
static saveObjRecSelection($a_obj_id, $a_sub_type="", array $a_records=null, $a_delete_before=true)
Save repository object record selection.

References $ilDB, ilObject\getId(), getOrgUnitType(), getOrgUnitTypeId(), and ilAdvancedMDRecord\saveObjRecSelection().

+ Here is the call graph for this function:

◆ updateTranslation()

ilObjOrgUnit::updateTranslation (   $a_title,
  $a_desc,
  $a_lang,
  $a_lang_default 
)

Definition at line 604 of file class.ilObjOrgUnit.php.

604 {
605 global $ilDB, $ilLog;
606
607 if (empty($a_title)) {
608 $a_title = "NO TITLE";
609 }
610
611 $query = "UPDATE object_translation SET ";
612
613 $query .= " title = " . $ilDB->quote($a_title, 'text');
614
615 if ($a_desc != "") {
616 $query .= ", description = " . $ilDB->quote($a_desc, 'text') . " ";
617 }
618
619 if ($a_lang_default) {
620 $query .= ", lang_default = " . $ilDB->quote($a_lang_default, 'integer') . " ";
621 }
622
623 $query .= " WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer') . " AND lang_code = "
624 . $ilDB->quote($a_lang, 'text');
625 $res = $ilDB->manipulate($query);
626
627 return true;
628 }

References $ilDB, $ilLog, $query, $res, and ilObject\getId().

+ Here is the call graph for this function:

Field Documentation

◆ $amd_data

ilObjOrgUnit::$amd_data
protected

Definition at line 42 of file class.ilObjOrgUnit.php.

◆ $employee_role

ilObjOrgUnit::$employee_role
protected

Definition at line 23 of file class.ilObjOrgUnit.php.

Referenced by getEmployeeRole(), and setEmployeeRole().

◆ $icons_cache

ilObjOrgUnit::$icons_cache
staticprotected

Definition at line 30 of file class.ilObjOrgUnit.php.

◆ $orgu_type_id

ilObjOrgUnit::$orgu_type_id = 0
protected

Definition at line 36 of file class.ilObjOrgUnit.php.

Referenced by getOrgUnitTypeId().

◆ $root_id

ilObjOrgUnit::$root_id
staticprotected

Definition at line 22 of file class.ilObjOrgUnit.php.

Referenced by getRootOrgId().

◆ $root_ref_id

ilObjOrgUnit::$root_ref_id
staticprotected

Definition at line 21 of file class.ilObjOrgUnit.php.

Referenced by getRootOrgRefId().

◆ $superior_role

ilObjOrgUnit::$superior_role
protected

Definition at line 24 of file class.ilObjOrgUnit.php.

Referenced by getSuperiorRole(), and setSuperiorRole().

◆ TABLE_NAME

const ilObjOrgUnit::TABLE_NAME = 'orgu_data'

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


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