ILIAS  release_4-4 Revision
ilECSEContentDetails Class Reference

Presentation of ecs content details (http://...campusconnect/courselinks/id/details) More...

+ Collaboration diagram for ilECSEContentDetails:

Public Member Functions

 __construct ()
 
 getSenders ()
 Get senders. More...
 
 getFirstSender ()
 get first sender More...
 
 getMySender ()
 Get sender from whom we received the ressource According to the documentation the sender and receiver arrays have corresponding indexes. More...
 
 getReceivers ()
 Get recievers. More...
 
 getReceiverInfo ()
 Get receiver info. More...
 
 getUrl ()
 Get url. More...
 
 getOwner ()
 
 loadFromJson ($json)
 Load from JSON object. More...
 

Static Public Member Functions

static getInstance ($a_server_id, $a_econtent_id, $a_resource_type)
 Get data from server. More...
 

Data Fields

 $senders = array()
 
 $sender_index = NULL
 
 $receivers = array()
 
 $url = array()
 
 $content_type = array()
 
 $owner = 0
 

Private Attributes

 $receiver_info = array()
 

Detailed Description

Presentation of ecs content details (http://...campusconnect/courselinks/id/details)

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 32 of file class.ilECSEContentDetails.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSEContentDetails::__construct ( )

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

45  {
46 
47  }

Member Function Documentation

◆ getFirstSender()

ilECSEContentDetails::getFirstSender ( )

get first sender

Definition at line 101 of file class.ilECSEContentDetails.php.

102  {
103  return isset($this->senders[0]) ? $this->senders[0] : 0;
104  }

◆ getInstance()

static ilECSEContentDetails::getInstance (   $a_server_id,
  $a_econtent_id,
  $a_resource_type 
)
static

Get data from server.

Parameters
int$a_server_id
int$a_econtent_id
string$a_resource_type
Returns
ilECSEContentDetails

Definition at line 57 of file class.ilECSEContentDetails.php.

References $ilLog, $res, ilECSSetting\getInstanceByServerId(), and ilECSConnector\HTTP_CODE_NOT_FOUND.

Referenced by ilECSObjectSettings\addSettingsToForm(), ilECSObjectSettings\getParticipants(), ilRemoteObjectBase\handleUpdate(), and ilECSObjectSettings\sendNewContentNotification().

58  {
59  global $ilLog;
60 
61  try
62  {
63  include_once './Services/WebServices/ECS/classes/class.ilECSSetting.php';
64  include_once './Services/WebServices/ECS/classes/class.ilECSConnector.php';
65  $connector = new ilECSConnector(ilECSSetting::getInstanceByServerId($a_server_id));
66  $res = $connector->getResource($a_resource_type, $a_econtent_id, true);
67  if($res->getHTTPCode() == ilECSConnector::HTTP_CODE_NOT_FOUND)
68  {
69  return;
70  }
71  if(!is_object($res->getResult()))
72  {
73  $ilLog->write(__METHOD__ . ': Error parsing result. Expected result of type array.');
74  $ilLog->logStack();
75  throw new ilECSConnectorException('error parsing json');
76  }
77  }
78  catch(ilECSConnectorException $exc)
79  {
80  return;
81  }
82 
83  include_once './Services/WebServices/ECS/classes/class.ilECSEContentDetails.php';
84  $details = new self();
85  $details->loadFromJSON($res->getResult());
86  return $details;
87  }
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMySender()

ilECSEContentDetails::getMySender ( )

Get sender from whom we received the ressource According to the documentation the sender and receiver arrays have corresponding indexes.

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

References $sender_index.

111  {
112  return $this->senders[$this->sender_index];
113  }

◆ getOwner()

ilECSEContentDetails::getOwner ( )

Definition at line 142 of file class.ilECSEContentDetails.php.

References $owner.

143  {
144  return (int) $this->owner;
145  }

◆ getReceiverInfo()

ilECSEContentDetails::getReceiverInfo ( )

Get receiver info.

Returns
array

Definition at line 128 of file class.ilECSEContentDetails.php.

References $receiver_info.

129  {
130  return (array) $this->receiver_info;
131  }

◆ getReceivers()

ilECSEContentDetails::getReceivers ( )

Get recievers.

Returns
<type>

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

References $receivers.

Referenced by loadFromJson().

120  {
121  return (array) $this->receivers;
122  }
+ Here is the caller graph for this function:

◆ getSenders()

ilECSEContentDetails::getSenders ( )

Get senders.

Returns
array

Definition at line 93 of file class.ilECSEContentDetails.php.

References $senders.

94  {
95  return (array) $this->senders;
96  }

◆ getUrl()

ilECSEContentDetails::getUrl ( )

Get url.

Returns
string

Definition at line 137 of file class.ilECSEContentDetails.php.

References $url.

138  {
139  return $this->url;
140  }

◆ loadFromJson()

ilECSEContentDetails::loadFromJson (   $json)

Load from JSON object.

public

Parameters
objectJSON object
Exceptions
ilException

Definition at line 154 of file class.ilECSEContentDetails.php.

References $ilLog, and getReceivers().

155  {
156  global $ilLog;
157 
158  if(!is_object($json))
159  {
160  $ilLog->write(__METHOD__.': Cannot load from JSON. No object given.');
161  throw new ilException('Cannot parse ECS content details.');
162  }
163 
164  foreach((array) $json->senders as $sender)
165  {
166  $this->senders[] = $sender->mid;
167  }
168 
169  $index = 0;
170  foreach((array) $json->receivers as $receiver)
171  {
172  $this->receivers[] = $receiver->mid;
173  if($receiver->itsyou and $this->sender_index === NULL)
174  {
175  $this->sender_index = $index;
176  }
177  ++$index;
178  }
179 
180  // Collect in one array
181  for($i = 0; $i < count($this->getReceivers()); ++$i)
182  {
183  $this->receiver_info[$this->sender[$i]] = $this->receivers[$i];
184  }
185 
186  if(is_object($json->owner))
187  {
188  $this->owner = (int) $json->owner->pid;
189  }
190 
191  $this->url = $json->url;
192  $this->content_type = $json->content_type;
193  return true;
194  }
Base class for ILIAS Exception handling.
+ Here is the call graph for this function:

Field Documentation

◆ $content_type

ilECSEContentDetails::$content_type = array()

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

◆ $owner

ilECSEContentDetails::$owner = 0

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

Referenced by getOwner().

◆ $receiver_info

ilECSEContentDetails::$receiver_info = array()
private

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

Referenced by getReceiverInfo().

◆ $receivers

ilECSEContentDetails::$receivers = array()

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

Referenced by getReceivers().

◆ $sender_index

ilECSEContentDetails::$sender_index = NULL

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

Referenced by getMySender().

◆ $senders

ilECSEContentDetails::$senders = array()

Definition at line 35 of file class.ilECSEContentDetails.php.

Referenced by getSenders().

◆ $url

ilECSEContentDetails::$url = array()

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

Referenced by getUrl().


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