ILIAS  release_8 Revision v8.24
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 34 of file class.ilECSCmsCourseCommandQueueHandler.php.

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

References $DIC, $server, and ILIAS\Repository\logger().

+ 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 65 of file class.ilECSCmsCourseCommandQueueHandler.php.

65 : ?bool
66 {
67 try {
68 $crs_reader = new ilECSCourseConnector($server);
69 $details = $crs_reader->getCourse($a_content_id, true);
70 $this->mid = $details->getMySender();
71
72 // Check if import is enabled
73 $part = ilECSParticipantSetting::getInstance($this->getServer()->getServerId(), $this->getMid());
74 if (!$part->isImportEnabled()) {
75 $this->logger->info(__METHOD__ . ': Import disabled for mid ' . $this->getMid());
76 return false;
77 }
78 // Check course allocation setting
80 $this->getServer()->getServerId(),
81 $this->getMid()
82 );
83 $enabled = $gl_settings->isCourseAllocationEnabled();
84 if (!$enabled) {
85 $this->logger->info(__METHOD__ . ': Course allocation disabled for ' . $this->getMid());
86 }
87 return $enabled;
88 } catch (ilECSConnectorException $e) {
89 $this->logger->error(__METHOD__ . ': Reading course details failed with message ' . $e->getMessage());
90 return false;
91 }
92 }
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.
bool $enabled
Whether the system instance is enabled to accept connection requests.
Definition: System.php:123
array $details
Details for error message relating to last request processed.
Definition: System.php:109

References ILIAS\LTI\ToolProvider\$details, Vendor\Package\$e, ILIAS\LTI\ToolProvider\$enabled, $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 148 of file class.ilECSCmsCourseCommandQueueHandler.php.

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

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 54 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 46 of file class.ilECSCmsCourseCommandQueueHandler.php.

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

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 98 of file class.ilECSCmsCourseCommandQueueHandler.php.

98 : bool
99 {
100 if (!$this->checkAllocationActivation($server, $a_content_id)) {
101 return true;
102 }
103 try {
104 $course = $this->readCourse($server, $a_content_id);
105 $this->logger->info(__METHOD__ . ': ' . print_r($course, true));
106 $this->doUpdate($a_content_id, $course);
107 return true;
108 } catch (ilECSConnectorException $e) {
109 $this->logger->error(__METHOD__ . ': Course creation failed with mesage ' . $e->getMessage());
110 return false;
111 }
112 return true;
113 }
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 118 of file class.ilECSCmsCourseCommandQueueHandler.php.

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

◆ handleUpdate()

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

Handle update.

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

127 : bool
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 $this->logger->error(__METHOD__ . ': Course creation failed with mesage ' . $e->getMessage());
139 return false;
140 }
141 return true;
142 }

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 159 of file class.ilECSCmsCourseCommandQueueHandler.php.

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

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 25 of file class.ilECSCmsCourseCommandQueueHandler.php.

◆ $mid

int ilECSCmsCourseCommandQueueHandler::$mid = 0
private

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

Referenced by getMid().

◆ $server

ilECSSetting ilECSCmsCourseCommandQueueHandler::$server
private

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