ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 34 of file class.ilECSDataMappingSettings.php.

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

35  {
36  global $DIC;
37  $this->db = $DIC->database();
38 
39  $this->settings = ilECSSetting::getInstanceByServerId($a_server_id);
40  $this->read();
41  }
global $DIC
Definition: feed.php:28
static getInstanceByServerId(int $a_server_id)
Get singleton instance per server.
+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilECSDataMappingSettings::delete ( )

Delete server.

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

References $query, and ILIAS\Repository\settings().

54  : void
55  {
56  $server_id = $this->settings->getServerId();
57  unset(self::$instances[$server_id]);
58 
59  $query = 'DELETE from ecs_data_mapping ' .
60  'WHERE sid = ' . $this->db->quote($server_id, 'integer');
61  $this->db->manipulate($query);
62  }
$query
+ 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 91 of file class.ilECSDataMappingSettings.php.

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

◆ getMappings()

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

get mappings

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

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

◆ getServer()

ilECSDataMappingSettings::getServer ( )

Get actice ecs setting.

Definition at line 67 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 102 of file class.ilECSDataMappingSettings.php.

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

Referenced by __construct().

102  : void
103  {
104  $this->mappings = array();
105 
106  $query = 'SELECT * FROM ecs_data_mapping ' .
107  'WHERE sid = ' . $this->db->quote($this->getServer()->getServerId(), 'integer') . ' ';
108  $res = $this->db->query($query);
109  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
110  $this->mappings[$row->mapping_type][$row->ecs_field] = (int) $row->advmd_id;
111  }
112  }
$res
Definition: ltiservices.php:69
$query
+ 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 30 of file class.ilECSDataMappingSettings.php.

◆ $instances

array ilECSDataMappingSettings::$instances = null
staticprivate

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

◆ $mappings

array ilECSDataMappingSettings::$mappings
private

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

◆ $settings

ilECSSetting ilECSDataMappingSettings::$settings
private

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

Referenced by getServer().


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