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

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

+ Collaboration diagram for ilECSCommunitiesCache:

Public Member Functions

 getCommunities ()
 Get communities. More...
 
 lookupOwnId ($a_server_id, $a_mid)
 Lookup own mid of the community of a mid. More...
 
 lookupTitle ($a_server_id, $a_mid)
 Lookup community title. More...
 

Static Public Member Functions

static getInstance ()
 Singleton instance. More...
 
static delete ($a_server_id)
 Delete comunities by server id. More...
 

Protected Member Functions

 __construct ()
 Singleton constructor. More...
 

Private Member Functions

 read ()
 Read comunities. More...
 

Private Attributes

 $communities = array()
 

Static Private 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 34 of file class.ilECSCommunitiesCache.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSCommunitiesCache::__construct ( )
protected

Singleton constructor.

Definition at line 43 of file class.ilECSCommunitiesCache.php.

44 {
45 $this->read();
46 }

References read().

+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

static ilECSCommunitiesCache::delete (   $a_server_id)
static

Delete comunities by server id.

Parameters
<type>$a_server_id

Definition at line 65 of file class.ilECSCommunitiesCache.php.

66 {
67 global $ilDB;
68
69 $query = 'DELETE FROM ecs_community '.
70 'WHERE sid = '.$ilDB->quote($a_server_id,'integer');
71 $ilDB->manipulate($query);
72 }
global $ilDB

References $ilDB, and $query.

Referenced by ilECSSettingsGUI\doDelete().

+ Here is the caller graph for this function:

◆ getCommunities()

ilECSCommunitiesCache::getCommunities ( )

Get communities.

Returns
array ilECSCommunityCache

Definition at line 78 of file class.ilECSCommunitiesCache.php.

References $communities.

Referenced by lookupOwnId(), and lookupTitle().

+ Here is the caller graph for this function:

◆ getInstance()

static ilECSCommunitiesCache::getInstance ( )
static

Singleton instance.

Returns
ilECSCommunitiesCache

Definition at line 52 of file class.ilECSCommunitiesCache.php.

53 {
54 if(isset(self::$instance))
55 {
56 return self::$instance;
57 }
58 return self::$instance = new ilECSCommunitiesCache();
59 }
+--------------------------------------------------------------------------—+ | ILIAS open source | +...

References $instance.

Referenced by ilECSUtils\getMatchableContent().

+ Here is the caller graph for this function:

◆ lookupOwnId()

ilECSCommunitiesCache::lookupOwnId (   $a_server_id,
  $a_mid 
)

Lookup own mid of the community of a mid.

Definition at line 86 of file class.ilECSCommunitiesCache.php.

87 {
88 foreach($this->getCommunities() as $com)
89 {
90 if($com->getServerId() == $a_server_id)
91 {
92 if(in_array($a_mid,$com->getMids()))
93 {
94 return $com->getOwnId();
95 }
96 }
97 }
98 return 0;
99 }

References getCommunities().

+ Here is the call graph for this function:

◆ lookupTitle()

ilECSCommunitiesCache::lookupTitle (   $a_server_id,
  $a_mid 
)

Lookup community title.

Parameters
intserver_id
intmid

Definition at line 106 of file class.ilECSCommunitiesCache.php.

107 {
108 foreach($this->getCommunities() as $com)
109 {
110 if($com->getServerId() == $a_server_id)
111 {
112 if(in_array($a_mid, $com->getMids()))
113 {
114 return $com->getCommunityName();
115 }
116 }
117 }
118 return '';
119 }

References getCommunities().

+ Here is the call graph for this function:

◆ read()

ilECSCommunitiesCache::read ( )
private

Read comunities.

Definition at line 124 of file class.ilECSCommunitiesCache.php.

125 {
126 global $ilDB;
127
128 $query = 'SELECT sid,cid FROM ecs_community ';
129 $res = $ilDB->query($query);
130 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
131 {
132 $this->communities[] = ilECSCommunityCache::getInstance($row->sid, $row->cid);
133 }
134 return true;
135 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
static getInstance($a_sid, $a_cid)
Get instance.

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, and ilECSCommunityCache\getInstance().

Referenced by __construct().

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

Field Documentation

◆ $communities

ilECSCommunitiesCache::$communities = array()
private

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

Referenced by getCommunities().

◆ $instance

ilECSCommunitiesCache::$instance = null
staticprivate

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

Referenced by getInstance().


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