ILIAS  release_8 Revision v8.23
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 (object $json)
 Load from JSON object. More...
 

Static Public Member Functions

static getInstanceFromServer (int $a_server_id, int $a_econtent_id, string $a_resource_type)
 Get data from server. More...
 

Private Member Functions

 loadFromServer (int $a_server_id, int $a_econtent_id, string $a_resource_type)
 

Private Attributes

array $senders = []
 
int $sender_index = null
 
array $receivers = []
 
string $url = ""
 
int $owner = 0
 
array $receiver_info = []
 
ilLogger $logger
 

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

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

Constructor & Destructor Documentation

◆ __construct()

ilECSEContentDetails::__construct ( )

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

References $DIC, and ILIAS\Repository\logger().

37  {
38  global $DIC;
39 
40  $this->logger = $DIC->logger()->wsrv();
41  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ getFirstReceiver()

ilECSEContentDetails::getFirstReceiver ( )

Get first receiver.

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

111  : int
112  {
113  return count($this->receivers) ? $this->receivers[0] : 0;
114  }

◆ getFirstSender()

ilECSEContentDetails::getFirstSender ( )

get first sender

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

86  : int
87  {
88  return $this->senders[0] ?? 0;
89  }

◆ getInstanceFromServer()

static ilECSEContentDetails::getInstanceFromServer ( int  $a_server_id,
int  $a_econtent_id,
string  $a_resource_type 
)
static

Get data from server.

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

References loadFromServer().

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

47  {
48  $instance = new self();
49  $detailsOnServer = $instance->loadFromServer($a_server_id, $a_econtent_id, $a_resource_type);
50  if ($detailsOnServer) {
51  $instance->loadFromJson($detailsOnServer);
52  }
53  return $instance;
54  }
loadFromServer(int $a_server_id, int $a_econtent_id, string $a_resource_type)
Presentation of ecs content details (http://...campusconnect/courselinks/id/details) ...
+ 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 95 of file class.ilECSEContentDetails.php.

References $sender_index.

95  : int
96  {
97  return $this->senders[$this->sender_index];
98  }

◆ getOwner()

ilECSEContentDetails::getOwner ( )

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

References $owner.

132  : int
133  {
134  return $this->owner;
135  }

◆ getReceiverInfo()

ilECSEContentDetails::getReceiverInfo ( )

Get receiver info.

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

References $receiver_info.

119  : array
120  {
121  return $this->receiver_info;
122  }

◆ getReceivers()

ilECSEContentDetails::getReceivers ( )

Get recievers.

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

References $receivers.

Referenced by loadFromJson().

103  : array
104  {
105  return $this->receivers;
106  }
+ Here is the caller graph for this function:

◆ getSenders()

ilECSEContentDetails::getSenders ( )

Get senders.

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

References $senders.

78  : array
79  {
80  return $this->senders;
81  }

◆ getUrl()

ilECSEContentDetails::getUrl ( )

Get url.

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

References $url.

127  : string
128  {
129  return $this->url;
130  }

◆ loadFromJson()

ilECSEContentDetails::loadFromJson ( object  $json)

Load from JSON object.

Parameters
objectJSON object
Exceptions
ilException

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

References $i, $index, getReceivers(), ILIAS\Repository\int(), and ILIAS\Repository\logger().

143  : bool
144  {
145  $this->logger->info(print_r($json, true));
146  foreach ((array) $json->senders as $sender) {
147  $this->senders[] = $sender->mid;
148  }
149 
150  $index = 0;
151  foreach ((array) $json->receivers as $receiver) {
152  $this->receivers[] = $receiver->mid;
153  if ($receiver->itsyou && $this->sender_index === null) {
154  $this->sender_index = $index;
155  }
156  ++$index;
157  }
158 
159  // Collect in one array
160  for ($i = 0, $iMax = count($this->getReceivers()); $i < $iMax; ++$i) {
161  $this->receiver_info[$this->senders[$i]] = $this->receivers[$i];
162  }
163 
164  if (is_object($json->owner)) {
165  $this->owner = (int) $json->owner->pid;
166  }
167 
168  $this->url = $json->url;
169  return true;
170  }
$index
Definition: metadata.php:145
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

◆ loadFromServer()

ilECSEContentDetails::loadFromServer ( int  $a_server_id,
int  $a_econtent_id,
string  $a_resource_type 
)
private

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

References $res, ilECSSetting\getInstanceByServerId(), ilECSConnector\HTTP_CODE_NOT_FOUND, and ILIAS\Repository\logger().

Referenced by getInstanceFromServer().

57  : ?object
58  {
59  try {
60  $connector = new ilECSConnector(ilECSSetting::getInstanceByServerId($a_server_id));
61  $res = $connector->getResource($a_resource_type, $a_econtent_id, true);
62  if ($res->getHTTPCode() === ilECSConnector::HTTP_CODE_NOT_FOUND) {
63  return null;
64  }
65  if (!is_object($res->getResult())) {
66  $this->logger->error(__METHOD__ . ': Error parsing result. Expected result of type array.');
67  $this->logger->logStack();
68  throw new ilECSConnectorException('error parsing json');
69  }
70  } catch (ilECSConnectorException $exc) {
71  return null;
72  }
73  return $res->getResult();
74  }
$res
Definition: ltiservices.php:69
static getInstanceByServerId(int $a_server_id)
Get singleton instance per server.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $logger

ilLogger ilECSEContentDetails::$logger
private

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

◆ $owner

int ilECSEContentDetails::$owner = 0
private

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

Referenced by getOwner().

◆ $receiver_info

array ilECSEContentDetails::$receiver_info = []
private

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

Referenced by getReceiverInfo().

◆ $receivers

array ilECSEContentDetails::$receivers = []
private

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

Referenced by getReceivers().

◆ $sender_index

int ilECSEContentDetails::$sender_index = null
private

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

Referenced by getMySender().

◆ $senders

array ilECSEContentDetails::$senders = []
private

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

Referenced by getSenders().

◆ $url

string ilECSEContentDetails::$url = ""
private

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

Referenced by getUrl().


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