ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.

Static Public Member Functions

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

Protected Member Functions

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

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

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

{
$this->sid = $sid;
$this->cid = $cid;
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

ilECSCommunityCache::create ( )
protected

Create new dataset ilDB $ilDB.

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

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

Referenced by update().

{
global $ilDB;
$query = 'INSERT INTO ecs_community (sid,cid,own_id,cname,mids) '.
'VALUES( '.
$ilDB->quote($this->getServerId(),'integer').', '.
$ilDB->quote($this->getCommunityId(),'integer').', '.
$ilDB->quote($this->getOwnId(),'integer').', '.
$ilDB->quote($this->getCommunityName(), 'text').', '.
$ilDB->quote(serialize($this->getMids()),'text').' '.
')';
$ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilECSCommunityCache::deleteByServerId (   $a_server_id)
static

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

References $query.

Referenced by ilECSSetting\delete().

{
global $ilDB;
$query = 'DELETE FROM ecs_community'.
' WHERE sid = '.$ilDB->quote($a_server_id,'integer');
$ilDB->manipulate($query);
return true;
}

+ Here is the caller graph for this function:

ilECSCommunityCache::getCommunityId ( )

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

References $cid.

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

{
return $this->cid;
}

+ Here is the caller graph for this function:

ilECSCommunityCache::getCommunityName ( )

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

References $cname.

Referenced by create(), and update().

{
return $this->cname;
}

+ Here is the caller graph for this function:

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 ilECSSettingsGUI\updateCommunities().

{
if(isset(self::$instance[$a_sid][$a_cid]))
{
return self::$instance[$a_sid][$a_cid];
}
return self::$instance[$a_sid][$a_cid] = new ilECSCommunityCache($a_sid, $a_cid);
}

+ Here is the caller graph for this function:

ilECSCommunityCache::getMids ( )

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

References $mids.

Referenced by create(), and update().

{
return $this->mids;
}

+ Here is the caller graph for this function:

ilECSCommunityCache::getOwnId ( )

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

References $own_id.

Referenced by create(), and update().

{
return $this->own_id;
}

+ Here is the caller graph for this function:

ilECSCommunityCache::getServerId ( )

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

References $sid.

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

{
return $this->sid;
}

+ Here is the caller graph for this function:

ilECSCommunityCache::read ( )
protected

Read dataset ilDB $ilDB.

Returns
bool

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

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

Referenced by __construct().

{
global $ilDB;
$this->entryExists = false;
$query = 'SELECT * FROM ecs_community '.
'WHERE sid = '.$ilDB->quote($this->getServerId(),'integer').' '.
'AND cid = '.$ilDB->quote($this->getCommunityId(),'integer');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->entryExists = true;
$this->setOwnId($row->own_id);
$this->setCommunityName($row->cname);
$this->setMids(unserialize($row->mids));
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCommunityCache::setCommunityName (   $a_name)

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

Referenced by read().

{
$this->cname = $a_name;
}

+ Here is the caller graph for this function:

ilECSCommunityCache::setMids (   $a_mids)

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

Referenced by read().

{
$this->mids = $a_mids;
}

+ Here is the caller graph for this function:

ilECSCommunityCache::setOwnId (   $a_id)

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

Referenced by read().

{
$this->own_id = $a_id;
}

+ Here is the caller graph for this function:

ilECSCommunityCache::update ( )

Create or update ecs community ilDB $ilDB.

Returns
bool

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

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

{
global $ilDB;
if(!$this->entryExists)
{
return $this->create();
}
$query = 'UPDATE ecs_community '.
'SET own_id = '.$ilDB->quote($this->getOwnId(),'integer').', '.
'cname = '.$ilDB->quote($this->getCommunityName(),'text').', '.
'mids = '.$ilDB->quote(serialize($this->getMids()),'text').' '.
'WHERE sid = '.$ilDB->quote($this->getServerId(),'integer').' '.
'AND cid = '.$ilDB->quote($this->getCommunityId(),'integer');
$ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilECSCommunityCache::$cid = 0
protected

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

Referenced by __construct(), and getCommunityId().

ilECSCommunityCache::$cname = ''
protected

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

Referenced by getCommunityName().

ilECSCommunityCache::$entryExists = false
protected

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

ilECSCommunityCache::$instance = null
staticprotected

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

ilECSCommunityCache::$mids = array()
protected

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

Referenced by getMids().

ilECSCommunityCache::$own_id = 0
protected

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

Referenced by getOwnId().

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: