ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilECSCmsCourseCommandQueueHandler Class Reference

Description of class. More...

+ Inheritance diagram for ilECSCmsCourseCommandQueueHandler:
+ Collaboration diagram for ilECSCmsCourseCommandQueueHandler:

Public Member Functions

 __construct (ilECSSetting $server)
 Constructor. More...
 
 getServer ()
 Get server. More...
 
 getMid ()
 Get mid. More...
 
 checkAllocationActivation (ilECSSetting $server, $a_content_id)
 Check if course allocation is activated for one recipient of the. More...
 
 handleCreate (ilECSSetting $server, $a_content_id)
 Handle create. More...
 
 handleDelete (ilECSSetting $server, $a_content_id)
 Handle delete. More...
 
 handleUpdate (ilECSSetting $server, $a_content_id)
 Handle update. More...
 
 handleCreate (ilECSSetting $server, $a_content_id)
 Handle create event. More...
 
 handleUpdate (ilECSSetting $server, $a_content_id)
 Handle update. More...
 
 handleDelete (ilECSSetting $server, $a_content_id)
 Handle delete action. More...
 

Protected Member Functions

 doUpdate ($a_content_id, $course)
 Perform update. More...
 

Private Member Functions

 readCourse (ilECSSetting $server, $a_content_id, $a_details=false)
 Read course from ecs. More...
 

Private Attributes

 $server = null
 
 $mid = 0
 

Detailed Description

Description of class.

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

Definition at line 15 of file class.ilECSCmsCourseCommandQueueHandler.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSCmsCourseCommandQueueHandler::__construct ( ilECSSetting  $server)

Constructor.

Definition at line 24 of file class.ilECSCmsCourseCommandQueueHandler.php.

References $server.

Member Function Documentation

◆ checkAllocationActivation()

ilECSCmsCourseCommandQueueHandler::checkAllocationActivation ( ilECSSetting  $server,
  $a_content_id 
)

Check if course allocation is activated for one recipient of the.

Parameters
ilECSSetting$server
type$a_content_id

Definition at line 52 of file class.ilECSCmsCourseCommandQueueHandler.php.

53 {
54 try {
55 include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseConnector.php';
56 $crs_reader = new ilECSCourseConnector($server);
57 $details = $crs_reader->getCourse($a_content_id, true);
58 $this->mid = $details->getMySender();
59
60 // Check if import is enabled
61 include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
62 $part = ilECSParticipantSetting::getInstance($this->getServer()->getServerId(), $this->getMid());
63 if (!$part->isImportEnabled()) {
64 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Import disabled for mid ' . $this->getMid());
65 return false;
66 }
67 // Check course allocation setting
68 include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingSettings.php';
70 $this->getServer()->getServerId(),
71 $this->getMid()
72 );
73 $enabled = $gl_settings->isCourseAllocationEnabled();
74 if (!$enabled) {
75 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Course allocation disabled for ' . $this->getMid());
76 }
77 return $enabled;
78 } catch (ilECSConnectorException $e) {
79 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Reading course details failed with message ' . $e->getMessage());
80 return false;
81 }
82 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static getInstanceByServerMid($a_server_id, $a_mid)
Get instance.
static getInstance($a_server_id, $mid)
Get instance by server id and mid.

References Vendor\Package\$e, $GLOBALS, $server, ilECSParticipantSetting\getInstance(), ilECSNodeMappingSettings\getInstanceByServerMid(), getMid(), and getServer().

Referenced by handleCreate(), and handleUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doUpdate()

ilECSCmsCourseCommandQueueHandler::doUpdate (   $a_content_id,
  $course 
)
protected

Perform update.

Parameters
type$a_content_id
type$course

Definition at line 150 of file class.ilECSCmsCourseCommandQueueHandler.php.

151 {
152 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Starting course creation/update');
153
154 include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseCreationHandler.php';
155 $creation_handler = new ilECSCourseCreationHandler($this->getServer(), $this->mid);
156 $creation_handler->handle($a_content_id, $course);
157 }

References $GLOBALS, and getServer().

Referenced by handleCreate(), and handleUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMid()

ilECSCmsCourseCommandQueueHandler::getMid ( )

Get mid.

Returns
type

Definition at line 42 of file class.ilECSCmsCourseCommandQueueHandler.php.

References $mid.

Referenced by checkAllocationActivation().

+ Here is the caller graph for this function:

◆ getServer()

ilECSCmsCourseCommandQueueHandler::getServer ( )

Get server.

Returns
ilECSServerSetting

Definition at line 33 of file class.ilECSCmsCourseCommandQueueHandler.php.

34 {
35 return $this->server;
36 }

References $server.

Referenced by checkAllocationActivation(), and doUpdate().

+ Here is the caller graph for this function:

◆ handleCreate()

ilECSCmsCourseCommandQueueHandler::handleCreate ( ilECSSetting  $server,
  $a_content_id 
)

Handle create.

Parameters
ilECSSetting$server
type$a_content_id

Implements ilECSCommandQueueHandler.

Definition at line 90 of file class.ilECSCmsCourseCommandQueueHandler.php.

91 {
92 include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
93 include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsTree.php';
94 include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseConnector.php';
95
96 if (!$this->checkAllocationActivation($server, $a_content_id)) {
97 return true;
98 }
99 try {
100 $course = $this->readCourse($server, $a_content_id);
101 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': ' . print_r($course, true));
102 $this->doUpdate($a_content_id, $course);
103 return true;
104 } catch (ilECSConnectorException $e) {
105 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Course creation failed with mesage ' . $e->getMessage());
106 return false;
107 }
108 return true;
109 }
checkAllocationActivation(ilECSSetting $server, $a_content_id)
Check if course allocation is activated for one recipient of the.
readCourse(ilECSSetting $server, $a_content_id, $a_details=false)
Read course from ecs.

References Vendor\Package\$e, $GLOBALS, checkAllocationActivation(), doUpdate(), and readCourse().

+ Here is the call graph for this function:

◆ handleDelete()

ilECSCmsCourseCommandQueueHandler::handleDelete ( ilECSSetting  $server,
  $a_content_id 
)

Handle delete.

Parameters
ilECSSetting$server
type$a_content_id

Implements ilECSCommandQueueHandler.

Definition at line 116 of file class.ilECSCmsCourseCommandQueueHandler.php.

117 {
118 // nothing todo
119 return true;
120 }

◆ handleUpdate()

ilECSCmsCourseCommandQueueHandler::handleUpdate ( ilECSSetting  $server,
  $a_content_id 
)

Handle update.

Parameters
ilECSSetting$server
type$a_content_id

Implements ilECSCommandQueueHandler.

Definition at line 127 of file class.ilECSCmsCourseCommandQueueHandler.php.

128 {
129 if (!$this->checkAllocationActivation($server, $a_content_id)) {
130 return true;
131 }
132
133 try {
134 $course = $this->readCourse($server, $a_content_id);
135 $this->doUpdate($a_content_id, $course);
136 return true;
137 } catch (ilECSConnectorException $e) {
138 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Course creation failed with mesage ' . $e->getMessage());
139 return false;
140 }
141 return true;
142 }

References Vendor\Package\$e, $GLOBALS, checkAllocationActivation(), doUpdate(), and readCourse().

+ Here is the call graph for this function:

◆ readCourse()

ilECSCmsCourseCommandQueueHandler::readCourse ( ilECSSetting  $server,
  $a_content_id,
  $a_details = false 
)
private

Read course from ecs.

Returns
boolean

Definition at line 164 of file class.ilECSCmsCourseCommandQueueHandler.php.

165 {
166 try {
167 include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseConnector.php';
168 $crs_reader = new ilECSCourseConnector($server);
169 return $crs_reader->getCourse($a_content_id, $a_details);
170 } catch (ilECSConnectorException $e) {
171 throw $e;
172 }
173 }

References Vendor\Package\$e, and $server.

Referenced by handleCreate(), and handleUpdate().

+ Here is the caller graph for this function:

Field Documentation

◆ $mid

ilECSCmsCourseCommandQueueHandler::$mid = 0
private

Definition at line 18 of file class.ilECSCmsCourseCommandQueueHandler.php.

Referenced by getMid().

◆ $server

ilECSCmsCourseCommandQueueHandler::$server = null
private

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