ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilECSCourseConnector Class Reference
+ Inheritance diagram for ilECSCourseConnector:
+ Collaboration diagram for ilECSCourseConnector:

Public Member Functions

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

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...
 
- Static Protected Member Functions inherited from ilECSConnector
static _fetchEContentIdFromHeader ($a_header)
 fetch new econtent id from location header More...
 
- Protected Attributes inherited from ilECSConnector
 $path_postfix = ''
 
 $settings
 
 $header_strings = array()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilECSCourseConnector::__construct ( ilECSSetting  $settings = null)

Constructor.

Parameters
ilECSSetting$settings

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

References ilECSConnector\$settings.

21  {
22  parent::__construct($settings);
23  }

Member Function Documentation

◆ getCourse()

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

Get single directory tree.

Returns
array an array of ecs cms directory tree entries

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

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

31  {
32  $this->path_postfix = '/campusconnect/courses/'. (int) $course_id;
33 
34  if($a_details and $course_id)
35  {
36  $this->path_postfix .= '/details';
37  }
38 
39  try {
40  $this->prepareConnection();
41  $this->setHeader(array());
42  if($a_details)
43  {
44  $this->addHeader('Accept', 'application/json');
45  }
46  else
47  {
48  $this->addHeader('Accept', 'text/uri-list');
49  }
50  $this->curl->setOpt(CURLOPT_HTTPHEADER, $this->getHeader());
51  $res = $this->call();
52 
53  if(substr($res, 0, 4) == 'http')
54  {
55  $json = file_get_contents($res);
56  $ecs_result = new ilECSResult($json);
57  }
58  else
59  {
60  $ecs_result = new ilECSResult($res);
61 
62  }
63 
64  // Return ECSEContentDetails for details switch
65  if($a_details)
66  {
67  include_once './Services/WebServices/ECS/classes/class.ilECSEContentDetails.php';
68  $details = new ilECSEContentDetails();
69  $details->loadFromJson($ecs_result->getResult());
70  return $details;
71  }
72  // Return json result
73  return $ecs_result->getResult();
74  }
75  catch(ilCurlConnectionException $e)
76  {
77  throw new ilECSConnectorException('Error calling ECS service: '.$e->getMessage());
78  }
79  }
Presentation of ecs content details (http://...campusconnect/courselinks/id/details) ...
setHeader($a_header_strings)
Create styles array
The data for the language used.
addHeader($a_name, $a_value)
Add Header.
prepareConnection()
prepare connection
+ Here is the call graph for this function:

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