ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilECSParticipantSettings Class Reference
+ Collaboration diagram for ilECSParticipantSettings:

Public Member Functions

 getServerId ()
 Get server id. More...
 
 read ()
 Read stored entry. More...
 
 isImportAllowed (array $a_mids)
 Check if import is allowed for scecific mid. More...
 
 getEnabledParticipants ()
 get number of participants that are enabled More...
 
 isEnabled ($a_mid)
 is partivcipant enabled More...
 
 setEnabledParticipants ($a_parts)
 set enabled participants by community More...
 

Static Public Member Functions

static _getInstance ()
 get instance More...
 
static getInstanceByServerId ($a_server_id)
 Get instance by server id. More...
 
static getAvailabeMids ($a_server_id)
 Get all available mids @global $ilDB. More...
 
static getExportableParticipants ($a_type)
 Get participants which are enabled and export is allowed. More...
 
static getExportServers ()
 Get server ids which allow an export @global <type> $ilDB. More...
 
static deleteByServer ($a_server_id)
 Delete by server @global $ilDB. More...
 
static loookupCmsMid ($a_server_id)
 Lookup mid of current cms participant @global $ilDB. More...
 

Private Member Functions

 __construct ($a_server_id)
 Constructor (Singleton) More...
 

Private Attributes

 $export = array()
 
 $import = array()
 
 $export_type = array()
 

Static Private Attributes

static $instances = null
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilECSParticipantSettings::__construct (   $a_server_id)
private

Constructor (Singleton)

@access private

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

47 {
48 $this->server_id = $a_server_id;
49 $this->read();
50 }

References read().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getInstance()

static ilECSParticipantSettings::_getInstance ( )
static

get instance

@access public

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

60 {
61 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Using deprecated call');
62 $GLOBALS['DIC']['ilLog']->logStack();
64 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static getInstanceByServerId($a_server_id)
Get instance by server id.

References $GLOBALS, and getInstanceByServerId().

+ Here is the call graph for this function:

◆ deleteByServer()

static ilECSParticipantSettings::deleteByServer (   $a_server_id)
static

Delete by server @global $ilDB.

Parameters
int$a_server_id

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

160 {
161 global $DIC;
162
163 $ilDB = $DIC['ilDB'];
164
165 $query = 'DELETE from ecs_part_settings ' .
166 'WHERE sid = ' . $ilDB->quote($a_server_id, 'integer');
167 $ilDB->manipulate($query);
168 }
$query
global $ilDB
$DIC
Definition: xapitoken.php:46

References $DIC, $ilDB, and $query.

Referenced by ilECSSettingsGUI\doDelete().

+ Here is the caller graph for this function:

◆ getAvailabeMids()

static ilECSParticipantSettings::getAvailabeMids (   $a_server_id)
static

Get all available mids @global $ilDB.

Parameters
type$a_server_id
Returns
type

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

86 {
87 global $DIC;
88
89 $ilDB = $DIC['ilDB'];
90
91 $query = 'SELECT mid FROM ecs_part_settings ' .
92 'WHERE sid = ' . $ilDB->quote($a_server_id, 'integer');
93 $res = $ilDB->query($query);
94
95 $mids = array();
96 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
97 $mids[] = $row->mid;
98 }
99 return $mids;
100 }
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSSettingsGUI\refreshParticipants().

+ Here is the caller graph for this function:

◆ getEnabledParticipants()

ilECSParticipantSettings::getEnabledParticipants ( )

get number of participants that are enabled

@access public

Deprecated:

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

248 {
249 $ret = array();
250 foreach ($this->export as $mid => $enabled) {
251 if ($enabled) {
252 $ret[] = $mid;
253 }
254 }
255 return $ret;
256 #return $this->enabled ? $this->enabled : array();
257 }
$ret
Definition: parser.php:6

References $ret.

◆ getExportableParticipants()

static ilECSParticipantSettings::getExportableParticipants (   $a_type)
static

Get participants which are enabled and export is allowed.

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

107 {
108 global $DIC;
109
110 $ilDB = $DIC['ilDB'];
111
112 $query = 'SELECT sid,mid,export_types FROM ecs_part_settings ep ' .
113 'JOIN ecs_server es ON ep.sid = es.server_id ' .
114 'WHERE export = ' . $ilDB->quote(1, 'integer') . ' ' .
115 'AND active = ' . $ilDB->quote(1, 'integer') . ' ' .
116 'ORDER BY cname,es.title';
117
118 $res = $ilDB->query($query);
119 $mids = array();
120 $counter = 0;
121 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
122 if (in_array($a_type, (array) unserialize($row->export_types))) {
123 $mids[$counter]['sid'] = $row->sid;
124 $mids[$counter]['mid'] = $row->mid;
125 $counter++;
126 }
127 }
128 return $mids;
129 }
$a_type
Definition: workflow.php:92

References $a_type, $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSObjectSettings\addSettingsToForm().

+ Here is the caller graph for this function:

◆ getExportServers()

static ilECSParticipantSettings::getExportServers ( )
static

Get server ids which allow an export @global <type> $ilDB.

Returns
<type>

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

137 {
138 global $DIC;
139
140 $ilDB = $DIC['ilDB'];
141
142 $query = 'SELECT DISTINCT(sid) FROM ecs_part_settings ep ' .
143 'JOIN ecs_server es ON ep.sid = es.server_id ' .
144 'WHERE export = ' . $ilDB->quote(1, 'integer') . ' ' .
145 'AND active = ' . $ilDB->quote(1, 'integer') . ' ';
146 $res = $ilDB->query($query);
147 $sids = array();
148 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
149 $sids[] = $row->sid;
150 }
151 return $sids;
152 }

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSObjectSettings\handleSettingsUpdate().

+ Here is the caller graph for this function:

◆ getInstanceByServerId()

static ilECSParticipantSettings::getInstanceByServerId (   $a_server_id)
static

Get instance by server id.

Parameters
int$a_server_id
Returns
ilECSParticipantSettings

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

72 {
73 if (isset(self::$instances[$a_server_id])) {
74 return self::$instances[$a_server_id];
75 }
76 return self::$instances[$a_server_id] = new ilECSParticipantSettings($a_server_id);
77 }

Referenced by _getInstance(), ilECSCommunityReader\getEnabledParticipants(), and ilRemoteObjectBase\handleUpdate().

+ Here is the caller graph for this function:

◆ getServerId()

ilECSParticipantSettings::getServerId ( )

Get server id.

Returns
int

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

198 {
199 return $this->server_id;
200 }

Referenced by read().

+ Here is the caller graph for this function:

◆ isEnabled()

ilECSParticipantSettings::isEnabled (   $a_mid)

is partivcipant enabled

@access public

Parameters
intmid
Deprecated:

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

268 {
269 return $this->export[$a_mid] ? true : false;
270 }

◆ isImportAllowed()

ilECSParticipantSettings::isImportAllowed ( array  $a_mids)

Check if import is allowed for scecific mid.

Parameters
array$a_mids
Returns
<type>

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

232 {
233 foreach ($a_mids as $mid) {
234 if ($this->import[$mid]) {
235 return true;
236 }
237 }
238 return false;
239 }

◆ loookupCmsMid()

static ilECSParticipantSettings::loookupCmsMid (   $a_server_id)
static

Lookup mid of current cms participant @global $ilDB.

Parameters
int$a_server_id

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

176 {
177 global $DIC;
178
179 $ilDB = $DIC['ilDB'];
180
181 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
182
183 $query = 'SELECT mid FROM ecs_part_settings ' .
184 'WHERE sid = ' . $ilDB->quote($a_server_id, 'integer') . ' ' .
185 'AND import_type = ' . $ilDB->quote(ilECSParticipantSetting::IMPORT_CMS);
186 $res = $ilDB->query($query);
187 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
188 return $row->mid;
189 }
190 return 0;
191 }

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

Referenced by ilECSCmsTreeCommandQueueHandler\init(), and ilECSMappingSettingsGUI\setTabs().

+ Here is the caller graph for this function:

◆ read()

ilECSParticipantSettings::read ( )

Read stored entry.

Returns
<type>

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

208 {
209 global $DIC;
210
211 $ilDB = $DIC['ilDB'];
212
213 $query = 'SELECT * FROM ecs_part_settings ' .
214 'WHERE sid = ' . $ilDB->quote($this->getServerId(), 'integer') . ' ';
215 $res = $ilDB->query($query);
216 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
217 $this->export[$row->mid] = $row->export;
218 $this->import[$row->mid] = $row->import;
219 $this->import_type[$row->mid] = $row->import_type;
220 $this->export_types[$row->mid] = (array) unserialize($row->export_types);
221 $this->import_types[$row->mid] = (array) unserialize($row->import_types);
222 }
223 return true;
224 }

References $DIC, $ilDB, $query, $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:

◆ setEnabledParticipants()

ilECSParticipantSettings::setEnabledParticipants (   $a_parts)

set enabled participants by community

@access public

Parameters
intcommunity id
arrayparticipant ids

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

280 {
281 $this->enabled = (array) $a_parts;
282 }

Field Documentation

◆ $export

ilECSParticipantSettings::$export = array()
private

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

◆ $export_type

ilECSParticipantSettings::$export_type = array()
private

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

◆ $import

ilECSParticipantSettings::$import = array()
private

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

◆ $instances

ilECSParticipantSettings::$instances = null
staticprivate

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


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