ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 note: title, description and type should be set when this function is called More...
 
 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 (?Translations $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 ()
 note: title, description and type should be set when this function is called More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 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, int $new_obj_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")
 checks if an object exists in object_data More...
 
- 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 getIconForType (string $type)
 
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
 
Translations $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
 
LOMServices $lom_services
 
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 27 of file class.ilObjOrgUnit.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

53 {
54 global $DIC;
55
56 $this->ilDb = $DIC->database();
57 $this->type = "orgu";
58 $this->ilAppEventHandler = $DIC->event();
59 $this->rbacreview = $DIC->rbac()->review();
60 $this->rbacadmin = $DIC->rbac()->admin();
61
63 $this->positionRepo = $dic["repo.Positions"];
64 $this->assignmentRepo = $dic["repo.UserAssignments"];
65
66 parent::__construct($a_id, $a_call_by_reference);
67 }
Global event handler.
$dic
Definition: ltiresult.php:33
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, $dic, ILIAS\GlobalScreen\Provider\__construct(), and ilOrgUnitLocalDIC\dic().

+ Here is the call graph for this function:

Member Function Documentation

◆ _exists()

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

checks if an object exists in object_data

Parameters
integer$idobject id or reference id
bool$referencetrue if id is a reference, else false (default)
string | null$typestring restrict on a certain type.
Returns
bool true if object exists

Reimplemented from ilObject.

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

364 : bool
365 {
366 return parent::_exists($id, $isReference, "orgu");
367 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id.

Referenced by ilOrgUnitImporter\buildRef().

+ 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

Reimplemented from ilContainer.

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

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

References ilObject\getId().

Referenced by getTranslations().

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

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

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

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

259 : void
260 {
261 $position_id = $this->positionRepo
262 ->getSingle(ilOrgUnitPosition::CORE_POSITION_SUPERIOR, 'core_identifier')
263 ->getId();
264
265 foreach ($user_ids as $user_id) {
266 $assignment = $this->assignmentRepo->get($user_id, $position_id, $this->getRefId());
267
268 $this->ilAppEventHandler->raise('components/ILIAS/OrgUnit', 'assignUsersToSuperiorRole', array(
269 'object' => $this,
270 'obj_id' => $this->getId(),
271 'ref_id' => $this->getRefId(),
272 'position_id' => $position_id,
273 'user_id' => $user_id
274 ));
275 }
276 }

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

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

321 : bool
322 {
323 $arrLocalRoles = $this->rbacreview->getLocalRoles($this->getRefId());
324 if (!in_array($role_id, $arrLocalRoles)) {
325 return false;
326 }
327
328 $return = $this->rbacadmin->assignUser($role_id, $user_id);
329
330 $this->ilAppEventHandler->raise('components/ILIAS/OrgUnit', 'assignUserToLocalRole', array(
331 'object' => $this,
332 'obj_id' => $this->getId(),
333 'ref_id' => $this->getRefId(),
334 'role_id' => $role_id,
335 'user_id' => $user_id,
336 ));
337
338 return $return;
339 }

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

+ Here is the call graph for this function:

◆ create()

ilObjOrgUnit::create ( )

note: title, description and type should be set when this function is called

Reimplemented from ilContainer.

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

81 : int
82 {
83 $id = parent::create();
84 $this->ilDb->insert(self::TABLE_NAME, array(
85 'orgu_type_id' => array('integer', $this->getOrgUnitTypeId()),
86 'orgu_id' => array('integer', $this->getId()),
87 ));
88 return $id;
89 }

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

+ Here is the call graph for this function:

◆ deassignUserFromEmployeeRole()

ilObjOrgUnit::deassignUserFromEmployeeRole ( int  $user_id)

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

278 : void
279 {
280 $position_id = $this->positionRepo
281 ->getSingle(ilOrgUnitPosition::CORE_POSITION_EMPLOYEE, 'core_identifier')
282 ->getId();
283
284 $assignment = $this->assignmentRepo->find($user_id, $position_id, $this->getRefId());
285 if ($assignment) {
286 $this->assignmentRepo->delete($assignment);
287 }
288
289 $this->ilAppEventHandler->raise('components/ILIAS/OrgUnit', 'deassignUserFromEmployeeRole', array(
290 'object' => $this,
291 'obj_id' => $this->getId(),
292 'ref_id' => $this->getRefId(),
293 'position_id' => $position_id,
294 'user_id' => $user_id,
295 ));
296 }

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

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

344 : bool
345 {
346 $arrLocalRoles = $this->rbacreview->getLocalRoles($this->getRefId());
347 if (!in_array($role_id, $arrLocalRoles)) {
348 return false;
349 }
350
351 $return = $this->rbacadmin->deassignUser($role_id, $user_id);
352
353 $this->ilAppEventHandler->raise('components/ILIAS/OrgUnit', 'deassignUserFromLocalRole', array(
354 'object' => $this,
355 'obj_id' => $this->getId(),
356 'ref_id' => $this->getRefId(),
357 'role_id' => $role_id,
358 'user_id' => $user_id,
359 ));
360
361 return $return;
362 }

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

+ Here is the call graph for this function:

◆ deassignUserFromSuperiorRole()

ilObjOrgUnit::deassignUserFromSuperiorRole ( int  $user_id)

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

298 : void
299 {
300 $position_id = $this->positionRepo
301 ->getSingle(ilOrgUnitPosition::CORE_POSITION_SUPERIOR, 'core_identifier')
302 ->getId();
303
304 $assignment = $this->assignmentRepo->find($user_id, $position_id, $this->getRefId());
305 if ($assignment) {
306 $this->assignmentRepo->delete($assignment);
307 }
308
309 $this->ilAppEventHandler->raise('components/ILIAS/OrgUnit', 'deassignUserFromSuperiorRole', array(
310 'object' => $this,
311 'obj_id' => $this->getId(),
312 'ref_id' => $this->getRefId(),
313 'position_id' => $position_id,
314 'user_id' => $user_id,
315 ));
316 }

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

+ 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

Reimplemented from ilContainer.

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

430 : bool
431 {
432 // always call parent delete function first!!
433 if (!parent::delete()) {
434 return false;
435 }
436
437 // put here category specific stuff
439
440 $query = "DELETE FROM object_translation WHERE obj_id = " . $this->ilDb->quote($this->getId(), 'integer');
441 $this->ilDb->manipulate($query);
442
443 $this->ilAppEventHandler->raise('components/ILIAS/OrgUnit', 'delete', array(
444 'object' => $this,
445 'obj_id' => $this->getId(),
446 ));
447
448 $sql = 'DELETE FROM ' . self::TABLE_NAME . ' WHERE orgu_id = ' . $this->ilDb->quote($this->getId(), 'integer');
449 $this->ilDb->manipulate($sql);
450
451 $path = ilOrgUnitPathStorage::find($this->getRefId());
452 if ($path instanceof ilOrgUnitPathStorage) {
453 $path->delete();
454 }
455
456 // Delete all position assignments to this object.
457 $assignments = $this->assignmentRepo->getByOrgUnit($this->getRefId());
458 foreach ($assignments as $assignment) {
459 $this->assignmentRepo->delete($assignment);
460 }
461
462 return true;
463 }
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.
const USER_FOLDER_ID
Definition: constants.php:33
$path
Definition: ltiservices.php:30

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

+ Here is the call graph for this function:

◆ deleteTranslation()

ilObjOrgUnit::deleteTranslation ( string  $a_lang)

remove translations of current OrgUnit

Parameters
$a_langstring en|de|...

Reimplemented from ilContainer.

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

478 : void
479 {
480 $query = "DELETE FROM object_translation WHERE obj_id= " . $this->quote(
481 $this->getId(),
482 'integer'
483 ) . " AND lang_code = "
484 . $this->quote($a_lang, 'text');
485 $this->ilDb->manipulate($query);
486 }

References ilObject\getId().

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

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

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

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

+ 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)

Reimplemented from ilObject.

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

381 : string
382 {
383 if (parent::getTitle() === "__OrgUnitAdministration") {
384 return $this->lng->txt("obj_orgu_description");
385 } else {
386 return parent::getLongDescription();
387 }
388 }

References ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getOrgUnitType()

ilObjOrgUnit::getOrgUnitType ( )

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

132 {
134 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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 ( )

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

126 : int
127 {
128 return $this->orgu_type_id;
129 }
int $orgu_type_id
ID of assigned OrgUnit type.

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

210 : int
211 {
213
214 return self::$root_id;
215 }
static loadRootOrgRefIdAndId()
static int $root_id

References $root_id, and loadRootOrgRefIdAndId().

Referenced by ilOrgUnitExportOptionXLS\isObjectSupported(), ilOrgUnitExportOptionXML\isObjectSupported(), and ilOrgUnitExporter\sendAndCreateSimpleExportFile().

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

◆ getRootOrgRefId()

◆ getTitle()

ilObjOrgUnit::getTitle ( )

Reimplemented from ilObject.

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

369 : string
370 {
371 if (parent::getTitle() !== "__OrgUnitAdministration") {
372 return parent::getTitle();
373 } else {
374 return $this->lng->txt("objs_orgu");
375 }
376 }

References ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle(), and ILIAS\Repository\lng().

Referenced by getTranslations().

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

394 {
395 $q = "SELECT * FROM object_translation WHERE obj_id = " . $this->ilDb->quote(
396 $this->getId(),
397 'integer'
398 ) . " ORDER BY lang_default DESC";
399 $r = $this->db->query($q);
400
401 $data = [];
402 while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
403 $data[$row->lang_code] = array(
404 "title" => $row->title,
405 "desc" => $row->description,
406 "lang" => $row->lang_code,
407 'default' => $row->lang_default,
408 );
409 }
410
411 $translations = $data;
412
413 if (!count($translations)) {
414 $this->addTranslation($this->getTitle(), "", $this->lng->getDefaultLanguage(), true);
415 $translations[$this->lng->getDefaultLanguage()] = array(
416 "title" => $this->getTitle(),
417 "desc" => "",
418 "lang" => $this->lng->getDefaultLanguage(),
419 );
420 }
421
422 return $translations;
423 }
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:23

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

+ Here is the call graph for this function:

◆ loadRootOrgRefIdAndId()

static ilObjOrgUnit::loadRootOrgRefIdAndId ( )
staticprivate

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

217 : void
218 {
219 if (self::$root_ref_id === 0 || self::$root_id === 0) {
220 global $DIC;
221 $ilDb = $DIC['ilDB'];
222 $q = "SELECT o.obj_id, r.ref_id FROM object_data o
223 INNER JOIN object_reference r ON r.obj_id = o.obj_id
224 WHERE title = " . $ilDb->quote('__OrgUnitAdministration', 'text') . "";
225 $set = $ilDb->query($q);
226 $res = $ilDb->fetchAssoc($set);
227 self::$root_id = (int) $res["obj_id"];
228 self::$root_ref_id = (int) $res["ref_id"];
229 }
230 }
quote($value, string $type)
fetchAssoc(ilDBStatement $statement)
$res
Definition: ltiservices.php:69

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

Referenced by getRootOrgId(), and getRootOrgRefId().

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

◆ removeTranslations()

ilObjOrgUnit::removeTranslations ( )

remove all Translations of current OrgUnit

Reimplemented from ilContainer.

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

468 : void
469 {
470 $query = "DELETE FROM object_translation WHERE obj_id= " . $this->ilDb->quote($this->getId(), 'integer');
471 $res = $this->ilDb->manipulate($query);
472 }

References $res, and ilObject\getId().

+ Here is the call graph for this function:

◆ setOrgUnitTypeId()

ilObjOrgUnit::setOrgUnitTypeId ( int  $a_id)

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

136 : void
137 {
138 $this->orgu_type_id = $a_id;
139 }

◆ update()

ilObjOrgUnit::update ( )

Reimplemented from ilContainer.

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

91 : bool
92 {
93 parent::update();
94 $sql = 'SELECT * FROM ' . self::TABLE_NAME . ' WHERE orgu_id = ' . $this->ilDb->quote(
95 $this->getId(),
96 'integer'
97 );
98 $set = $this->ilDb->query($sql);
99 if ($this->ilDb->numRows($set)) {
100 $this->ilDb->update(self::TABLE_NAME, array(
101 'orgu_type_id' => array('integer', $this->getOrgUnitTypeId()),
102 ), array(
103 'orgu_id' => array('integer', $this->getId()),
104 ));
105 } else {
106 $this->ilDb->insert(self::TABLE_NAME, array(
107 'orgu_type_id' => array('integer', $this->getOrgUnitTypeId()),
108 'orgu_id' => array('integer', $this->getId()),
109 ));
110 }
111 // Update selection for advanced meta data of the type
112 if ($this->getOrgUnitTypeId()) {
114 $this->getId(),
115 'orgu_type',
116 $this->getOrgUnitType()->getAssignedAdvancedMDRecordIds()
117 );
118 } else {
119 // If no type is assigned, delete relations by passing an empty array
120 ilAdvancedMDRecord::saveObjRecSelection($this->getId(), 'orgu_type', array());
121 }
122
123 return true;
124 }
static saveObjRecSelection(int $a_obj_id, string $a_sub_type="", ?array $a_records=null, bool $a_delete_before=true)
Save repository object record selection.

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

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

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

References ilObject\$desc, $lang, ilObject\$title, and ilObject\getId().

+ Here is the call graph for this function:

◆ writePath()

ilObjOrgUnit::writePath ( )

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

532 : void
533 {
534 if ($this->getRefId()) {
535 ilOrgUnitPathStorage::writePathByRefId($this->getRefId());
536 } else {
537 throw new \LogicException('No ref_id on OrgU with id ' . $this->getId(), 1);
538 }
539 }

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

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

◆ $assignmentRepo

ilOrgUnitUserAssignmentDBRepository ilObjOrgUnit::$assignmentRepo
protected

Definition at line 37 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 42 of file class.ilObjOrgUnit.php.

Referenced by getIconsCache().

◆ $ilAppEventHandler

ilAppEventHandler ilObjOrgUnit::$ilAppEventHandler
private

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

◆ $ilDb

ilDBInterface ilObjOrgUnit::$ilDb
private

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

Referenced by getIconsCache(), and loadRootOrgRefIdAndId().

◆ $orgu_type_id

int ilObjOrgUnit::$orgu_type_id = 0
protected

ID of assigned OrgUnit type.

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

Referenced by getOrgUnitTypeId().

◆ $positionRepo

ilOrgUnitPositionDBRepository ilObjOrgUnit::$positionRepo
protected

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

◆ $rbacadmin

ilRbacAdmin ilObjOrgUnit::$rbacadmin
private

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

◆ $rbacreview

ilRbacReview ilObjOrgUnit::$rbacreview
private

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

◆ $root_id

int ilObjOrgUnit::$root_id = 0
staticprotected

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

Referenced by getRootOrgId().

◆ $root_ref_id

int ilObjOrgUnit::$root_ref_id = 0
staticprotected

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

Referenced by getRootOrgRefId().

◆ TABLE_NAME

const ilObjOrgUnit::TABLE_NAME = 'orgu_data'

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


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