ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilECSCourseConnector Class Reference
+ Inheritance diagram for ilECSCourseConnector:
+ Collaboration diagram for ilECSCourseConnector:

Public Member Functions

 getCourse ($course_id, $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

Member Function Documentation

◆ getCourse()

ilECSCourseConnector::getCourse (   $course_id,
  $a_details = false 
)

Get single directory tree.

Returns
mixed an array of ecs cms directory tree entries

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

31 {
32 $this->path_postfix = '/campusconnect/courses/' . (int) $course_id;
33
34 if ($a_details && $course_id) {
35 $this->path_postfix .= '/details';
36 }
37
38 try {
39 $this->prepareConnection();
40 $this->setHeader([]);
41 if ($a_details) {
42 $this->addHeader('Accept', 'application/json');
43 } else {
44 $this->addHeader('Accept', 'text/uri-list');
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 $details->loadFromJson($ecs_result->getResult());
60 return $details;
61 }
62 // Return json result
63 return $ecs_result->getResult();
65 $this->logger->error('Error calling ECS service: ' . $e->getMessage());
66 throw new ilECSConnectorException('Error calling ECS service: ' . $e->getMessage());
67 }
68 }
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)
Presentation of ecs content details (http://...campusconnect/courselinks/id/details)
$res
Definition: ltiservices.php:69

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

+ Here is the call graph for this function:

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