ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilECSCourseUrlConnector Class Reference

Connector for writing ecs course urls. More...

+ Inheritance diagram for ilECSCourseUrlConnector:
+ Collaboration diagram for ilECSCourseUrlConnector:

Public Member Functions

 __construct (ilECSSetting $settings=null)
 Constructor.
 addUrl (ilECSCourseUrl $url, $a_target_mid)
 Send url of newly created courses to ecs.
- Public Member Functions inherited from ilECSConnector
 addHeader ($a_name, $a_value)
 Add Header.
 getHeader ()
 setHeader ($a_header_strings)
 getServer ()
 Get current server setting.
 addAuth ($a_post, $a_target_mid)
 Add auth resource.
 getAuth ($a_hash)
 get auth resource
 getEventQueues ()
 get event queue
 readEventFifo ($a_delete=false)
 Read event fifo.
 getResourceList ($a_path)
 getResource ($a_path, $a_econtent_id, $a_details_only=false)
 Get resources from ECS server.
 addResource ($a_path, $a_post)
 Add resource.
 updateResource ($a_path, $a_econtent_id, $a_post_string)
 update resource
 deleteResource ($a_path, $a_econtent_id)
 Delete resource.
 getMemberships ($a_mid=0)
 public

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

Detailed Description

Connector for writing ecs course urls.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e $Id$

Definition at line 13 of file class.ilECSCourseUrlConnector.php.

Constructor & Destructor Documentation

ilECSCourseUrlConnector::__construct ( ilECSSetting  $settings = null)

Constructor.

Parameters
ilECSSetting$settings

Reimplemented from ilECSConnector.

Definition at line 19 of file class.ilECSCourseUrlConnector.php.

References ilECSConnector\$settings.

{
parent::__construct($settings);
}

Member Function Documentation

ilECSCourseUrlConnector::addUrl ( ilECSCourseUrl  $url,
  $a_target_mid 
)

Send url of newly created courses to ecs.

Returns
type
Exceptions
ilECSConnectorException

Definition at line 29 of file class.ilECSCourseUrlConnector.php.

References $GLOBALS, $ilLog, $ret, ilECSConnector\addHeader(), ilECSConnector\call(), ilECSConnector\getHeader(), ilECSConnector\HEADER_MEMBERSHIPS, and ilECSConnector\prepareConnection().

{
global $ilLog;
$ilLog->write(__METHOD__.': Add new course url ...');
$this->path_postfix = '/campusconnect/course_urls';
try
{
$this->addHeader('Content-Type', 'application/json');
$this->addHeader('Accept', 'application/json');
$this->curl->setOpt(CURLOPT_HTTPHEADER, $this->getHeader());
$this->curl->setOpt(CURLOPT_POST,true);
$this->curl->setOpt(CURLOPT_POSTFIELDS,json_encode($url));
$GLOBALS['ilLog']->write(__METHOD__.': Sending url '. print_r(json_encode($url),true));
$ret = $this->call();
$info = $this->curl->getInfo(CURLINFO_HTTP_CODE);
$ilLog->write(__METHOD__.': Checking HTTP status...');
if($info != self::HTTP_CODE_CREATED)
{
$ilLog->write(__METHOD__.': Cannot create course url ressource, did not receive HTTP 201. ');
$ilLog->write(__METHOD__.': POST was: '. json_encode($url));
$ilLog->write(__METHOD__.': HTTP code: '.$info);
throw new ilECSConnectorException('Received HTTP status code: '.$info);
}
$ilLog->write(__METHOD__.': ... got HTTP 201 (created)');
}
{
throw new ilECSConnectorException('Error calling ECS service: '.$exc->getMessage());
}
}

+ Here is the call graph for this function:


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