60 include_once(
'Services/WebServices/ECS/classes/class.ilECSSetting.php');
61 include_once(
'Services/WebServices/ECS/classes/class.ilECSConnector.php');
62 include_once(
'Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
63 include_once(
'Services/WebServices/ECS/classes/class.ilECSEContent.php');
64 include_once(
'Services/WebServices/ECS/classes/class.ilECSReaderException.php');
70 $this->econtent_id = $a_econtent_id;
81 return $this->econtent ? $this->econtent : array();
90 return $this->econtent_details ? $this->econtent_details : array();
104 $this->connector->addHeader(self::ECS_QUERY_STRINGS, $a_filter ? $a_filter : self::ALL_ECONTENT);
105 $res = $this->connector->getResourceList();
106 return $res->getResult();
110 $ilLog->write(__METHOD__ .
': Error connecting to ECS server. ' . $e->getMessage());
115 $ilLog->write(__METHOD__ .
': Error reading course links. ' . $e->getMessage());
127 public function read($details_only =
false)
138 $res = $this->connector->getResource($this->econtent_id,$details_only);
144 if(!is_object(
$res->getResult()))
146 $ilLog->write(__METHOD__ .
': Error parsing result. Expected result of type array.');
153 include_once
'./Services/WebServices/ECS/classes/class.ilECSEContentDetails.php';
154 $tmp_content =
new ilECSEContentDetails();
155 $tmp_content->loadFromJSON(
$res->getResult());
156 $this->econtent_details = $tmp_content;
161 $tmp_content->loadFromJSON(
$res->getResult());
166 $tmp_content->setOwner($sender);
167 $GLOBALS[
'ilLog']->write(__METHOD__.
': Reading sender from header: '.$sender);
171 $details = $this->
read(
true);
173 $GLOBALS[
'ilLog']->write(__METHOD__.
': Reading sender from details: '.$details->getFirstSender());
174 $tmp_content->setOwner($details->getFirstSender());
176 $this->econtent = $tmp_content;
182 $ilLog->write(__METHOD__ .
': Error connecting to ECS server. ' . $e->getMessage());
187 $ilLog->write(__METHOD__ .
': Error reading EContent. ' . $e->getMessage());
200 #$GLOBALS['ilLog']->write(__METHOD__.' Reading sender from header');
203 #$GLOBALS['ilLog']->write(__METHOD__.' Key is: '.$key);
204 if($key == self::ECS_HEADER_SENDER)
206 #$GLOBALS['ilLog']->write(__METHOD__.' Value is: '.$value);
207 $sender = trim($value);
208 $value_arr = explode(
',', $value);
209 foreach((array) $value_arr as $s)
211 return (
int) trim($s);