ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilECSCourseConnector.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once './Services/WebServices/ECS/classes/class.ilECSConnector.php';
5 include_once './Services/WebServices/ECS/classes/class.ilECSConnectorException.php';
6 
14 {
15 
20  public function __construct(ilECSSetting $settings = null)
21  {
22  parent::__construct($settings);
23  }
24 
25 
30  public function getCourse($course_id, $a_details = false)
31  {
32  $this->path_postfix = '/campusconnect/courses/' . (int) $course_id;
33 
34  if ($a_details and $course_id) {
35  $this->path_postfix .= '/details';
36  }
37 
38  try {
39  $this->prepareConnection();
40  $this->setHeader(array());
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 (substr($res, 0, 4) == 'http') {
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  include_once './Services/WebServices/ECS/classes/class.ilECSEContentDetails.php';
59  $details = new ilECSEContentDetails();
60  $details->loadFromJson($ecs_result->getResult());
61  return $details;
62  }
63  // Return json result
64  return $ecs_result->getResult();
65  } catch (ilCurlConnectionException $e) {
66  throw new ilECSConnectorException('Error calling ECS service: ' . $e->getMessage());
67  }
68  }
69 }
Presentation of ecs content details (http://...campusconnect/courselinks/id/details) ...
foreach($_POST as $key=> $value) $res
__construct(ilECSSetting $settings=null)
Constructor.
setHeader($a_header_strings)
Create styles array
The data for the language used.
addHeader($a_name, $a_value)
Add Header.
prepareConnection()
prepare connection
getCourse($course_id, $a_details=false)
Get single directory tree.