ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilECSEnrolmentStatusConnector Class Reference

Connector for course member ressource. More...

+ Inheritance diagram for ilECSEnrolmentStatusConnector:
+ Collaboration diagram for ilECSEnrolmentStatusConnector:

Public Member Functions

 __construct (ilECSSetting $settings=null)
 Constructor.
 getEnrolmentStatus ($a_enrole_id=0, $a_details=false)
 Get single directory tree.
 addEnrolmentStatus (ilECSEnrolmentStatus $enrolment, $a_target_mid)
 Add new enrolment status.
- 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, $a_details_only=FALSE)
 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 course member ressource.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Id:
class.ilECSEnrolmentStatusConnector.php 51113 2014-07-02 10:50:18Z smeyer

Definition at line 14 of file class.ilECSEnrolmentStatusConnector.php.

Constructor & Destructor Documentation

ilECSEnrolmentStatusConnector::__construct ( ilECSSetting  $settings = null)

Constructor.

Parameters
ilECSSetting$settings

Reimplemented from ilECSConnector.

Definition at line 21 of file class.ilECSEnrolmentStatusConnector.php.

References ilECSConnector\$settings.

{
parent::__construct($settings);
}

Member Function Documentation

ilECSEnrolmentStatusConnector::addEnrolmentStatus ( ilECSEnrolmentStatus  $enrolment,
  $a_target_mid 
)

Add new enrolment status.

Definition at line 94 of file class.ilECSEnrolmentStatusConnector.php.

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

{
global $ilLog;
$ilLog->write(__METHOD__.': Add new enrolment status');
$this->path_postfix = '/campusconnect/member_status';
try
{
$this->addHeader('Content-Type', 'application/json');
$this->addHeader('Accept', 'application/json');
#$this->addHeader(ilECSConnector::HEADER_MEMBERSHIPS, 1);
$this->curl->setOpt(CURLOPT_HTTPHEADER, $this->getHeader());
$this->curl->setOpt(CURLOPT_POST,true);
$this->curl->setOpt(CURLOPT_POSTFIELDS,json_encode($enrolment));
$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 auth resource, did not receive HTTP 201. ');
$ilLog->write(__METHOD__.': POST was: '.print_r($enrolment,TRUE));
$ilLog->write(__METHOD__.': HTTP code: '.$info);
throw new ilECSConnectorException('Received HTTP status code: '.$info);
}
$ilLog->write(__METHOD__.': ... got HTTP 201 (created)');
$enrolment_res = $result->getResult();
$ilLog->write(__METHOD__.': ... Received result: '.print_r($enrolment_res,TRUE));
return $enrolment_res;
}
{
throw new ilECSConnectorException('Error calling ECS service: '.$exc->getMessage());
}
}

+ Here is the call graph for this function:

ilECSEnrolmentStatusConnector::getEnrolmentStatus (   $a_enrole_id = 0,
  $a_details = false 
)

Get single directory tree.

Returns
mixed object of EContentDetails or object of ECSEnrolmentStatus

Definition at line 31 of file class.ilECSEnrolmentStatusConnector.php.

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

{
if($a_enrole_id)
{
$this->path_postfix = '/campusconnect/member_status/'. (int) $a_enrole_id;
}
if($a_details and $a_enrole_id)
{
$this->path_postfix .= '/details';
}
try {
$this->setHeader(array());
if($a_details)
{
$this->addHeader('Accept', 'application/json');
}
else
{
#$this->addHeader('Accept', 'text/uri-list');
}
$this->curl->setOpt(CURLOPT_HTTPHEADER, $this->getHeader());
$res = $this->call();
if(substr($res, 0, 4) == 'http')
{
$json = file_get_contents($res);
$ecs_result = new ilECSResult($json);
}
else
{
$ecs_result = new ilECSResult($res);
}
// Return ECSEContentDetails for details switch
if($a_details)
{
include_once './Services/WebServices/ECS/classes/class.ilECSEContentDetails.php';
$details = new ilECSEContentDetails();
$GLOBALS['ilLog']->write(print_r($res,true));
$details->loadFromJson($ecs_result->getResult());
return $details;
}
else
{
include_once './Services/WebServices/ECS/classes/Connectors/class.ilECSEnrolmentStatus.php';
$enrolment = new ilECSEnrolmentStatus();
$enrolment->loadFromJson($ecs_result->getResult());
return $enrolment;
}
}
{
throw new ilECSConnectorException('Error calling ECS service: '.$e->getMessage());
}
}

+ Here is the call graph for this function:


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