ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 143 of file class.ilECSCommunityCache.php.

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

Referenced by update().

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  }
$query
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 183 of file class.ilECSCommunityCache.php.

References $ilDB, and $query.

Referenced by ilECSSetting\delete().

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

◆ getCommunityId()

ilECSCommunityCache::getCommunityId ( )

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

References $cid.

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

80  {
81  return $this->cid;
82  }
+ Here is the caller graph for this function:

◆ getCommunityName()

ilECSCommunityCache::getCommunityName ( )

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

References $cname.

Referenced by create(), and update().

100  {
101  return $this->cname;
102  }
+ 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  return self::$instance[$a_sid][$a_cid];
68  }
69  return self::$instance[$a_sid][$a_cid] = new ilECSCommunityCache($a_sid, $a_cid);
70  }
+-----------------------------------------------------------------------——+ | ILIAS open source | +...
+ Here is the caller graph for this function:

◆ getMids()

ilECSCommunityCache::getMids ( )

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

References $mids.

Referenced by create(), and update().

110  {
111  return $this->mids;
112  }
+ Here is the caller graph for this function:

◆ getOwnId()

ilECSCommunityCache::getOwnId ( )

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

References $own_id.

Referenced by create(), and update().

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

◆ getServerId()

ilECSCommunityCache::getServerId ( )

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

References $sid.

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

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

◆ read()

ilECSCommunityCache::read ( )
protected

Read dataset ilDB $ilDB.

Returns
bool

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

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

Referenced by __construct().

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  }
foreach($_POST as $key=> $value) $res
$query
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 94 of file class.ilECSCommunityCache.php.

Referenced by read().

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

◆ setMids()

ilECSCommunityCache::setMids (   $a_mids)

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

Referenced by read().

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

◆ setOwnId()

ilECSCommunityCache::setOwnId (   $a_id)

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

Referenced by read().

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

◆ update()

ilECSCommunityCache::update ( )

Create or update ecs community ilDB $ilDB.

Returns
bool

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

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

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  }
create()
Create new dataset ilDB $ilDB.
$query
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: