ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilECSDirectoryTreeConnector Class Reference
+ Inheritance diagram for ilECSDirectoryTreeConnector:
+ Collaboration diagram for ilECSDirectoryTreeConnector:

Public Member Functions

 getDirectoryTrees (int $a_mid=0)
 Get directory tree. More...
 
 getDirectoryTree ($tree_id)
 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

◆ getDirectoryTree()

ilECSDirectoryTreeConnector::getDirectoryTree (   $tree_id)

Get single directory tree.

Returns
ilECSResult an array of ecs cms directory tree entries

Definition at line 58 of file class.ilECSDirectoryTreeConnector.php.

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

58  : ilECSResult
59  {
60  $this->path_postfix = '/campusconnect/directory_trees/' . (int) $tree_id;
61 
62  try {
63  $this->prepareConnection();
64  $this->setHeader(array());
65  $this->addHeader('Accept', 'text/uri-list');
66  $this->curl->setOpt(CURLOPT_HTTPHEADER, $this->getHeader());
67  $res = $this->call();
68 
69  if (strpos($res, 'http') === 0) {
70  $json = file_get_contents($res);
71  $ecs_result = new ilECSResult($json);
72  } else {
73  $ecs_result = new ilECSResult($res);
74  }
75  return $ecs_result;
76  } catch (ilCurlConnectionException $e) {
77  throw new ilECSConnectorException('Error calling ECS service: ' . $e->getMessage());
78  }
79  }
$res
Definition: ltiservices.php:69
addHeader(string $a_name, string $a_value)
Add Header.
setHeader(array $a_header_strings)
prepareConnection()
prepare connection
+ Here is the call graph for this function:

◆ getDirectoryTrees()

ilECSDirectoryTreeConnector::getDirectoryTrees ( int  $a_mid = 0)

Get directory tree.

Exceptions
ilECSConnectorException

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

References $res, ilECSConnector\addHeader(), ilECSConnector\call(), ilECSConnector\getHeader(), ilECSConnector\prepareConnection(), ilECSResult\RESULT_TYPE_URL_LIST, and ilECSConnector\setHeader().

32  : ?\ilECSUriList
33  {
34  $this->path_postfix = '/campusconnect/directory_trees';
35 
36  try {
37  $this->prepareConnection();
38  $this->setHeader(array());
39  $this->addHeader('Accept', 'text/uri-list');
40  $this->addHeader('X-EcsQueryStrings', 'all=true');
41  if ($a_mid) {
42  $this->addHeader('X-EcsReceiverMemberships', (string) $a_mid);
43  }
44 
45  $this->curl->setOpt(CURLOPT_HTTPHEADER, $this->getHeader());
46  $res = $this->call();
47 
48  return (new ilECSResult($res, ilECSResult::RESULT_TYPE_URL_LIST))->getResult();
49  } catch (ilCurlConnectionException $exc) {
50  throw new ilECSConnectorException('Error calling ECS service: ' . $exc->getMessage());
51  }
52  }
const RESULT_TYPE_URL_LIST
$res
Definition: ltiservices.php:69
addHeader(string $a_name, string $a_value)
Add Header.
Presentation of ecs uril (http://...campusconnect/courselinks)
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: