ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 $DIC, $ilDB, $query, getCommunityId(), getCommunityName(), getMids(), getOwnId(), and getServerId().

Referenced by update().

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  }
global $DIC
Definition: saml.php:7
$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 189 of file class.ilECSCommunityCache.php.

References $DIC, $ilDB, and $query.

Referenced by ilECSSetting\delete().

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  }
global $DIC
Definition: saml.php:7
$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 168 of file class.ilECSCommunityCache.php.

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

Referenced by __construct().

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  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
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 $DIC, $ilDB, $query, create(), getCommunityId(), getCommunityName(), getMids(), getOwnId(), and getServerId().

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  }
global $DIC
Definition: saml.php:7
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: