ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 44 of file class.ilECSEContentDetails.php.

45  {
46 
47  }

Member Function Documentation

◆ getFirstReceiver()

ilECSEContentDetails::getFirstReceiver ( )

Get first receiver.

Returns
int

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

References getReceivers().

129  {
130  foreach ($this->getReceivers() as $mid)
131  {
132  return $mid;
133  }
134  return 0;
135  }
+ Here is the call graph for this function:

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

References $owner.

156  {
157  return (int) $this->owner;
158  }

◆ getReceiverInfo()

ilECSEContentDetails::getReceiverInfo ( )

Get receiver info.

Returns
array

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

References $receiver_info, and array.

142  {
143  return (array) $this->receiver_info;
144  }
Create styles array
The data for the language used.

◆ getReceivers()

ilECSEContentDetails::getReceivers ( )

Get recievers.

Returns
<type>

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

References $receivers, and array.

Referenced by getFirstReceiver(), and loadFromJson().

120  {
121  return (array) $this->receivers;
122  }
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 93 of file class.ilECSEContentDetails.php.

References $senders, and array.

94  {
95  return (array) $this->senders;
96  }
Create styles array
The data for the language used.

◆ getUrl()

ilECSEContentDetails::getUrl ( )

Get url.

Returns
string

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

References $url.

151  {
152  return $this->url;
153  }

◆ loadFromJson()

ilECSEContentDetails::loadFromJson (   $json)

Load from JSON object.

public

Parameters
objectJSON object
Exceptions
ilException

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

References $ilLog, array, and getReceivers().

168  {
169  global $ilLog;
170 
171  if(!is_object($json))
172  {
173  $ilLog->write(__METHOD__.': Cannot load from JSON. No object given.');
174  throw new ilException('Cannot parse ECS content details.');
175  }
176 
177  foreach((array) $json->senders as $sender)
178  {
179  $this->senders[] = $sender->mid;
180  }
181 
182  $index = 0;
183  foreach((array) $json->receivers as $receiver)
184  {
185  $this->receivers[] = $receiver->mid;
186  if($receiver->itsyou and $this->sender_index === NULL)
187  {
188  $this->sender_index = $index;
189  }
190  ++$index;
191  }
192 
193  // Collect in one array
194  for($i = 0; $i < count($this->getReceivers()); ++$i)
195  {
196  $this->receiver_info[$this->sender[$i]] = $this->receivers[$i];
197  }
198 
199  if(is_object($json->owner))
200  {
201  $this->owner = (int) $json->owner->pid;
202  }
203 
204  $this->url = $json->url;
205  $this->content_type = $json->content_type;
206  return true;
207  }
Base class for ILIAS Exception handling.
Create styles array
The data for the language used.
+ 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: