ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
 getFirstReceiver ()
 Get first receiver. 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 43 of file class.ilECSEContentDetails.php.

44  {
45  }

Member Function Documentation

◆ getFirstReceiver()

ilECSEContentDetails::getFirstReceiver ( )

Get first receiver.

Returns
int

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

References getReceivers().

124  {
125  foreach ($this->getReceivers() as $mid) {
126  return $mid;
127  }
128  return 0;
129  }
+ Here is the call graph for this function:

◆ getFirstSender()

ilECSEContentDetails::getFirstSender ( )

get first sender

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

97  {
98  return isset($this->senders[0]) ? $this->senders[0] : 0;
99  }

◆ 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 55 of file class.ilECSEContentDetails.php.

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

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

56  {
57  global $DIC;
58 
59  $ilLog = $DIC['ilLog'];
60 
61  try {
62  include_once './Services/WebServices/ECS/classes/class.ilECSSetting.php';
63  include_once './Services/WebServices/ECS/classes/class.ilECSConnector.php';
64  $connector = new ilECSConnector(ilECSSetting::getInstanceByServerId($a_server_id));
65  $res = $connector->getResource($a_resource_type, $a_econtent_id, true);
66  if ($res->getHTTPCode() == ilECSConnector::HTTP_CODE_NOT_FOUND) {
67  return;
68  }
69  if (!is_object($res->getResult())) {
70  $ilLog->write(__METHOD__ . ': Error parsing result. Expected result of type array.');
71  $ilLog->logStack();
72  throw new ilECSConnectorException('error parsing json');
73  }
74  } catch (ilECSConnectorException $exc) {
75  return;
76  }
77 
78  include_once './Services/WebServices/ECS/classes/class.ilECSEContentDetails.php';
79  $details = new self();
80  $details->loadFromJSON($res->getResult());
81  return $details;
82  }
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
+ 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 105 of file class.ilECSEContentDetails.php.

References $sender_index.

106  {
107  return $this->senders[$this->sender_index];
108  }

◆ getOwner()

ilECSEContentDetails::getOwner ( )

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

References $owner.

150  {
151  return (int) $this->owner;
152  }

◆ getReceiverInfo()

ilECSEContentDetails::getReceiverInfo ( )

Get receiver info.

Returns
array

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

References $receiver_info.

136  {
137  return (array) $this->receiver_info;
138  }

◆ getReceivers()

ilECSEContentDetails::getReceivers ( )

Get recievers.

Returns
<type>

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

References $receivers.

Referenced by getFirstReceiver(), and loadFromJson().

115  {
116  return (array) $this->receivers;
117  }
+ Here is the caller graph for this function:

◆ getSenders()

ilECSEContentDetails::getSenders ( )

Get senders.

Returns
array

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

References $senders.

89  {
90  return (array) $this->senders;
91  }

◆ getUrl()

ilECSEContentDetails::getUrl ( )

Get url.

Returns
string

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

References $url.

145  {
146  return $this->url;
147  }

◆ loadFromJson()

ilECSEContentDetails::loadFromJson (   $json)

Load from JSON object.

public

Parameters
objectJSON object
Exceptions
ilException

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

References $DIC, $i, $ilLog, $index, and getReceivers().

162  {
163  global $DIC;
164 
165  $ilLog = $DIC['ilLog'];
166 
167  if (!is_object($json)) {
168  $ilLog->write(__METHOD__ . ': Cannot load from JSON. No object given.');
169  throw new ilException('Cannot parse ECS content details.');
170  }
171 
172  foreach ((array) $json->senders as $sender) {
173  $this->senders[] = $sender->mid;
174  }
175 
176  $index = 0;
177  foreach ((array) $json->receivers as $receiver) {
178  $this->receivers[] = $receiver->mid;
179  if ($receiver->itsyou and $this->sender_index === null) {
180  $this->sender_index = $index;
181  }
182  ++$index;
183  }
184 
185  // Collect in one array
186  for ($i = 0; $i < count($this->getReceivers()); ++$i) {
187  $this->receiver_info[$this->sender[$i]] = $this->receivers[$i];
188  }
189 
190  if (is_object($json->owner)) {
191  $this->owner = (int) $json->owner->pid;
192  }
193 
194  $this->url = $json->url;
195  $this->content_type = $json->content_type;
196  return true;
197  }
global $DIC
Definition: saml.php:7
$index
Definition: metadata.php:60
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:

Field Documentation

◆ $content_type

ilECSEContentDetails::$content_type = array()

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

◆ $owner

ilECSEContentDetails::$owner = 0

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

Referenced by getOwner().

◆ $receiver_info

ilECSEContentDetails::$receiver_info = array()
private

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

Referenced by getReceiverInfo().

◆ $receivers

ilECSEContentDetails::$receivers = array()

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

Referenced by getReceivers().

◆ $sender_index

ilECSEContentDetails::$sender_index = null

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

Referenced by getMySender().

◆ $senders

ilECSEContentDetails::$senders = array()

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

Referenced by getSenders().

◆ $url

ilECSEContentDetails::$url = array()

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

Referenced by getUrl().


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