ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilECSCourseMemberConnector Class Reference

Connector for course member ressource. More...

+ Inheritance diagram for ilECSCourseMemberConnector:
+ Collaboration diagram for ilECSCourseMemberConnector:

Public Member Functions

 getCourseMember ($course_member_id, bool $a_details=false)
 Get single directory tree. More...
 
- Public Member Functions inherited from ilECSConnector
 __construct (ilECSSetting $settings=null)
 
 addHeader (string $a_name, string $a_value)
 Add Header. More...
 
 getHeader ()
 
 setHeader (array $a_header_strings)
 
 getServer ()
 Get current server setting. More...
 
 addAuth (string $a_post, int $a_target_mid)
 Add auth resource. More...
 
 getAuth (string $a_hash, bool $a_details_only=false)
 get auth resource More...
 
 readEventFifo (bool $a_delete=false)
 Read event fifo. More...
 
 getResourceList (string $a_path)
 
 getResource (string $a_path, int $a_econtent_id, bool $a_details_only=false)
 Get resources from ECS server. More...
 
 addResource (string $a_path, $a_post)
 Add resource. More...
 
 updateResource (string $a_path, int $a_econtent_id, string $a_post_string)
 update resource More...
 
 deleteResource (string $a_path, int $a_econtent_id)
 Delete resource. More...
 
 getMemberships (int $a_mid=0)
 

Additional Inherited Members

- Data Fields inherited from ilECSConnector
const HTTP_CODE_CREATED = 201
 
const HTTP_CODE_OK = 200
 
const HTTP_CODE_NOT_FOUND = 404
 
const HEADER_MEMBERSHIPS = 'X-EcsReceiverMemberships'
 
const HEADER_COMMUNITIES = 'X-EcsReceiverCommunities'
 
- Protected Member Functions inherited from ilECSConnector
 prepareConnection ()
 prepare connection More...
 
 call ()
 call peer More...
 
- Protected Attributes inherited from ilECSConnector
string $path_postfix = ''
 
ilECSSetting $settings = null
 
ilCurlConnection $curl = null
 
array $header_strings = []
 
ilLogger $logger
 

Detailed Description

Connector for course member ressource.

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.ilECSCourseMemberConnector.php.

Member Function Documentation

◆ getCourseMember()

ilECSCourseMemberConnector::getCourseMember (   $course_member_id,
bool  $a_details = false 
)

Get single directory tree.

Returns
mixed an array of ecs cms directory tree entries

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

References ILIAS\LTI\ToolProvider\$details, Vendor\Package\$e, $res, ilECSConnector\addHeader(), ilECSConnector\call(), ilECSConnector\getHeader(), ILIAS\Repository\int(), ILIAS\Repository\logger(), ilECSConnector\prepareConnection(), and ilECSConnector\setHeader().

32  {
33  $this->path_postfix = '/campusconnect/course_members/' . (int) $course_member_id;
34 
35  if ($a_details && $course_member_id) {
36  $this->path_postfix .= '/details';
37  }
38 
39  try {
40  $this->prepareConnection();
41  $this->setHeader(array());
42  if ($a_details) {
43  $this->addHeader('Accept', 'application/json');
44  }
45  $this->curl->setOpt(CURLOPT_HTTPHEADER, $this->getHeader());
46  $res = $this->call();
47 
48  if (strpos($res, 'http') === 0) {
49  $json = file_get_contents($res);
50  $ecs_result = new ilECSResult($json);
51  } else {
52  $ecs_result = new ilECSResult($res);
53  }
54 
55  // Return ECSEContentDetails for details switch
56  if ($a_details) {
58  $this->logger->debug(print_r($res, true));
59  $details->loadFromJson($ecs_result->getResult());
60  return $details;
61  }
62 
63  return $ecs_result->getResult();
64  } catch (ilCurlConnectionException $e) {
65  throw new ilECSConnectorException('Error calling ECS service: ' . $e->getMessage());
66  }
67  }
$res
Definition: ltiservices.php:69
addHeader(string $a_name, string $a_value)
Add Header.
Presentation of ecs content details (http://...campusconnect/courselinks/id/details) ...
array $details
Details for error message relating to last request processed.
Definition: System.php:109
setHeader(array $a_header_strings)
prepareConnection()
prepare connection
+ Here is the call graph for this function:

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