ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 
 deleteTranslation ($a_lang)
 
 addTranslation ($a_title, $a_desc, $a_lang, $a_lang_default)
 
 updateTranslation ($a_title, $a_desc, $a_lang, $a_lang_default)
 
- Public Member Functions inherited from ilContainer
 ilContainer ($a_id=0, $a_call_by_reference=true)
 Constructor public. More...
 
 createContainerDirectory ()
 Create directory for the container. More...
 
 getContainerDirectory ()
 Get the container directory. More...
 
 _getContainerDirectory ($a_id)
 Get the container directory. More...
 
 getBigIconPath ()
 Get path for big icon. More...
 
 getSmallIconPath ()
 Get path for small icon. More...
 
 getTinyIconPath ()
 Get path for tiny icon. More...
 
 getCustomIconPath ()
 Get path for custom icon. More...
 
 setHiddenFilesFound ($a_hiddenfilesfound)
 Set Found hidden files (set by getSubItems). More...
 
 getHiddenFilesFound ()
 Get Found hidden files (set by getSubItems). More...
 
 getStyleSheetId ()
 get ID of assigned style sheet object More...
 
 setStyleSheetId ($a_style_id)
 set ID of assigned style sheet object More...
 
 _lookupContainerSetting ($a_id, $a_keyword, $a_default_value=NULL)
 Lookup a container setting. More...
 
 _writeContainerSetting ($a_id, $a_keyword, $a_value)
 
 _lookupIconPath ($a_id, $a_size="big")
 lookup icon path More...
 
 saveIcons ($a_custom_icon)
 save container icons More...
 
 removeCustomIcon ()
 remove small icon More...
 
 cloneObject ($a_target_id, $a_copy_id=0)
 Clone container settings. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies (container sorting) More...
 
 cloneAllObject ($session_id, $client_id, $new_type, $ref_id, $clone_source, $options, $soap_call=false)
 clone all objects according to this container More...
 
 getViewMode ()
 Get container view mode. More...
 
 getOrderType ()
 Get order type default implementation. More...
 
 setOrderType ($a_value)
 
 getSubItems ($a_admin_panel_enabled=false, $a_include_side_block=false, $a_get_single=0)
 Get subitems of container. More...
 
 gotItems ()
 Check whether we got any items. More...
 
 addAdditionalSubItemInformation (&$object)
 Add additional information to sub item, e.g. More...
 
 getGroupedObjTypes ()
 Get grouped repository object types. More...
 
 enablePageEditing ()
 Check whether page editing is allowed for container. More...
 
 create ()
 Create. More...
 
 update ()
 Update. More...
 
 read ()
 read More...
 
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ($a_force_db=false)
 read object data from db into object More...
 
 getId ()
 get object id 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 ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 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...
 
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class) More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _lookupOwner ($a_id)
 lookup object owner More...
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
 _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 _lookupCreationDate ($a_id)
 Lookup creation date. More...
 

Static Public Member Functions

static getRootOrgRefId ()
 
static getRootOrgId ()
 
static _exists ($a_id, $a_reference=false)
 
- Static Public Member Functions inherited from ilContainer
static _getContainerSettings ($a_id)
 
static _deleteContainerSettings ($a_id, $a_keyword=null, $a_keyword_like=false)
 
static _exportContainerSettings (ilXmlWriter $a_xml, $a_obj_id)
 
static getCompleteDescriptions (array $objects)
 overwrites description fields to long or short description in an assoc array keys needed (obj_id and description) More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupObjId ($a_id)
 
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB. More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data 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 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_ILINC = 7
 
const VIEW_DEFAULT = self::VIEW_BY_TYPE
 
const SORT_TITLE = 0
 
const SORT_MANUAL = 1
 
const SORT_ACTIVATION = 2
 
const SORT_INHERIT = 3
 
const SORT_CREATION = 4
 
const SORT_DIRECTION_ASC = 0
 
const SORT_DIRECTION_DESC = 1
 
const SORT_NEW_ITEMS_POSITION_TOP = 0
 
const SORT_NEW_ITEMS_POSITION_BOTTOM = 1
 
const SORT_NEW_ITEMS_ORDER_TITLE = 0
 
const SORT_NEW_ITEMS_ORDER_CREATION = 1
 
const SORT_NEW_ITEMS_ORDER_ACTIVATION = 2
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $ilias
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 
 $obj_data_record
 object_data record More...
 

Protected Attributes

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

Static Protected Attributes

static $root_ref_id
 
static $root_id
 
static $icons_cache
 

Private Member Functions

 loadRoles ()
 
 doLoadRoles ()
 

Static Private Member Functions

static loadRootOrgRefIdAndId ()
 

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

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

51  {
52  $this->type = "orgu";
53  $this->ilContainer($a_id, $a_call_by_reference);
54  }
ilContainer($a_id=0, $a_call_by_reference=true)
Constructor public.
+ Here is the call graph for this function:

Member Function Documentation

◆ _exists()

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

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

Referenced by ilOrgUnitImporter\buildRef().

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

◆ addTranslation()

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

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

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

Referenced by getTranslations().

568  {
569  global $ilDB;
570 
571  if (empty($a_title)) {
572  $a_title = "NO TITLE";
573  }
574 
575  $query = "INSERT INTO object_translation " . "(obj_id,title,description,lang_code,lang_default) " . "VALUES " . "("
576  . $ilDB->quote($this->getId(), 'integer') . "," . $ilDB->quote($a_title, 'text') . "," . $ilDB->quote($a_desc, 'text') . ","
577  . $ilDB->quote($a_lang, 'text') . "," . $ilDB->quote($a_lang_default, 'integer') . ")";
578  $res = $ilDB->manipulate($query);
579 
580  return true;
581  }
getId()
get object id public
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignUsersToEmployeeRole()

ilObjOrgUnit::assignUsersToEmployeeRole (   $user_ids)

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

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

265  {
266  global $rbacadmin, $ilAppEventHandler;
267  foreach ($user_ids as $user_id) {
268  $rbacadmin->assignUser($this->getEmployeeRole(), $user_id);
269 
270  $ilAppEventHandler->raise('Modules/OrgUnit', 'assignUsersToEmployeeRole', array(
271  'object' => $this,
272  'obj_id' => $this->getId(),
273  'ref_id' => $this->getRefId(),
274  'role_id' => $this->getEmployeeRole(),
275  'user_id' => $user_id
276  ));
277  }
278  }
getId()
get object id public
getRefId()
get reference id public
+ Here is the call graph for this function:

◆ assignUsersToSuperiorRole()

ilObjOrgUnit::assignUsersToSuperiorRole (   $user_ids)

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

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

281  {
282  global $rbacadmin, $ilAppEventHandler;
283  foreach ($user_ids as $user_id) {
284  $rbacadmin->assignUser($this->getSuperiorRole(), $user_id);
285 
286  $ilAppEventHandler->raise('Modules/OrgUnit', 'assignUsersToSuperiorRole', array(
287  'object' => $this,
288  'obj_id' => $this->getId(),
289  'ref_id' => $this->getRefId(),
290  'role_id' => $this->getSuperiorRole(),
291  'user_id' => $user_id
292  ));
293  }
294  }
getId()
get object id public
getRefId()
get reference id public
+ 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 332 of file class.ilObjOrgUnit.php.

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

333  {
334  global $rbacreview, $rbacadmin, $ilAppEventHandler;
335 
336  $arrLocalRoles = $rbacreview->getLocalRoles($this->getRefId());
337  if ( ! in_array($role_id, $arrLocalRoles)) {
338  return false;
339  }
340 
341  $return = $rbacadmin->assignUser($role_id, $user_id);
342 
343  $ilAppEventHandler->raise('Modules/OrgUnit',
344  'assignUserToLocalRole',
345  array('object' => $this,
346  'obj_id' => $this->getId(),
347  'ref_id' => $this->getRefId(),
348  'role_id' => $role_id,
349  'user_id' => $user_id));
350 
351  return $return;
352  }
getId()
get object id public
getRefId()
get reference id public
+ Here is the call graph for this function:

◆ create()

ilObjOrgUnit::create ( )

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

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

70  {
71  global $ilDB;
72  parent::create();
73  $ilDB->insert(self::TABLE_NAME, array(
74  'orgu_type_id' => array( 'integer', $this->getOrgUnitTypeId() ),
75  'orgu_id' => array( 'integer', $this->getId() ),
76  ));
77  }
getId()
get object id public
global $ilDB
+ Here is the call graph for this function:

◆ deassignUserFromEmployeeRole()

ilObjOrgUnit::deassignUserFromEmployeeRole (   $user_id)

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

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

297  {
298  global $rbacadmin, $ilAppEventHandler;
299  $rbacadmin->deassignUser($this->getEmployeeRole(), $user_id);
300 
301  $ilAppEventHandler->raise('Modules/OrgUnit', 'deassignUserFromEmployeeRole', array(
302  'object' => $this,
303  'obj_id' => $this->getId(),
304  'ref_id' => $this->getRefId(),
305  'role_id' => $this->getEmployeeRole(),
306  'user_id' => $user_id
307  ));
308  }
getId()
get object id public
getRefId()
get reference id public
+ 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 362 of file class.ilObjOrgUnit.php.

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

363  {
364  global $rbacreview, $rbacadmin, $ilAppEventHandler;
365 
366  $arrLocalRoles = $rbacreview->getLocalRoles($this->getRefId());
367  if ( ! in_array($role_id, $arrLocalRoles)) {
368  return false;
369  }
370 
371  $return = $rbacadmin->deassignUser($role_id, $user_id);
372 
373  $ilAppEventHandler->raise('Modules/OrgUnit',
374  'deassignUserFromLocalRole',
375  array('object' => $this,
376  'obj_id' => $this->getId(),
377  'ref_id' => $this->getRefId(),
378  'role_id' => $role_id,
379  'user_id' => $user_id));
380 
381  return $return;
382  }
getId()
get object id public
getRefId()
get reference id public
+ Here is the call graph for this function:

◆ deassignUserFromSuperiorRole()

ilObjOrgUnit::deassignUserFromSuperiorRole (   $user_id)

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

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

311  {
312  global $rbacadmin, $ilAppEventHandler;
313  $rbacadmin->deassignUser($this->getSuperiorRole(), $user_id);
314 
315  $ilAppEventHandler->raise('Modules/OrgUnit', 'deassignUserFromSuperiorRole', array(
316  'object' => $this,
317  'obj_id' => $this->getId(),
318  'ref_id' => $this->getRefId(),
319  'role_id' => $this->getSuperiorRole(),
320  'user_id' => $user_id
321  ));
322  }
getId()
get object id public
getRefId()
get reference id public
+ 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 521 of file class.ilObjOrgUnit.php.

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

521  {
522  global $ilDB, $ilAppEventHandler;
523 
524  // always call parent delete function first!!
525  if (!parent::delete()) {
526  return false;
527  }
528 
529  // put here category specific stuff
530  include_once('./Services/User/classes/class.ilObjUserFolder.php');
532 
533  $query = "DELETE FROM object_translation WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer');
534  $res = $ilDB->manipulate($query);
535 
536  $ilAppEventHandler->raise('Modules/OrgUnit', 'delete', array(
537  'object' => $this,
538  'obj_id' => $this->getId()
539  ));
540 
541  $sql = 'DELETE FROM ' . self::TABLE_NAME . ' WHERE orgu_id = ' . $ilDB->quote($this->getId(), 'integer');
542  $ilDB->manipulate($sql);
543 
544  return true;
545  }
static _updateUserFolderAssignment($a_old_id, $a_new_id)
Update user folder assignment Typically called after deleting a category with local user accounts...
getId()
get object id public
global $ilDB
const USER_FOLDER_ID
Class ilObjUserFolder.
+ Here is the call graph for this function:

◆ deleteTranslation()

ilObjOrgUnit::deleteTranslation (   $a_lang)

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

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

558  {
559  global $ilDB;
560 
561  $query = "DELETE FROM object_translation WHERE obj_id= " . $ilDB->quote($this->getId(), 'integer') . " AND lang_code = "
562  . $ilDB->quote($a_lang, 'text');
563  $res = $ilDB->manipulate($query);
564  }
getId()
get object id public
global $ilDB
+ Here is the call graph for this function:

◆ doLoadRoles()

ilObjOrgUnit::doLoadRoles ( )
private

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

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

Referenced by loadRoles().

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

◆ getEmployeeRole()

ilObjOrgUnit::getEmployeeRole ( )
Returns
int

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

References $employee_role, and loadRoles().

Referenced by assignUsersToEmployeeRole(), and deassignUserFromEmployeeRole().

400  {
401  $this->loadRoles();
402 
403  return $this->employee_role;
404  }
+ 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 468 of file class.ilObjOrgUnit.php.

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

◆ getOrgUnitType()

ilObjOrgUnit::getOrgUnitType ( )
Returns
ilOrgUnitType|null

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

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

Referenced by update().

118  {
120  }
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 110 of file class.ilObjOrgUnit.php.

References $orgu_type_id.

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

110  {
111  return $this->orgu_type_id;
112  }
+ Here is the caller graph for this function:

◆ getRootOrgId()

static ilObjOrgUnit::getRootOrgId ( )
static

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

Referenced by ilOrgUnitExporter\sendAndCreateSimpleExportFile().

203  {
204  self::loadRootOrgRefIdAndId();
205 
206  return self::$root_id;
207  }
+ Here is the caller graph for this function:

◆ getRootOrgRefId()

◆ getSuperiorRole()

ilObjOrgUnit::getSuperiorRole ( )
Returns
int

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

References $superior_role, and loadRoles().

Referenced by assignUsersToSuperiorRole(), and deassignUserFromSuperiorRole().

418  {
419  $this->loadRoles();
420 
421  return $this->superior_role;
422  }
+ 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 453 of file class.ilObjOrgUnit.php.

Referenced by getTranslations().

453  {
454  if (parent::getTitle() != "__OrgUnitAdministration") {
455  return parent::getTitle();
456  } else {
457  return $this->lng->txt("objs_orgu");
458  }
459  }
+ 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 480 of file class.ilObjOrgUnit.php.

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

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

◆ initDefaultRoles()

ilObjOrgUnit::initDefaultRoles ( )

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

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

Referenced by loadRoles().

425  {
426  global $rbacadmin, $rbacreview, $ilAppEventHandler;
427  include_once './Services/AccessControl/classes/class.ilObjRole.php';
428  $role = new ilObjRole();
429  $role->setTitle("il_orgu_employee_" . $this->getRefId());
430  $role->setDescription("Emplyee of org unit obj_no." . $this->getId());
431  $role->create();
432 
433  $GLOBALS['rbacadmin']->assignRoleToFolder($role->getId(), $this->getRefId(), 'y');
434 
435  include_once './Services/AccessControl/classes/class.ilObjRole.php';
436  $role_sup = ilObjRole::createDefaultRole('il_orgu_superior_' . $this->getRefId(), "Superior of org unit obj_no."
437  . $this->getId(), 'il_orgu_superior', $this->getRefId());
438 
439  $ilAppEventHandler->raise('Modules/OrgUnit', 'initDefaultRoles', array(
440  'object' => $this,
441  'obj_id' => $this->getId(),
442  'ref_id' => $this->getRefId(),
443  'role_superior_id' => $role->getId(),
444  'role_employee_id' => $role_sup->getId()
445  ));
446  }
Class ilObjRole.
static createDefaultRole($a_title, $a_description, $a_tpl_name, $a_ref_id)
getId()
get object id public
$GLOBALS['ct_recipient']
getRefId()
get reference id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadRoles()

ilObjOrgUnit::loadRoles ( )
private

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

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

Referenced by getEmployeeRole(), and getSuperiorRole().

224  {
225  global $ilLog;
226  if (!$this->employee_role || !$this->superior_role) {
227  $this->doLoadRoles();
228  }
229 
230  if (!$this->employee_role || !$this->superior_role) {
231  $this->initDefaultRoles();
232  $this->doLoadRoles();
233  if (!$this->employee_role || !$this->superior_role) {
234  throw new Exception("The standard roles the orgu object with id: " . $this->getId()
235  . " aren't initialized or have been deleted, newly creating them didn't work!");
236  } else {
237  $ilLog->write("[" . __FILE__ . ":" . __LINE__ . "] The standard roles for the orgu obj with id: " . $this->getId()
238  . " were newly created as they couldnt be found.");
239  }
240  }
241  }
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadRootOrgRefIdAndId()

static ilObjOrgUnit::loadRootOrgRefIdAndId ( )
staticprivate

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

References $ilDB, and $res.

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

◆ removeTranslations()

ilObjOrgUnit::removeTranslations ( )

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

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

549  {
550  global $ilDB;
551 
552  $query = "DELETE FROM object_translation WHERE obj_id= " . $ilDB->quote($this->getId(), 'integer');
553  $res = $ilDB->manipulate($query);
554  }
getId()
get object id public
global $ilDB
+ Here is the call graph for this function:

◆ setEmployeeRole()

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

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

References $employee_role.

387  {
388  $this->employee_role = $employee_role;
389  }

◆ setOrgUnitTypeId()

ilObjOrgUnit::setOrgUnitTypeId (   $a_id)
Parameters
$a_id

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

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

Referenced by __construct().

126  {
127  $this->orgu_type_id = $a_id;
128  }
+ 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 410 of file class.ilObjOrgUnit.php.

References $superior_role.

410  {
411  $this->superior_role = $superior_role;
412  }

◆ update()

ilObjOrgUnit::update ( )

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

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

80  {
81  global $ilDB;
82  parent::update();
83  $sql = 'SELECT * FROM ' . self::TABLE_NAME . ' WHERE orgu_id = ' . $ilDB->quote($this->getId(), 'integer');
84  $set = $ilDB->query($sql);
85  if ($ilDB->numRows($set)) {
86  $ilDB->update(self::TABLE_NAME, array(
87  'orgu_type_id' => array( 'integer', $this->getOrgUnitTypeId() ),
88  ), array(
89  'orgu_id' => array( 'integer', $this->getId() ),
90  ));
91  } else {
92  $ilDB->insert(self::TABLE_NAME, array(
93  'orgu_type_id' => array( 'integer', $this->getOrgUnitTypeId() ),
94  'orgu_id' => array( 'integer', $this->getId() ),
95  ));
96  }
97  // Update selection for advanced meta data of the type
98  if ($this->getOrgUnitTypeId()) {
99  ilAdvancedMDRecord::saveObjRecSelection($this->getId(), 'orgu_type', $this->getOrgUnitType()->getAssignedAdvancedMDRecordIds());
100  } else {
101  // If no type is assigned, delete relations by passing an empty array
102  ilAdvancedMDRecord::saveObjRecSelection($this->getId(), 'orgu_type', array());
103  }
104  }
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
global $ilDB
+ Here is the call graph for this function:

◆ updateTranslation()

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

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

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

585  {
586  global $ilDB, $ilLog;
587 
588  if (empty($a_title)) {
589  $a_title = "NO TITLE";
590  }
591 
592  $query = "UPDATE object_translation SET ";
593 
594  $query .= " title = " . $ilDB->quote($a_title, 'text');
595 
596  if ($a_desc != "") {
597  $query .= ", description = " . $ilDB->quote($a_desc, 'text') . " ";
598  }
599 
600  if ($a_lang_default) {
601  $query .= ", lang_default = " . $ilDB->quote($a_lang_default, 'integer') . " ";
602  }
603 
604  $query .= " WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer') . " AND lang_code = " . $ilDB->quote($a_lang, 'text');
605  $res = $ilDB->manipulate($query);
606 
607  return true;
608  }
getId()
get object id public
global $ilDB
+ Here is the call graph for this function:

Field Documentation

◆ $amd_data

ilObjOrgUnit::$amd_data
protected

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

Referenced by setOrgUnitTypeId().

◆ $employee_role

ilObjOrgUnit::$employee_role
protected

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

Referenced by getEmployeeRole(), and setEmployeeRole().

◆ $icons_cache

ilObjOrgUnit::$icons_cache
staticprotected

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

Referenced by setOrgUnitTypeId().

◆ $orgu_type_id

ilObjOrgUnit::$orgu_type_id = 0
protected

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

Referenced by getOrgUnitTypeId().

◆ $root_id

ilObjOrgUnit::$root_id
staticprotected

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

◆ $root_ref_id

ilObjOrgUnit::$root_ref_id
staticprotected

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

◆ $superior_role

ilObjOrgUnit::$superior_role
protected

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

Referenced by getSuperiorRole(), and setSuperiorRole().

◆ TABLE_NAME

const ilObjOrgUnit::TABLE_NAME = 'orgu_data'

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


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