ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilECSDirectoryTreeConnector.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once './Services/WebServices/ECS/classes/class.ilECSConnector.php';
5include_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
31 public function getDirectoryTrees($a_mid = 0)
32 {
33 global $ilLog;
34
35 $this->path_postfix = '/campusconnect/directory_trees';
36
37 try {
38 $this->prepareConnection();
39 $this->setHeader(array());
40 $this->addHeader('Accept', 'text/uri-list');
41 $this->addHeader('X-EcsQueryStrings', 'all=true');
42 if($a_mid)
43 {
44 $this->addHeader('X-EcsReceiverMemberships', $a_mid);
45 }
46
47 $this->curl->setOpt(CURLOPT_HTTPHEADER, $this->getHeader());
48 $res = $this->call();
49
50 $ecsResult = new ilECSResult($res,false, ilECSResult::RESULT_TYPE_URL_LIST);
51 return $ecsResult->getResult();
52 }
53 catch(ilCurlConnectionException $exc) {
54 throw new ilECSConnectorException('Error calling ECS service: '.$exc->getMessage());
55 }
56 }
57
62 public function getDirectoryTree($tree_id)
63 {
64 $this->path_postfix = '/campusconnect/directory_trees/'. (int) $tree_id;
65
66 try {
67 $this->prepareConnection();
68 $this->setHeader(array());
69 $this->addHeader('Accept', 'text/uri-list');
70 $this->curl->setOpt(CURLOPT_HTTPHEADER, $this->getHeader());
71 $res = $this->call();
72
73 if(substr($res, 0, 4) == 'http')
74 {
75 $json = file_get_contents($res);
76 $ecs_result = new ilECSResult($json);
77 }
78 else
79 {
80 $ecs_result = new ilECSResult($res);
81 }
82 return $ecs_result;
83 }
85 {
86 throw new ilECSConnectorException('Error calling ECS service: '.$e->getMessage());
87 }
88 }
89}
90?>
addHeader($a_name, $a_value)
Add Header.
prepareConnection()
prepare connection
setHeader($a_header_strings)
getDirectoryTree($tree_id)
Get single directory tree.
getDirectoryTrees($a_mid=0)
Get directory tree @global ilLog $ilLog.
__construct(ilECSSetting $settings=null)
Constructor.
const RESULT_TYPE_URL_LIST