ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilStudyProgrammeTypeDBRepository Class Reference
+ Inheritance diagram for ilStudyProgrammeTypeDBRepository:
+ Collaboration diagram for ilStudyProgrammeTypeDBRepository:

Public Member Functions

 __construct (protected ilDBInterface $db, protected ilStudyProgrammeSettingsRepository $settings_repo, protected ilObjUser $usr, protected ilLanguage $lng, protected ilComponentFactory $component_factory, protected UIFactory $ui_factory, protected Renderer $ui_renderer, protected IRSS $irss,)
 
 createType (string $default_language)
 Create a type record and return an object representing it. More...
 
 createAMDRecord ()
 Create an amd-record record and return an object representing it. More...
 
 createTypeTranslation ()
 Create a type translation record and return an object representing it. More...
 
 updateType (ilStudyProgrammeType $type)
 Persist type properties. More...
 
 removeIconFromIrss (string $identifier)
 
 updateAMDRecord (ilStudyProgrammeAdvancedMetadataRecord $rec)
 Persist amd-record properties. More...
 
 updateTypeTranslation (ilStudyProgrammeTypeTranslation $tt)
 Persist type translation properties. More...
 
 deleteAMDRecord (ilStudyProgrammeAdvancedMetadataRecord $rec)
 Delete record corresponding to given object. More...
 
 deleteTypeTranslation (ilStudyProgrammeTypeTranslation $tt)
 Delete record corresponding to given object. More...
 
 deleteTypeTranslationByTypeId (int $type_id)
 Delete all translation records corresponding to a type id. More...
 
 getAllTypes (?Range $range=null, ?Order $order=null)
 
 getType (int $type_id)
 Get a type with given type_id. More...
 
 getAllTypesArray ()
 Get an assicative array of all persisted types id => title.
Returns
array<int, string>
More...
 
 getAssignedAMDRecordsByType (int $type_id, bool $only_active=false)
 
Returns
ilAdvancedMDRecord[]
More...
 
 getAllAMDRecords ()
 
Returns
ilAdvancedMDRecord[]
More...
 
 getAMDRecordsByTypeIdAndRecordId (int $type_id, int $record_id)
 
Returns
ilStudyProgrammeAdvancedMetadataRecord[]
More...
 
 getAMDRecordsByTypeId (int $type_id, bool $only_active=false)
 
Returns
ilStudyProgrammeAdvancedMetadataRecord[]
More...
 
 getTranslationsArrayByTypeIdAndLangCode (int $type_id, string $lang_code)
 
 getStudyProgrammesByTypeId (int $type_id)
 Get all prg-settings objects by corresponding type-id.
Returns
ilStudyProgrammeSettings[]
More...
 
 getStudyProgrammeIdsByTypeId (int $type_id)
 Get all prg-settings ids by corresponding type-id.
Returns
int[]
More...
 
 getAvailableAdvancedMDRecords ()
 
Returns
ilStudyProgrammeAdvancedMetadataRecord[]
More...
 
 getAvailableAdvancedMDRecordIds ()
 
Returns
int[]
More...
 
 getTranslationsByTypeAndLang (int $type_id, string $lang_code)
 
 getTranslationByTypeIdMemberLang (int $type_id, string $member, string $lang_code)
 
 getTable ()
 
 getTotalRowCount (?array $filter_data, ?array $additional_parameters)
 Mainly for the purpose of pagination-support, it is important to know about the total number of records available. More...
 
 getRows (DataTableInterface\DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, ?array $filter_data, ?array $additional_parameters)
 
 getIconPathFS (ilStudyProgrammeType $type)
 
 getIconPath (ilStudyProgrammeType $type)
 
- Public Member Functions inherited from ilStudyProgrammeTypeRepository
 createType (string $default_language)
 Create a type record and return an object representing it. More...
 
 createAMDRecord ()
 Create an amd-record record and return an object representing it. More...
 
 createTypeTranslation ()
 Create a type translation record and return an object representing it. More...
 
 updateType (ilStudyProgrammeType $type)
 Persist type properties. More...
 
 updateAMDRecord (ilStudyProgrammeAdvancedMetadataRecord $rec)
 Persist amd-record properties. More...
 
 updateTypeTranslation (ilStudyProgrammeTypeTranslation $tt)
 Persist type translation properties. More...
 
 deleteType (ilStudyProgrammeType $type)
 Delete record corresponding to given object. More...
 
 deleteAMDRecord (ilStudyProgrammeAdvancedMetadataRecord $rec)
 Delete record corresponding to given object. More...
 
 deleteTypeTranslation (ilStudyProgrammeTypeTranslation $tt)
 Delete record corresponding to given object. More...
 
 deleteTypeTranslationByTypeId (int $type_id)
 Delete all translation records corresponding to a type id. More...
 
 getAllTypes ()
 Get all persisted type-objects. More...
 
 getType (int $type_id)
 Get a type with given type_id. More...
 
 getAllTypesArray ()
 Get an assicative array of all persisted types id => title. More...
 
 getAssignedAMDRecordsByType (int $type_id, bool $only_active=false)
 
 getAssignedAMDRecordIdsByType (int $type_id, bool $only_active=false)
 
 getAllAMDRecords ()
 
 getAllAMDRecordIds ()
 
 getAMDRecordsByTypeIdAndRecordId (int $type_id, int $record_id)
 
 getAMDRecordsByTypeId (int $type_id, bool $only_active=false)
 
 getTranslationsArrayByTypeIdAndLangCode (int $type_id, string $lang_code)
 
 getStudyProgrammesByTypeId (int $type_id)
 Get all prg-settings objects by corresponding type-id. More...
 
 getStudyProgrammeIdsByTypeId (int $type_id)
 Get all prg-settings ids by corresponding type-id. More...
 
 getAvailableAdvancedMDRecords ()
 
 getAvailableAdvancedMDRecordIds ()
 
 getTranslationsByTypeAndLang (int $type_id, string $lang_code)
 
 getTranslationByTypeIdMemberLang (int $type_id, string $member, string $lang_code)
 
- Public Member Functions inherited from ILIAS\UI\Component\Table\DataRetrieval
 getRows (DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, ?array $filter_data, ?array $additional_parameters)
 This is called by the table to retrieve rows; map data-records to rows using the $row_builder e.g. More...
 
 getTotalRowCount (?array $filter_data, ?array $additional_parameters)
 Mainly for the purpose of pagination-support, it is important to know about the total number of records available. More...
 

Protected Member Functions

 insertRowTypeDB (array $row)
 
 createTypeByRow (array $row)
 
 insertRowAMDDB (array $row)
 
 createAMDByRow (array $row)
 
 insertRowTypeTranslationDB (array $row)
 
 createTypeTranslationByRow (array $row)
 
 updateRowTypeDB (array $row)
 
 updateRowAMDRecordDB (array $row)
 
 updateRowTypeTranslationDB (array $row)
 
 getActivePlugins ()
 
 deleteAllTranslationsByTypeId (int $type_id)
 
 deleteAMDRecordsByTypeId (int $type_id)
 
 getAllTypesRecords ()
 
 getAllTypesRecordCount ()
 
 getColums ()
 

Protected Attributes

array $active_plugins = null
 
array $amd_records_assigned = []
 

Static Protected Attributes

static array $amd_records_available = null
 

Private Attributes

const TYPE_TABLE = 'prg_type'
 
const FIELD_ID = 'id'
 
const FIELD_DEFAULT_LANG = 'default_lang'
 
const FIELD_OWNER = 'owner'
 
const FIELD_CREATE_DATE = 'create_date'
 
const FIELD_LAST_UPDATE = 'last_update'
 
const FIELD_ICON = 'icon'
 
const TYPE_TRANSLATION_TABLE = 'prg_translations'
 
const FIELD_PRG_TYPE_ID = 'prg_type_id'
 
const FIELD_LANG = 'lang'
 
const FIELD_MEMBER = 'member'
 
const FIELD_VALUE = 'value'
 
const AMD_TABLE = 'prg_type_adv_md_rec'
 
const FIELD_TYPE_ID = 'type_id'
 
const FIELD_REC_ID = 'rec_id'
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeTypeDBRepository::__construct ( protected ilDBInterface  $db,
protected ilStudyProgrammeSettingsRepository  $settings_repo,
protected ilObjUser  $usr,
protected ilLanguage  $lng,
protected ilComponentFactory  $component_factory,
protected UIFactory  $ui_factory,
protected Renderer  $ui_renderer,
protected IRSS  $irss 
)

Definition at line 59 of file class.ilStudyProgrammeTypeDBRepository.php.

68 {
69 }

Member Function Documentation

◆ createAMDByRow()

ilStudyProgrammeTypeDBRepository::createAMDByRow ( array  $row)
protected

Definition at line 159 of file class.ilStudyProgrammeTypeDBRepository.php.

160 {
161 $return = new ilStudyProgrammeAdvancedMetadataRecord((int) $row[self::FIELD_ID]);
162 $return->setTypeId((int) $row[self::FIELD_TYPE_ID]);
163 $return->setRecId((int) $row[self::FIELD_REC_ID]);
164 return $return;
165 }

Referenced by createAMDRecord().

+ Here is the caller graph for this function:

◆ createAMDRecord()

ilStudyProgrammeTypeDBRepository::createAMDRecord ( )

Create an amd-record record and return an object representing it.

Implements ilStudyProgrammeTypeRepository.

Definition at line 135 of file class.ilStudyProgrammeTypeDBRepository.php.

136 {
137 $id = $this->db->nextId(self::AMD_TABLE);
138 $row = [
139 self::FIELD_ID => $id,
140 self::FIELD_TYPE_ID => null,
141 self::FIELD_REC_ID => null
142 ];
143 $this->insertRowAMDDB($row);
144 return $this->createAMDByRow($row);
145 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, createAMDByRow(), and insertRowAMDDB().

+ Here is the call graph for this function:

◆ createType()

ilStudyProgrammeTypeDBRepository::createType ( string  $default_language)

Create a type record and return an object representing it.

Implements ilStudyProgrammeTypeRepository.

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

75 {
76 $id = $this->db->nextId(self::TYPE_TABLE);
77 $now = date("Y-m-d H:i:s");
78 $row = [
79 self::FIELD_ID => $id,
80 self::FIELD_DEFAULT_LANG => $default_language,
81 self::FIELD_OWNER => $this->usr->getId(),
82 self::FIELD_CREATE_DATE => $now,
83 self::FIELD_LAST_UPDATE => $now,
84 self::FIELD_ICON => ''
85 ];
86 $this->insertRowTypeDB($row);
87 return $this->createTypeByRow($row);
88 }
Class ilStudyProgrammeType.

References $id, createTypeByRow(), and insertRowTypeDB().

+ Here is the call graph for this function:

◆ createTypeByRow()

ilStudyProgrammeTypeDBRepository::createTypeByRow ( array  $row)
protected

Definition at line 105 of file class.ilStudyProgrammeTypeDBRepository.php.

106 {
107 $return = new ilStudyProgrammeType(
108 (int) $row[self::FIELD_ID],
109 $this,
110 $this->lng,
111 $this->usr,
112 $this->component_factory
113 );
114 $return->setDefaultLang($row[self::FIELD_DEFAULT_LANG]);
115 $return->setOwner((int) $row[self::FIELD_OWNER]);
116 $return->setCreateDate(
117 DateTime::createFromFormat(
119 $row[self::FIELD_CREATE_DATE]
120 )
121 );
122 $return->setLastUpdate(
123 DateTime::createFromFormat(
125 $row[self::FIELD_LAST_UPDATE]
126 )
127 );
128 $return = $return->withIconIdentifier($row[self::FIELD_ICON]);
129 return $return;
130 }

References ilStudyProgrammeType\DATE_TIME_FORMAT, and ILIAS\Repository\lng().

Referenced by createType(), and getAllTypes().

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

◆ createTypeTranslation()

ilStudyProgrammeTypeDBRepository::createTypeTranslation ( )

Create a type translation record and return an object representing it.

Implements ilStudyProgrammeTypeRepository.

Definition at line 170 of file class.ilStudyProgrammeTypeDBRepository.php.

171 {
172 $id = $this->db->nextId(self::TYPE_TRANSLATION_TABLE);
173 $row = [
174 self::FIELD_ID => $id,
175 self::FIELD_PRG_TYPE_ID => null,
176 self::FIELD_LANG => null,
177 self::FIELD_MEMBER => null,
178 self::FIELD_VALUE => null
179 ];
180 $this->insertRowTypeTranslationDB($row);
181 return $this->createTypeTranslationByRow($row);
182 }
Class ilStudyProgrammeTypeTranslation This class represents a translation for a given ilStudyProgramm...

References $id, createTypeTranslationByRow(), and insertRowTypeTranslationDB().

+ Here is the call graph for this function:

◆ createTypeTranslationByRow()

ilStudyProgrammeTypeDBRepository::createTypeTranslationByRow ( array  $row)
protected

Definition at line 198 of file class.ilStudyProgrammeTypeDBRepository.php.

199 {
200 $return = new ilStudyProgrammeTypeTranslation((int) $row[self::FIELD_ID]);
201 $return->setPrgTypeId((int) $row[self::FIELD_PRG_TYPE_ID]);
202 $return->setLang((string) $row[self::FIELD_LANG]);
203 $return->setMember((string) $row[self::FIELD_MEMBER]);
204 $return->setValue((string) $row[self::FIELD_VALUE]);
205 return $return;
206 }

Referenced by createTypeTranslation().

+ Here is the caller graph for this function:

◆ deleteAllTranslationsByTypeId()

ilStudyProgrammeTypeDBRepository::deleteAllTranslationsByTypeId ( int  $type_id)
protected

Definition at line 347 of file class.ilStudyProgrammeTypeDBRepository.php.

347 : void
348 {
349 $this->db->manipulate(
350 'DELETE FROM ' . self::TYPE_TRANSLATION_TABLE .
351 ' WHERE ' . self::FIELD_PRG_TYPE_ID . ' = ' . $this->db->quote($type_id, 'integer')
352 );
353 }

◆ deleteAMDRecord()

ilStudyProgrammeTypeDBRepository::deleteAMDRecord ( ilStudyProgrammeAdvancedMetadataRecord  $rec)

Delete record corresponding to given object.

Implements ilStudyProgrammeTypeRepository.

Definition at line 365 of file class.ilStudyProgrammeTypeDBRepository.php.

365 : void
366 {
367 $this->db->manipulate(
368 'DELETE FROM ' . self::AMD_TABLE .
369 ' WHERE ' . self::FIELD_ID . ' = ' . $this->db->quote($rec->getId(), 'integer')
370 );
371 }

References ilStudyProgrammeAdvancedMetadataRecord\getId().

+ Here is the call graph for this function:

◆ deleteAMDRecordsByTypeId()

ilStudyProgrammeTypeDBRepository::deleteAMDRecordsByTypeId ( int  $type_id)
protected

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

354 : void
355 {
356 $this->db->manipulate(
357 'DELETE FROM ' . self::AMD_TABLE .
358 ' WHERE ' . self::FIELD_TYPE_ID . ' = ' . $this->db->quote($type_id, 'integer')
359 );
360 }

◆ deleteTypeTranslation()

ilStudyProgrammeTypeDBRepository::deleteTypeTranslation ( ilStudyProgrammeTypeTranslation  $tt)

Delete record corresponding to given object.

Implements ilStudyProgrammeTypeRepository.

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

376 : void
377 {
378 $this->db->manipulate(
379 'DELETE FROM ' . self::TYPE_TRANSLATION_TABLE .
380 ' WHERE ' . self::FIELD_ID . ' = ' . $this->db->quote($tt->getId(), 'integer')
381 );
382 }

References ilStudyProgrammeTypeTranslation\getId().

+ Here is the call graph for this function:

◆ deleteTypeTranslationByTypeId()

ilStudyProgrammeTypeDBRepository::deleteTypeTranslationByTypeId ( int  $type_id)

Delete all translation records corresponding to a type id.

Implements ilStudyProgrammeTypeRepository.

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

387 : void
388 {
389 $this->db->manipulate(
390 'DELETE FROM ' . self::TYPE_TRANSLATION_TABLE .
391 ' WHERE ' . self::FIELD_REC_ID . ' = ' . $this->db->quote($type_id, 'integer')
392 );
393 }

◆ getActivePlugins()

ilStudyProgrammeTypeDBRepository::getActivePlugins ( )
protected

Definition at line 342 of file class.ilStudyProgrammeTypeDBRepository.php.

342 : Iterator
343 {
344 return $this->component_factory->getActivePluginsInSlot('prgtypehk');
345 }

◆ getAllAMDRecords()

ilStudyProgrammeTypeDBRepository::getAllAMDRecords ( )

Returns
ilAdvancedMDRecord[]

Implements ilStudyProgrammeTypeRepository.

Definition at line 546 of file class.ilStudyProgrammeTypeDBRepository.php.

546 : array
547 {
548 if (is_array(self::$amd_records_available)) {
550 }
551 self::$amd_records_available = ilAdvancedMDRecord::_getActivatedRecordsByObjectType('prg', 'prg_type');
553 }
static _getActivatedRecordsByObjectType(string $a_obj_type, string $a_sub_type="", bool $a_only_optional=false)
Get activated records by object type.

References ilAdvancedMDRecord\_getActivatedRecordsByObjectType().

+ Here is the call graph for this function:

◆ getAllTypes()

ilStudyProgrammeTypeDBRepository::getAllTypes ( ?Range  $range = null,
?Order  $order = null 
)

Definition at line 398 of file class.ilStudyProgrammeTypeDBRepository.php.

401 : array {
402 $return = [];
403 foreach ($this->getAllTypesRecords($range, $order) as $row) {
404 $return[] = $this->createTypeByRow($row);
405 }
406
407 if($order) {
408 list($order_field, $order_direction) = $order->join([], fn($ret, $key, $value) => [$key, $value]);
409 usort(
410 $return,
411 static function ($a, $b) use ($order_field) {
412 switch ($order_field) {
413 case 'title':
414 $a_aspect = $a->getTitle();
415 $b_aspect = $b->getTitle();
416 break;
417 case 'description':
418 $a_aspect = $a->getDescription();
419 $b_aspect = $b->getDescription();
420 break;
421 case 'default_language':
422 $a_aspect = $a->getDefaultLang();
423 $b_aspect = $b->getDefaultLang();
424 break;
425 }
426 return $a_aspect <=> $b_aspect;
427 }
428 );
429 if ($order_direction === 'DESC') {
430 $return = array_reverse($return);
431 }
432 }
433 if($range) {
434 $return = array_slice($return, $range->getStart(), $range->getLength());
435 }
436
437 return $return;
438 }
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

References createTypeByRow().

+ Here is the call graph for this function:

◆ getAllTypesArray()

ilStudyProgrammeTypeDBRepository::getAllTypesArray ( )

Get an assicative array of all persisted types id => title.

Returns
array<int, string>

Implements ilStudyProgrammeTypeRepository.

Definition at line 489 of file class.ilStudyProgrammeTypeDBRepository.php.

489 : array
490 {
491 $return = [];
492 foreach ($this->getAllTypes() as $type) {
493 $return[$type->getId()] = $type->getTitle();
494 }
495 return $return;
496 }
getAllTypes()
Get all persisted type-objects.

◆ getAllTypesRecordCount()

ilStudyProgrammeTypeDBRepository::getAllTypesRecordCount ( )
protected

Definition at line 457 of file class.ilStudyProgrammeTypeDBRepository.php.

457 : int
458 {
459 $q = 'SELECT count(*) AS cnt FROM ' . self::TYPE_TABLE;
460 $res = $this->db->query($q);
461 return (int) $this->db->fetchAssoc($res)['cnt'];
462 }
$res
Definition: ltiservices.php:69
$q
Definition: shib_logout.php:23

References $q, and $res.

◆ getAllTypesRecords()

ilStudyProgrammeTypeDBRepository::getAllTypesRecords ( )
protected

Definition at line 440 of file class.ilStudyProgrammeTypeDBRepository.php.

441 : Generator {
442 $q = 'SELECT'
443 . ' ' . self::FIELD_DEFAULT_LANG
444 . ' ,' . self::FIELD_OWNER
445 . ' ,' . self::FIELD_CREATE_DATE
446 . ' ,' . self::FIELD_LAST_UPDATE
447 . ' ,' . self::FIELD_ICON
448 . ' ,' . self::FIELD_ID
449 . ' FROM ' . self::TYPE_TABLE;
450
451 $res = $this->db->query($q);
452 while ($rec = $this->db->fetchAssoc($res)) {
453 yield $rec;
454 }
455 }

◆ getAMDRecordsByTypeId()

ilStudyProgrammeTypeDBRepository::getAMDRecordsByTypeId ( int  $type_id,
bool  $only_active = false 
)

Returns
ilStudyProgrammeAdvancedMetadataRecord[]

Implements ilStudyProgrammeTypeRepository.

Definition at line 592 of file class.ilStudyProgrammeTypeDBRepository.php.

592 : array
593 {
594 $q = 'SELECT'
595 . ' ' . self::FIELD_REC_ID
596 . ' ,' . self::FIELD_TYPE_ID
597 . ' ,' . self::FIELD_ID
598 . ' FROM ' . self::AMD_TABLE
599 . ' WHERE ' . self::FIELD_TYPE_ID . ' = ' . $this->db->quote($type_id, 'integer');
600 $return = [];
601 $res = $this->db->query($q);
602 while ($rec = $this->db->fetchAssoc($res)) {
603 $return[] = $this->createAMDByRow($rec);
604 }
605 return $return;
606 }

References $q, and $res.

◆ getAMDRecordsByTypeIdAndRecordId()

ilStudyProgrammeTypeDBRepository::getAMDRecordsByTypeIdAndRecordId ( int  $type_id,
int  $record_id 
)

Returns
ilStudyProgrammeAdvancedMetadataRecord[]

Implements ilStudyProgrammeTypeRepository.

Definition at line 572 of file class.ilStudyProgrammeTypeDBRepository.php.

572 : array
573 {
574 $q = 'SELECT'
575 . ' ' . self::FIELD_REC_ID
576 . ' ,' . self::FIELD_TYPE_ID
577 . ' ,' . self::FIELD_ID
578 . ' FROM ' . self::AMD_TABLE
579 . ' WHERE ' . self::FIELD_TYPE_ID . ' = ' . $this->db->quote($type_id, 'integer')
580 . ' AND ' . self::FIELD_REC_ID . ' = ' . $this->db->quote($record_id, 'integer');
581 $return = [];
582 $res = $this->db->query($q);
583 while ($rec = $this->db->fetchAssoc($res)) {
584 $return[] = $this->createAMDByRow($rec);
585 }
586 return $return;
587 }

References $q, and $res.

◆ getAssignedAMDRecordsByType()

ilStudyProgrammeTypeDBRepository::getAssignedAMDRecordsByType ( int  $type_id,
bool  $only_active = false 
)

Returns
ilAdvancedMDRecord[]

Implements ilStudyProgrammeTypeRepository.

Definition at line 501 of file class.ilStudyProgrammeTypeDBRepository.php.

501 : array
502 {
503 $active = ($only_active) ? 1 : 0; // Cache key
504 if (
505 array_key_exists($type_id, $this->amd_records_assigned) &&
506 isset($this->amd_records_assigned[$type_id][$active]) &&
507 is_array($this->amd_records_assigned[$type_id][$active])
508 ) {
509 return $this->amd_records_assigned[$type_id][$active];
510 }
511 $q = 'SELECT'
512 . ' ' . self::FIELD_REC_ID
513 . ' FROM ' . self::AMD_TABLE
514 . ' WHERE ' . self::FIELD_TYPE_ID . ' = ' . $this->db->quote($type_id, 'integer');
515 $res = $this->db->query($q);
516 $this->amd_records_assigned[$type_id][$active] = [];
517 while ($rec = $this->db->fetchAssoc($res)) {
518 $amd_record = new ilAdvancedMDRecord((int) $rec[self::FIELD_REC_ID]);
519 if ($only_active) {
520 if ($amd_record->isActive()) {
521 $this->amd_records_assigned[$type_id][1][] = $amd_record;
522 }
523 } else {
524 $this->amd_records_assigned[$type_id][0][] = $amd_record;
525 }
526 }
527 return $this->amd_records_assigned[$type_id][$active];
528 }

References $q, and $res.

◆ getAvailableAdvancedMDRecordIds()

ilStudyProgrammeTypeDBRepository::getAvailableAdvancedMDRecordIds ( )

Returns
int[]

Implements ilStudyProgrammeTypeRepository.

Definition at line 658 of file class.ilStudyProgrammeTypeDBRepository.php.

658 : array
659 {
660 $q = 'SELECT ' . self::FIELD_REC_ID
661 . ' FROM ' . self::AMD_TABLE;
662 $return = [];
663 $res = $this->db->query($q);
664 while ($rec = $this->db->fetchAssoc($res)) {
665 $return[] = $rec[self::FIELD_REC_ID];
666 }
667 return $return;
668 }

References $q, and $res.

◆ getAvailableAdvancedMDRecords()

ilStudyProgrammeTypeDBRepository::getAvailableAdvancedMDRecords ( )

Returns
ilStudyProgrammeAdvancedMetadataRecord[]

Implements ilStudyProgrammeTypeRepository.

Definition at line 640 of file class.ilStudyProgrammeTypeDBRepository.php.

640 : array
641 {
642 $q = 'SELECT'
643 . ' ' . self::FIELD_REC_ID
644 . ' ,' . self::FIELD_TYPE_ID
645 . ' ,' . self::FIELD_ID
646 . ' FROM ' . self::AMD_TABLE;
647 $return = [];
648 $res = $this->db->query($q);
649 while ($rec = $this->db->fetchAssoc($res)) {
650 $return[] = $this->createAMDByRow($rec);
651 }
652 return $return;
653 }

References $q, and $res.

◆ getColums()

ilStudyProgrammeTypeDBRepository::getColums ( )
protected

Definition at line 718 of file class.ilStudyProgrammeTypeDBRepository.php.

718 : array
719 {
720 $f = $this->ui_factory;
721 return [
722 'title' => $f->table()->column()->text($this->lng->txt('title')),
723 'description' => $f->table()->column()->text($this->lng->txt('description')),
724 'default_language' => $f->table()->column()->status($this->lng->txt('default_language')),
725 'icon' => $f->table()->column()->statusIcon($this->lng->txt('icon'))->withIsSortable(false)
726 ];
727 }

References Vendor\Package\$f, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getIconPath()

ilStudyProgrammeTypeDBRepository::getIconPath ( ilStudyProgrammeType  $type)

Definition at line 773 of file class.ilStudyProgrammeTypeDBRepository.php.

773 : ?string
774 {
775 $icon_id = $this->irss->manage()->find($type->getIconIdentifier());
776 if($icon_id) {
777 return $this->irss->consume()->src($icon_id)->getSrc();
778 }
779 return null;
780 }

References ilStudyProgrammeType\getIconIdentifier().

+ Here is the call graph for this function:

◆ getIconPathFS()

ilStudyProgrammeTypeDBRepository::getIconPathFS ( ilStudyProgrammeType  $type)

Definition at line 764 of file class.ilStudyProgrammeTypeDBRepository.php.

764 : ?string
765 {
766 $icon_id = $this->irss->manage()->find($type->getIconIdentifier());
767 if($icon_id) {
768 return $this->irss->consume()->stream($icon_id)->getStream()->getMetadata('uri');
769 }
770 return null;
771 }

References ilStudyProgrammeType\getIconIdentifier().

+ Here is the call graph for this function:

◆ getRows()

ilStudyProgrammeTypeDBRepository::getRows ( DataTableInterface\DataRowBuilder  $row_builder,
array  $visible_column_ids,
Range  $range,
Order  $order,
?array  $filter_data,
?array  $additional_parameters 
)

Definition at line 736 of file class.ilStudyProgrammeTypeDBRepository.php.

743 : \Generator {
744 foreach ($this->getAllTypes($range, $order) as $idx => $type) {
745 $default_language = $type->getDefaultLang();
746
747 $icon = $this->ui_factory->symbol()->icon()->standard('prg', $this->lng->txt('prg_type'), 'small');
748 if($type->getIconIdentifier() && $icon_path = $this->getIconPath($type)) {
749 $icon = $this->ui_factory->symbol()->icon()->custom($icon_path, '');
750 }
751
752 yield $row_builder->buildDataRow(
753 (string)$type->getId(),
754 [
755 'title' => $type->getTitle($default_language),
756 'description' => $type->getDescription($default_language),
757 'default_language' => $default_language,
758 'icon' => $icon
759 ]
760 );
761 }
762 }

References ilStudyProgrammeType\getDefaultLang(), ilStudyProgrammeType\getDescription(), ilStudyProgrammeType\getIconIdentifier(), ilStudyProgrammeType\getId(), ilStudyProgrammeType\getTitle(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getStudyProgrammeIdsByTypeId()

ilStudyProgrammeTypeDBRepository::getStudyProgrammeIdsByTypeId ( int  $type_id)

Get all prg-settings ids by corresponding type-id.

Returns
int[]

Implements ilStudyProgrammeTypeRepository.

Definition at line 627 of file class.ilStudyProgrammeTypeDBRepository.php.

627 : array
628 {
629 return array_map(
630 static function (ilStudyProgrammeSettings $settings): int {
631 return $settings->getObjId();
632 },
633 $this->settings_repo->loadByType($type_id)
634 );
635 }
getObjId()
Get the id of the study program.

References ilStudyProgrammeSettings\getObjId().

+ Here is the call graph for this function:

◆ getStudyProgrammesByTypeId()

ilStudyProgrammeTypeDBRepository::getStudyProgrammesByTypeId ( int  $type_id)

Get all prg-settings objects by corresponding type-id.

Returns
ilStudyProgrammeSettings[]

Implements ilStudyProgrammeTypeRepository.

Definition at line 619 of file class.ilStudyProgrammeTypeDBRepository.php.

619 : array
620 {
621 return $this->settings_repo->loadByType($type_id);
622 }

◆ getTable()

ilStudyProgrammeTypeDBRepository::getTable ( )

Definition at line 709 of file class.ilStudyProgrammeTypeDBRepository.php.

709 : DataTable\Data
710 {
711 return $this->ui_factory->table()->data(
712 $this,
713 $this->lng->txt('prg_subtypes'),
714 $this->getColums(),
715 );
716 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getTotalRowCount()

ilStudyProgrammeTypeDBRepository::getTotalRowCount ( ?array  $filter_data,
?array  $additional_parameters 
)

Mainly for the purpose of pagination-support, it is important to know about the total number of records available.

Given the nature of a DataTable, which is, opposite to a PresentationTable, rather administrative than explorative, this information will increase user experience quite a bit. However, you may return null, if the call is to costly, but expect the View Control to look a little different in this case.

Make sure that potential filters or user restrictions are being applied to the count.

Implements ILIAS\UI\Component\Table\DataRetrieval.

Definition at line 729 of file class.ilStudyProgrammeTypeDBRepository.php.

◆ getTranslationByTypeIdMemberLang()

ilStudyProgrammeTypeDBRepository::getTranslationByTypeIdMemberLang ( int  $type_id,
string  $member,
string  $lang_code 
)

Implements ilStudyProgrammeTypeRepository.

Definition at line 686 of file class.ilStudyProgrammeTypeDBRepository.php.

691 $q = 'SELECT'
692 . ' ' . self::FIELD_LANG
693 . ' ,' . self::FIELD_PRG_TYPE_ID
694 . ' ,' . self::FIELD_ID
695 . ' ,' . self::FIELD_MEMBER
696 . ' ,' . self::FIELD_VALUE
697 . ' FROM ' . self::TYPE_TRANSLATION_TABLE
698 . ' WHERE ' . self::FIELD_PRG_TYPE_ID . ' = ' . $this->db->quote($type_id, 'integer')
699 . ' AND ' . self::FIELD_LANG . ' = ' . $this->db->quote($lang_code, 'text')
700 . ' AND ' . self::FIELD_MEMBER . ' = ' . $this->db->quote($member, 'text');
701 $res = $this->db->query($q);
702 while ($rec = $this->db->fetchAssoc($res)) {
703 return $this->createTypeTranslationByRow($rec);
704 }
705 return null;
706 }

◆ getTranslationsArrayByTypeIdAndLangCode()

ilStudyProgrammeTypeDBRepository::getTranslationsArrayByTypeIdAndLangCode ( int  $type_id,
string  $lang_code 
)

Implements ilStudyProgrammeTypeRepository.

Definition at line 611 of file class.ilStudyProgrammeTypeDBRepository.php.

611 : array
612 {
613 throw new LogicException("Not implemented yet.");
614 }

◆ getTranslationsByTypeAndLang()

ilStudyProgrammeTypeDBRepository::getTranslationsByTypeAndLang ( int  $type_id,
string  $lang_code 
)
Returns
array<string, string>

Implements ilStudyProgrammeTypeRepository.

Definition at line 670 of file class.ilStudyProgrammeTypeDBRepository.php.

670 : array
671 {
672 $q = 'SELECT'
673 . ' ' . self::FIELD_MEMBER
674 . ' ,' . self::FIELD_VALUE
675 . ' FROM ' . self::TYPE_TRANSLATION_TABLE
676 . ' WHERE ' . self::FIELD_PRG_TYPE_ID . ' = ' . $this->db->quote($type_id, 'integer')
677 . ' AND ' . self::FIELD_LANG . ' = ' . $this->db->quote($lang_code, 'text');
678 $res = $this->db->query($q);
679 $return = [];
680 while ($rec = $this->db->fetchAssoc($res)) {
681 $return[$rec[self::FIELD_MEMBER]] = $rec[self::FIELD_VALUE];
682 }
683 return $return;
684 }

References $q, and $res.

◆ getType()

ilStudyProgrammeTypeDBRepository::getType ( int  $type_id)

Get a type with given type_id.

Implements ilStudyProgrammeTypeRepository.

Definition at line 467 of file class.ilStudyProgrammeTypeDBRepository.php.

468 {
469 $q = 'SELECT'
470 . ' ' . self::FIELD_DEFAULT_LANG
471 . ' ,' . self::FIELD_OWNER
472 . ' ,' . self::FIELD_CREATE_DATE
473 . ' ,' . self::FIELD_LAST_UPDATE
474 . ' ,' . self::FIELD_ICON
475 . ' ,' . self::FIELD_ID
476 . ' FROM ' . self::TYPE_TABLE
477 . ' WHERE ' . self::FIELD_ID . ' = ' . $this->db->quote($type_id, 'integer');
478 $res = $this->db->query($q);
479 while ($rec = $this->db->fetchAssoc($res)) {
480 return $this->createTypeByRow($rec);
481 }
482
483 throw new LogicException("No entry found for type id: " . $type_id);
484 }

References $q, and $res.

◆ insertRowAMDDB()

ilStudyProgrammeTypeDBRepository::insertRowAMDDB ( array  $row)
protected

Definition at line 147 of file class.ilStudyProgrammeTypeDBRepository.php.

147 : void
148 {
149 $this->db->insert(
150 self::AMD_TABLE,
151 [
152 self::FIELD_ID => ['interger',$row[self::FIELD_ID]]
153 ,self::FIELD_TYPE_ID => ['integer',$row[self::FIELD_TYPE_ID]]
154 ,self::FIELD_REC_ID => ['interger',$row[self::FIELD_REC_ID]]
155 ]
156 );
157 }

Referenced by createAMDRecord().

+ Here is the caller graph for this function:

◆ insertRowTypeDB()

ilStudyProgrammeTypeDBRepository::insertRowTypeDB ( array  $row)
protected

Definition at line 90 of file class.ilStudyProgrammeTypeDBRepository.php.

90 : void
91 {
92 $this->db->insert(
93 self::TYPE_TABLE,
94 [
95 self::FIELD_ID => ['interger',$row[self::FIELD_ID]]
96 ,self::FIELD_DEFAULT_LANG => ['text',$row[self::FIELD_DEFAULT_LANG]]
97 ,self::FIELD_OWNER => ['interger',$row[self::FIELD_OWNER]]
98 ,self::FIELD_CREATE_DATE => ['text',$row[self::FIELD_CREATE_DATE]]
99 ,self::FIELD_LAST_UPDATE => ['text',$row[self::FIELD_LAST_UPDATE]]
100 ,self::FIELD_ICON => ['text',$row[self::FIELD_ICON]]
101 ]
102 );
103 }

Referenced by createType().

+ Here is the caller graph for this function:

◆ insertRowTypeTranslationDB()

ilStudyProgrammeTypeDBRepository::insertRowTypeTranslationDB ( array  $row)
protected

Definition at line 184 of file class.ilStudyProgrammeTypeDBRepository.php.

184 : void
185 {
186 $this->db->insert(
187 self::TYPE_TRANSLATION_TABLE,
188 [
189 self::FIELD_ID => ['interger',$row[self::FIELD_ID]]
190 ,self::FIELD_PRG_TYPE_ID => ['integer',$row[self::FIELD_PRG_TYPE_ID]]
191 ,self::FIELD_LANG => ['text',$row[self::FIELD_LANG]]
192 ,self::FIELD_MEMBER => ['text',$row[self::FIELD_MEMBER]]
193 ,self::FIELD_VALUE => ['text',$row[self::FIELD_VALUE]]
194 ]
195 );
196 }

Referenced by createTypeTranslation().

+ Here is the caller graph for this function:

◆ removeIconFromIrss()

ilStudyProgrammeTypeDBRepository::removeIconFromIrss ( string  $identifier)

Definition at line 221 of file class.ilStudyProgrammeTypeDBRepository.php.

221 : void
222 {
223 if($rid = $this->irss->manage()->find($identifier)) {
224 $this->irss->manage()->remove($rid, new ilStudyProgrammeTypeStakeholder());
225 }
226 }

◆ updateAMDRecord()

ilStudyProgrammeTypeDBRepository::updateAMDRecord ( ilStudyProgrammeAdvancedMetadataRecord  $rec)

Persist amd-record properties.

Implements ilStudyProgrammeTypeRepository.

Definition at line 245 of file class.ilStudyProgrammeTypeDBRepository.php.

245 : void
246 {
248 [
249 self::FIELD_ID => $rec->getId()
250 ,self::FIELD_REC_ID => $rec->getRecId()
251 ,self::FIELD_TYPE_ID => $rec->getTypeId()
252 ]
253 );
254 }

References ilStudyProgrammeAdvancedMetadataRecord\getId(), ilStudyProgrammeAdvancedMetadataRecord\getRecId(), ilStudyProgrammeAdvancedMetadataRecord\getTypeId(), and updateRowAMDRecordDB().

+ Here is the call graph for this function:

◆ updateRowAMDRecordDB()

ilStudyProgrammeTypeDBRepository::updateRowAMDRecordDB ( array  $row)
protected

Definition at line 256 of file class.ilStudyProgrammeTypeDBRepository.php.

256 : void
257 {
258 $q = 'UPDATE ' . self::AMD_TABLE
259 . ' SET'
260 . ' ' . self::FIELD_REC_ID . ' = ' . $this->db->quote($row[self::FIELD_REC_ID], 'integer')
261 . ' ,' . self::FIELD_TYPE_ID . ' = ' . $this->db->quote($row[self::FIELD_TYPE_ID], 'integer')
262 . ' WHERE ' . self::FIELD_ID . ' = ' . $this->db->quote($row[self::FIELD_ID], 'integer')
263 ;
264 $this->db->manipulate($q);
265 }

References $q.

Referenced by updateAMDRecord().

+ Here is the caller graph for this function:

◆ updateRowTypeDB()

ilStudyProgrammeTypeDBRepository::updateRowTypeDB ( array  $row)
protected

Definition at line 228 of file class.ilStudyProgrammeTypeDBRepository.php.

228 : void
229 {
230 $q = 'UPDATE ' . self::TYPE_TABLE
231 . ' SET'
232 . ' ' . self::FIELD_DEFAULT_LANG . ' = ' . $this->db->quote($row[self::FIELD_DEFAULT_LANG], 'text')
233 . ' ,' . self::FIELD_OWNER . ' = ' . $this->db->quote($row[self::FIELD_OWNER], 'integer')
234 . ' ,' . self::FIELD_CREATE_DATE . ' = ' . $this->db->quote($row[self::FIELD_CREATE_DATE], 'text')
235 . ' ,' . self::FIELD_LAST_UPDATE . ' = ' . $this->db->quote($row[self::FIELD_LAST_UPDATE], 'text')
236 . ' ,' . self::FIELD_ICON . ' = ' . $this->db->quote($row[self::FIELD_ICON], 'text')
237 . ' WHERE ' . self::FIELD_ID . ' = ' . $this->db->quote($row[self::FIELD_ID], 'integer')
238 ;
239 $this->db->manipulate($q);
240 }

References $q.

Referenced by updateType().

+ Here is the caller graph for this function:

◆ updateRowTypeTranslationDB()

ilStudyProgrammeTypeDBRepository::updateRowTypeTranslationDB ( array  $row)
protected

Definition at line 283 of file class.ilStudyProgrammeTypeDBRepository.php.

283 : void
284 {
285 $q = 'UPDATE ' . self::TYPE_TRANSLATION_TABLE
286 . ' SET'
287 . ' ' . self::FIELD_PRG_TYPE_ID . ' = ' . $this->db->quote($row[self::FIELD_PRG_TYPE_ID], 'integer')
288 . ' ,' . self::FIELD_LANG . ' = ' . $this->db->quote($row[self::FIELD_LANG], 'text')
289 . ' ,' . self::FIELD_MEMBER . ' = ' . $this->db->quote($row[self::FIELD_MEMBER], 'text')
290 . ' ,' . self::FIELD_VALUE . ' = ' . $this->db->quote($row[self::FIELD_VALUE], 'text')
291 . ' WHERE ' . self::FIELD_ID . ' = ' . $this->db->quote($row[self::FIELD_ID], 'integer')
292 ;
293 $this->db->manipulate($q);
294 }

References $q.

Referenced by updateTypeTranslation().

+ Here is the caller graph for this function:

◆ updateType()

ilStudyProgrammeTypeDBRepository::updateType ( ilStudyProgrammeType  $type)

Persist type properties.

Implements ilStudyProgrammeTypeRepository.

Definition at line 208 of file class.ilStudyProgrammeTypeDBRepository.php.

208 : void
209 {
210 $this->updateRowTypeDB(
211 [
212 self::FIELD_ID => $type->getId()
213 ,self::FIELD_DEFAULT_LANG => $type->getDefaultLang()
214 ,self::FIELD_OWNER => $type->getOwner()
215 ,self::FIELD_CREATE_DATE => $type->getCreateDate()->format(ilStudyProgrammeType::DATE_TIME_FORMAT)
216 ,self::FIELD_LAST_UPDATE => $type->getLastUpdate()->format(ilStudyProgrammeType::DATE_TIME_FORMAT)
217 ,self::FIELD_ICON => $type->getIconIdentifier()
218 ]
219 );
220 }

References ilStudyProgrammeType\DATE_TIME_FORMAT, ilStudyProgrammeType\getCreateDate(), ilStudyProgrammeType\getDefaultLang(), ilStudyProgrammeType\getIconIdentifier(), ilStudyProgrammeType\getId(), ilStudyProgrammeType\getLastUpdate(), ilStudyProgrammeType\getOwner(), and updateRowTypeDB().

+ Here is the call graph for this function:

◆ updateTypeTranslation()

ilStudyProgrammeTypeDBRepository::updateTypeTranslation ( ilStudyProgrammeTypeTranslation  $tt)

Field Documentation

◆ $active_plugins

array ilStudyProgrammeTypeDBRepository::$active_plugins = null
protected

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

◆ $amd_records_assigned

array ilStudyProgrammeTypeDBRepository::$amd_records_assigned = []
protected

Definition at line 56 of file class.ilStudyProgrammeTypeDBRepository.php.

◆ $amd_records_available

array ilStudyProgrammeTypeDBRepository::$amd_records_available = null
staticprotected

Definition at line 57 of file class.ilStudyProgrammeTypeDBRepository.php.

◆ AMD_TABLE

const ilStudyProgrammeTypeDBRepository::AMD_TABLE = 'prg_type_adv_md_rec'
private

Definition at line 50 of file class.ilStudyProgrammeTypeDBRepository.php.

◆ FIELD_CREATE_DATE

const ilStudyProgrammeTypeDBRepository::FIELD_CREATE_DATE = 'create_date'
private

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

◆ FIELD_DEFAULT_LANG

const ilStudyProgrammeTypeDBRepository::FIELD_DEFAULT_LANG = 'default_lang'
private

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

◆ FIELD_ICON

const ilStudyProgrammeTypeDBRepository::FIELD_ICON = 'icon'
private

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

◆ FIELD_ID

const ilStudyProgrammeTypeDBRepository::FIELD_ID = 'id'
private

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

◆ FIELD_LANG

const ilStudyProgrammeTypeDBRepository::FIELD_LANG = 'lang'
private

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

◆ FIELD_LAST_UPDATE

const ilStudyProgrammeTypeDBRepository::FIELD_LAST_UPDATE = 'last_update'
private

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

◆ FIELD_MEMBER

const ilStudyProgrammeTypeDBRepository::FIELD_MEMBER = 'member'
private

Definition at line 47 of file class.ilStudyProgrammeTypeDBRepository.php.

◆ FIELD_OWNER

const ilStudyProgrammeTypeDBRepository::FIELD_OWNER = 'owner'
private

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

◆ FIELD_PRG_TYPE_ID

const ilStudyProgrammeTypeDBRepository::FIELD_PRG_TYPE_ID = 'prg_type_id'
private

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

◆ FIELD_REC_ID

const ilStudyProgrammeTypeDBRepository::FIELD_REC_ID = 'rec_id'
private

Definition at line 53 of file class.ilStudyProgrammeTypeDBRepository.php.

◆ FIELD_TYPE_ID

const ilStudyProgrammeTypeDBRepository::FIELD_TYPE_ID = 'type_id'
private

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

◆ FIELD_VALUE

const ilStudyProgrammeTypeDBRepository::FIELD_VALUE = 'value'
private

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

◆ TYPE_TABLE

const ilStudyProgrammeTypeDBRepository::TYPE_TABLE = 'prg_type'
private

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

◆ TYPE_TRANSLATION_TABLE

const ilStudyProgrammeTypeDBRepository::TYPE_TRANSLATION_TABLE = 'prg_translations'
private

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


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