ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilECSCmsCourseCommandQueueHandler Class Reference
+ 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...
 
- Public Member Functions inherited from ilECSCommandQueueHandler
 handleCreate (ilECSSetting $server, int $a_content_id)
 Handle create event. More...
 
 handleUpdate (ilECSSetting $server, int $a_content_id)
 Handle update. More...
 
 handleDelete (ilECSSetting $server, int $a_content_id)
 Handle delete action. More...
 

Protected Member Functions

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

Private Member Functions

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

Private Attributes

ilLogger $logger
 
ilECSSetting $server
 
int $mid = 0
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilECSCmsCourseCommandQueueHandler::__construct ( ilECSSetting  $server)

Constructor.

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

36 {
37 global $DIC;
38
39 $this->logger = $DIC->logger()->wsrv();
40
41 $this->server = $server;
42 }
global $DIC
Definition: shib_login.php:26

References $DIC, $server, ILIAS\Repository\logger(), and ILIAS\UI\examples\Progress\Bar\server().

+ Here is the call graph for this function:

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
$a_content_id
Returns
bool

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

66 : ?bool
67 {
68 try {
69 $crs_reader = new ilECSCourseConnector($server);
70 $details = $crs_reader->getCourse($a_content_id, true);
71 $this->mid = $details->getMySender();
72
73 // Check if import is enabled
74 $part = ilECSParticipantSetting::getInstance($this->getServer()->getServerId(), $this->getMid());
75 if (!$part->isImportEnabled()) {
76 $this->logger->info(__METHOD__ . ': Import disabled for mid ' . $this->getMid());
77 return false;
78 }
79 // Check course allocation setting
81 $this->getServer()->getServerId(),
82 $this->getMid()
83 );
84 $enabled = $gl_settings->isCourseAllocationEnabled();
85 if (!$enabled) {
86 $this->logger->info(__METHOD__ . ': Course allocation disabled for ' . $this->getMid());
87 }
88 return $enabled;
89 } catch (ilECSConnectorException $e) {
90 $this->logger->error(__METHOD__ . ': Reading course details failed with message ' . $e->getMessage());
91 return false;
92 }
93 }
static getInstanceByServerMid(int $a_server_id, int $a_mid)
Get instance.
static getInstance(int $a_server_id, int $mid)
Get instance by server id and mid.

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

Referenced by handleCreate(), and handleUpdate().

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

◆ doUpdate()

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

Perform update.

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

149 : void
150 {
151 $this->logger->info(__METHOD__ . ': Starting course creation/update');
152
153 $creation_handler = new ilECSCourseCreationHandler($this->getServer(), $this->mid);
154 $creation_handler->handle($a_content_id, $course);
155 }

References getServer(), and ILIAS\Repository\logger().

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.

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

References $mid.

Referenced by checkAllocationActivation().

+ Here is the caller graph for this function:

◆ getServer()

ilECSCmsCourseCommandQueueHandler::getServer ( )

Get server.

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

48 {
49 return $this->server;
50 }

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.

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

99 : bool
100 {
101 if (!$this->checkAllocationActivation($server, $a_content_id)) {
102 return true;
103 }
104 try {
105 $course = $this->readCourse($server, $a_content_id);
106 $this->logger->info(__METHOD__ . ': ' . print_r($course, true));
107 $this->doUpdate($a_content_id, $course);
108 return true;
109 } catch (ilECSConnectorException $e) {
110 $this->logger->error(__METHOD__ . ': Course creation failed with mesage ' . $e->getMessage());
111 return false;
112 }
113 return true;
114 }
checkAllocationActivation(ilECSSetting $server, $a_content_id)
Check if course allocation is activated for one recipient of the.
doUpdate(int $a_content_id, $course)
Perform update.
readCourse(ilECSSetting $server, $a_content_id)
Read course from ecs.

References Vendor\Package\$e, checkAllocationActivation(), doUpdate(), ILIAS\Repository\logger(), and readCourse().

+ Here is the call graph for this function:

◆ handleDelete()

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

Handle delete.

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

119 : bool
120 {
121 // nothing todo
122 return true;
123 }

◆ handleUpdate()

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

Handle update.

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

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

References Vendor\Package\$e, checkAllocationActivation(), doUpdate(), ILIAS\Repository\logger(), and readCourse().

+ Here is the call graph for this function:

◆ readCourse()

ilECSCmsCourseCommandQueueHandler::readCourse ( ilECSSetting  $server,
  $a_content_id 
)
private

Read course from ecs.

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

161 {
162 return (new ilECSCourseConnector($server))->getCourse($a_content_id, false);
163 }

References $server.

Referenced by handleCreate(), and handleUpdate().

+ Here is the caller graph for this function:

Field Documentation

◆ $logger

ilLogger ilECSCmsCourseCommandQueueHandler::$logger
private

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

◆ $mid

int ilECSCmsCourseCommandQueueHandler::$mid = 0
private

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

Referenced by getMid().

◆ $server

ilECSSetting ilECSCmsCourseCommandQueueHandler::$server
private

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