ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 

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.

References $GLOBALS, ilECSParticipantSetting\getInstance(), ilECSNodeMappingSettings\getInstanceByServerMid(), getMid(), and getServer().

Referenced by handleCreate(), and handleUpdate().

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['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['ilLog']->write(__METHOD__ . ': Course allocation disabled for ' . $this->getMid());
76  }
77  return $enabled;
78  } catch (ilECSConnectorException $e) {
79  $GLOBALS['ilLog']->write(__METHOD__ . ': Reading course details failed with message ' . $e->getMessage());
80  return false;
81  }
82  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static getInstanceByServerMid($a_server_id, $a_mid)
Get instance.
static getInstance($a_server_id, $mid)
Get instance by server id and mid.
+ 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.

References $GLOBALS, and getServer().

Referenced by handleCreate(), and handleUpdate().

151  {
152  $GLOBALS['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  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
+ 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.

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.

References $GLOBALS, checkAllocationActivation(), doUpdate(), and readCourse().

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['ilLog']->write(__METHOD__ . ': ' . print_r($course, true));
102  $this->doUpdate($a_content_id, $course);
103  return true;
104  } catch (ilECSConnectorException $e) {
105  $GLOBALS['ilLog']->write(__METHOD__ . ': Course creation failed with mesage ' . $e->getMessage());
106  return false;
107  }
108  return true;
109  }
readCourse(ilECSSetting $server, $a_content_id, $a_details=false)
Read course from ecs.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
checkAllocationActivation(ilECSSetting $server, $a_content_id)
Check if course allocation is activated for one recipient of the.
doUpdate($a_content_id, $course)
Perform update.
+ 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.

References $GLOBALS, checkAllocationActivation(), doUpdate(), and readCourse().

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['ilLog']->write(__METHOD__ . ': Course creation failed with mesage ' . $e->getMessage());
139  return false;
140  }
141  return true;
142  }
readCourse(ilECSSetting $server, $a_content_id, $a_details=false)
Read course from ecs.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
checkAllocationActivation(ilECSSetting $server, $a_content_id)
Check if course allocation is activated for one recipient of the.
doUpdate($a_content_id, $course)
Perform update.
+ 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.

Referenced by handleCreate(), and handleUpdate().

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  }
+ 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

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

Referenced by __construct(), and getServer().


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