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

Public Member Functions

 getAvailabeMids ()
 Get all available mids. More...
 
 lookupCmsMid ()
 Lookup mid of current cms participant. More...
 
 getServerId ()
 Get server id. More...
 
 isImportAllowed (array $a_mids)
 Check if import is allowed for specific mid. More...
 
 getEnabledParticipants ()
 get number of participants that are enabled More...
 
 isEnabled ($a_mid)
 is participant enabled More...
 

Static Public Member Functions

static getInstanceByServerId (int $a_server_id)
 Get instance by server id. More...
 

Private Member Functions

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

Private Attributes

array $export = array()
 
array $import = array()
 
int $server_id
 
ilDBInterface $db
 

Static Private Attributes

static array $instances = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilECSParticipantSettings::__construct ( int  $a_server_id)
private

Constructor (Singleton)

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

39 {
40 global $DIC;
41
42 $this->db = $DIC['ilDB'];
43 $this->server_id = $a_server_id;
44 $this->read();
45 }
global $DIC
Definition: shib_login.php:26

References $DIC, and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ getAvailabeMids()

ilECSParticipantSettings::getAvailabeMids ( )

Get all available mids.

Returns
int[] membership id

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

59 : array
60 {
61 $query = 'SELECT mid FROM ecs_part_settings ' .
62 'WHERE sid = ' . $this->db->quote($this->server_id, 'integer');
63 $res = $this->db->query($query);
64
65 $mids = array();
66 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
67 $mids[] = (int) $row->mid;
68 }
69 return $mids;
70 }
$res
Definition: ltiservices.php:69

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

+ Here is the call graph for this function:

◆ getEnabledParticipants()

ilECSParticipantSettings::getEnabledParticipants ( )

get number of participants that are enabled

Deprecated:

Definition at line 129 of file class.ilECSParticipantSettings.php.

129 : array
130 {
131 $ret = array();
132 foreach ($this->export as $mid => $enabled) {
133 if ($enabled) {
134 $ret[] = $mid;
135 }
136 }
137 return $ret;
138 }

◆ getInstanceByServerId()

static ilECSParticipantSettings::getInstanceByServerId ( int  $a_server_id)
static

Get instance by server id.

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

51 {
52 return self::$instances[$a_server_id] ?? (self::$instances[$a_server_id] = new ilECSParticipantSettings($a_server_id));
53 }

Referenced by ilECSCommunityReader\getEnabledParticipants(), ilRemoteObjectBase\handleUpdate(), ilECSCmsTreeCommandQueueHandler\init(), ilECSSettingsGUI\refreshParticipants(), and ilECSMappingSettingsGUI\setTabs().

+ Here is the caller graph for this function:

◆ getServerId()

ilECSParticipantSettings::getServerId ( )

Get server id.

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

92 : int
93 {
94 return $this->server_id;
95 }

References $server_id.

Referenced by read().

+ Here is the caller graph for this function:

◆ isEnabled()

ilECSParticipantSettings::isEnabled (   $a_mid)

is participant enabled

Parameters
intmid
Deprecated:

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

147 : bool
148 {
149 return $this->export[$a_mid] ? true : false;
150 }
return true

References true.

◆ isImportAllowed()

ilECSParticipantSettings::isImportAllowed ( array  $a_mids)

Check if import is allowed for specific mid.

Definition at line 114 of file class.ilECSParticipantSettings.php.

114 : bool
115 {
116 foreach ($a_mids as $mid) {
117 if ($this->import[$mid]) {
118 return true;
119 }
120 }
121 return false;
122 }

◆ lookupCmsMid()

ilECSParticipantSettings::lookupCmsMid ( )

Lookup mid of current cms participant.

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

77 : int
78 {
79 $query = 'SELECT mid FROM ecs_part_settings ' .
80 'WHERE sid = ' . $this->db->quote($this->server_id, 'integer') . ' ' .
81 'AND import_type = ' . $this->db->quote(ilECSParticipantSetting::IMPORT_CMS);
82 $res = $this->db->query($query);
83 if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
84 return (int) $row->mid;
85 }
86 return 0;
87 }

References $res, ilDBConstants\FETCHMODE_OBJECT, and ilECSParticipantSetting\IMPORT_CMS.

◆ read()

ilECSParticipantSettings::read ( )
private

Read stored entry.

Definition at line 100 of file class.ilECSParticipantSettings.php.

100 : void
101 {
102 $query = 'SELECT * FROM ecs_part_settings ' .
103 'WHERE sid = ' . $this->db->quote($this->getServerId(), 'integer') . ' ';
104 $res = $this->db->query($query);
105 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
106 $this->export[$row->mid] = $row->export;
107 $this->import[$row->mid] = $row->import;
108 }
109 }

References $res, ilDBConstants\FETCHMODE_OBJECT, and getServerId().

Referenced by __construct().

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

Field Documentation

◆ $db

ilDBInterface ilECSParticipantSettings::$db
private

Definition at line 33 of file class.ilECSParticipantSettings.php.

◆ $export

array ilECSParticipantSettings::$export = array()
private

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

◆ $import

array ilECSParticipantSettings::$import = array()
private

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

◆ $instances

array ilECSParticipantSettings::$instances = null
staticprivate

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

◆ $server_id

int ilECSParticipantSettings::$server_id
private

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

Referenced by getServerId().


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