ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilOrgUnitType Class Reference

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

+ Collaboration diagram for ilOrgUnitType:

Public Member Functions

 __construct (int $a_id=0)
 
 save ()
 Wrapper around create() and update() methods. More...
 
 getTitle (string $a_lang_code='')
 Get the title of an OrgUnit type. More...
 
 setTitle (string $a_title, string $a_lang_code='')
 Set title of OrgUnit type. More...
 
 getDescription (string $a_lang_code='')
 Get the description of an OrgUnit type. More...
 
 setDescription (string $a_description, string $a_lang_code='')
 Set description of OrgUnit type. More...
 
 getOrgUnitIds (bool $include_deleted=true)
 Get an array of IDs of ilObjOrgUnit objects using this type. More...
 
 getOrgUnits (bool $include_deleted=true)
 Get an array of ilObjOrgUnit objects using this type. More...
 
 getAssignedAdvancedMDRecords (bool $a_only_active=false)
 Get assigned AdvancedMDRecord objects. More...
 
 processAndStoreIconFile (array $file_data)
 Resize and store an icon file for this object. More...
 
 removeIconFile ()
 Remove the icon file on disk. More...
 
 getActivePlugins ()
 Get array of all acitve plugins for the ilOrgUnitTypeHook plugin slot. More...
 
 setTranslations (array $translations)
 Getters & Setters. More...
 
 getTranslations ()
 Returns the loaded translation objects. More...
 
 setOwner (int $owner)
 
 getOwner ()
 
 setLastUpdate (string $last_update)
 
 getLastUpdate ()
 
 getId ()
 
 setIcon (?string $icon)
 Set new Icon filename. More...
 
 getIcon ()
 
 getIconPath (bool $append_filename=false)
 Return the path to the icon. More...
 
 getDefaultLang ()
 
 setCreateDate (string $create_date)
 
 getCreateDate ()
 

Static Public Member Functions

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. More...
 
static getAllTypes ()
 Get array of all instances of ilOrgUnitType objects. More...
 
static getAvailableAdvancedMDRecords ()
 Get all available AdvancedMDRecord objects for OrgUnits/Types. More...
 

Data Fields

const TABLE_NAME = 'orgu_types'
 
const WEB_DATA_FOLDER = 'orgu_data'
 Folder in ILIAS webdir to store the icons. More...
 

Protected Member Functions

 getTranslation (string $a_member, string $a_lang_code)
 Protected. More...
 
 loadTranslation (string $a_lang_code)
 Helper function to load a translation. More...
 
 read ()
 Read object data from database. More...
 
 updateable ()
 Helper function to check if this type can be updated. More...
 

Protected Attributes

int $id = 0
 
string $default_lang = ''
 
int $owner
 
string $create_date
 
string $last_update
 
string $icon = null
 
array $translations = array()
 
array $amd_records_assigned
 
array $orgus = []
 
array $orgus_ids = []
 
ilDBInterface $db
 
ILIAS DI LoggingServices $log
 
ilObjUser $user
 
array $active_plugins
 
ilLanguage $lng
 
ilComponentFactory $component_factory
 

Static Protected Attributes

static array $amd_records_available = null
 
static array $instances = array()
 

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 ilOrgUnitType

Author
: 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 24 of file class.ilOrgUnitType.php.

Constructor & Destructor Documentation

◆ __construct()

ilOrgUnitType::__construct ( int  $a_id = 0)
Exceptions
ilOrgUnitTypeException

Definition at line 55 of file class.ilOrgUnitType.php.

References $DIC, ILIAS\Repository\int(), ILIAS\Repository\lng(), read(), and ILIAS\Repository\user().

56  {
57  global $DIC;
58  $this->component_factory = $DIC['component.factory'];
59  $this->db = $DIC->database();
60  $this->log = $DIC->logger();
61  $this->user = $DIC->user();
62  $this->lng = $DIC->language();
63  if ($a_id) {
64  $this->id = (int) $a_id;
65  $this->read();
66  }
67  }
read()
Read object data from database.
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ getActivePlugins()

ilOrgUnitType::getActivePlugins ( )

Get array of all acitve plugins for the ilOrgUnitTypeHook plugin slot.

Returns
array

Definition at line 654 of file class.ilOrgUnitType.php.

Referenced by getAllTypes(), getAvailableAdvancedMDRecords(), getIconPath(), getTranslation(), save(), and updateable().

654  : array
655  {
656  return iterator_to_array($this->component_factory->getActivePluginsInSlot("orgutypehk"));
657  }
+ Here is the caller graph for this function:

◆ getAllTypes()

static ilOrgUnitType::getAllTypes ( )
static

Get array of all instances of ilOrgUnitType objects.

Definition at line 97 of file class.ilOrgUnitType.php.

References $DIC, $ilDB, $lang, XapiProxy\$plugin, $type, getActivePlugins(), getDefaultLang(), getIcon(), getId(), getOwner(), getTranslation(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

Referenced by ilOrgUnitTypeTableGUI\initColumns(), and ilObjOrgUnitSettingsFormGUI\saveObject().

97  : array
98  {
99  global $DIC;
100  $ilDB = $DIC['ilDB'];
101  $sql = 'SELECT id FROM ' . self::TABLE_NAME;
102  $set = $ilDB->query($sql);
103  $types = array();
104  while ($rec = $ilDB->fetchObject($set)) {
105  $type = new self($rec->id);
106  $types[] = $type;
107  self::$instances[$rec->id] = $type;
108  }
109 
110  return $types;
111  }
$type
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAssignedAdvancedMDRecords()

ilOrgUnitType::getAssignedAdvancedMDRecords ( bool  $a_only_active = false)

Get assigned AdvancedMDRecord objects.

Parameters
bool$a_only_activeTrue if only active AMDRecords are returned
Returns
ilAdvancedMDRecord[]

Definition at line 374 of file class.ilOrgUnitType.php.

References getId().

374  : array
375  {
376  $active = ($a_only_active) ? 1 : 0; // Cache key
377  if (isset($this->amd_records_assigned[$active])) {
378  return $this->amd_records_assigned[$active];
379  }
380  $this->amd_records_assigned[$active] = [];
381  $sql = 'SELECT * FROM orgu_types_adv_md_rec WHERE type_id = ' . $this->db->quote($this->getId(), 'integer');
382  $set = $this->db->query($sql);
383  while ($rec = $this->db->fetchObject($set)) {
384  $amd_record = new ilAdvancedMDRecord((int) $rec->rec_id);
385  if ($a_only_active) {
386  if ($amd_record->isActive()) {
387  $this->amd_records_assigned[1][] = $amd_record;
388  }
389  } else {
390  $this->amd_records_assigned[0][] = $amd_record;
391  }
392  }
393 
394  return $this->amd_records_assigned[$active];
395  }
+ Here is the call graph for this function:

◆ getAvailableAdvancedMDRecords()

static ilOrgUnitType::getAvailableAdvancedMDRecords ( )
static

Get all available AdvancedMDRecord objects for OrgUnits/Types.

Returns
ilAdvancedMDRecord[]

Definition at line 417 of file class.ilOrgUnitType.php.

References ILIAS\LTI\ToolProvider\$key, XapiProxy\$plugin, ilAdvancedMDRecord\_getActivatedRecordsByObjectType(), getActivePlugins(), getId(), getOrgUnitIds(), ILIAS\Repository\lng(), and ilAdvancedMDRecord\saveObjRecSelection().

Referenced by ilOrgUnitTypeAdvancedMetaDataFormGUI\saveObject().

417  : array
418  {
419  if (is_array(self::$amd_records_available)) {
420  return self::$amd_records_available;
421  }
422  self::$amd_records_available = ilAdvancedMDRecord::_getActivatedRecordsByObjectType('orgu', 'orgu_type');
423 
424  return self::$amd_records_available;
425  }
static _getActivatedRecordsByObjectType(string $a_obj_type, string $a_sub_type="", bool $a_only_optional=false)
Get activated records by object type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCreateDate()

ilOrgUnitType::getCreateDate ( )

Definition at line 855 of file class.ilOrgUnitType.php.

References $create_date.

855  : string
856  {
857  return $this->create_date;
858  }

◆ getDefaultLang()

ilOrgUnitType::getDefaultLang ( )

Definition at line 845 of file class.ilOrgUnitType.php.

References $default_lang.

Referenced by getAllTypes(), getTranslation(), setDescription(), and setTitle().

845  : string
846  {
847  return $this->default_lang;
848  }
+ Here is the caller graph for this function:

◆ getDescription()

ilOrgUnitType::getDescription ( string  $a_lang_code = '')

Get the description of an OrgUnit type.

If no language code is given, a translation in the user-language is returned. If no such translation exists, the description of the default language is substituted. If a language code is provided, returns description for the given language or null.

Parameters
string$a_lang_code
Returns
null|string

Definition at line 289 of file class.ilOrgUnitType.php.

References getTranslation().

289  : ?string
290  {
291  return $this->getTranslation('description', $a_lang_code);
292  }
getTranslation(string $a_member, string $a_lang_code)
Protected.
+ Here is the call graph for this function:

◆ getIcon()

ilOrgUnitType::getIcon ( )

Definition at line 792 of file class.ilOrgUnitType.php.

References $icon.

Referenced by getAllTypes(), getIconPath(), and processAndStoreIconFile().

792  : ?string
793  {
794  return $this->icon;
795  }
+ Here is the caller graph for this function:

◆ getIconPath()

ilOrgUnitType::getIconPath ( bool  $append_filename = false)

Return the path to the icon.

Parameters
bool$append_filenameIf true, append filename of icon
Returns
string

Definition at line 802 of file class.ilOrgUnitType.php.

References $default_lang, $path, XapiProxy\$plugin, getActivePlugins(), getIcon(), getId(), ilFileUtils\getWebspaceDir(), and ILIAS\Repository\lng().

Referenced by processAndStoreIconFile(), removeIconFile(), and save().

802  : string
803  {
804  $path = ilFileUtils::getWebspaceDir() . '/' . self::WEB_DATA_FOLDER . '/' . 'type_' . $this->getId() . '/';
805  if ($append_filename) {
806  $path .= $this->getIcon();
807  }
808 
809  return $path;
810  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
$path
Definition: ltiservices.php:32
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getId()

ilOrgUnitType::getId ( )

Definition at line 772 of file class.ilOrgUnitType.php.

References $id.

Referenced by getAllTypes(), getAssignedAdvancedMDRecords(), getAvailableAdvancedMDRecords(), getIconPath(), getOrgUnitIds(), getTranslation(), getTranslations(), loadTranslation(), and save().

772  : int
773  {
774  return $this->id;
775  }
+ Here is the caller graph for this function:

◆ getInstance()

static ilOrgUnitType::getInstance ( int  $a_id)
static

Get instance of an ilOrgUnitType object Returns object from cache or from database, returns null if no object was found.

Parameters
int$a_idID of the OrgUnit type
Returns
ilOrgUnitType|null

Definition at line 75 of file class.ilOrgUnitType.php.

References Vendor\Package\$e, and $type.

Referenced by ilObjOrgUnit\getIconsCache(), ilObjOrgUnit\getOrgUnitType(), and ilModulesOrgUnitTest\testIfOrgUnitHasRequiredLocalRoles().

75  : ?ilOrgUnitType
76  {
77  if (!$a_id) {
78  return null;
79  }
80  if (isset(self::$instances[$a_id])) {
81  return self::$instances[$a_id];
82  } else {
83  try {
84  $type = new self($a_id);
85  self::$instances[$a_id] = $type;
86 
87  return $type;
88  } catch (ilOrgUnitTypeException $e) {
89  return null;
90  }
91  }
92  }
Class ilOrgUnitTypeException.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$type
+ Here is the caller graph for this function:

◆ getLastUpdate()

ilOrgUnitType::getLastUpdate ( )

Definition at line 767 of file class.ilOrgUnitType.php.

References $last_update.

767  : string
768  {
769  return $this->last_update;
770  }

◆ getOrgUnitIds()

ilOrgUnitType::getOrgUnitIds ( bool  $include_deleted = true)

Get an array of IDs of ilObjOrgUnit objects using this type.

Parameters
bool$include_deleted
Returns
array

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

References getId().

Referenced by getAvailableAdvancedMDRecords(), and getOrgUnits().

311  : array
312  {
313  $cache_key = ($include_deleted) ? 1 : 0;
314 
315  if (array_key_exists($cache_key, $this->orgus_ids)
316  && is_array($this->orgus_ids[$cache_key])
317  ) {
318  return $this->orgus_ids[$cache_key];
319  }
320  if ($include_deleted) {
321  $sql = 'SELECT * FROM orgu_data WHERE orgu_type_id = ' . $this->db->quote($this->getId(), 'integer');
322  } else {
323  $sql
324  = 'SELECT DISTINCT orgu_id FROM orgu_data od ' . 'JOIN object_reference oref ON oref.obj_id = od.orgu_id ' . 'WHERE od.orgu_type_id = '
325  . $this->db->quote($this->getId(), 'integer') . ' AND oref.deleted IS NULL';
326  }
327  $set = $this->db->query($sql);
328  $this->orgus_ids[$cache_key] = array();
329  while ($rec = $this->db->fetchObject($set)) {
330  $this->orgus_ids[$cache_key][] = $rec->orgu_id;
331  }
332 
333  return $this->orgus_ids[$cache_key];
334  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOrgUnits()

ilOrgUnitType::getOrgUnits ( bool  $include_deleted = true)

Get an array of ilObjOrgUnit objects using this type.

Parameters
bool$include_deletedTrue if also deleted OrgUnits are returned
Returns
int[]

Definition at line 341 of file class.ilOrgUnitType.php.

References $ref_id, ilObject\_getAllReferences(), ilObject\_isInTrash(), and getOrgUnitIds().

Referenced by save().

341  : array
342  {
343  $cache_key = ($include_deleted) ? 1 : 0;
344 
345  if (array_key_exists($cache_key, $this->orgus)
346  && is_array($this->orgus[$cache_key])
347  ) {
348  return $this->orgus[$cache_key];
349  }
350  $this->orgus[$cache_key] = array();
351  $ids = $this->getOrgUnitIds($include_deleted);
352  foreach ($ids as $id) {
353  $orgu = new ilObjOrgUnit($id, false);
354  if (!$include_deleted) {
355  // Check if OrgUnit is in trash (each OrgUnit does only have one reference)
356  $ref_ids = ilObject::_getAllReferences($id);
357  $ref_ids = array_values($ref_ids);
358  $ref_id = $ref_ids[0];
360  continue;
361  }
362  }
363  $this->orgus[$cache_key][] = $orgu;
364  }
365 
366  return $this->orgus[$cache_key];
367  }
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:67
getOrgUnitIds(bool $include_deleted=true)
Get an array of IDs of ilObjOrgUnit objects using this type.
static _isInTrash(int $ref_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOwner()

ilOrgUnitType::getOwner ( )

Definition at line 757 of file class.ilOrgUnitType.php.

References $owner.

Referenced by getAllTypes().

757  : int
758  {
759  return $this->owner;
760  }
+ Here is the caller graph for this function:

◆ getTitle()

ilOrgUnitType::getTitle ( string  $a_lang_code = '')

Get the title of an OrgUnit type.

If no language code is given, a translation in the user-language is returned. If no such translation exists, the translation of the default language is substituted. If a language code is provided, returns title for the given language or null.

Parameters
string$a_lang_code
Returns
null|string

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

References getTranslation().

265  : ?string
266  {
267  return $this->getTranslation('title', $a_lang_code);
268  }
getTranslation(string $a_member, string $a_lang_code)
Protected.
+ Here is the call graph for this function:

◆ getTranslation()

ilOrgUnitType::getTranslation ( string  $a_member,
string  $a_lang_code 
)
protected

Protected.

Helper method to return a translation for a given member and language

Parameters
$a_member
$a_lang_code
Returns
null|string

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

References $lang, XapiProxy\$plugin, getActivePlugins(), getDefaultLang(), getId(), ILIAS\Repository\lng(), loadTranslation(), and ILIAS\Repository\user().

Referenced by getAllTypes(), getDescription(), and getTitle().

564  : ?string
565  {
566  $lang = ($a_lang_code) ? $a_lang_code : $this->user->getLanguage();
567  $trans_obj = $this->loadTranslation($lang);
568  if (!is_null($trans_obj)) {
569  $translation = $trans_obj->getMember($a_member);
570  // If the translation does exist but is an empty string and there was no lang code given,
571  // substitute default language anyway because an empty string provides no information
572  if (!$a_lang_code && !$translation) {
573  $trans_obj = $this->loadTranslation($this->getDefaultLang());
574 
575  return $trans_obj->getMember($a_member);
576  }
577 
578  return $translation;
579  } else {
580  // If no lang code was given and there was no translation found, return string in default language
581  if (!$a_lang_code) {
582  $trans_obj = $this->loadTranslation($this->getDefaultLang());
583 
584  return $trans_obj->getMember($a_member);
585  }
586 
587  return null;
588  }
589  }
loadTranslation(string $a_lang_code)
Helper function to load a translation.
$lang
Definition: xapiexit.php:26
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTranslations()

ilOrgUnitType::getTranslations ( )

Returns the loaded translation objects.

Returns
array

Definition at line 732 of file class.ilOrgUnitType.php.

References $translations, and getId().

732  : array
733  {
734  return $this->translations;
735  }
+ Here is the call graph for this function:

◆ loadTranslation()

ilOrgUnitType::loadTranslation ( string  $a_lang_code)
protected

Helper function to load a translation.

Returns translation object from cache or null, if no translation exists for the given code.

Parameters
string$a_lang_codeA language code
Returns
ilOrgUnitTypeTranslation|null

Definition at line 665 of file class.ilOrgUnitType.php.

References getId(), and ilOrgUnitTypeTranslation\getInstance().

Referenced by getTranslation().

666  {
667  if (isset($this->translations[$a_lang_code])) {
668  return $this->translations[$a_lang_code];
669  } else {
670  $trans_obj = ilOrgUnitTypeTranslation::getInstance($this->getId(), $a_lang_code);
671  if (!is_null($trans_obj)) {
672  $this->translations[$a_lang_code] = $trans_obj;
673 
674  return $trans_obj;
675  }
676  }
677 
678  return null;
679  }
static getInstance(int $a_orgu_type_id, string $a_lang_code)
Get instance of an ilOrgUnitType object Returns object from cache or from database, returns null if no object was found.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processAndStoreIconFile()

ilOrgUnitType::processAndStoreIconFile ( array  $file_data)

Resize and store an icon file for this object.

Parameters
array$file_dataThe array containing file information from the icon from PHPs $_FILES array
Returns
bool

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

References $filename, getIcon(), getIconPath(), ilFileUtils\makeDirParents(), ilFileUtils\moveUploadedFile(), and updateable().

524  : bool
525  {
526  if (!$this->updateable()) {
527  return false;
528  }
529  if (!count($file_data) || !$file_data['name']) {
530  return false;
531  }
532  if (!is_dir($this->getIconPath())) {
534  }
535  $filename = $this->getIcon() ? $this->getIcon() : $file_data['name'];
536  return ilFileUtils::moveUploadedFile($file_data['tmp_name'], $filename, $this->getIconPath(true), false);
537  }
updateable()
Helper function to check if this type can be updated.
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
getIconPath(bool $append_filename=false)
Return the path to the icon.
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
$filename
Definition: buildRTE.php:78
+ Here is the call graph for this function:

◆ read()

ilOrgUnitType::read ( )
protected

Read object data from database.

Exceptions
ilOrgUnitTypeException

Definition at line 685 of file class.ilOrgUnitType.php.

References setCreateDate(), setIcon(), setLastUpdate(), and setOwner().

Referenced by __construct().

685  : void
686  {
687  $sql = 'SELECT * FROM ' . self::TABLE_NAME . ' WHERE id = ' . $this->db->quote($this->id, 'integer');
688  $set = $this->db->query($sql);
689  if (!$this->db->numRows($set)) {
690  throw new ilOrgUnitTypeException("OrgUnit type with id {$this->id} does not exist in database");
691  }
692  $rec = $this->db->fetchObject($set);
693  $this->default_lang = $rec->default_lang; // Don't use Setter because of unnecessary plugin checks
694  $this->setCreateDate($rec->create_date);
695  $this->setLastUpdate($rec->last_update);
696  $this->setOwner($rec->owner);
697  $this->setIcon($rec->icon);
698  }
Class ilOrgUnitTypeException.
setCreateDate(string $create_date)
setIcon(?string $icon)
Set new Icon filename.
setLastUpdate(string $last_update)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeIconFile()

ilOrgUnitType::removeIconFile ( )

Remove the icon file on disk.

Definition at line 542 of file class.ilOrgUnitType.php.

References getIconPath(), setIcon(), and updateable().

542  : void
543  {
544  if (!$this->updateable()) {
545  return;
546  }
547  if (is_file($this->getIconPath(true))) {
548  unlink($this->getIconPath(true));
549  $this->setIcon('');
550  }
551  }
updateable()
Helper function to check if this type can be updated.
getIconPath(bool $append_filename=false)
Return the path to the icon.
setIcon(?string $icon)
Set new Icon filename.
+ Here is the call graph for this function:

◆ save()

ilOrgUnitType::save ( )

Wrapper around create() and update() methods.

Exceptions
ilOrgUnitTypePluginException

Definition at line 189 of file class.ilOrgUnitType.php.

References XapiProxy\$plugin, getActivePlugins(), getIconPath(), getId(), getOrgUnits(), and ILIAS\Repository\lng().

189  : void
190  {
191  if ($this->getId()) {
192  $this->update();
193  } else {
194  $this->create();
195  }
196  }
+ Here is the call graph for this function:

◆ setCreateDate()

ilOrgUnitType::setCreateDate ( string  $create_date)

Definition at line 850 of file class.ilOrgUnitType.php.

References $create_date.

Referenced by read().

851  {
852  $this->create_date = $create_date;
853  }
+ Here is the caller graph for this function:

◆ setDescription()

ilOrgUnitType::setDescription ( string  $a_description,
string  $a_lang_code = '' 
)

Set description of OrgUnit type.

If no lang code is given, sets description for default language.

Parameters
$a_description
string$a_lang_code

Definition at line 300 of file class.ilOrgUnitType.php.

References $lang, and getDefaultLang().

300  : void
301  {
302  $lang = ($a_lang_code) ? $a_lang_code : $this->getDefaultLang();
303  $this->setTranslation('description', $a_description, $lang);
304  }
$lang
Definition: xapiexit.php:26
+ Here is the call graph for this function:

◆ setIcon()

ilOrgUnitType::setIcon ( ?string  $icon)

Set new Icon filename.

Note that if you did also send a new icon image file with a form, make sure to call ilOrgUnitType::processAndStoreIconFile() to store the file additionally on disk. If you want to delete the icon, set call ilOrgUnitType::removeIconFile() first and set an empty string here.

Exceptions
ilOrgUnitTypeException

Definition at line 784 of file class.ilOrgUnitType.php.

References $icon.

Referenced by read(), and removeIconFile().

784  : void
785  {
786  if ($icon and !preg_match('/\.(svg)$/', $icon)) {
787  throw new ilOrgUnitTypeException('Icon must be set with file extension svg');
788  }
789  $this->icon = $icon;
790  }
Class ilOrgUnitTypeException.
+ Here is the caller graph for this function:

◆ setLastUpdate()

ilOrgUnitType::setLastUpdate ( string  $last_update)

Definition at line 762 of file class.ilOrgUnitType.php.

References $last_update.

Referenced by read().

763  {
764  $this->last_update = $last_update;
765  }
+ Here is the caller graph for this function:

◆ setOwner()

ilOrgUnitType::setOwner ( int  $owner)

Definition at line 752 of file class.ilOrgUnitType.php.

References $owner.

Referenced by read().

753  {
754  $this->owner = $owner;
755  }
+ Here is the caller graph for this function:

◆ setTitle()

ilOrgUnitType::setTitle ( string  $a_title,
string  $a_lang_code = '' 
)

Set title of OrgUnit type.

If no lang code is given, sets title for default language.

Parameters
$a_title
string$a_lang_code

Definition at line 276 of file class.ilOrgUnitType.php.

References $lang, and getDefaultLang().

277  {
278  $lang = ($a_lang_code) ? $a_lang_code : $this->getDefaultLang();
279  $this->setTranslation('title', $a_title, $lang);
280  }
$lang
Definition: xapiexit.php:26
+ Here is the call graph for this function:

◆ setTranslations()

ilOrgUnitType::setTranslations ( array  $translations)

Getters & Setters.

Parameters
string[]$translations

Definition at line 723 of file class.ilOrgUnitType.php.

References $translations.

724  {
725  $this->translations = $translations;
726  }

◆ updateable()

ilOrgUnitType::updateable ( )
protected

Helper function to check if this type can be updated.

Returns
bool

Definition at line 704 of file class.ilOrgUnitType.php.

References XapiProxy\$plugin, and getActivePlugins().

Referenced by processAndStoreIconFile(), and removeIconFile().

704  : bool
705  {
706  foreach ($this->getActivePlugins() as $plugin) {
707  if (!$plugin->allowUpdate($this->getId())) {
708  return false;
709  }
710  }
711 
712  return true;
713  }
getActivePlugins()
Get array of all acitve plugins for the ilOrgUnitTypeHook plugin slot.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $active_plugins

array ilOrgUnitType::$active_plugins
protected

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

◆ $amd_records_assigned

array ilOrgUnitType::$amd_records_assigned
protected

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

◆ $amd_records_available

array ilOrgUnitType::$amd_records_available = null
staticprotected

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

◆ $component_factory

ilComponentFactory ilOrgUnitType::$component_factory
protected

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

◆ $create_date

string ilOrgUnitType::$create_date
protected

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

Referenced by getCreateDate(), and setCreateDate().

◆ $db

ilDBInterface ilOrgUnitType::$db
protected

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

◆ $default_lang

string ilOrgUnitType::$default_lang = ''
protected

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

Referenced by getDefaultLang(), and getIconPath().

◆ $icon

string ilOrgUnitType::$icon = null
protected

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

Referenced by getIcon(), and setIcon().

◆ $id

int ilOrgUnitType::$id = 0
protected

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

Referenced by getId().

◆ $instances

array ilOrgUnitType::$instances = array()
staticprotected
Parameters
self[]

Definition at line 48 of file class.ilOrgUnitType.php.

◆ $last_update

string ilOrgUnitType::$last_update
protected

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

Referenced by getLastUpdate(), and setLastUpdate().

◆ $lng

ilLanguage ilOrgUnitType::$lng
protected

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

◆ $log

ILIAS DI LoggingServices ilOrgUnitType::$log
protected

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

◆ $orgus

array ilOrgUnitType::$orgus = []
protected

Definition at line 40 of file class.ilOrgUnitType.php.

◆ $orgus_ids

array ilOrgUnitType::$orgus_ids = []
protected

Definition at line 41 of file class.ilOrgUnitType.php.

◆ $owner

int ilOrgUnitType::$owner
protected

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

Referenced by getOwner(), and setOwner().

◆ $translations

array ilOrgUnitType::$translations = array()
protected

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

Referenced by getTranslations(), and setTranslations().

◆ $user

ilObjUser ilOrgUnitType::$user
protected

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

◆ TABLE_NAME

const ilOrgUnitType::TABLE_NAME = 'orgu_types'

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

◆ WEB_DATA_FOLDER

const ilOrgUnitType::WEB_DATA_FOLDER = 'orgu_data'

Folder in ILIAS webdir to store the icons.

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


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