ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
class.ilECSCommunityCache.php
Go to the documentation of this file.
1
<?php
32
class
ilECSCommunityCache
33
{
34
protected
static
$instance
= null;
35
36
protected
$sid
= 0;
37
protected
$cid
= 0;
38
protected
$own_id
= 0;
39
protected
$cname
=
''
;
40
protected
$mids
=
array
();
41
42
protected
$entryExists
=
false
;
43
44
50
protected
function
__construct
(
$sid
,
$cid
)
51
{
52
$this->sid =
$sid
;
53
$this->cid =
$cid
;
54
55
$this->
read
();
56
}
57
64
public
static
function
getInstance
($a_sid, $a_cid)
65
{
66
if
(isset(self::$instance[$a_sid][$a_cid])) {
67
return
self::$instance[$a_sid][$a_cid];
68
}
69
return
self::$instance[$a_sid][$a_cid] =
new
ilECSCommunityCache
($a_sid, $a_cid);
70
}
71
72
73
74
public
function
getServerId
()
75
{
76
return
$this->sid
;
77
}
78
79
public
function
getCommunityId
()
80
{
81
return
$this->cid
;
82
}
83
84
public
function
setOwnId
($a_id)
85
{
86
$this->own_id = $a_id;
87
}
88
89
public
function
getOwnId
()
90
{
91
return
$this->own_id
;
92
}
93
94
public
function
setCommunityName
($a_name)
95
{
96
$this->cname = $a_name;
97
}
98
99
public
function
getCommunityName
()
100
{
101
return
$this->cname
;
102
}
103
104
public
function
setMids
($a_mids)
105
{
106
$this->mids = $a_mids;
107
}
108
109
public
function
getMids
()
110
{
111
return
$this->mids
;
112
}
113
119
public
function
update
()
120
{
121
global
$ilDB
;
122
123
if
(!$this->entryExists) {
124
return
$this->
create
();
125
}
126
127
$query
=
'UPDATE ecs_community '
.
128
'SET own_id = '
. $ilDB->quote($this->
getOwnId
(),
'integer'
) .
', '
.
129
'cname = '
. $ilDB->quote($this->
getCommunityName
(),
'text'
) .
', '
.
130
'mids = '
. $ilDB->quote(serialize($this->
getMids
()),
'text'
) .
' '
.
131
'WHERE sid = '
. $ilDB->quote($this->
getServerId
(),
'integer'
) .
' '
.
132
'AND cid = '
. $ilDB->quote($this->
getCommunityId
(),
'integer'
);
133
$ilDB->manipulate(
$query
);
134
return
true
;
135
}
136
137
138
143
protected
function
create
()
144
{
145
global
$ilDB
;
146
147
$query
=
'INSERT INTO ecs_community (sid,cid,own_id,cname,mids) '
.
148
'VALUES( '
.
149
$ilDB->quote($this->
getServerId
(),
'integer'
) .
', '
.
150
$ilDB->quote($this->
getCommunityId
(),
'integer'
) .
', '
.
151
$ilDB->quote($this->
getOwnId
(),
'integer'
) .
', '
.
152
$ilDB->quote($this->
getCommunityName
(),
'text'
) .
', '
.
153
$ilDB->quote(serialize($this->
getMids
()),
'text'
) .
' '
.
154
')'
;
155
$ilDB->manipulate(
$query
);
156
return
true
;
157
}
158
164
protected
function
read
()
165
{
166
global
$ilDB
;
167
168
$this->entryExists =
false
;
169
170
$query
=
'SELECT * FROM ecs_community '
.
171
'WHERE sid = '
. $ilDB->quote($this->
getServerId
(),
'integer'
) .
' '
.
172
'AND cid = '
. $ilDB->quote($this->
getCommunityId
(),
'integer'
);
173
$res
= $ilDB->query(
$query
);
174
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
175
$this->entryExists =
true
;
176
$this->
setOwnId
(
$row
->own_id);
177
$this->
setCommunityName
(
$row
->cname);
178
$this->
setMids
(unserialize(
$row
->mids));
179
}
180
return
true
;
181
}
182
183
public
static
function
deleteByServerId
($a_server_id)
184
{
185
global
$ilDB
;
186
187
$query
=
'DELETE FROM ecs_community'
.
188
' WHERE sid = '
. $ilDB->quote($a_server_id,
'integer'
);
189
$ilDB->manipulate(
$query
);
190
return
true
;
191
}
192
}
ilECSCommunityCache\create
create()
Create new dataset ilDB $ilDB.
Definition:
class.ilECSCommunityCache.php:143
ilECSCommunityCache\$mids
$mids
Definition:
class.ilECSCommunityCache.php:40
ilECSCommunityCache\getOwnId
getOwnId()
Definition:
class.ilECSCommunityCache.php:89
ilECSCommunityCache\setOwnId
setOwnId($a_id)
Definition:
class.ilECSCommunityCache.php:84
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilECSCommunityCache\__construct
__construct($sid, $cid)
Singleton constructor.
Definition:
class.ilECSCommunityCache.php:50
$query
$query
Definition:
proxy_ylocal.php:13
ilECSCommunityCache\deleteByServerId
static deleteByServerId($a_server_id)
Definition:
class.ilECSCommunityCache.php:183
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
ilECSCommunityCache\setMids
setMids($a_mids)
Definition:
class.ilECSCommunityCache.php:104
ilECSCommunityCache\getCommunityId
getCommunityId()
Definition:
class.ilECSCommunityCache.php:79
ilECSCommunityCache\setCommunityName
setCommunityName($a_name)
Definition:
class.ilECSCommunityCache.php:94
ilECSCommunityCache\$cname
$cname
Definition:
class.ilECSCommunityCache.php:39
ilECSCommunityCache\update
update()
Create or update ecs community ilDB $ilDB.
Definition:
class.ilECSCommunityCache.php:119
ilECSCommunityCache\getServerId
getServerId()
Definition:
class.ilECSCommunityCache.php:74
ilECSCommunityCache\$entryExists
$entryExists
Definition:
class.ilECSCommunityCache.php:42
ilECSCommunityCache\$sid
$sid
Definition:
class.ilECSCommunityCache.php:36
ilECSCommunityCache\read
read()
Read dataset ilDB $ilDB.
Definition:
class.ilECSCommunityCache.php:164
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilECSCommunityCache\getInstance
static getInstance($a_sid, $a_cid)
Get instance.
Definition:
class.ilECSCommunityCache.php:64
ilECSCommunityCache\$cid
$cid
Definition:
class.ilECSCommunityCache.php:37
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
$row
$row
Definition:
10autofilter-selection-1.php:74
ilECSCommunityCache\$instance
static $instance
Definition:
class.ilECSCommunityCache.php:34
ilECSCommunityCache\getCommunityName
getCommunityName()
Definition:
class.ilECSCommunityCache.php:99
ilECSCommunityCache\getMids
getMids()
Definition:
class.ilECSCommunityCache.php:109
ilECSCommunityCache\$own_id
$own_id
Definition:
class.ilECSCommunityCache.php:38
ilECSCommunityCache
+-----------------------------------------------------------------------——+ | ILIAS open source | +...
Definition:
class.ilECSCommunityCache.php:32
Services
WebServices
ECS
classes
class.ilECSCommunityCache.php
Generated on Sat Jan 18 2025 19:01:41 for ILIAS by
1.8.13 (using
Doxyfile
)