ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilECSCourseMemberConnector.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27{
32 public function getCourseMember($course_member_id, bool $a_details = false)
33 {
34 $this->path_postfix = '/campusconnect/course_members/' . (int) $course_member_id;
35
36 if ($a_details && $course_member_id) {
37 $this->path_postfix .= '/details';
38 }
39
40 try {
41 $this->prepareConnection();
42 $this->setHeader(array());
43 if ($a_details) {
44 $this->addHeader('Accept', 'application/json');
45 }
46 $this->curl->setOpt(CURLOPT_HTTPHEADER, $this->getHeader());
47 $res = $this->call();
48
49 if (strpos($res, 'http') === 0) {
50 $json = file_get_contents($res);
51 $ecs_result = new ilECSResult($json);
52 } else {
53 $ecs_result = new ilECSResult($res);
54 }
55
56 // Return ECSEContentDetails for details switch
57 if ($a_details) {
58 $details = new ilECSEContentDetails();
59 $this->logger->debug(print_r($res, true));
60 $details->loadFromJson($ecs_result->getResult());
61 return $details;
62 }
63
64 return $ecs_result->getResult();
66 throw new ilECSConnectorException('Error calling ECS service: ' . $e->getMessage());
67 }
68 }
69}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addHeader(string $a_name, string $a_value)
Add Header.
prepareConnection()
prepare connection
setHeader(array $a_header_strings)
Connector for course member ressource.
getCourseMember($course_member_id, bool $a_details=false)
Get single directory tree.
Presentation of ecs content details (http://...campusconnect/courselinks/id/details)
$res
Definition: ltiservices.php:69