ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 121 of file class.ilECSEContentDetails.php.

References getReceivers().

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

◆ getFirstSender()

ilECSEContentDetails::getFirstSender ( )

get first sender

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

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

◆ 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 $ilLog, $res, ilECSSetting\getInstanceByServerId(), and ilECSConnector\HTTP_CODE_NOT_FOUND.

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

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

References $sender_index.

104  {
105  return $this->senders[$this->sender_index];
106  }

◆ getOwner()

ilECSEContentDetails::getOwner ( )

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

References $owner.

148  {
149  return (int) $this->owner;
150  }

◆ getReceiverInfo()

ilECSEContentDetails::getReceiverInfo ( )

Get receiver info.

Returns
array

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

References $receiver_info, and array.

134  {
135  return (array) $this->receiver_info;
136  }
Create styles array
The data for the language used.

◆ getReceivers()

ilECSEContentDetails::getReceivers ( )

Get recievers.

Returns
<type>

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

References $receivers, and array.

Referenced by getFirstReceiver(), and loadFromJson().

113  {
114  return (array) $this->receivers;
115  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getSenders()

ilECSEContentDetails::getSenders ( )

Get senders.

Returns
array

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

References $senders, and array.

87  {
88  return (array) $this->senders;
89  }
Create styles array
The data for the language used.

◆ getUrl()

ilECSEContentDetails::getUrl ( )

Get url.

Returns
string

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

References $url.

143  {
144  return $this->url;
145  }

◆ loadFromJson()

ilECSEContentDetails::loadFromJson (   $json)

Load from JSON object.

public

Parameters
objectJSON object
Exceptions
ilException

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

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

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