ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ()
 
 update ()
 
 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 ()
 
 getTitle ()
 Return title. More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getTranslations ()
 
 delete ()
 delete category and all related data More...
 
 removeTranslations ()
 remove all Translations of current OrgUnit More...
 
 deleteTranslation ($a_lang)
 remove translations of current OrgUnit More...
 
 addTranslation ($a_title, $a_desc, $a_lang, $a_lang_default)
 add a new translation to current OrgUnit More...
 
 updateTranslation ($a_title, $a_desc, $a_lang, $a_lang_default)
 update a translation to current OrgUnit More...
 
 writePath ()
 
- Public Member Functions inherited from ilContainer
 __construct ($a_id=0, $a_reference=true)
 
 createContainerDirectory ()
 Create directory for the container. More...
 
 getContainerDirectory ()
 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...
 
 setNewsTimeline ($a_val)
 Set news timeline. More...
 
 getNewsTimeline ()
 Get news timeline. More...
 
 setNewsTimelineAutoEntries ($a_val)
 Set news timeline auto entries. More...
 
 getNewsTimelineAutoEntries ()
 Get news timeline auto entries. More...
 
 setNewsTimelineLandingPage ($a_val)
 Set news timline is landing page. More...
 
 getNewsTimelineLandingPage ()
 Get news timline is landing page. More...
 
 isNewsTimelineEffective ()
 Is news timeline effective? More...
 
 isNewsTimelineLandingPageEffective ()
 Is news timeline landing page effective? More...
 
 setNewsBlockActivated ($a_val)
 Set news block activated. More...
 
 getNewsBlockActivated ()
 Get news block activated. More...
 
 setUseNews ($a_val)
 Set use news. More...
 
 getUseNews ()
 Get use news. More...
 
 saveIcons ($a_custom_icon)
 save container icons More...
 
 removeCustomIcon ()
 remove small icon More...
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 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...
 
 readContainerSettings ()
 Read container settings. More...
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title 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 ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. 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...
 
 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) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. 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...
 
 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, $type="orgu")
 
- Static Public Member Functions inherited from ilContainer
static _getContainerDirectory ($a_id)
 Get the container directory. More...
 
static _lookupContainerSetting ($a_id, $a_keyword, $a_default_value=NULL)
 Lookup a container setting. More...
 
static _writeContainerSetting ($a_id, $a_keyword, $a_value)
 
static _getContainerSettings ($a_id)
 
static _deleteContainerSettings ($a_id, $a_keyword=null, $a_keyword_like=false)
 
static _exportContainerSettings (ilXmlWriter $a_xml, $a_obj_id)
 
static _lookupIconPath ($a_id, $a_size="big")
 lookup icon path More...
 
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 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data 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 _lookupCreationDate ($a_id)
 Lookup creation date. 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
 

Protected Attributes

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

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
 
- Static Protected Member Functions inherited from ilContainer
static fixInternalLinksAfterCopy ($a_target_id, $a_copy_id, $a_source_ref_id)
 Fix internal links after copy process. More...
 

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 64 of file class.ilObjOrgUnit.php.

References $DIC, $ilDB, ilObject\getId(), ilContainer\read(), and setOrgUnitTypeId().

64  {
65  $this->type = "orgu";
66  parent::__construct($a_id, $a_call_by_reference);
67  }
+ Here is the call graph for this function:

Member Function Documentation

◆ _exists()

static ilObjOrgUnit::_exists (   $a_id,
  $a_reference = false,
  $type = "orgu" 
)
static
Parameters
$a_id
bool$a_reference
string$type
Returns
bool

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

Referenced by ilOrgUnitImporter\buildRef().

444  {
445  return parent::_exists($a_id, $a_reference, "orgu");
446  }
+ Here is the caller graph for this function:

◆ addTranslation()

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

add a new translation to current OrgUnit

Parameters
$a_title
$a_desc
$a_lang
$a_lang_default
Returns
bool

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

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

Referenced by getTranslations().

661  {
662  global $DIC;
663  $ilDB = $DIC['ilDB'];
664 
665  if (empty($a_title)) {
666  $a_title = "NO TITLE";
667  }
668 
669  $query = "INSERT INTO object_translation "
670  . "(obj_id,title,description,lang_code,lang_default) " . "VALUES " . "("
671  . $ilDB->quote($this->getId(), 'integer') . "," . $ilDB->quote($a_title, 'text')
672  . "," . $ilDB->quote($a_desc, 'text') . "," . $ilDB->quote($a_lang, 'text') . ","
673  . $ilDB->quote($a_lang_default, 'integer') . ")";
674  $res = $ilDB->manipulate($query);
675 
676  return true;
677  }
getId()
get object id public
global $ilDB
global $DIC
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignUsersToEmployeeRole()

ilObjOrgUnit::assignUsersToEmployeeRole (   $user_ids)

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

References $DIC, array, getEmployeeRole(), ilObject\getId(), and ilObject\getRefId().

298  {
299  global $DIC;
300  $rbacadmin = $DIC['rbacadmin'];
301  $ilAppEventHandler = $DIC['ilAppEventHandler'];
302  foreach ($user_ids as $user_id) {
303  $rbacadmin->assignUser($this->getEmployeeRole(), $user_id);
304 
305  $ilAppEventHandler->raise('Modules/OrgUnit', 'assignUsersToEmployeeRole', array(
306  'object' => $this,
307  'obj_id' => $this->getId(),
308  'ref_id' => $this->getRefId(),
309  'role_id' => $this->getEmployeeRole(),
310  'user_id' => $user_id,
311  ));
312  }
313  }
getId()
get object id public
Create styles array
The data for the language used.
getRefId()
get reference id public
global $DIC
+ Here is the call graph for this function:

◆ assignUsersToSuperiorRole()

ilObjOrgUnit::assignUsersToSuperiorRole (   $user_ids)

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

References $DIC, array, ilObject\getId(), ilObject\getRefId(), and getSuperiorRole().

316  {
317  global $DIC;
318  $rbacadmin = $DIC['rbacadmin'];
319  $ilAppEventHandler = $DIC['ilAppEventHandler'];
320  foreach ($user_ids as $user_id) {
321  $rbacadmin->assignUser($this->getSuperiorRole(), $user_id);
322 
323  $ilAppEventHandler->raise('Modules/OrgUnit', 'assignUsersToSuperiorRole', array(
324  'object' => $this,
325  'obj_id' => $this->getId(),
326  'ref_id' => $this->getRefId(),
327  'role_id' => $this->getSuperiorRole(),
328  'user_id' => $user_id,
329  ));
330  }
331  }
getId()
get object id public
Create styles array
The data for the language used.
getRefId()
get reference id public
global $DIC
+ 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 373 of file class.ilObjOrgUnit.php.

References $DIC, array, ilObject\getId(), and ilObject\getRefId().

373  {
374  global $DIC;
375  $rbacreview = $DIC['rbacreview'];
376  $rbacadmin = $DIC['rbacadmin'];
377  $ilAppEventHandler = $DIC['ilAppEventHandler'];
378 
379  $arrLocalRoles = $rbacreview->getLocalRoles($this->getRefId());
380  if (!in_array($role_id, $arrLocalRoles)) {
381  return false;
382  }
383 
384  $return = $rbacadmin->assignUser($role_id, $user_id);
385 
386  $ilAppEventHandler->raise('Modules/OrgUnit', 'assignUserToLocalRole', array(
387  'object' => $this,
388  'obj_id' => $this->getId(),
389  'ref_id' => $this->getRefId(),
390  'role_id' => $role_id,
391  'user_id' => $user_id,
392  ));
393 
394  return $return;
395  }
getId()
get object id public
Create styles array
The data for the language used.
getRefId()
get reference id public
global $DIC
+ Here is the call graph for this function:

◆ create()

ilObjOrgUnit::create ( )

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

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

85  {
86  global $DIC;
87  $ilDB = $DIC['ilDB'];
88  parent::create();
89  $ilDB->insert(self::TABLE_NAME, array(
90  'orgu_type_id' => array( 'integer', $this->getOrgUnitTypeId() ),
91  'orgu_id' => array( 'integer', $this->getId() ),
92  ));
93  }
getId()
get object id public
Create styles array
The data for the language used.
global $ilDB
global $DIC
+ Here is the call graph for this function:

◆ deassignUserFromEmployeeRole()

ilObjOrgUnit::deassignUserFromEmployeeRole (   $user_id)

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

References $DIC, array, getEmployeeRole(), ilObject\getId(), and ilObject\getRefId().

334  {
335  global $DIC;
336  $rbacadmin = $DIC['rbacadmin'];
337  $ilAppEventHandler = $DIC['ilAppEventHandler'];
338  $rbacadmin->deassignUser($this->getEmployeeRole(), $user_id);
339 
340  $ilAppEventHandler->raise('Modules/OrgUnit', 'deassignUserFromEmployeeRole', array(
341  'object' => $this,
342  'obj_id' => $this->getId(),
343  'ref_id' => $this->getRefId(),
344  'role_id' => $this->getEmployeeRole(),
345  'user_id' => $user_id,
346  ));
347  }
getId()
get object id public
Create styles array
The data for the language used.
getRefId()
get reference id public
global $DIC
+ 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 405 of file class.ilObjOrgUnit.php.

References $DIC, array, ilObject\getId(), and ilObject\getRefId().

405  {
406  global $DIC;
407  $rbacreview = $DIC['rbacreview'];
408  $rbacadmin = $DIC['rbacadmin'];
409  $ilAppEventHandler = $DIC['ilAppEventHandler'];
410 
411  $arrLocalRoles = $rbacreview->getLocalRoles($this->getRefId());
412  if (!in_array($role_id, $arrLocalRoles)) {
413  return false;
414  }
415 
416  $return = $rbacadmin->deassignUser($role_id, $user_id);
417 
418  $ilAppEventHandler->raise('Modules/OrgUnit', 'deassignUserFromLocalRole', array(
419  'object' => $this,
420  'obj_id' => $this->getId(),
421  'ref_id' => $this->getRefId(),
422  'role_id' => $role_id,
423  'user_id' => $user_id,
424  ));
425 
426  return $return;
427  }
getId()
get object id public
Create styles array
The data for the language used.
getRefId()
get reference id public
global $DIC
+ Here is the call graph for this function:

◆ deassignUserFromSuperiorRole()

ilObjOrgUnit::deassignUserFromSuperiorRole (   $user_id)

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

References $DIC, array, ilObject\getId(), ilObject\getRefId(), and getSuperiorRole().

350  {
351  global $DIC;
352  $rbacadmin = $DIC['rbacadmin'];
353  $ilAppEventHandler = $DIC['ilAppEventHandler'];
354  $rbacadmin->deassignUser($this->getSuperiorRole(), $user_id);
355 
356  $ilAppEventHandler->raise('Modules/OrgUnit', 'deassignUserFromSuperiorRole', array(
357  'object' => $this,
358  'obj_id' => $this->getId(),
359  'ref_id' => $this->getRefId(),
360  'role_id' => $this->getSuperiorRole(),
361  'user_id' => $user_id,
362  ));
363  }
getId()
get object id public
Create styles array
The data for the language used.
getRefId()
get reference id public
global $DIC
+ Here is the call graph for this function:

◆ delete()

ilObjOrgUnit::delete ( )

delete category and all related data

public

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

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

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

577  {
578  global $DIC;
579  $ilDB = $DIC['ilDB'];
580  $ilAppEventHandler = $DIC['ilAppEventHandler'];
581 
582  // always call parent delete function first!!
583  if (!parent::delete()) {
584  return false;
585  }
586 
587  // put here category specific stuff
588  include_once('./Services/User/classes/class.ilObjUserFolder.php');
590 
591  $query = "DELETE FROM object_translation WHERE obj_id = "
592  . $ilDB->quote($this->getId(), 'integer');
593  $res = $ilDB->manipulate($query);
594 
595  $ilAppEventHandler->raise('Modules/OrgUnit', 'delete', array(
596  'object' => $this,
597  'obj_id' => $this->getId(),
598  ));
599 
600  $sql = 'DELETE FROM ' . self::TABLE_NAME . ' WHERE orgu_id = '
601  . $ilDB->quote($this->getId(), 'integer');
602  $ilDB->manipulate($sql);
603 
604  $path = ilOrgUnitPathStorage::find($this->getRefId());
605  if ($path instanceof ilOrgUnitPathStorage) {
606  $path->delete();
607  }
608 
609  if (!$this->employee_role || !$this->superior_role) {
610  $this->doLoadRoles();
611  }
612  $emp = new ilObjRole($this->employee_role);
613  $emp->setParent($this->getRefId());
614  $emp->delete();
615  $sup = new ilObjRole($this->superior_role);
616  $sup->setParent($this->getRefId());
617  $sup->delete();
618 
619  return true;
620  }
Class ilObjRole.
static _updateUserFolderAssignment($a_old_id, $a_new_id)
Update user folder assignment Typically called after deleting a category with local user accounts...
$path
Definition: aliased.php:25
Class ilOrgUnitPathStorage.
getId()
get object id public
Create styles array
The data for the language used.
global $ilDB
getRefId()
get reference id public
const USER_FOLDER_ID
Class ilObjUserFolder.
global $DIC
+ Here is the call graph for this function:

◆ deleteTranslation()

ilObjOrgUnit::deleteTranslation (   $a_lang)

remove translations of current OrgUnit

Parameters
$a_langstring en|de|...

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

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

641  {
642  global $DIC;
643  $ilDB = $DIC['ilDB'];
644 
645  $query = "DELETE FROM object_translation WHERE obj_id= "
646  . $ilDB->quote($this->getId(), 'integer') . " AND lang_code = "
647  . $ilDB->quote($a_lang, 'text');
648  $res = $ilDB->manipulate($query);
649  }
getId()
get object id public
global $ilDB
global $DIC
+ Here is the call graph for this function:

◆ doLoadRoles()

ilObjOrgUnit::doLoadRoles ( )
private

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

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

Referenced by delete(), and loadRoles().

274  {
275  global $DIC;
276  $ilDB = $DIC['ilDB'];
277  if (!$this->employee_role || !$this->superior_role) {
278  $q = "SELECT obj_id, title FROM object_data WHERE title = 'il_orgu_employee_"
279  . $ilDB->quote($this->getRefId(), "integer") . "' OR title = 'il_orgu_superior_"
280  . $ilDB->quote($this->getRefId(), "integer") . "'";
281  $set = $ilDB->query($q);
282  while ($res = $ilDB->fetchAssoc($set)) {
283  if ($res["title"] == "il_orgu_employee_" . $this->getRefId()) {
284  $this->employee_role = $res["obj_id"];
285  } elseif ($res["title"] == "il_orgu_superior_" . $this->getRefId()) {
286  $this->superior_role = $res["obj_id"];
287  }
288  }
289 
290  if (!$this->employee_role || !$this->superior_role) {
291  throw new Exception("The standard roles the orgu object with id: " . $this->getId()
292  . " aren't initialized or have been deleted!");
293  }
294  }
295  }
getId()
get object id public
global $ilDB
getRefId()
get reference id public
global $DIC
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEmployeeRole()

ilObjOrgUnit::getEmployeeRole ( )
Returns
int

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

References $employee_role, and loadRoles().

Referenced by assignUsersToEmployeeRole(), and deassignUserFromEmployeeRole().

452  {
453  $this->loadRoles();
454 
455  return $this->employee_role;
456  }
+ 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)

public

Returns
string object description

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

520  {
521  if (parent::getTitle() == "__OrgUnitAdministration") {
522  return $this->lng->txt("obj_orgu_description");
523  } else {
524  return parent::getLongDescription();
525  }
526  }

◆ getOrgUnitType()

ilObjOrgUnit::getOrgUnitType ( )
Returns
ilOrgUnitType|null

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

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

Referenced by update().

137  {
139  }
static getInstance($a_id)
Public.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOrgUnitTypeId()

ilObjOrgUnit::getOrgUnitTypeId ( )
Returns
int

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

References $orgu_type_id.

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

129  {
130  return $this->orgu_type_id;
131  }
+ Here is the caller graph for this function:

◆ getRootOrgId()

static ilObjOrgUnit::getRootOrgId ( )
static
Returns
int

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

Referenced by ilOrgUnitExporter\sendAndCreateSimpleExportFile().

230  {
231  self::loadRootOrgRefIdAndId();
232 
233  return self::$root_id;
234  }
+ Here is the caller graph for this function:

◆ getRootOrgRefId()

◆ getSuperiorRole()

ilObjOrgUnit::getSuperiorRole ( )
Returns
int

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

References $superior_role, and loadRoles().

Referenced by assignUsersToSuperiorRole(), and deassignUserFromSuperiorRole().

470  {
471  $this->loadRoles();
472 
473  return $this->superior_role;
474  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ilObjOrgUnit::getTitle ( )

Return title.

Returns
string

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

Referenced by getTranslations().

505  {
506  if (parent::getTitle() != "__OrgUnitAdministration") {
507  return parent::getTitle();
508  } else {
509  return $this->lng->txt("objs_orgu");
510  }
511  }
+ 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 532 of file class.ilObjOrgUnit.php.

References $data, $DIC, $ilDB, ilObject\$lng, $r, $row, addTranslation(), array, ilDBConstants\FETCHMODE_OBJECT, ilObject\getId(), and getTitle().

532  {
533  global $DIC;
534  $lng = $DIC['lng'];
535  $ilDB = $DIC['ilDB'];
536 
537  $translations = array();
538 
539  $q = "SELECT * FROM object_translation WHERE obj_id = "
540  . $ilDB->quote($this->getId(), 'integer') . " ORDER BY lang_default DESC";
541  $r = $this->ilias->db->query($q);
542 
543  $num = 0;
544 
545  while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
546  $data["Fobject"][$num] = array(
547  "title" => $row->title,
548  "desc" => $row->description,
549  "lang" => $row->lang_code,
550  'lang_default' => $row->lang_default,
551  );
552  $num ++;
553  }
554 
555  $translations = $data;
556 
557  if (!count($translations["Fobject"])) {
558  $this->addTranslation($this->getTitle(), "", $lng->getDefaultLanguage(), true);
559  $translations["Fobject"][] = array(
560  "title" => $this->getTitle(),
561  "desc" => "",
562  "lang" => $lng->getDefaultLanguage(),
563  );
564  }
565 
566  return $translations;
567  }
$r
Definition: example_031.php:79
addTranslation($a_title, $a_desc, $a_lang, $a_lang_default)
add a new translation to current OrgUnit
getId()
get object id public
getTitle()
Return title.
redirection script todo: (a better solution should control the processing via a xml file) ...
Create styles array
The data for the language used.
global $ilDB
global $DIC
+ Here is the call graph for this function:

◆ initDefaultRoles()

ilObjOrgUnit::initDefaultRoles ( )

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

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

Referenced by loadRoles().

477  {
478  global $DIC;
479  $ilAppEventHandler = $DIC['ilAppEventHandler'];
480 
481  include_once './Services/AccessControl/classes/class.ilObjRole.php';
482  $role_emp = ilObjRole::createDefaultRole('il_orgu_employee_'
483  . $this->getRefId(), "Emplyee of org unit obj_no."
484  . $this->getId(), 'il_orgu_employee', $this->getRefId());
485 
486  $role_sup = ilObjRole::createDefaultRole('il_orgu_superior_'
487  . $this->getRefId(), "Superior of org unit obj_no."
488  . $this->getId(), 'il_orgu_superior', $this->getRefId());
489 
490  $ilAppEventHandler->raise('Modules/OrgUnit', 'initDefaultRoles', array(
491  'object' => $this,
492  'obj_id' => $this->getId(),
493  'ref_id' => $this->getRefId(),
494  'role_superior_id' => $role_sup->getId(),
495  'role_employee_id' => $role_emp->getId(),
496  ));
497  }
static createDefaultRole($a_title, $a_description, $a_tpl_name, $a_ref_id)
getId()
get object id public
Create styles array
The data for the language used.
getRefId()
get reference id public
global $DIC
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadRoles()

ilObjOrgUnit::loadRoles ( )
private

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

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

Referenced by getEmployeeRole(), and getSuperiorRole().

252  {
253  global $DIC;
254  $ilLog = $DIC['ilLog'];
255  if (!$this->employee_role || !$this->superior_role) {
256  $this->doLoadRoles();
257  }
258 
259  if (!$this->employee_role || !$this->superior_role) {
260  $this->initDefaultRoles();
261  $this->doLoadRoles();
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, newly creating them didn't work!");
265  } else {
266  $ilLog->write("[" . __FILE__ . ":" . __LINE__
267  . "] The standard roles for the orgu obj with id: " . $this->getId()
268  . " were newly created as they couldnt be found.");
269  }
270  }
271  }
getId()
get object id public
global $DIC
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadRootOrgRefIdAndId()

static ilObjOrgUnit::loadRootOrgRefIdAndId ( )
staticprivate

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

References $DIC, $ilDB, and $res.

237  {
238  if (self::$root_ref_id === null || self::$root_id === null) {
239  global $DIC;
240  $ilDB = $DIC['ilDB'];
241  $q = "SELECT o.obj_id, r.ref_id FROM object_data o
242  INNER JOIN object_reference r ON r.obj_id = o.obj_id
243  WHERE title = " . $ilDB->quote('__OrgUnitAdministration', 'text') . "";
244  $set = $ilDB->query($q);
245  $res = $ilDB->fetchAssoc($set);
246  self::$root_id = $res["obj_id"];
247  self::$root_ref_id = $res["ref_id"];
248  }
249  }
global $ilDB
global $DIC

◆ removeTranslations()

ilObjOrgUnit::removeTranslations ( )

remove all Translations of current OrgUnit

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

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

626  {
627  global $DIC;
628  $ilDB = $DIC['ilDB'];
629 
630  $query = "DELETE FROM object_translation WHERE obj_id= "
631  . $ilDB->quote($this->getId(), 'integer');
632  $res = $ilDB->manipulate($query);
633  }
getId()
get object id public
global $ilDB
global $DIC
+ Here is the call graph for this function:

◆ setEmployeeRole()

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

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

References $employee_role.

433  {
434  $this->employee_role = $employee_role;
435  }

◆ setOrgUnitTypeId()

ilObjOrgUnit::setOrgUnitTypeId (   $a_id)
Parameters
$a_id

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

References $amd_data, $DIC, $icons_cache, $ilDB, $row, ilObject\$type, array, ilObject\getId(), ilOrgUnitType\getInstance(), ilAdvancedMDValues\getInstancesForObjectId(), and getOrgUnitTypeId().

Referenced by __construct().

145  {
146  $this->orgu_type_id = $a_id;
147  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSuperiorRole()

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

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

References $superior_role.

462  {
463  $this->superior_role = $superior_role;
464  }

◆ update()

ilObjOrgUnit::update ( )

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

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

96  {
97  global $DIC;
98  $ilDB = $DIC['ilDB'];
99  parent::update();
100  $sql = 'SELECT * FROM ' . self::TABLE_NAME . ' WHERE orgu_id = '
101  . $ilDB->quote($this->getId(), 'integer');
102  $set = $ilDB->query($sql);
103  if ($ilDB->numRows($set)) {
104  $ilDB->update(self::TABLE_NAME, array(
105  'orgu_type_id' => array( 'integer', $this->getOrgUnitTypeId() ),
106  ), array(
107  'orgu_id' => array( 'integer', $this->getId() ),
108  ));
109  } else {
110  $ilDB->insert(self::TABLE_NAME, array(
111  'orgu_type_id' => array( 'integer', $this->getOrgUnitTypeId() ),
112  'orgu_id' => array( 'integer', $this->getId() ),
113  ));
114  }
115  // Update selection for advanced meta data of the type
116  if ($this->getOrgUnitTypeId()) {
117  ilAdvancedMDRecord::saveObjRecSelection($this->getId(), 'orgu_type', $this->getOrgUnitType()
118  ->getAssignedAdvancedMDRecordIds());
119  } else {
120  // If no type is assigned, delete relations by passing an empty array
121  ilAdvancedMDRecord::saveObjRecSelection($this->getId(), 'orgu_type', array());
122  }
123  }
static saveObjRecSelection($a_obj_id, $a_sub_type="", array $a_records=null, $a_delete_before=true)
Save repository object record selection.
getId()
get object id public
Create styles array
The data for the language used.
global $ilDB
global $DIC
+ Here is the call graph for this function:

◆ updateTranslation()

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

update a translation to current OrgUnit

Parameters
$a_title
$a_desc
$a_lang
$a_lang_default
Returns
bool

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

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

689  {
690  global $DIC;
691  $ilDB = $DIC['ilDB'];
692  $ilLog = $DIC['ilLog'];
693 
694  if (empty($a_title)) {
695  $a_title = "NO TITLE";
696  }
697 
698  $query = "UPDATE object_translation SET ";
699 
700  $query .= " title = " . $ilDB->quote($a_title, 'text');
701 
702  if ($a_desc != "") {
703  $query .= ", description = " . $ilDB->quote($a_desc, 'text') . " ";
704  }
705 
706  if ($a_lang_default) {
707  $query .= ", lang_default = " . $ilDB->quote($a_lang_default, 'integer') . " ";
708  }
709 
710  $query .= " WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer') . " AND lang_code = "
711  . $ilDB->quote($a_lang, 'text');
712  $res = $ilDB->manipulate($query);
713 
714  return true;
715  }
getId()
get object id public
global $ilDB
global $DIC
+ Here is the call graph for this function:

◆ writePath()

ilObjOrgUnit::writePath ( )

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

References ilObject\getRefId().

718  {
719  if ($this->getRefId()) {
720  ilOrgUnitPathStorage::writePathByRefId($this->getRefId());
721  }
722  }
getRefId()
get reference id public
+ Here is the call graph for this function:

Field Documentation

◆ $amd_data

ilObjOrgUnit::$amd_data
protected

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

Referenced by setOrgUnitTypeId().

◆ $employee_role

ilObjOrgUnit::$employee_role
protected

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

Referenced by getEmployeeRole(), and setEmployeeRole().

◆ $icons_cache

ilObjOrgUnit::$icons_cache
staticprotected

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

Referenced by setOrgUnitTypeId().

◆ $orgu_type_id

ilObjOrgUnit::$orgu_type_id = 0
protected

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

Referenced by getOrgUnitTypeId().

◆ $root_id

ilObjOrgUnit::$root_id
staticprotected

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

◆ $root_ref_id

ilObjOrgUnit::$root_ref_id
staticprotected

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

◆ $superior_role

ilObjOrgUnit::$superior_role
protected

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

Referenced by getSuperiorRole(), and setSuperiorRole().

◆ TABLE_NAME

const ilObjOrgUnit::TABLE_NAME = 'orgu_data'

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


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