ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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.

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 }
ilComponentFactory $component_factory
ilStudyProgrammeTypeRepository $type_repo

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

+ Here is the call graph for this function:

Member Function Documentation

◆ changedTranslations()

ilStudyProgrammeType::changedTranslations ( )

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

396 : array
397 {
399 }

References $changed_translations.

◆ getActivePlugins()

ilStudyProgrammeType::getActivePlugins ( )
protected

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

391 : Iterator
392 {
393 return $this->component_factory->getActivePluginsInSlot("prgtypehk");
394 }

Referenced by updateable().

+ Here is the caller graph for this function:

◆ getCreateDate()

ilStudyProgrammeType::getCreateDate ( )

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

381 : DateTime
382 {
383 return $this->create_date;
384 }

References $create_date.

Referenced by ilStudyProgrammeTypeDBRepository\updateType().

+ Here is the caller graph for this function:

◆ getDefaultLang()

ilStudyProgrammeType::getDefaultLang ( )

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

371 : string
372 {
373 return $this->default_lang;
374 }

References $default_lang.

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

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

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.

References getTranslation().

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

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

344 : DateTime
345 {
346 return $this->last_update;
347 }

References $last_update.

Referenced by ilStudyProgrammeTypeDBRepository\updateType().

+ Here is the caller graph for this function:

◆ getOwner()

ilStudyProgrammeType::getOwner ( )

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

334 : int
335 {
336 return $this->owner;
337 }

References $owner.

Referenced by ilStudyProgrammeTypeDBRepository\updateType().

+ Here is the caller graph for this function:

◆ getRepository()

ilStudyProgrammeType::getRepository ( )

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

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

References $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.

65 : string
66 {
67 return (string) $this->getTranslation('title', $a_lang_code);
68 }

References getTranslation().

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

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

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 }
$lang
Definition: xapiexit.php:25

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

Referenced by getDescription(), and getTitle().

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

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

References $translations.

◆ loadTranslation()

ilStudyProgrammeType::loadTranslation ( string  $lang_code)
protected

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

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 }

References getId().

Referenced by getTranslation().

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

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

References $create_date.

◆ setDefaultLang()

ilStudyProgrammeType::setDefaultLang ( string  $default_lang)

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

366 : void
367 {
368 $this->default_lang = $default_lang;
369 }

References $default_lang.

◆ 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.

94 : void
95 {
96 $lang = ($lang_code) ?: $this->getDefaultLang();
97 $this->setTranslation('description', $description, $lang);
98 }

References $lang, and getDefaultLang().

+ Here is the call graph for this function:

◆ setLastUpdate()

ilStudyProgrammeType::setLastUpdate ( DateTime  $last_update)

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

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

References $last_update.

◆ setOwner()

ilStudyProgrammeType::setOwner ( int  $owner)

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

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

References $owner.

◆ 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.

74 : void
75 {
76 $lang = ($lang_code) ?: $this->getDefaultLang();
77 $this->setTranslation('title', $title, $lang);
78 }

References $lang, and getDefaultLang().

+ Here is the call graph for this function:

◆ setTranslations()

ilStudyProgrammeType::setTranslations ( array  $translations)

Getters & Setters.

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

268 : void
269 {
270 $this->translations = $translations;
271 }

References $translations.

◆ updateable()

ilStudyProgrammeType::updateable ( )
protected

Helper function to check if this type can be updated.

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

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 }

References XapiProxy\$plugin, and getActivePlugins().

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

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:66

References $id, $ref_id, ilObject\_getAllReferences(), getId(), and ilObjStudyProgramme\getInstanceByRefId().

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

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

354 : self
355 {
356 $clone = clone $this;
357 $clone->icon = $identifier;
358 return $clone;
359 }

Referenced by ilStudyProgrammeTypeGUI\updateCustomIcons().

+ 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

◆ $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: