ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilECSCommunityCache Class Reference

+--------------------------------------------------------------------------—+ | ILIAS open source | +--------------------------------------------------------------------------—+ More...

+ Collaboration diagram for ilECSCommunityCache:

Public Member Functions

 getServerId ()
 
 getCommunityId ()
 
 setOwnId ($a_id)
 
 getOwnId ()
 
 setCommunityName ($a_name)
 
 getCommunityName ()
 
 setMids ($a_mids)
 
 getMids ()
 
 update ()
 Create or update ecs community @global ilDB $ilDB. More...
 

Static Public Member Functions

static getInstance ($a_sid, $a_cid)
 Get instance. More...
 
static deleteByServerId ($a_server_id)
 

Protected Member Functions

 __construct ($sid, $cid)
 Singleton constructor. More...
 
 create ()
 Create new dataset @global ilDB $ilDB. More...
 
 read ()
 Read dataset @global ilDB $ilDB. More...
 

Protected Attributes

 $sid = 0
 
 $cid = 0
 
 $own_id = 0
 
 $cname = ''
 
 $mids = array()
 
 $entryExists = false
 

Static Protected Attributes

static $instance = null
 

Detailed Description

+--------------------------------------------------------------------------—+ | ILIAS open source | +--------------------------------------------------------------------------—+

Copyright (c) 1998-2006 ILIAS open source, University of Cologne
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

+--------------------------------------------------------------------------—+

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

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

Constructor & Destructor Documentation

◆ __construct()

ilECSCommunityCache::__construct (   $sid,
  $cid 
)
protected

Singleton constructor.

Parameters
int$sid
int$cid

Definition at line 50 of file class.ilECSCommunityCache.php.

51 {
52 $this->sid = $sid;
53 $this->cid = $cid;
54
55 $this->read();
56 }
read()
Read dataset @global ilDB $ilDB.

References $cid, $sid, and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilECSCommunityCache::create ( )
protected

Create new dataset @global ilDB $ilDB.

Definition at line 145 of file class.ilECSCommunityCache.php.

146 {
147 global $ilDB;
148
149 $query = 'INSERT INTO ecs_community (sid,cid,own_id,cname,mids) '.
150 'VALUES( '.
151 $ilDB->quote($this->getServerId(),'integer').', '.
152 $ilDB->quote($this->getCommunityId(),'integer').', '.
153 $ilDB->quote($this->getOwnId(),'integer').', '.
154 $ilDB->quote($this->getCommunityName(), 'text').', '.
155 $ilDB->quote(serialize($this->getMids()),'text').' '.
156 ')';
157 $ilDB->manipulate($query);
158 return true;
159 }
global $ilDB

References $ilDB, $query, getCommunityId(), getCommunityName(), getMids(), getOwnId(), and getServerId().

Referenced by update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteByServerId()

static ilECSCommunityCache::deleteByServerId (   $a_server_id)
static

Definition at line 186 of file class.ilECSCommunityCache.php.

187 {
188 global $ilDB;
189
190 $query = 'DELETE FROM ecs_community'.
191 ' WHERE sid = '.$ilDB->quote($a_server_id,'integer');
192 $ilDB->manipulate($query);
193 return true;
194 }

References $ilDB, and $query.

Referenced by ilECSSetting\delete().

+ Here is the caller graph for this function:

◆ getCommunityId()

ilECSCommunityCache::getCommunityId ( )

Definition at line 80 of file class.ilECSCommunityCache.php.

81 {
82 return $this->cid;
83 }

References $cid.

Referenced by create(), read(), and update().

+ Here is the caller graph for this function:

◆ getCommunityName()

ilECSCommunityCache::getCommunityName ( )

Definition at line 100 of file class.ilECSCommunityCache.php.

References $cname.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getInstance()

static ilECSCommunityCache::getInstance (   $a_sid,
  $a_cid 
)
static

Get instance.

Parameters
int$a_sid
int$a_cid
Returns
ilECSCommunityCache

Definition at line 64 of file class.ilECSCommunityCache.php.

65 {
66 if(isset(self::$instance[$a_sid][$a_cid]))
67 {
68 return self::$instance[$a_sid][$a_cid];
69 }
70 return self::$instance[$a_sid][$a_cid] = new ilECSCommunityCache($a_sid, $a_cid);
71 }
+--------------------------------------------------------------------------—+ | ILIAS open source | +...

Referenced by ilECSCommunitiesCache\read(), and ilECSSettingsGUI\updateCommunities().

+ Here is the caller graph for this function:

◆ getMids()

ilECSCommunityCache::getMids ( )

Definition at line 110 of file class.ilECSCommunityCache.php.

References $mids.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getOwnId()

ilECSCommunityCache::getOwnId ( )

Definition at line 90 of file class.ilECSCommunityCache.php.

References $own_id.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getServerId()

ilECSCommunityCache::getServerId ( )

Definition at line 75 of file class.ilECSCommunityCache.php.

76 {
77 return $this->sid;
78 }

References $sid.

Referenced by create(), read(), and update().

+ Here is the caller graph for this function:

◆ read()

ilECSCommunityCache::read ( )
protected

Read dataset @global ilDB $ilDB.

Returns
bool

Definition at line 166 of file class.ilECSCommunityCache.php.

167 {
168 global $ilDB;
169
170 $this->entryExists = false;
171
172 $query = 'SELECT * FROM ecs_community '.
173 'WHERE sid = '.$ilDB->quote($this->getServerId(),'integer').' '.
174 'AND cid = '.$ilDB->quote($this->getCommunityId(),'integer');
175 $res = $ilDB->query($query);
176 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
177 {
178 $this->entryExists = true;
179 $this->setOwnId($row->own_id);
180 $this->setCommunityName($row->cname);
181 $this->setMids(unserialize($row->mids));
182 }
183 return true;
184 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, getCommunityId(), getServerId(), setCommunityName(), setMids(), and setOwnId().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCommunityName()

ilECSCommunityCache::setCommunityName (   $a_name)

Definition at line 95 of file class.ilECSCommunityCache.php.

96 {
97 $this->cname = $a_name;
98 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setMids()

ilECSCommunityCache::setMids (   $a_mids)

Definition at line 105 of file class.ilECSCommunityCache.php.

106 {
107 $this->mids = $a_mids;
108 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setOwnId()

ilECSCommunityCache::setOwnId (   $a_id)

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

86 {
87 $this->own_id = $a_id;
88 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilECSCommunityCache::update ( )

Create or update ecs community @global ilDB $ilDB.

Returns
bool

Definition at line 120 of file class.ilECSCommunityCache.php.

121 {
122 global $ilDB;
123
124 if(!$this->entryExists)
125 {
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 }
create()
Create new dataset @global ilDB $ilDB.

References $ilDB, $query, create(), getCommunityId(), getCommunityName(), getMids(), getOwnId(), and getServerId().

+ Here is the call graph for this function:

Field Documentation

◆ $cid

ilECSCommunityCache::$cid = 0
protected

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

Referenced by __construct(), and getCommunityId().

◆ $cname

ilECSCommunityCache::$cname = ''
protected

Definition at line 39 of file class.ilECSCommunityCache.php.

Referenced by getCommunityName().

◆ $entryExists

ilECSCommunityCache::$entryExists = false
protected

Definition at line 42 of file class.ilECSCommunityCache.php.

◆ $instance

ilECSCommunityCache::$instance = null
staticprotected

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

◆ $mids

ilECSCommunityCache::$mids = array()
protected

Definition at line 40 of file class.ilECSCommunityCache.php.

Referenced by getMids().

◆ $own_id

ilECSCommunityCache::$own_id = 0
protected

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

Referenced by getOwnId().

◆ $sid

ilECSCommunityCache::$sid = 0
protected

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

Referenced by __construct(), and getServerId().


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