ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilECSCommunityReader Class Reference
+ Collaboration diagram for ilECSCommunityReader:

Public Member Functions

 getServer ()
 Get server setting.
 getOwnMIDs ()
 get publishable ids
 getCommunities ()
 get communities
 getCommunityById ($a_id)
 get community by id
 getParticipantByMID ($a_mid)
 get participant by id
 getCommunityByMID ($a_mid)
 Get community by mid.
 getPublishableParticipants ()
 get publishable communities
 getEnabledParticipants ()
 get enabled participants

Static Public Member Functions

static _getInstance ()
 get singleton instance
static getInstanceByServerId ($a_server_id)
 Get instance by server id.

Protected Attributes

 $position = 0
 $log
 $settings = null
 $connector = null
 $communities = array()
 $participants = array()
 $own_ids = array()

Private Member Functions

 __construct (ilECSSetting $setting=null)
 Singleton constructor.
 read ()
 Read private.

Static Private Attributes

static $instances = null

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

ilECSCommunityReader::__construct ( ilECSSetting  $setting = null)
private

Singleton constructor.

private

Exceptions
ilECSConnectorException

Definition at line 56 of file class.ilECSCommunityReader.php.

References $GLOBALS, $ilLog, and read().

{
global $ilLog;
include_once('Services/WebServices/ECS/classes/class.ilECSSetting.php');
include_once('Services/WebServices/ECS/classes/class.ilECSConnector.php');
include_once('Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
include_once('Services/WebServices/ECS/classes/class.ilECSCommunity.php');
if($setting)
{
$this->settings = $setting;
}
else
{
$GLOBALS['ilLog']->write(__METHOD__.': Using deprecated call');
$GLOBALS['ilLog']->logStack();
}
$this->connector = new ilECSConnector($this->settings);
$this->log = $ilLog;
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

static ilECSCommunityReader::_getInstance ( )
static

get singleton instance

public

Returns
ilECSCommunityReader

Definition at line 87 of file class.ilECSCommunityReader.php.

References $GLOBALS, and getInstanceByServerId().

Referenced by ilECSSettingsGUI\exportImported(), and ilECSUtils\lookupParticipantName().

{
$GLOBALS['ilLog']->write(__METHOD__.': Using deprecated call');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCommunityReader::getCommunities ( )

get communities

public

Parameters

Definition at line 135 of file class.ilECSCommunityReader.php.

Referenced by getEnabledParticipants(), and getPublishableParticipants().

{
return $this->communities ? $this->communities : array();
}

+ Here is the caller graph for this function:

ilECSCommunityReader::getCommunityById (   $a_id)

get community by id

public

Parameters
intcomm_id

Definition at line 147 of file class.ilECSCommunityReader.php.

{
foreach($this->communities as $community)
{
if($community->getId() == $a_id)
{
return $community;
}
}
return null;
}
ilECSCommunityReader::getCommunityByMID (   $a_mid)

Get community by mid.

Parameters
int$a_mid
Returns
ilECSCommunity

Definition at line 175 of file class.ilECSCommunityReader.php.

{
foreach($this->communities as $community)
{
foreach($community->getParticipants() as $part)
{
if($part->getMID() == $a_mid)
{
return $community;
}
}
}
return null;
}
ilECSCommunityReader::getEnabledParticipants ( )

get enabled participants

public

Definition at line 217 of file class.ilECSCommunityReader.php.

References getCommunities(), getInstanceByServerId(), and getServer().

{
include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
$en = $ps->getEnabledParticipants();
foreach($this->getCommunities() as $community)
{
foreach($community->getParticipants() as $participant)
{
if(in_array($participant->getMid(), $en))
{
$e_part[] = $participant;
}
}
}
return $e_part ? $e_part : array();
}

+ Here is the call graph for this function:

static ilECSCommunityReader::getInstanceByServerId (   $a_server_id)
static

Get instance by server id.

Parameters
int$a_server_id
Returns
ilECSCommunityReader

Definition at line 98 of file class.ilECSCommunityReader.php.

References ilECSSetting\getInstanceByServerId().

Referenced by _getInstance(), ilECSSettingsGUI\communities(), getEnabledParticipants(), ilECSImportedContentTableGUI\parse(), ilECSTaskScheduler\readMIDs(), ilECSContentWriter\sendNewContentNotification(), ilECSSettingsGUI\updateCommunities(), ilECSContentWriter\updateJSON(), and ilECSSettingsGUI\updateTitle().

{
if(isset(self::$instances[$a_server_id]))
{
return self::$instances[$a_server_id];
}
return self::$instances[$a_server_id] = new ilECSCommunityReader(ilECSSetting::getInstanceByServerId($a_server_id));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCommunityReader::getOwnMIDs ( )

get publishable ids

public

Definition at line 123 of file class.ilECSCommunityReader.php.

{
return $this->own_ids ? $this->own_ids : array();
}
ilECSCommunityReader::getParticipantByMID (   $a_mid)

get participant by id

public

Parameters
intmid

Definition at line 165 of file class.ilECSCommunityReader.php.

{
return isset($this->participants[$a_mid]) ? $this->participants[$a_mid] : false;
}
ilECSCommunityReader::getPublishableParticipants ( )

get publishable communities

public

Definition at line 196 of file class.ilECSCommunityReader.php.

References getCommunities().

{
foreach($this->getCommunities() as $community)
{
foreach($community->getParticipants() as $participant)
{
if($participant->isPublishable())
{
$p_part[] = $participant;
}
}
}
return $p_part ? $p_part : array();
}

+ Here is the call graph for this function:

ilECSCommunityReader::getServer ( )

Get server setting.

Returns
ilECSSetting

Definition at line 111 of file class.ilECSCommunityReader.php.

References $settings.

Referenced by getEnabledParticipants().

{
}

+ Here is the caller graph for this function:

ilECSCommunityReader::read ( )
private

Read private.

Exceptions
ilECSConnectorException

Definition at line 241 of file class.ilECSCommunityReader.php.

References $ilLog, and $res.

Referenced by __construct().

{
global $ilLog;
try
{
$res = $this->connector->getMemberships();
if(!is_array($res->getResult()))
{
return false;
}
foreach($res->getResult() as $community)
{
$tmp_comm = new ilECSCommunity($community);
foreach($tmp_comm->getParticipants() as $participant)
{
$this->participants[$participant->getMID()] = $participant;
if($participant->isSelf())
{
$this->own_ids[] = $participant->getMID();
}
}
$this->communities[] = $tmp_comm;
}
}
{
$ilLog->write(__METHOD__.': Error connecting to ECS server. '.$e->getMessage());
throw $e;
}
}

+ Here is the caller graph for this function:

Field Documentation

ilECSCommunityReader::$communities = array()
protected

Definition at line 46 of file class.ilECSCommunityReader.php.

ilECSCommunityReader::$connector = null
protected

Definition at line 44 of file class.ilECSCommunityReader.php.

ilECSCommunityReader::$instances = null
staticprivate

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

ilECSCommunityReader::$log
protected

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

ilECSCommunityReader::$own_ids = array()
protected

Definition at line 48 of file class.ilECSCommunityReader.php.

ilECSCommunityReader::$participants = array()
protected

Definition at line 47 of file class.ilECSCommunityReader.php.

ilECSCommunityReader::$position = 0
protected

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

ilECSCommunityReader::$settings = null
protected

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

Referenced by getServer().


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