ILIAS  release_8 Revision v8.23
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 37 of file class.ilECSParticipantSettings.php.

References $DIC, and read().

38  {
39  global $DIC;
40 
41  $this->db = $DIC['ilDB'];
42  $this->server_id = $a_server_id;
43  $this->read();
44  }
global $DIC
Definition: feed.php:28
+ 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 58 of file class.ilECSParticipantSettings.php.

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

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

◆ getEnabledParticipants()

ilECSParticipantSettings::getEnabledParticipants ( )

get number of participants that are enabled

Deprecated:

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

References ILIAS\LTI\ToolProvider\$enabled.

128  : array
129  {
130  $ret = array();
131  foreach ($this->export as $mid => $enabled) {
132  if ($enabled) {
133  $ret[] = $mid;
134  }
135  }
136  return $ret;
137  }
bool $enabled
Whether the system instance is enabled to accept connection requests.
Definition: System.php:123

◆ getInstanceByServerId()

static ilECSParticipantSettings::getInstanceByServerId ( int  $a_server_id)
static

Get instance by server id.

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

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

50  {
51  return self::$instances[$a_server_id] ?? (self::$instances[$a_server_id] = new ilECSParticipantSettings($a_server_id));
52  }
+ Here is the caller graph for this function:

◆ getServerId()

ilECSParticipantSettings::getServerId ( )

Get server id.

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

References $server_id.

Referenced by read().

91  : int
92  {
93  return $this->server_id;
94  }
+ Here is the caller graph for this function:

◆ isEnabled()

ilECSParticipantSettings::isEnabled (   $a_mid)

is participant enabled

Parameters
intmid
Deprecated:

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

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

◆ isImportAllowed()

ilECSParticipantSettings::isImportAllowed ( array  $a_mids)

Check if import is allowed for specific mid.

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

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

◆ lookupCmsMid()

ilECSParticipantSettings::lookupCmsMid ( )

Lookup mid of current cms participant.

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

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

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

◆ read()

ilECSParticipantSettings::read ( )
private

Read stored entry.

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

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

Referenced by __construct().

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

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

◆ $export

array ilECSParticipantSettings::$export = array()
private

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

◆ $import

array ilECSParticipantSettings::$import = array()
private

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

◆ $instances

array ilECSParticipantSettings::$instances = null
staticprivate

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

◆ $server_id

int ilECSParticipantSettings::$server_id
private

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

Referenced by getServerId().


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