ILIAS  release_8 Revision v8.24
ilStudyProgrammeTypeDBRepository Class Reference

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

+ Inheritance diagram for ilStudyProgrammeTypeDBRepository:
+ Collaboration diagram for ilStudyProgrammeTypeDBRepository:

Public Member Functions

 __construct (ilDBInterface $db, ilStudyProgrammeSettingsRepository $settings_repo, ILIAS\Filesystem\Filesystem $webdir, ilObjUser $usr, ilLanguage $lng, ilComponentFactory $component_factory)
 
 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...
 
 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.
Returns
ilStudyProgrammeType[]
More...
 
 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)
 
- 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)
 

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 ()
 

Protected Attributes

array $active_plugins = null
 
array $amd_records_assigned = []
 
ilDBInterface $db
 
ilStudyProgrammeSettingsRepository $settings_repo
 
ILIAS Filesystem Filesystem $webdir
 
ilObjUser $usr
 
ilLanguage $lng
 
ilComponentFactory $component_factory
 

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

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

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

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeTypeDBRepository::__construct ( ilDBInterface  $db,
ilStudyProgrammeSettingsRepository  $settings_repo,
ILIAS\Filesystem\Filesystem  $webdir,
ilObjUser  $usr,
ilLanguage  $lng,
ilComponentFactory  $component_factory 
)

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

References $component_factory, $db, $lng, $settings_repo, $usr, $webdir, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ createAMDByRow()

ilStudyProgrammeTypeDBRepository::createAMDByRow ( array  $row)
protected

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

162 {
163 $return = new ilStudyProgrammeAdvancedMetadataRecord((int) $row[self::FIELD_ID]);
164 $return->setTypeId((int) $row[self::FIELD_TYPE_ID]);
165 $return->setRecId((int) $row[self::FIELD_REC_ID]);
166 return $return;
167 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Referenced by createAMDRecord(), getAMDRecordsByTypeId(), getAMDRecordsByTypeIdAndRecordId(), and getAvailableAdvancedMDRecords().

+ 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 137 of file class.ilStudyProgrammeTypeDBRepository.php.

138 {
139 $id = $this->db->nextId(self::AMD_TABLE);
140 $row = [
141 self::FIELD_ID => $id,
142 self::FIELD_TYPE_ID => null,
143 self::FIELD_REC_ID => null
144 ];
145 $this->insertRowAMDDB($row);
146 return $this->createAMDByRow($row);
147 }
$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 75 of file class.ilStudyProgrammeTypeDBRepository.php.

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

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

+ Here is the call graph for this function:

◆ createTypeByRow()

ilStudyProgrammeTypeDBRepository::createTypeByRow ( array  $row)
protected

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

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

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

Referenced by createType(), getAllTypes(), and getType().

+ 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 172 of file class.ilStudyProgrammeTypeDBRepository.php.

173 {
174 $id = $this->db->nextId(self::TYPE_TRANSLATION_TABLE);
175 $row = [
176 self::FIELD_ID => $id,
177 self::FIELD_PRG_TYPE_ID => null,
178 self::FIELD_LANG => null,
179 self::FIELD_MEMBER => null,
180 self::FIELD_VALUE => null
181 ];
182 $this->insertRowTypeTranslationDB($row);
183 return $this->createTypeTranslationByRow($row);
184 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

+ Here is the call graph for this function:

◆ createTypeTranslationByRow()

ilStudyProgrammeTypeDBRepository::createTypeTranslationByRow ( array  $row)
protected

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

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

Referenced by createTypeTranslation(), and getTranslationByTypeIdMemberLang().

+ Here is the caller graph for this function:

◆ deleteAllTranslationsByTypeId()

ilStudyProgrammeTypeDBRepository::deleteAllTranslationsByTypeId ( int  $type_id)
protected

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

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

◆ deleteAMDRecord()

ilStudyProgrammeTypeDBRepository::deleteAMDRecord ( ilStudyProgrammeAdvancedMetadataRecord  $rec)

Delete record corresponding to given object.

Implements ilStudyProgrammeTypeRepository.

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

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

References ilStudyProgrammeAdvancedMetadataRecord\getId().

+ Here is the call graph for this function:

◆ deleteAMDRecordsByTypeId()

ilStudyProgrammeTypeDBRepository::deleteAMDRecordsByTypeId ( int  $type_id)
protected

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

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

◆ deleteTypeTranslation()

ilStudyProgrammeTypeDBRepository::deleteTypeTranslation ( ilStudyProgrammeTypeTranslation  $tt)

Delete record corresponding to given object.

Implements ilStudyProgrammeTypeRepository.

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

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

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 384 of file class.ilStudyProgrammeTypeDBRepository.php.

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

◆ getActivePlugins()

ilStudyProgrammeTypeDBRepository::getActivePlugins ( )
protected

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

339 : Iterator
340 {
341 return $this->component_factory->getActivePluginsInSlot('prgtypehk');
342 }

◆ getAllAMDRecords()

ilStudyProgrammeTypeDBRepository::getAllAMDRecords ( )

Returns
ilAdvancedMDRecord[]

Implements ilStudyProgrammeTypeRepository.

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

503 : array
504 {
505 if (is_array(self::$amd_records_available)) {
507 }
508 self::$amd_records_available = ilAdvancedMDRecord::_getActivatedRecordsByObjectType('prg', 'prg_type');
510 }
static _getActivatedRecordsByObjectType(string $a_obj_type, string $a_sub_type="", bool $a_only_optional=false)
Get activated records by object type.

References $amd_records_available, and ilAdvancedMDRecord\_getActivatedRecordsByObjectType().

+ Here is the call graph for this function:

◆ getAllTypes()

ilStudyProgrammeTypeDBRepository::getAllTypes ( )

Get all persisted type-objects.

Returns
ilStudyProgrammeType[]

Implements ilStudyProgrammeTypeRepository.

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

395 : array
396 {
397 $return = [];
398 foreach ($this->getAllTypesRecords() as $row) {
399 $return[] = $this->createTypeByRow($row);
400 }
401 return $return;
402 }

References createTypeByRow(), and getAllTypesRecords().

Referenced by getAllTypesArray().

+ Here is the call graph for this function:
+ Here is the caller 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 446 of file class.ilStudyProgrammeTypeDBRepository.php.

446 : array
447 {
448 $return = [];
449 foreach ($this->getAllTypes() as $type) {
450 $return[$type->getId()] = $type->getTitle();
451 }
452 return $return;
453 }
getAllTypes()
Get all persisted type-objects.ilStudyProgrammeType[]
$type

References $type, and getAllTypes().

+ Here is the call graph for this function:

◆ getAllTypesRecords()

ilStudyProgrammeTypeDBRepository::getAllTypesRecords ( )
protected

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

404 : Generator
405 {
406 $q = 'SELECT'
407 . ' ' . self::FIELD_DEFAULT_LANG
408 . ' ,' . self::FIELD_OWNER
409 . ' ,' . self::FIELD_CREATE_DATE
410 . ' ,' . self::FIELD_LAST_UPDATE
411 . ' ,' . self::FIELD_ICON
412 . ' ,' . self::FIELD_ID
413 . ' FROM ' . self::TYPE_TABLE;
414 $res = $this->db->query($q);
415
416 while ($rec = $this->db->fetchAssoc($res)) {
417 yield $rec;
418 }
419 }
$res
Definition: ltiservices.php:69

References $res, and TYPE_TABLE.

Referenced by getAllTypes().

+ Here is the caller graph for this function:

◆ getAMDRecordsByTypeId()

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

Returns
ilStudyProgrammeAdvancedMetadataRecord[]

Implements ilStudyProgrammeTypeRepository.

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

549 : array
550 {
551 $q = 'SELECT'
552 . ' ' . self::FIELD_REC_ID
553 . ' ,' . self::FIELD_TYPE_ID
554 . ' ,' . self::FIELD_ID
555 . ' FROM ' . self::AMD_TABLE
556 . ' WHERE ' . self::FIELD_TYPE_ID . ' = ' . $this->db->quote($type_id, 'integer');
557 $return = [];
558 $res = $this->db->query($q);
559 while ($rec = $this->db->fetchAssoc($res)) {
560 $return[] = $this->createAMDByRow($rec);
561 }
562 return $return;
563 }

References $res, and createAMDByRow().

+ Here is the call graph for this function:

◆ getAMDRecordsByTypeIdAndRecordId()

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

Returns
ilStudyProgrammeAdvancedMetadataRecord[]

Implements ilStudyProgrammeTypeRepository.

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

529 : array
530 {
531 $q = 'SELECT'
532 . ' ' . self::FIELD_REC_ID
533 . ' ,' . self::FIELD_TYPE_ID
534 . ' ,' . self::FIELD_ID
535 . ' FROM ' . self::AMD_TABLE
536 . ' WHERE ' . self::FIELD_TYPE_ID . ' = ' . $this->db->quote($type_id, 'integer')
537 . ' AND ' . self::FIELD_REC_ID . ' = ' . $this->db->quote($record_id, 'integer');
538 $return = [];
539 $res = $this->db->query($q);
540 while ($rec = $this->db->fetchAssoc($res)) {
541 $return[] = $this->createAMDByRow($rec);
542 }
543 return $return;
544 }

References $res, and createAMDByRow().

+ Here is the call graph for this function:

◆ getAssignedAMDRecordsByType()

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

Returns
ilAdvancedMDRecord[]

Implements ilStudyProgrammeTypeRepository.

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

458 : array
459 {
460 $active = ($only_active) ? 1 : 0; // Cache key
461 if (
462 array_key_exists($type_id, $this->amd_records_assigned) &&
463 isset($this->amd_records_assigned[$type_id][$active]) &&
464 is_array($this->amd_records_assigned[$type_id][$active])
465 ) {
466 return $this->amd_records_assigned[$type_id][$active];
467 }
468 $q = 'SELECT'
469 . ' ' . self::FIELD_REC_ID
470 . ' FROM ' . self::AMD_TABLE
471 . ' WHERE ' . self::FIELD_TYPE_ID . ' = ' . $this->db->quote($type_id, 'integer');
472 $res = $this->db->query($q);
473 $this->amd_records_assigned[$type_id][$active] = [];
474 while ($rec = $this->db->fetchAssoc($res)) {
475 $amd_record = new ilAdvancedMDRecord((int) $rec[self::FIELD_REC_ID]);
476 if ($only_active) {
477 if ($amd_record->isActive()) {
478 $this->amd_records_assigned[$type_id][1][] = $amd_record;
479 }
480 } else {
481 $this->amd_records_assigned[$type_id][0][] = $amd_record;
482 }
483 }
484 return $this->amd_records_assigned[$type_id][$active];
485 }

References $res.

◆ getAvailableAdvancedMDRecordIds()

ilStudyProgrammeTypeDBRepository::getAvailableAdvancedMDRecordIds ( )

Returns
int[]

Implements ilStudyProgrammeTypeRepository.

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

615 : array
616 {
617 $q = 'SELECT ' . self::FIELD_REC_ID
618 . ' FROM ' . self::AMD_TABLE;
619 $return = [];
620 $res = $this->db->query($q);
621 while ($rec = $this->db->fetchAssoc($res)) {
622 $return[] = $rec[self::FIELD_REC_ID];
623 }
624 return $return;
625 }

References $res, AMD_TABLE, and FIELD_REC_ID.

◆ getAvailableAdvancedMDRecords()

ilStudyProgrammeTypeDBRepository::getAvailableAdvancedMDRecords ( )

Returns
ilStudyProgrammeAdvancedMetadataRecord[]

Implements ilStudyProgrammeTypeRepository.

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

597 : array
598 {
599 $q = 'SELECT'
600 . ' ' . self::FIELD_REC_ID
601 . ' ,' . self::FIELD_TYPE_ID
602 . ' ,' . self::FIELD_ID
603 . ' FROM ' . self::AMD_TABLE;
604 $return = [];
605 $res = $this->db->query($q);
606 while ($rec = $this->db->fetchAssoc($res)) {
607 $return[] = $this->createAMDByRow($rec);
608 }
609 return $return;
610 }

References $res, AMD_TABLE, and createAMDByRow().

+ 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 584 of file class.ilStudyProgrammeTypeDBRepository.php.

584 : array
585 {
586 return array_map(
587 static function (ilStudyProgrammeSettings $settings): int {
588 return $settings->getObjId();
589 },
590 $this->settings_repo->loadByType($type_id)
591 );
592 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200

References ILIAS\LTI\ToolProvider\$settings.

◆ getStudyProgrammesByTypeId()

ilStudyProgrammeTypeDBRepository::getStudyProgrammesByTypeId ( int  $type_id)

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

Returns
ilStudyProgrammeSettings[]

Implements ilStudyProgrammeTypeRepository.

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

576 : array
577 {
578 return $this->settings_repo->loadByType($type_id);
579 }

◆ getTranslationByTypeIdMemberLang()

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

Implements ilStudyProgrammeTypeRepository.

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

648 $q = 'SELECT'
649 . ' ' . self::FIELD_LANG
650 . ' ,' . self::FIELD_PRG_TYPE_ID
651 . ' ,' . self::FIELD_ID
652 . ' ,' . self::FIELD_MEMBER
653 . ' ,' . self::FIELD_VALUE
654 . ' FROM ' . self::TYPE_TRANSLATION_TABLE
655 . ' WHERE ' . self::FIELD_PRG_TYPE_ID . ' = ' . $this->db->quote($type_id, 'integer')
656 . ' AND ' . self::FIELD_LANG . ' = ' . $this->db->quote($lang_code, 'text')
657 . ' AND ' . self::FIELD_MEMBER . ' = ' . $this->db->quote($member, 'text');
658 $res = $this->db->query($q);
659 while ($rec = $this->db->fetchAssoc($res)) {
660 return $this->createTypeTranslationByRow($rec);
661 }
662 return null;
663 }

References createTypeTranslationByRow().

+ Here is the call graph for this function:

◆ getTranslationsArrayByTypeIdAndLangCode()

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

Implements ilStudyProgrammeTypeRepository.

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

568 : array
569 {
570 throw new LogicException("Not implemented yet.");
571 }

◆ getTranslationsByTypeAndLang()

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

Implements ilStudyProgrammeTypeRepository.

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

627 : array
628 {
629 $q = 'SELECT'
630 . ' ' . self::FIELD_MEMBER
631 . ' ,' . self::FIELD_VALUE
632 . ' FROM ' . self::TYPE_TRANSLATION_TABLE
633 . ' WHERE ' . self::FIELD_PRG_TYPE_ID . ' = ' . $this->db->quote($type_id, 'integer')
634 . ' AND ' . self::FIELD_LANG . ' = ' . $this->db->quote($lang_code, 'text');
635 $res = $this->db->query($q);
636 $return = [];
637 while ($rec = $this->db->fetchAssoc($res)) {
638 $return[$rec[self::FIELD_MEMBER]] = $rec[self::FIELD_VALUE];
639 }
640 return $return;
641 }

References $res, FIELD_MEMBER, and FIELD_VALUE.

◆ getType()

ilStudyProgrammeTypeDBRepository::getType ( int  $type_id)

Get a type with given type_id.

Implements ilStudyProgrammeTypeRepository.

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

425 {
426 $q = 'SELECT'
427 . ' ' . self::FIELD_DEFAULT_LANG
428 . ' ,' . self::FIELD_OWNER
429 . ' ,' . self::FIELD_CREATE_DATE
430 . ' ,' . self::FIELD_LAST_UPDATE
431 . ' ,' . self::FIELD_ICON
432 . ' ,' . self::FIELD_ID
433 . ' FROM ' . self::TYPE_TABLE
434 . ' WHERE ' . self::FIELD_ID . ' = ' . $this->db->quote($type_id, 'integer');
435 $res = $this->db->query($q);
436 while ($rec = $this->db->fetchAssoc($res)) {
437 return $this->createTypeByRow($rec);
438 }
439
440 throw new LogicException("No entry found for type id: " . $type_id);
441 }

References $res, and createTypeByRow().

+ Here is the call graph for this function:

◆ insertRowAMDDB()

ilStudyProgrammeTypeDBRepository::insertRowAMDDB ( array  $row)
protected

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

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

Referenced by createAMDRecord().

+ Here is the caller graph for this function:

◆ insertRowTypeDB()

ilStudyProgrammeTypeDBRepository::insertRowTypeDB ( array  $row)
protected

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

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

Referenced by createType().

+ Here is the caller graph for this function:

◆ insertRowTypeTranslationDB()

ilStudyProgrammeTypeDBRepository::insertRowTypeTranslationDB ( array  $row)
protected

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

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

Referenced by createTypeTranslation().

+ Here is the caller graph for this function:

◆ updateAMDRecord()

ilStudyProgrammeTypeDBRepository::updateAMDRecord ( ilStudyProgrammeAdvancedMetadataRecord  $rec)

Persist amd-record properties.

Implements ilStudyProgrammeTypeRepository.

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

240 : void
241 {
243 [
244 self::FIELD_ID => $rec->getId()
245 ,self::FIELD_REC_ID => $rec->getRecId()
246 ,self::FIELD_TYPE_ID => $rec->getTypeId()
247 ]
248 );
249 }

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 251 of file class.ilStudyProgrammeTypeDBRepository.php.

251 : void
252 {
253 $q = 'UPDATE ' . self::AMD_TABLE
254 . ' SET'
255 . ' ' . self::FIELD_REC_ID . ' = ' . $this->db->quote($row[self::FIELD_REC_ID], 'integer')
256 . ' ,' . self::FIELD_TYPE_ID . ' = ' . $this->db->quote($row[self::FIELD_TYPE_ID], 'integer')
257 . ' WHERE ' . self::FIELD_ID . ' = ' . $this->db->quote($row[self::FIELD_ID], 'integer')
258 ;
259 $this->db->manipulate($q);
260 }

Referenced by updateAMDRecord().

+ Here is the caller graph for this function:

◆ updateRowTypeDB()

ilStudyProgrammeTypeDBRepository::updateRowTypeDB ( array  $row)
protected

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

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

Referenced by updateType().

+ Here is the caller graph for this function:

◆ updateRowTypeTranslationDB()

ilStudyProgrammeTypeDBRepository::updateRowTypeTranslationDB ( array  $row)
protected

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

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

Referenced by updateTypeTranslation().

+ Here is the caller graph for this function:

◆ updateType()

ilStudyProgrammeTypeDBRepository::updateType ( ilStudyProgrammeType  $type)

Persist type properties.

Implements ilStudyProgrammeTypeRepository.

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

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

References $type, ilStudyProgrammeType\DATE_TIME_FORMAT, 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 44 of file class.ilStudyProgrammeTypeDBRepository.php.

◆ $amd_records_assigned

array ilStudyProgrammeTypeDBRepository::$amd_records_assigned = []
protected

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

◆ $amd_records_available

array ilStudyProgrammeTypeDBRepository::$amd_records_available = null
staticprotected

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

Referenced by getAllAMDRecords().

◆ $component_factory

ilComponentFactory ilStudyProgrammeTypeDBRepository::$component_factory
protected

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

Referenced by __construct().

◆ $db

ilDBInterface ilStudyProgrammeTypeDBRepository::$db
protected

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

Referenced by __construct().

◆ $lng

ilLanguage ilStudyProgrammeTypeDBRepository::$lng
protected

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

Referenced by __construct().

◆ $settings_repo

ilStudyProgrammeSettingsRepository ilStudyProgrammeTypeDBRepository::$settings_repo
protected

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

Referenced by __construct().

◆ $usr

ilObjUser ilStudyProgrammeTypeDBRepository::$usr
protected

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

Referenced by __construct().

◆ $webdir

ILIAS Filesystem Filesystem ilStudyProgrammeTypeDBRepository::$webdir
protected

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

Referenced by __construct().

◆ AMD_TABLE

const ilStudyProgrammeTypeDBRepository::AMD_TABLE = 'prg_type_adv_md_rec'
private

◆ FIELD_CREATE_DATE

const ilStudyProgrammeTypeDBRepository::FIELD_CREATE_DATE = 'create_date'
private

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

◆ FIELD_DEFAULT_LANG

const ilStudyProgrammeTypeDBRepository::FIELD_DEFAULT_LANG = 'default_lang'
private

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

◆ FIELD_ICON

const ilStudyProgrammeTypeDBRepository::FIELD_ICON = 'icon'
private

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

◆ FIELD_ID

const ilStudyProgrammeTypeDBRepository::FIELD_ID = 'id'
private

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

◆ FIELD_LANG

const ilStudyProgrammeTypeDBRepository::FIELD_LANG = 'lang'
private

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

◆ FIELD_LAST_UPDATE

const ilStudyProgrammeTypeDBRepository::FIELD_LAST_UPDATE = 'last_update'
private

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

◆ FIELD_MEMBER

const ilStudyProgrammeTypeDBRepository::FIELD_MEMBER = 'member'
private

◆ FIELD_OWNER

const ilStudyProgrammeTypeDBRepository::FIELD_OWNER = 'owner'
private

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

◆ FIELD_PRG_TYPE_ID

const ilStudyProgrammeTypeDBRepository::FIELD_PRG_TYPE_ID = 'prg_type_id'
private

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

◆ FIELD_REC_ID

const ilStudyProgrammeTypeDBRepository::FIELD_REC_ID = 'rec_id'
private

◆ FIELD_TYPE_ID

const ilStudyProgrammeTypeDBRepository::FIELD_TYPE_ID = 'type_id'
private

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

◆ FIELD_VALUE

const ilStudyProgrammeTypeDBRepository::FIELD_VALUE = 'value'
private

◆ TYPE_TABLE

const ilStudyProgrammeTypeDBRepository::TYPE_TABLE = 'prg_type'
private

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

Referenced by getAllTypesRecords().

◆ TYPE_TRANSLATION_TABLE

const ilStudyProgrammeTypeDBRepository::TYPE_TRANSLATION_TABLE = 'prg_translations'
private

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


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