ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 26 of file class.ilECSEContentDetails.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSEContentDetails::__construct ( )

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

38 {
39 global $DIC;
40
41 $this->logger = $DIC->logger()->wsrv();
42 }
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getFirstReceiver()

ilECSEContentDetails::getFirstReceiver ( )

Get first receiver.

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

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

◆ getFirstSender()

ilECSEContentDetails::getFirstSender ( )

get first sender

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

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

◆ getInstanceFromServer()

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

Get data from server.

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

48 {
49 $instance = new self();
50 $detailsOnServer = $instance->loadFromServer($a_server_id, $a_econtent_id, $a_resource_type);
51 if ($detailsOnServer) {
52 $instance->loadFromJson($detailsOnServer);
53 }
54 return $instance;
55 }
Presentation of ecs content details (http://...campusconnect/courselinks/id/details)
loadFromServer(int $a_server_id, int $a_econtent_id, string $a_resource_type)

References loadFromServer().

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

+ 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 96 of file class.ilECSEContentDetails.php.

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

References $sender_index.

◆ getOwner()

ilECSEContentDetails::getOwner ( )

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

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

References $owner.

◆ getReceiverInfo()

ilECSEContentDetails::getReceiverInfo ( )

Get receiver info.

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

120 : array
121 {
123 }

References $receiver_info.

◆ getReceivers()

ilECSEContentDetails::getReceivers ( )

Get recievers.

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

104 : array
105 {
106 return $this->receivers;
107 }

References $receivers.

Referenced by loadFromJson().

+ Here is the caller graph for this function:

◆ getSenders()

ilECSEContentDetails::getSenders ( )

Get senders.

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

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

References $senders.

◆ getUrl()

ilECSEContentDetails::getUrl ( )

Get url.

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

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

References $url.

◆ loadFromJson()

ilECSEContentDetails::loadFromJson ( object  $json)

Load from JSON object.

Parameters
objectJSON object
Exceptions
ilException

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

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

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

+ 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 58 of file class.ilECSEContentDetails.php.

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

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

Referenced by getInstanceFromServer().

+ 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 35 of file class.ilECSEContentDetails.php.

◆ $owner

int ilECSEContentDetails::$owner = 0
private

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

Referenced by getOwner().

◆ $receiver_info

array ilECSEContentDetails::$receiver_info = []
private

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

Referenced by getReceiverInfo().

◆ $receivers

array ilECSEContentDetails::$receivers = []
private

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

Referenced by getReceivers().

◆ $sender_index

int ilECSEContentDetails::$sender_index = null
private

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

Referenced by getMySender().

◆ $senders

array ilECSEContentDetails::$senders = []
private

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

Referenced by getSenders().

◆ $url

string ilECSEContentDetails::$url = ""
private

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

Referenced by getUrl().


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