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

Public Member Functions

 delete ()
 Delete server. More...
 
 getServer ()
 Get actice ecs setting. More...
 
 getMappings ($a_mapping_type=ilECSDataMappingSetting::MAPPING_IMPORT_RCRS)
 get mappings More...
 
 getMappingByECSName (int $a_mapping_type, string $a_key)
 get mapping by key More...
 

Static Public Member Functions

static getInstanceByServerId (int $a_server_id)
 Get singleton instance. More...
 

Private Member Functions

 __construct (int $a_server_id)
 Singleton Constructor. More...
 
 read ()
 Read settings. More...
 

Private Attributes

ilECSSetting $settings
 
array $mappings
 
ilDbInterface $db
 

Static Private Attributes

static array $instances = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilECSDataMappingSettings::__construct ( int  $a_server_id)
private

Singleton Constructor.

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

36 {
37 global $DIC;
38 $this->db = $DIC->database();
39
40 $this->settings = ilECSSetting::getInstanceByServerId($a_server_id);
41 $this->read();
42 }
static getInstanceByServerId(int $a_server_id)
Get singleton instance per server.
global $DIC
Definition: shib_login.php:26

References $DIC, ilECSSetting\getInstanceByServerId(), read(), and ILIAS\Repository\settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilECSDataMappingSettings::delete ( )

Delete server.

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

55 : void
56 {
57 $server_id = $this->settings->getServerId();
58 unset(self::$instances[$server_id]);
59
60 $query = 'DELETE from ecs_data_mapping ' .
61 'WHERE sid = ' . $this->db->quote($server_id, 'integer');
62 $this->db->manipulate($query);
63 }

References ILIAS\Repository\settings().

+ Here is the call graph for this function:

◆ getInstanceByServerId()

static ilECSDataMappingSettings::getInstanceByServerId ( int  $a_server_id)
static

◆ getMappingByECSName()

ilECSDataMappingSettings::getMappingByECSName ( int  $a_mapping_type,
string  $a_key 
)

get mapping by key

Parameters
intmapping type import, export, crs, rcrs
stringECS data field name. E.g. 'lecturer'
Returns
int AdvancedMetaData field id or 0 (no mapping)

Definition at line 92 of file class.ilECSDataMappingSettings.php.

92 : int
93 {
94 return $this->mappings[$a_mapping_type][$a_key] ?? 0;
95 }

◆ getMappings()

ilECSDataMappingSettings::getMappings (   $a_mapping_type = ilECSDataMappingSetting::MAPPING_IMPORT_RCRS)

get mappings

Definition at line 78 of file class.ilECSDataMappingSettings.php.

78 : array
79 {
80 return $this->mappings[$a_mapping_type];
81 }

◆ getServer()

ilECSDataMappingSettings::getServer ( )

Get actice ecs setting.

Definition at line 68 of file class.ilECSDataMappingSettings.php.

References $settings.

Referenced by read().

+ Here is the caller graph for this function:

◆ read()

ilECSDataMappingSettings::read ( )
private

Read settings.

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

103 : void
104 {
105 $this->mappings = array();
106
107 $query = 'SELECT * FROM ecs_data_mapping ' .
108 'WHERE sid = ' . $this->db->quote($this->getServer()->getServerId(), 'integer') . ' ';
109 $res = $this->db->query($query);
110 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
111 $this->mappings[$row->mapping_type][$row->ecs_field] = (int) $row->advmd_id;
112 }
113 }
$res
Definition: ltiservices.php:69

References $res, ilDBConstants\FETCHMODE_OBJECT, getServer(), and ILIAS\Repository\int().

Referenced by __construct().

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

Field Documentation

◆ $db

ilDbInterface ilECSDataMappingSettings::$db
private

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

◆ $instances

array ilECSDataMappingSettings::$instances = null
staticprivate

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

◆ $mappings

array ilECSDataMappingSettings::$mappings
private

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

◆ $settings

ilECSSetting ilECSDataMappingSettings::$settings
private

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

Referenced by getServer().


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