ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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['ilLog']->write(__METHOD__ . ': Using deprecated call');
62 $GLOBALS['ilLog']->logStack();
64 }
static getInstanceByServerId($a_server_id)
Get instance by server id.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

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 153 of file class.ilECSParticipantSettings.php.

154 {
155 global $ilDB;
156
157 $query = 'DELETE from ecs_part_settings ' .
158 'WHERE sid = ' . $ilDB->quote($a_server_id, 'integer');
159 $ilDB->manipulate($query);
160 }
$query
global $ilDB

References $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 $ilDB;
88
89 $query = 'SELECT mid FROM ecs_part_settings ' .
90 'WHERE sid = ' . $ilDB->quote($a_server_id, 'integer');
91 $res = $ilDB->query($query);
92
93 $mids = array();
94 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
95 $mids[] = $row->mid;
96 }
97 return $mids;
98 }
foreach($_POST as $key=> $value) $res

References $ilDB, $query, $res, $row, 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 235 of file class.ilECSParticipantSettings.php.

236 {
237 $ret = array();
238 foreach ($this->export as $mid => $enabled) {
239 if ($enabled) {
240 $ret[] = $mid;
241 }
242 }
243 return $ret;
244 #return $this->enabled ? $this->enabled : array();
245 }
$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 104 of file class.ilECSParticipantSettings.php.

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

References $a_type, $counter, $ilDB, $query, $res, $row, 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 132 of file class.ilECSParticipantSettings.php.

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

References $ilDB, $query, $res, $row, 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 187 of file class.ilECSParticipantSettings.php.

188 {
189 return $this->server_id;
190 }

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 255 of file class.ilECSParticipantSettings.php.

256 {
257 return $this->export[$a_mid] ? true : false;
258 }

◆ isImportAllowed()

ilECSParticipantSettings::isImportAllowed ( array  $a_mids)

Check if import is allowed for scecific mid.

Parameters
array$a_mids
Returns
<type>

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

220 {
221 foreach ($a_mids as $mid) {
222 if ($this->import[$mid]) {
223 return true;
224 }
225 }
226 return false;
227 }

◆ loookupCmsMid()

static ilECSParticipantSettings::loookupCmsMid (   $a_server_id)
static

Lookup mid of current cms participant @global $ilDB.

Parameters
int$a_server_id

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

168 {
169 global $ilDB;
170
171 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
172
173 $query = 'SELECT mid FROM ecs_part_settings ' .
174 'WHERE sid = ' . $ilDB->quote($a_server_id, 'integer') . ' ' .
175 'AND import_type = ' . $ilDB->quote(ilECSParticipantSetting::IMPORT_CMS);
176 $res = $ilDB->query($query);
177 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
178 return $row->mid;
179 }
180 return 0;
181 }

References $ilDB, $query, $res, $row, 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 197 of file class.ilECSParticipantSettings.php.

198 {
199 global $ilDB;
200
201 $query = 'SELECT * FROM ecs_part_settings ' .
202 'WHERE sid = ' . $ilDB->quote($this->getServerId(), 'integer') . ' ';
203 $res = $ilDB->query($query);
204 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
205 $this->export[$row->mid] = $row->export;
206 $this->import[$row->mid] = $row->import;
207 $this->import_type[$row->mid] = $row->import_type;
208 $this->export_types[$row->mid] = (array) unserialize($row->export_types);
209 $this->import_types[$row->mid] = (array) unserialize($row->import_types);
210 }
211 return true;
212 }

References $ilDB, $query, $res, $row, 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 267 of file class.ilECSParticipantSettings.php.

268 {
269 $this->enabled = (array) $a_parts;
270 }

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: