ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilObjOrgUnit Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct (int $a_id=0, bool $a_call_by_reference=true)
 
 create ()
 
 update ()
 
 getOrgUnitTypeId ()
 
 getOrgUnitType ()
 
 setOrgUnitTypeId (int $a_id)
 
 assignUsersToEmployeeRole (array $user_ids)
 Adds the user ids to the position employee. More...
 
 assignUsersToSuperiorRole (array $user_ids)
 Adds the user ids to the position superior. More...
 
 deassignUserFromEmployeeRole (int $user_id)
 
 deassignUserFromSuperiorRole (int $user_id)
 
 assignUserToLocalRole (int $role_id, int $user_id)
 Assign a given user to a given local role. More...
 
 deassignUserFromLocalRole (int $role_id, int $user_id)
 Deassign a given user to a given local role. More...
 
 getTitle ()
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getTranslations ()
 
 delete ()
 delete orgunit, childs and all related data More...
 
 removeTranslations ()
 remove all Translations of current OrgUnit More...
 
 deleteTranslation (string $a_lang)
 remove translations of current OrgUnit More...
 
 addTranslation (string $a_title, string $a_desc, string $a_lang, string $a_lang_default)
 add a new translation to current OrgUnit More...
 
 updateTranslation (string $title, string $desc, string $lang, string $lang_default)
 update a translation to current OrgUnit More...
 
 writePath ()
 
- Public Member Functions inherited from ilContainer
 getTileSizes ()
 
 getObjectTranslation ()
 
 setObjectTranslation (?ilObjectTranslation $obj_trans)
 
 createContainerDirectory ()
 
 getContainerDirectory ()
 
 setHiddenFilesFound (bool $a_hiddenfilesfound)
 
 getHiddenFilesFound ()
 
 getStyleSheetId ()
 
 setStyleSheetId (int $a_style_id)
 
 setNewsTimeline (bool $a_val)
 
 getNewsTimeline ()
 
 setNewsTimelineAutoEntries (bool $a_val)
 
 getNewsTimelineAutoEntries ()
 
 setNewsTimelineLandingPage (bool $a_val)
 
 getNewsTimelineLandingPage ()
 
 isNewsTimelineEffective ()
 
 isNewsTimelineLandingPageEffective ()
 
 setNewsBlockActivated (bool $a_val)
 
 getNewsBlockActivated ()
 
 setUseNews (bool $a_val)
 
 getUseNews ()
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies (container sorting) More...
 
 cloneAllObject (string $session_id, string $client_id, string $new_type, int $ref_id, int $clone_source, array $options, bool $soap_call=false, int $a_submode=1)
 
 delete ()
 delete category and all related data More...
 
 getViewMode ()
 
 getOrderType ()
 
 setOrderType (int $a_value)
 
 isClassificationFilterActive ()
 
 filteredSubtree ()
 Note grp/crs currently allow to filter in their whole subtrees Catetories only their direct childs. More...
 
 getSubItems (bool $a_admin_panel_enabled=false, bool $a_include_side_block=false, int $a_get_single=0, ilContainerUserFilter $container_user_filter=null)
 
 gotItems ()
 
 addAdditionalSubItemInformation (array &$object)
 Add additional information to sub item, e.g. More...
 
 getGroupedObjTypes ()
 
 enablePageEditing ()
 
 create ()
 
 putInTree (int $parent_ref_id)
 
 update ()
 
 read ()
 
 readContainerSettings ()
 
 removeTranslations ()
 
 deleteTranslation (string $a_lang)
 
 addTranslation (string $a_title, string $a_desc, string $a_lang, string $a_lang_default)
 
- Public Member Functions inherited from ilObject
 getObjectProperties ()
 
 flushObjectProperties ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $description)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 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. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static getIconsCache ()
 Returns an array that maps from OrgUnit object IDs to its icon defined by the assigned OrgUnit type. More...
 
static getRootOrgRefId ()
 
static getRootOrgId ()
 
static _exists (int $id, bool $isReference=false, ?string $type="orgu")
 
- Static Public Member Functions inherited from ilContainer
static _getContainerDirectory (int $a_id)
 
static _lookupContainerSetting (int $a_id, string $a_keyword, string $a_default_value=null)
 
static _hasContainerSetting (int $a_id, string $a_keyword)
 
static _writeContainerSetting (int $a_id, string $a_keyword, string $a_value)
 
static _getContainerSettings (int $a_id)
 
static _deleteContainerSettings (int $a_id, string $a_keyword="", bool $a_keyword_like=false)
 
static _exportContainerSettings (ilXmlWriter $a_xml, int $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 (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, \ilDBInterface $ilDB=null)
 

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
 
const TILE_NORMAL = 0
 
const TILE_SMALL = 1
 
const TILE_LARGE = 2
 
const TILE_EXTRA_LARGE = 3
 
const TILE_FULL = 4
 
array $items = []
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 

Protected Attributes

ilOrgUnitPositionDBRepository $positionRepo
 
ilOrgUnitUserAssignmentDBRepository $assignmentRepo
 
int $orgu_type_id = 0
 ID of assigned OrgUnit type. More...
 
array $amd_data
 Advanced Metadata Values for this OrgUnit. More...
 
- Protected Attributes inherited from ilContainer
News $news
 
ILIAS Style Content DomainService $content_style_domain
 
ILIAS Container InternalDomainService $domain
 
ilAccessHandler $access
 
ilRbacSystem $rbacsystem
 
ilObjUser $user
 
ilObjectDefinition $obj_definition
 
int $order_type = 0
 
bool $hiddenfilesfound = false
 
bool $news_timeline = false
 
bool $news_timeline_auto_entries = false
 
ilSetting $setting
 
ilObjectTranslation $obj_trans = null
 
int $style_id = 0
 
bool $news_timeline_landing_page = false
 
bool $news_block_activated = false
 
bool $use_news = false
 
ilRecommendedContentManager $recommended_content_manager
 
array $type_grps = null
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Static Protected Attributes

static int $root_ref_id = 0
 
static int $root_id = 0
 
static array $icons_cache = null
 Cache storing OrgUnit objects that have OrgUnit types with custom icons assigned. More...
 

Static Private Member Functions

static loadRootOrgRefIdAndId ()
 

Private Attributes

ilDBInterface $ilDb
 
ilAppEventHandler $ilAppEventHandler
 
ilRbacReview $rbacreview
 
ilRbacAdmin $rbacadmin
 

Additional Inherited Members

- Static Public Attributes inherited from ilContainer
static bool $data_preloaded = false
 
- Protected Member Functions inherited from ilContainer
 getInitialSubitems ()
 
 applyContainerUserFilter (array $objects, ilContainerUserFilter $container_user_filter=null)
 
- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilObjOrgUnit Based on methods of ilObjCategoryGUI

Author
: Oskar Truffer ot@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
: Martin Studer ms@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
: Stefan Wanzenried sw@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
: Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, $dic, ILIAS\MetaData\Repository\Validation\Data\__construct(), ilOrgUnitLocalDIC\dic(), ilObject\getId(), ilContainer\read(), and setOrgUnitTypeId().

54  {
55  global $DIC;
56 
57  $this->ilDb = $DIC->database();
58  $this->type = "orgu";
59  $this->ilAppEventHandler = $DIC->event();
60  $this->rbacreview = $DIC->rbac()->review();
61  $this->rbacadmin = $DIC->rbac()->admin();
62 
64  $this->positionRepo = $dic["repo.Positions"];
65  $this->assignmentRepo = $dic["repo.UserAssignments"];
66 
67  parent::__construct($a_id, $a_call_by_reference);
68  }
Global event handler.
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
$dic
Definition: result.php:32
+ Here is the call graph for this function:

Member Function Documentation

◆ _exists()

static ilObjOrgUnit::_exists ( int  $id,
bool  $isReference = false,
?string  $type = "orgu" 
)
static

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

Referenced by ilOrgUnitImporter\buildRef().

365  : bool
366  {
367  return parent::_exists($id, $isReference, "orgu");
368  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

◆ addTranslation()

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

add a new translation to current OrgUnit

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

References ilObject\getId().

Referenced by getTranslations().

492  : void
493  {
494  if (empty($a_title)) {
495  $a_title = "NO TITLE";
496  }
497 
498  $query = "INSERT INTO object_translation " . "(obj_id,title,description,lang_code,lang_default) " . "VALUES " . "("
499  . $this->ilDb->quote($this->getId(), 'integer') . "," . $this->ilDb->quote(
500  $a_title,
501  'text'
502  ) . "," . $this->ilDb->quote($a_desc, 'text') . ","
503  . $this->ilDb->quote($a_lang, 'text') . "," . $this->ilDb->quote($a_lang_default, 'integer') . ")";
504  $this->ilDb->manipulate($query);
505  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignUsersToEmployeeRole()

ilObjOrgUnit::assignUsersToEmployeeRole ( array  $user_ids)

Adds the user ids to the position employee.

Parameters
int[]$user_ids

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

References ilOrgUnitPosition\CORE_POSITION_EMPLOYEE, ilObject\getId(), ilObject\getRefId(), and ilAppEventHandler\raise().

237  : void
238  {
239  $position_id = $this->positionRepo
240  ->getSingle(ilOrgUnitPosition::CORE_POSITION_EMPLOYEE, 'core_identifier')
241  ->getId();
242 
243  foreach ($user_ids as $user_id) {
244  $assignment = $this->assignmentRepo->get($user_id, $position_id, $this->getRefId());
245 
246  $this->ilAppEventHandler->raise('Modules/OrgUnit', 'assignUsersToEmployeeRole', array(
247  'object' => $this,
248  'obj_id' => $this->getId(),
249  'ref_id' => $this->getRefId(),
250  'position_id' => $position_id,
251  'user_id' => $user_id
252  ));
253  }
254  }
Global event handler.
raise(string $a_component, string $a_event, array $a_parameter=[])
Raise an event.
+ Here is the call graph for this function:

◆ assignUsersToSuperiorRole()

ilObjOrgUnit::assignUsersToSuperiorRole ( array  $user_ids)

Adds the user ids to the position superior.

Parameters
int[]$user_ids

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

References ilOrgUnitPosition\CORE_POSITION_SUPERIOR, ilObject\getId(), ilObject\getRefId(), and ilAppEventHandler\raise().

260  : void
261  {
262  $position_id = $this->positionRepo
263  ->getSingle(ilOrgUnitPosition::CORE_POSITION_SUPERIOR, 'core_identifier')
264  ->getId();
265 
266  foreach ($user_ids as $user_id) {
267  $assignment = $this->assignmentRepo->get($user_id, $position_id, $this->getRefId());
268 
269  $this->ilAppEventHandler->raise('Modules/OrgUnit', 'assignUsersToSuperiorRole', array(
270  'object' => $this,
271  'obj_id' => $this->getId(),
272  'ref_id' => $this->getRefId(),
273  'position_id' => $position_id,
274  'user_id' => $user_id
275  ));
276  }
277  }
Global event handler.
raise(string $a_component, string $a_event, array $a_parameter=[])
Raise an event.
+ Here is the call graph for this function:

◆ assignUserToLocalRole()

ilObjOrgUnit::assignUserToLocalRole ( int  $role_id,
int  $user_id 
)

Assign a given user to a given local role.

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

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

322  : bool
323  {
324  $arrLocalRoles = $this->rbacreview->getLocalRoles($this->getRefId());
325  if (!in_array($role_id, $arrLocalRoles)) {
326  return false;
327  }
328 
329  $return = $this->rbacadmin->assignUser($role_id, $user_id);
330 
331  $this->ilAppEventHandler->raise('Modules/OrgUnit', 'assignUserToLocalRole', array(
332  'object' => $this,
333  'obj_id' => $this->getId(),
334  'ref_id' => $this->getRefId(),
335  'role_id' => $role_id,
336  'user_id' => $user_id,
337  ));
338 
339  return $return;
340  }
Global event handler.
raise(string $a_component, string $a_event, array $a_parameter=[])
Raise an event.
+ Here is the call graph for this function:

◆ create()

ilObjOrgUnit::create ( )

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

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

82  : int
83  {
84  $id = parent::create();
85  $this->ilDb->insert(self::TABLE_NAME, array(
86  'orgu_type_id' => array('integer', $this->getOrgUnitTypeId()),
87  'orgu_id' => array('integer', $this->getId()),
88  ));
89  return $id;
90  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ deassignUserFromEmployeeRole()

ilObjOrgUnit::deassignUserFromEmployeeRole ( int  $user_id)

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

References ilOrgUnitPosition\CORE_POSITION_EMPLOYEE, ilObject\getId(), ilObject\getRefId(), and ilAppEventHandler\raise().

279  : void
280  {
281  $position_id = $this->positionRepo
282  ->getSingle(ilOrgUnitPosition::CORE_POSITION_EMPLOYEE, 'core_identifier')
283  ->getId();
284 
285  $assignment = $this->assignmentRepo->find($user_id, $position_id, $this->getRefId());
286  if ($assignment) {
287  $this->assignmentRepo->delete($assignment);
288  }
289 
290  $this->ilAppEventHandler->raise('Modules/OrgUnit', 'deassignUserFromEmployeeRole', array(
291  'object' => $this,
292  'obj_id' => $this->getId(),
293  'ref_id' => $this->getRefId(),
294  'position_id' => $position_id,
295  'user_id' => $user_id,
296  ));
297  }
Global event handler.
raise(string $a_component, string $a_event, array $a_parameter=[])
Raise an event.
+ Here is the call graph for this function:

◆ deassignUserFromLocalRole()

ilObjOrgUnit::deassignUserFromLocalRole ( int  $role_id,
int  $user_id 
)

Deassign a given user to a given local role.

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

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

345  : bool
346  {
347  $arrLocalRoles = $this->rbacreview->getLocalRoles($this->getRefId());
348  if (!in_array($role_id, $arrLocalRoles)) {
349  return false;
350  }
351 
352  $return = $this->rbacadmin->deassignUser($role_id, $user_id);
353 
354  $this->ilAppEventHandler->raise('Modules/OrgUnit', 'deassignUserFromLocalRole', array(
355  'object' => $this,
356  'obj_id' => $this->getId(),
357  'ref_id' => $this->getRefId(),
358  'role_id' => $role_id,
359  'user_id' => $user_id,
360  ));
361 
362  return $return;
363  }
Global event handler.
raise(string $a_component, string $a_event, array $a_parameter=[])
Raise an event.
+ Here is the call graph for this function:

◆ deassignUserFromSuperiorRole()

ilObjOrgUnit::deassignUserFromSuperiorRole ( int  $user_id)

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

References ilOrgUnitPosition\CORE_POSITION_SUPERIOR, ilObject\getId(), ilObject\getRefId(), and ilAppEventHandler\raise().

299  : void
300  {
301  $position_id = $this->positionRepo
302  ->getSingle(ilOrgUnitPosition::CORE_POSITION_SUPERIOR, 'core_identifier')
303  ->getId();
304 
305  $assignment = $this->assignmentRepo->find($user_id, $position_id, $this->getRefId());
306  if ($assignment) {
307  $this->assignmentRepo->delete($assignment);
308  }
309 
310  $this->ilAppEventHandler->raise('Modules/OrgUnit', 'deassignUserFromSuperiorRole', array(
311  'object' => $this,
312  'obj_id' => $this->getId(),
313  'ref_id' => $this->getRefId(),
314  'position_id' => $position_id,
315  'user_id' => $user_id,
316  ));
317  }
Global event handler.
raise(string $a_component, string $a_event, array $a_parameter=[])
Raise an event.
+ Here is the call graph for this function:

◆ delete()

ilObjOrgUnit::delete ( )

delete orgunit, childs and all related data

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

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

References $path, ilObjUserFolder\_updateUserFolderAssignment(), ilObject\getId(), ilObject\getRefId(), ilAppEventHandler\raise(), and USER_FOLDER_ID.

431  : bool
432  {
433  // always call parent delete function first!!
434  if (!parent::delete()) {
435  return false;
436  }
437 
438  // put here category specific stuff
440 
441  $query = "DELETE FROM object_translation WHERE obj_id = " . $this->ilDb->quote($this->getId(), 'integer');
442  $this->ilDb->manipulate($query);
443 
444  $this->ilAppEventHandler->raise('Modules/OrgUnit', 'delete', array(
445  'object' => $this,
446  'obj_id' => $this->getId(),
447  ));
448 
449  $sql = 'DELETE FROM ' . self::TABLE_NAME . ' WHERE orgu_id = ' . $this->ilDb->quote($this->getId(), 'integer');
450  $this->ilDb->manipulate($sql);
451 
452  $path = ilOrgUnitPathStorage::find($this->getRefId());
453  if ($path instanceof ilOrgUnitPathStorage) {
454  $path->delete();
455  }
456 
457  // Delete all position assignments to this object.
458  $assignments = $this->assignmentRepo->getByOrgUnit($this->getRefId());
459  foreach ($assignments as $assignment) {
460  $this->assignmentRepo->delete($assignment);
461  }
462 
463  return true;
464  }
Global event handler.
const USER_FOLDER_ID
Definition: constants.php:33
static _updateUserFolderAssignment(int $a_old_id, int $a_new_id)
Update user folder assignment Typically called after deleting a category with local user accounts...
Class ilOrgUnitPathStorage.
$path
Definition: ltiservices.php:32
raise(string $a_component, string $a_event, array $a_parameter=[])
Raise an event.
+ Here is the call graph for this function:

◆ deleteTranslation()

ilObjOrgUnit::deleteTranslation ( string  $a_lang)

remove translations of current OrgUnit

Parameters
$a_langstring en|de|...

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

References ilObject\getId().

479  : void
480  {
481  $query = "DELETE FROM object_translation WHERE obj_id= " . $this->quote(
482  $this->getId(),
483  'integer'
484  ) . " AND lang_code = "
485  . $this->quote($a_lang, 'text');
486  $this->ilDb->manipulate($query);
487  }
+ Here is the call graph for this function:

◆ getIconsCache()

static ilObjOrgUnit::getIconsCache ( )
static

Returns an array that maps from OrgUnit object IDs to its icon defined by the assigned OrgUnit type.

Keys = OrgUnit object IDs, values = Path to the icon This allows to get the Icons of OrgUnits without loading the object (e.g. used in the tree explorer)

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

References $DIC, $icons_cache, ilObject\$type, ilDBInterface\fetchObject(), ilOrgUnitType\getInstance(), and ilDBInterface\query().

Referenced by ilOrgUnitExplorerGUI\getNodeIcon(), ilObjOrgUnitListGUI\getTypeIcon(), and ilObjOrgUnitGUI\setTitleAndDescription().

179  : array
180  {
181  if (is_array(self::$icons_cache)) {
182  return self::$icons_cache;
183  }
184  global $DIC;
185  $ilDb = $DIC->database();
186  $sql = 'SELECT orgu_id, ot.id AS type_id FROM orgu_data
187  INNER JOIN orgu_types AS ot ON (ot.id = orgu_data.orgu_type_id)
188  WHERE ot.icon IS NOT NULL';
189  $set = $ilDb->query($sql);
190  $icons_cache = array();
191 
192  $irss = $DIC['resource_storage'];
193  while ($row = $ilDb->fetchObject($set)) {
194  $type = ilOrgUnitType::getInstance($row->type_id);
195  if ($type && $icon_id = $irss->manage()->find($type->getIconIdentifier())) {
196  $icons_cache[$row->orgu_id] = $irss->consume()->src($icon_id)->getSrc();
197  }
198  }
199  self::$icons_cache = $icons_cache;
200 
201  return $icons_cache;
202  }
string $type
static array $icons_cache
Cache storing OrgUnit objects that have OrgUnit types with custom icons assigned. ...
ilDBInterface $ilDb
global $DIC
Definition: feed.php:28
fetchObject(ilDBStatement $query_result)
query(string $query)
Run a (read-only) Query on the database.
static getInstance(int $a_id)
Get instance of an ilOrgUnitType object Returns object from cache or from database, returns null if no object was found.
+ 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)

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

References ILIAS\Repository\lng().

382  : string
383  {
384  if (parent::getTitle() === "__OrgUnitAdministration") {
385  return $this->lng->txt("obj_orgu_description");
386  } else {
387  return parent::getLongDescription();
388  }
389  }
+ Here is the call graph for this function:

◆ getOrgUnitType()

ilObjOrgUnit::getOrgUnitType ( )

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

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

Referenced by update().

132  : ?ilOrgUnitType
133  {
135  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(int $a_id)
Get instance of an ilOrgUnitType object Returns object from cache or from database, returns null if no object was found.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOrgUnitTypeId()

ilObjOrgUnit::getOrgUnitTypeId ( )

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

References $orgu_type_id.

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

127  : int
128  {
129  return $this->orgu_type_id;
130  }
int $orgu_type_id
ID of assigned OrgUnit type.
+ Here is the caller graph for this function:

◆ getRootOrgId()

static ilObjOrgUnit::getRootOrgId ( )
static

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

Referenced by ilOrgUnitExporter\sendAndCreateSimpleExportFile().

211  : int
212  {
213  self::loadRootOrgRefIdAndId();
214 
215  return self::$root_id;
216  }
+ Here is the caller graph for this function:

◆ getRootOrgRefId()

◆ getTitle()

ilObjOrgUnit::getTitle ( )

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

References ILIAS\Repository\lng().

Referenced by getTranslations().

370  : string
371  {
372  if (parent::getTitle() !== "__OrgUnitAdministration") {
373  return parent::getTitle();
374  } else {
375  return $this->lng->txt("objs_orgu");
376  }
377  }
+ Here is the call graph for this function:
+ 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 394 of file class.ilObjOrgUnit.php.

References $data, $q, $r, addTranslation(), ilDBConstants\FETCHMODE_OBJECT, ilObject\getId(), getTitle(), and ILIAS\Repository\lng().

395  {
396  $q = "SELECT * FROM object_translation WHERE obj_id = " . $this->ilDb->quote(
397  $this->getId(),
398  'integer'
399  ) . " ORDER BY lang_default DESC";
400  $r = $this->db->query($q);
401 
402  $data = [];
403  while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
404  $data[$row->lang_code] = array(
405  "title" => $row->title,
406  "desc" => $row->description,
407  "lang" => $row->lang_code,
408  'default' => $row->lang_default,
409  );
410  }
411 
412  $translations = $data;
413 
414  if (!count($translations)) {
415  $this->addTranslation($this->getTitle(), "", $this->lng->getDefaultLanguage(), true);
416  $translations[$this->lng->getDefaultLanguage()] = array(
417  "title" => $this->getTitle(),
418  "desc" => "",
419  "lang" => $this->lng->getDefaultLanguage(),
420  );
421  }
422 
423  return $translations;
424  }
addTranslation(string $a_title, string $a_desc, string $a_lang, string $a_lang_default)
add a new translation to current OrgUnit
$q
Definition: shib_logout.php:21
$r
+ Here is the call graph for this function:

◆ loadRootOrgRefIdAndId()

static ilObjOrgUnit::loadRootOrgRefIdAndId ( )
staticprivate

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

References $DIC, $q, $res, ilDBInterface\fetchAssoc(), ILIAS\Repository\int(), ilDBInterface\query(), and ilDBInterface\quote().

218  : void
219  {
220  if (self::$root_ref_id === 0 || self::$root_id === 0) {
221  global $DIC;
222  $ilDb = $DIC['ilDB'];
223  $q = "SELECT o.obj_id, r.ref_id FROM object_data o
224  INNER JOIN object_reference r ON r.obj_id = o.obj_id
225  WHERE title = " . $ilDb->quote('__OrgUnitAdministration', 'text') . "";
226  $set = $ilDb->query($q);
227  $res = $ilDb->fetchAssoc($set);
228  self::$root_id = (int) $res["obj_id"];
229  self::$root_ref_id = (int) $res["ref_id"];
230  }
231  }
$res
Definition: ltiservices.php:69
fetchAssoc(ilDBStatement $statement)
quote($value, string $type)
ilDBInterface $ilDb
global $DIC
Definition: feed.php:28
query(string $query)
Run a (read-only) Query on the database.
$q
Definition: shib_logout.php:21
+ Here is the call graph for this function:

◆ removeTranslations()

ilObjOrgUnit::removeTranslations ( )

remove all Translations of current OrgUnit

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

References $res, and ilObject\getId().

469  : void
470  {
471  $query = "DELETE FROM object_translation WHERE obj_id= " . $this->ilDb->quote($this->getId(), 'integer');
472  $res = $this->ilDb->manipulate($query);
473  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:

◆ setOrgUnitTypeId()

ilObjOrgUnit::setOrgUnitTypeId ( int  $a_id)

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

References $amd_data, ilObject\getId(), ilAdvancedMDValues\getInstancesForObjectId(), and getOrgUnitTypeId().

Referenced by __construct().

137  : void
138  {
139  $this->orgu_type_id = $a_id;
140  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilObjOrgUnit::update ( )

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

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

92  : bool
93  {
94  parent::update();
95  $sql = 'SELECT * FROM ' . self::TABLE_NAME . ' WHERE orgu_id = ' . $this->ilDb->quote(
96  $this->getId(),
97  'integer'
98  );
99  $set = $this->ilDb->query($sql);
100  if ($this->ilDb->numRows($set)) {
101  $this->ilDb->update(self::TABLE_NAME, array(
102  'orgu_type_id' => array('integer', $this->getOrgUnitTypeId()),
103  ), array(
104  'orgu_id' => array('integer', $this->getId()),
105  ));
106  } else {
107  $this->ilDb->insert(self::TABLE_NAME, array(
108  'orgu_type_id' => array('integer', $this->getOrgUnitTypeId()),
109  'orgu_id' => array('integer', $this->getId()),
110  ));
111  }
112  // Update selection for advanced meta data of the type
113  if ($this->getOrgUnitTypeId()) {
115  $this->getId(),
116  'orgu_type',
117  $this->getOrgUnitType()->getAssignedAdvancedMDRecordIds()
118  );
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 
124  return true;
125  }
static saveObjRecSelection(int $a_obj_id, string $a_sub_type="", array $a_records=null, bool $a_delete_before=true)
Save repository object record selection.
+ Here is the call graph for this function:

◆ updateTranslation()

ilObjOrgUnit::updateTranslation ( string  $title,
string  $desc,
string  $lang,
string  $lang_default 
)

update a translation to current OrgUnit

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

References ilObject\getId().

510  : void
511  {
512  if (empty($title)) {
513  $a_title = "NO TITLE";
514  }
515 
516  $query = "UPDATE object_translation SET ";
517 
518  $query .= " title = " . $this->ilDb->quote($title, 'text');
519 
520  if ($desc !== "") {
521  $query .= ", description = " . $this->ilDb->quote($desc, 'text') . " ";
522  }
523 
524  $query .= ", lang_default = " . $this->ilDb->quote($lang_default, 'integer') . " ";
525 
526  $query .= " WHERE obj_id = " . $this->ilDb->quote(
527  $this->getId(),
528  'integer'
529  ) . " AND lang_code = " . $this->ilDb->quote($lang, 'text');
530  $this->ilDb->manipulate($query);
531  }
string $title
string $desc
$lang
Definition: xapiexit.php:26
+ Here is the call graph for this function:

◆ writePath()

ilObjOrgUnit::writePath ( )

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

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

533  : void
534  {
535  if ($this->getRefId()) {
536  ilOrgUnitPathStorage::writePathByRefId($this->getRefId());
537  } else {
538  throw new \LogicException('No ref_id on OrgU with id ' . $this->getId(), 1);
539  }
540  }
+ Here is the call graph for this function:

Field Documentation

◆ $amd_data

array ilObjOrgUnit::$amd_data
protected

Advanced Metadata Values for this OrgUnit.

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

Referenced by setOrgUnitTypeId().

◆ $assignmentRepo

ilOrgUnitUserAssignmentDBRepository ilObjOrgUnit::$assignmentRepo
protected

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

◆ $icons_cache

array ilObjOrgUnit::$icons_cache = null
staticprotected

Cache storing OrgUnit objects that have OrgUnit types with custom icons assigned.

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

Referenced by getIconsCache().

◆ $ilAppEventHandler

ilAppEventHandler ilObjOrgUnit::$ilAppEventHandler
private

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

◆ $ilDb

ilDBInterface ilObjOrgUnit::$ilDb
private

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

◆ $orgu_type_id

int ilObjOrgUnit::$orgu_type_id = 0
protected

ID of assigned OrgUnit type.

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

Referenced by getOrgUnitTypeId().

◆ $positionRepo

ilOrgUnitPositionDBRepository ilObjOrgUnit::$positionRepo
protected

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

◆ $rbacadmin

ilRbacAdmin ilObjOrgUnit::$rbacadmin
private

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

◆ $rbacreview

ilRbacReview ilObjOrgUnit::$rbacreview
private

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

◆ $root_id

int ilObjOrgUnit::$root_id = 0
staticprotected

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

◆ $root_ref_id

int ilObjOrgUnit::$root_ref_id = 0
staticprotected

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

◆ TABLE_NAME

const ilObjOrgUnit::TABLE_NAME = 'orgu_data'

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


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