ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

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

159 {
160 global $ilDB;
161
162 $query = 'DELETE from ecs_part_settings '.
163 'WHERE sid = '.$ilDB->quote($a_server_id,'integer');
164 $ilDB->manipulate($query);
165 }
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 86 of file class.ilECSParticipantSettings.php.

87 {
88 global $ilDB;
89
90 $query = 'SELECT mid FROM ecs_part_settings '.
91 'WHERE sid = '.$ilDB->quote($a_server_id,'integer');
92 $res = $ilDB->query($query);
93
94 $mids = array();
95 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
96 {
97 $mids[] = $row->mid;
98 }
99 return $mids;
100 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

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

245 {
246 $ret = array();
247 foreach($this->export as $mid => $enabled)
248 {
249 if($enabled)
250 {
251 $ret[] = $mid;
252 }
253 }
254 return $ret;
255 #return $this->enabled ? $this->enabled : array();
256 }

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

References $ilDB, $query, $res, $row, and DB_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 $ilDB;
139
140 $query = 'SELECT DISTINCT(sid) FROM ecs_part_settings ep '.
141 'JOIN ecs_server es ON ep.sid = es.server_id '.
142 'WHERE export = '.$ilDB->quote(1,'integer').' '.
143 'AND active = '.$ilDB->quote(1,'integer').' ';
144 $res = $ilDB->query($query);
145 $sids = array();
146 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
147 {
148 $sids[] = $row->sid;
149 }
150 return $sids;
151 }

References $ilDB, $query, $res, $row, and DB_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 {
75 return self::$instances[$a_server_id];
76 }
77 return self::$instances[$a_server_id] = new ilECSParticipantSettings($a_server_id);
78 }

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

194 {
195 return $this->server_id;
196 }

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

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

◆ isImportAllowed()

ilECSParticipantSettings::isImportAllowed ( array  $a_mids)

Check if import is allowed for scecific mid.

Parameters
array$a_mids
Returns
<type>

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

227 {
228 foreach($a_mids as $mid)
229 {
230 if($this->import[$mid])
231 {
232 return true;
233 }
234 }
235 return false;
236 }

◆ loookupCmsMid()

static ilECSParticipantSettings::loookupCmsMid (   $a_server_id)
static

Lookup mid of current cms participant @global $ilDB.

Parameters
int$a_server_id

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

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

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

204 {
205 global $ilDB;
206
207 $query = 'SELECT * FROM ecs_part_settings '.
208 'WHERE sid = '.$ilDB->quote($this->getServerId(),'integer').' ';
209 $res = $ilDB->query($query);
210 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
211 {
212 $this->export[$row->mid] = $row->export;
213 $this->import[$row->mid] = $row->import;
214 $this->import_type[$row->mid] = $row->import_type;
215 $this->export_types[$row->mid] = (array) unserialize($row->export_types);
216 $this->import_types[$row->mid] = (array) unserialize($row->import_types);
217 }
218 return true;
219 }

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

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

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: