ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilECSCommunityCache Class Reference

+-----------------------------------------------------------------------——+ | 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. 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 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 ilDB $ilDB. More...
 
 read ()
 Read dataset 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.

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

51  {
52  $this->sid = $sid;
53  $this->cid = $cid;
54 
55  $this->read();
56  }
read()
Read dataset ilDB $ilDB.
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilECSCommunityCache::create ( )
protected

Create new dataset ilDB $ilDB.

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

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

Referenced by update().

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
+ 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.

References $ilDB, and $query.

Referenced by ilECSSetting\delete().

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  }
global $ilDB
+ Here is the caller graph for this function:

◆ getCommunityId()

ilECSCommunityCache::getCommunityId ( )

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

References $cid.

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

81  {
82  return $this->cid;
83  }
+ 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().

101  {
102  return $this->cname;
103  }
+ 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.

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

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 | +...
+ 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().

111  {
112  return $this->mids;
113  }
+ 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().

91  {
92  return $this->own_id;
93  }
+ Here is the caller graph for this function:

◆ getServerId()

ilECSCommunityCache::getServerId ( )

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

References $sid.

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

76  {
77  return $this->sid;
78  }
+ Here is the caller graph for this function:

◆ read()

ilECSCommunityCache::read ( )
protected

Read dataset ilDB $ilDB.

Returns
bool

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

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

Referenced by __construct().

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(ilDBConstants::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  }
global $ilDB
+ 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.

Referenced by read().

96  {
97  $this->cname = $a_name;
98  }
+ Here is the caller graph for this function:

◆ setMids()

ilECSCommunityCache::setMids (   $a_mids)

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

Referenced by read().

106  {
107  $this->mids = $a_mids;
108  }
+ Here is the caller graph for this function:

◆ setOwnId()

ilECSCommunityCache::setOwnId (   $a_id)

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

Referenced by read().

86  {
87  $this->own_id = $a_id;
88  }
+ Here is the caller graph for this function:

◆ update()

ilECSCommunityCache::update ( )

Create or update ecs community ilDB $ilDB.

Returns
bool

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

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

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 ilDB $ilDB.
global $ilDB
+ 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: