ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ 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
$DIC
;
122
123
$ilDB
= $DIC[
'ilDB'
];
124
125
if
(!$this->entryExists) {
126
return
$this->
create
();
127
}
128
129
$query
=
'UPDATE ecs_community '
.
130
'SET own_id = '
.
$ilDB
->quote($this->
getOwnId
(),
'integer'
) .
', '
.
131
'cname = '
.
$ilDB
->quote($this->
getCommunityName
(),
'text'
) .
', '
.
132
'mids = '
.
$ilDB
->quote(serialize($this->
getMids
()),
'text'
) .
' '
.
133
'WHERE sid = '
.
$ilDB
->quote($this->
getServerId
(),
'integer'
) .
' '
.
134
'AND cid = '
.
$ilDB
->quote($this->
getCommunityId
(),
'integer'
);
135
$ilDB
->manipulate(
$query
);
136
return
true
;
137
}
138
139
140
145
protected
function
create
()
146
{
147
global
$DIC
;
148
149
$ilDB
= $DIC[
'ilDB'
];
150
151
$query
=
'INSERT INTO ecs_community (sid,cid,own_id,cname,mids) '
.
152
'VALUES( '
.
153
$ilDB
->quote($this->
getServerId
(),
'integer'
) .
', '
.
154
$ilDB
->quote($this->
getCommunityId
(),
'integer'
) .
', '
.
155
$ilDB
->quote($this->
getOwnId
(),
'integer'
) .
', '
.
156
$ilDB
->quote($this->
getCommunityName
(),
'text'
) .
', '
.
157
$ilDB
->quote(serialize($this->
getMids
()),
'text'
) .
' '
.
158
')'
;
159
$ilDB
->manipulate(
$query
);
160
return
true
;
161
}
162
168
protected
function
read
()
169
{
170
global
$DIC
;
171
172
$ilDB
= $DIC[
'ilDB'
];
173
174
$this->entryExists =
false
;
175
176
$query
=
'SELECT * FROM ecs_community '
.
177
'WHERE sid = '
.
$ilDB
->quote($this->
getServerId
(),
'integer'
) .
' '
.
178
'AND cid = '
.
$ilDB
->quote($this->
getCommunityId
(),
'integer'
);
179
$res
=
$ilDB
->query(
$query
);
180
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
181
$this->entryExists =
true
;
182
$this->
setOwnId
(
$row
->own_id);
183
$this->
setCommunityName
(
$row
->cname);
184
$this->
setMids
(unserialize(
$row
->mids));
185
}
186
return
true
;
187
}
188
189
public
static
function
deleteByServerId
($a_server_id)
190
{
191
global
$DIC
;
192
193
$ilDB
= $DIC[
'ilDB'
];
194
195
$query
=
'DELETE FROM ecs_community'
.
196
' WHERE sid = '
.
$ilDB
->quote($a_server_id,
'integer'
);
197
$ilDB
->manipulate(
$query
);
198
return
true
;
199
}
200
}
$DIC
global $DIC
Definition:
saml.php:7
ilECSCommunityCache\create
create()
Create new dataset ilDB $ilDB.
Definition:
class.ilECSCommunityCache.php:145
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:189
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
$row
$row
Definition:
migrateto20.php:360
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:168
$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
php
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
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 Thu Jan 30 2025 19:02:08 for ILIAS by
1.8.13 (using
Doxyfile
)