ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilECSCommunitiesCache 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 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.

References read().

44  {
45  $this->read();
46  }
+ 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 64 of file class.ilECSCommunitiesCache.php.

References $DIC, $ilDB, and $query.

Referenced by ilECSSettingsGUI\doDelete().

65  {
66  global $DIC;
67 
68  $ilDB = $DIC['ilDB'];
69 
70  $query = 'DELETE FROM ecs_community ' .
71  'WHERE sid = ' . $ilDB->quote($a_server_id, 'integer');
72  $ilDB->manipulate($query);
73  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the caller graph for this function:

◆ getCommunities()

ilECSCommunitiesCache::getCommunities ( )

Get communities.

Returns
array ilECSCommunityCache

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

References $communities.

Referenced by lookupOwnId(), and lookupTitle().

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

Referenced by ilECSUtils\getMatchableContent().

53  {
54  if (isset(self::$instance)) {
55  return self::$instance;
56  }
57  return self::$instance = new ilECSCommunitiesCache();
58  }
+-----------------------------------------------------------------------——+ | ILIAS open source | +...
+ 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 87 of file class.ilECSCommunitiesCache.php.

References getCommunities().

88  {
89  foreach ($this->getCommunities() as $com) {
90  if ($com->getServerId() == $a_server_id) {
91  if (in_array($a_mid, $com->getMids())) {
92  return $com->getOwnId();
93  }
94  }
95  }
96  return 0;
97  }
+ 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 104 of file class.ilECSCommunitiesCache.php.

References getCommunities().

105  {
106  foreach ($this->getCommunities() as $com) {
107  if ($com->getServerId() == $a_server_id) {
108  if (in_array($a_mid, $com->getMids())) {
109  return $com->getCommunityName();
110  }
111  }
112  }
113  return '';
114  }
+ Here is the call graph for this function:

◆ read()

ilECSCommunitiesCache::read ( )
private

Read comunities.

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

References $DIC, $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, and ilECSCommunityCache\getInstance().

Referenced by __construct().

120  {
121  global $DIC;
122 
123  $ilDB = $DIC['ilDB'];
124 
125  $query = 'SELECT sid,cid FROM ecs_community ';
126  $res = $ilDB->query($query);
127  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
128  $this->communities[] = ilECSCommunityCache::getInstance($row->sid, $row->cid);
129  }
130  return true;
131  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
static getInstance($a_sid, $a_cid)
Get instance.
+ 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.


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