ILIAS  trunk Revision v11.0_alpha-1861-g09f3d197f78
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilStudyProgrammeType Class Reference

Class ilStudyProgrammeType. More...

+ Collaboration diagram for ilStudyProgrammeType:

Public Member Functions

 __construct (int $id, ilStudyProgrammeTypeRepository $type_repo, ilLanguage $lng, ilObjUser $user, ilComponentFactory $component_factory)
 
 getTitle (string $a_lang_code='')
 Get the title of an StudyProgramme type. More...
 
 setTitle (string $title, string $lang_code='')
 Set title of StudyProgramme type. More...
 
 getDescription (string $lang_code='')
 Get the description of an StudyProgramme type. More...
 
 setDescription (string $description, string $lang_code='')
 Set description of StudyProgramme type. More...
 
 updateAssignedStudyProgrammesIcons ()
 Update the Icons of assigned objects. More...
 
 setTranslations (array $translations)
 Getters & Setters. More...
 
 getTranslations ()
 
 setOwner (int $owner)
 
 getOwner ()
 
 setLastUpdate (DateTime $last_update)
 
 getLastUpdate ()
 
 getId ()
 
 withIconIdentifier (?string $identifier)
 
 getIconIdentifier ()
 
 setDefaultLang (string $default_lang)
 
 getDefaultLang ()
 
 setCreateDate (DateTime $create_date)
 
 getCreateDate ()
 
 getRepository ()
 
 changedTranslations ()
 

Data Fields

const DATE_TIME_FORMAT = 'Y-m-d H:i:s'
 
const DATE_FORMAT = 'Y-m-d'
 

Protected Member Functions

 getTranslation (string $member, string $lang_code)
 Helper method to return a translation for a given member and language. More...
 
 loadTranslation (string $lang_code)
 
 updateable ()
 Helper function to check if this type can be updated. More...
 
 getActivePlugins ()
 

Protected Attributes

string $default_lang = ''
 
int $owner
 
DateTime $create_date
 
DateTime $last_update
 
string $icon
 
ilObjUser $user
 
array $active_plugins
 
ilLanguage $lng
 
array $translations
 
array $changed_translations = array()
 
int $id = 0
 
ilStudyProgrammeTypeRepository $type_repo
 
ilComponentFactory $component_factory
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeType::__construct ( int  $id,
ilStudyProgrammeTypeRepository  $type_repo,
ilLanguage  $lng,
ilObjUser  $user,
ilComponentFactory  $component_factory 
)

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

References $component_factory, $id, $lng, $type_repo, $user, ILIAS\Repository\lng(), and ILIAS\Repository\user().

52  {
53  $this->id = $id;
54  $this->type_repo = $type_repo;
55  $this->lng = $lng;
56  $this->user = $user;
57  $this->component_factory = $component_factory;
58  }
ilStudyProgrammeTypeRepository $type_repo
ilComponentFactory $component_factory
+ Here is the call graph for this function:

Member Function Documentation

◆ changedTranslations()

ilStudyProgrammeType::changedTranslations ( )

Definition at line 396 of file class.ilStudyProgrammeType.php.

References $changed_translations.

396  : array
397  {
399  }

◆ getActivePlugins()

ilStudyProgrammeType::getActivePlugins ( )
protected

Definition at line 391 of file class.ilStudyProgrammeType.php.

Referenced by setTranslations(), updateable(), and updateAssignedStudyProgrammesIcons().

391  : Iterator
392  {
393  return $this->component_factory->getActivePluginsInSlot("prgtypehk");
394  }
+ Here is the caller graph for this function:

◆ getCreateDate()

ilStudyProgrammeType::getCreateDate ( )

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

References $create_date.

Referenced by ilStudyProgrammeTypeDBRepository\updateType().

381  : DateTime
382  {
383  return $this->create_date;
384  }
+ Here is the caller graph for this function:

◆ getDefaultLang()

ilStudyProgrammeType::getDefaultLang ( )

Definition at line 371 of file class.ilStudyProgrammeType.php.

References $default_lang.

Referenced by ilStudyProgrammeTypeDBRepository\getRows(), getTranslation(), setDescription(), setTitle(), and ilStudyProgrammeTypeDBRepository\updateType().

371  : string
372  {
373  return $this->default_lang;
374  }
+ Here is the caller graph for this function:

◆ getDescription()

ilStudyProgrammeType::getDescription ( string  $lang_code = '')

Get the description of an StudyProgramme 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.

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

References getTranslation().

Referenced by ilStudyProgrammeTypeGUI\buildLanguagesForms(), and ilStudyProgrammeTypeDBRepository\getRows().

85  : string
86  {
87  return (string) $this->getTranslation('description', $lang_code);
88  }
getTranslation(string $member, string $lang_code)
Helper method to return a translation for a given member and language.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIconIdentifier()

◆ getId()

◆ getLastUpdate()

ilStudyProgrammeType::getLastUpdate ( )

Definition at line 344 of file class.ilStudyProgrammeType.php.

References $last_update.

Referenced by ilStudyProgrammeTypeDBRepository\updateType().

344  : DateTime
345  {
346  return $this->last_update;
347  }
+ Here is the caller graph for this function:

◆ getOwner()

ilStudyProgrammeType::getOwner ( )

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

References $owner.

Referenced by ilStudyProgrammeTypeDBRepository\updateType().

334  : int
335  {
336  return $this->owner;
337  }
+ Here is the caller graph for this function:

◆ getRepository()

ilStudyProgrammeType::getRepository ( )

Definition at line 386 of file class.ilStudyProgrammeType.php.

References $type_repo.

387  {
388  return $this->type_repo;
389  }
Covers the persistence of sp-type related information.
ilStudyProgrammeTypeRepository $type_repo

◆ getTitle()

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

Get the title of an StudyProgramme 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.

Definition at line 65 of file class.ilStudyProgrammeType.php.

References getTranslation().

Referenced by ilStudyProgrammeTypeGUI\buildLanguagesForms(), ilStudyProgrammeTypeGUI\editCustomIcons(), and ilStudyProgrammeTypeDBRepository\getRows().

65  : string
66  {
67  return (string) $this->getTranslation('title', $a_lang_code);
68  }
getTranslation(string $member, string $lang_code)
Helper method to return a translation for a given member and language.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTranslation()

ilStudyProgrammeType::getTranslation ( string  $member,
string  $lang_code 
)
protected

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

Definition at line 204 of file class.ilStudyProgrammeType.php.

References $lang, getDefaultLang(), loadTranslation(), null, and ILIAS\Repository\user().

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

204  : ?string
205  {
206  $lang = ($lang_code) ?: $this->user->getLanguage();
207 
208  $trans_obj = $this->loadTranslation($lang);
209  if (!is_null($trans_obj)) {
210  $translation = $trans_obj[$member] ?? null;
211  // If the translation does exist but is an empty string and there was no lang code given,
212  // substitute default language anyway because an empty string provides no information
213  if (!$lang_code && !$translation) {
214  $trans_obj = $this->loadTranslation($this->getDefaultLang());
215 
216  return $trans_obj[$member] ?? null;
217  }
218 
219  return $translation;
220  }
221 
222  // If no lang code was given and there was no translation found, return string in default language
223  if (!$lang_code) {
224  $trans_obj = $this->loadTranslation($this->getDefaultLang());
225 
226  return $trans_obj[$member] ?? null;
227  }
228 
229  return null;
230  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$lang
Definition: xapiexit.php:25
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTranslations()

ilStudyProgrammeType::getTranslations ( )

Definition at line 324 of file class.ilStudyProgrammeType.php.

References $translations.

324  : ?array
325  {
326  return $this->translations;
327  }

◆ loadTranslation()

ilStudyProgrammeType::loadTranslation ( string  $lang_code)
protected

Definition at line 232 of file class.ilStudyProgrammeType.php.

References getId(), and null.

Referenced by getTranslation().

232  : ?array
233  {
234  if (isset($this->translations[$lang_code])) {
235  return $this->translations[$lang_code];
236  } else {
237  $trans_array = $this->type_repo->getTranslationsByTypeAndLang($this->getId(), $lang_code);
238 
239  //ilStudyProgrammeTypeTranslation::where(array('prg_type_id'=>$this->getId(), 'lang'=>$a_lang_code))->getArray('member', 'value');
240  if (count($trans_array)) {
241  $this->translations[$lang_code] = $trans_array;
242 
243  return $trans_array;
244  }
245  }
246 
247  return null;
248  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCreateDate()

ilStudyProgrammeType::setCreateDate ( DateTime  $create_date)

Definition at line 376 of file class.ilStudyProgrammeType.php.

References $create_date.

376  : void
377  {
378  $this->create_date = $create_date;
379  }

◆ setDefaultLang()

ilStudyProgrammeType::setDefaultLang ( string  $default_lang)

Definition at line 366 of file class.ilStudyProgrammeType.php.

References $default_lang.

Referenced by ilStudyProgrammeTypeGUI\update().

366  : void
367  {
368  $this->default_lang = $default_lang;
369  }
+ Here is the caller graph for this function:

◆ setDescription()

ilStudyProgrammeType::setDescription ( string  $description,
string  $lang_code = '' 
)

Set description of StudyProgramme type.

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

Definition at line 94 of file class.ilStudyProgrammeType.php.

References $lang, and getDefaultLang().

Referenced by ilStudyProgrammeTypeGUI\update().

94  : void
95  {
96  $lang = ($lang_code) ?: $this->getDefaultLang();
97  $this->setTranslation('description', $description, $lang);
98  }
$lang
Definition: xapiexit.php:25
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLastUpdate()

ilStudyProgrammeType::setLastUpdate ( DateTime  $last_update)

Definition at line 339 of file class.ilStudyProgrammeType.php.

References $last_update.

339  : void
340  {
341  $this->last_update = $last_update;
342  }

◆ setOwner()

ilStudyProgrammeType::setOwner ( int  $owner)

Definition at line 329 of file class.ilStudyProgrammeType.php.

References $owner.

329  : void
330  {
331  $this->owner = $owner;
332  }

◆ setTitle()

ilStudyProgrammeType::setTitle ( string  $title,
string  $lang_code = '' 
)

Set title of StudyProgramme type.

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

Definition at line 74 of file class.ilStudyProgrammeType.php.

References $lang, and getDefaultLang().

Referenced by ilStudyProgrammeTypeGUI\update().

74  : void
75  {
76  $lang = ($lang_code) ?: $this->getDefaultLang();
77  $this->setTranslation('title', $title, $lang);
78  }
$lang
Definition: xapiexit.php:25
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTranslations()

ilStudyProgrammeType::setTranslations ( array  $translations)

Getters & Setters.

Definition at line 268 of file class.ilStudyProgrammeType.php.

References XapiProxy\$plugin, $translations, getActivePlugins(), getId(), getTranslation(), and ILIAS\Repository\lng().

268  : void
269  {
270  $this->translations = $translations;
271  }
+ Here is the call graph for this function:

◆ updateable()

ilStudyProgrammeType::updateable ( )
protected

Helper function to check if this type can be updated.

Definition at line 253 of file class.ilStudyProgrammeType.php.

References XapiProxy\$plugin, and getActivePlugins().

253  : bool
254  {
255  foreach ($this->getActivePlugins() as $plugin) {
256  if (!$plugin->allowUpdate($this->getId())) {
257  return false;
258  }
259  }
260 
261  return true;
262  }
+ Here is the call graph for this function:

◆ updateAssignedStudyProgrammesIcons()

ilStudyProgrammeType::updateAssignedStudyProgrammesIcons ( )

Update the Icons of assigned objects.

Definition at line 103 of file class.ilStudyProgrammeType.php.

References XapiProxy\$plugin, $ref_id, ilObject\_getAllReferences(), getActivePlugins(), getId(), ilObjStudyProgramme\getInstanceByRefId(), ILIAS\Repository\lng(), and ilAdvancedMDRecord\saveObjRecSelection().

Referenced by ilStudyProgrammeTypeCustomIconsFormGUI\saveObject(), and ilStudyProgrammeTypeGUI\updateCustomIcons().

103  : void
104  {
105  $obj_ids = $this->type_repo->getStudyProgrammeIdsByTypeId($this->getId());
106 
107  foreach ($obj_ids as $id) {
110  $osp->updateCustomIcon();
111  }
112  }
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ withIconIdentifier()

ilStudyProgrammeType::withIconIdentifier ( ?string  $identifier)

Definition at line 354 of file class.ilStudyProgrammeType.php.

Referenced by ilStudyProgrammeTypeGUI\updateCustomIcons().

354  : self
355  {
356  $clone = clone $this;
357  $clone->icon = $identifier;
358  return $clone;
359  }
+ Here is the caller graph for this function:

Field Documentation

◆ $active_plugins

array ilStudyProgrammeType::$active_plugins
protected

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

◆ $changed_translations

array ilStudyProgrammeType::$changed_translations = array()
protected

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

Referenced by changedTranslations().

◆ $component_factory

ilComponentFactory ilStudyProgrammeType::$component_factory
protected

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

Referenced by __construct().

◆ $create_date

DateTime ilStudyProgrammeType::$create_date
protected

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

Referenced by getCreateDate(), and setCreateDate().

◆ $default_lang

string ilStudyProgrammeType::$default_lang = ''
protected

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

Referenced by getDefaultLang(), and setDefaultLang().

◆ $icon

string ilStudyProgrammeType::$icon
protected

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

Referenced by getIconIdentifier().

◆ $id

int ilStudyProgrammeType::$id = 0
protected

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

Referenced by __construct(), and getId().

◆ $last_update

DateTime ilStudyProgrammeType::$last_update
protected

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

Referenced by getLastUpdate(), and setLastUpdate().

◆ $lng

ilLanguage ilStudyProgrammeType::$lng
protected

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

Referenced by __construct().

◆ $owner

int ilStudyProgrammeType::$owner
protected

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

Referenced by getOwner(), and setOwner().

◆ $translations

array ilStudyProgrammeType::$translations
protected

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

Referenced by getTranslations(), and setTranslations().

◆ $type_repo

ilStudyProgrammeTypeRepository ilStudyProgrammeType::$type_repo
protected

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

Referenced by __construct(), and getRepository().

◆ $user

ilObjUser ilStudyProgrammeType::$user
protected

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

Referenced by __construct().

◆ DATE_FORMAT

const ilStudyProgrammeType::DATE_FORMAT = 'Y-m-d'

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

◆ DATE_TIME_FORMAT

const ilStudyProgrammeType::DATE_TIME_FORMAT = 'Y-m-d H:i:s'

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