ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
56  include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseConnector.php';
57  $crs_reader = new ilECSCourseConnector($server);
58  $details = $crs_reader->getCourse($a_content_id,true);
59  $this->mid = $details->getMySender();
60 
61  // Check if import is enabled
62  include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
63  $part = ilECSParticipantSetting::getInstance($this->getServer()->getServerId(), $this->getMid());
64  if(!$part->isImportEnabled())
65  {
66  $GLOBALS['ilLog']->write(__METHOD__.': Import disabled for mid '.$this->getMid());
67  return false;
68  }
69  // Check course allocation setting
70  include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingSettings.php';
72  $this->getServer()->getServerId(),
73  $this->getMid()
74  );
75  $enabled = $gl_settings->isCourseAllocationEnabled();
76  if(!$enabled)
77  {
78  $GLOBALS['ilLog']->write(__METHOD__.': Course allocation disabled for '.$this->getMid());
79  }
80  return $enabled;
81  }
82  catch(ilECSConnectorException $e)
83  {
84  $GLOBALS['ilLog']->write(__METHOD__.': Reading course details failed with message '. $e->getMessage());
85  return false;
86  }
87  }
$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 163 of file class.ilECSCmsCourseCommandQueueHandler.php.

References $GLOBALS, and getServer().

Referenced by handleCreate(), and handleUpdate().

164  {
165  $GLOBALS['ilLog']->write(__METHOD__.': Starting course creation/update');
166 
167  include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseCreationHandler.php';
168  $creation_handler = new ilECSCourseCreationHandler($this->getServer(),$this->mid);
169  $creation_handler->handle($a_content_id, $course);
170  }
$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 95 of file class.ilECSCmsCourseCommandQueueHandler.php.

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

96  {
97  include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
98  include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsTree.php';
99  include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseConnector.php';
100 
101  if(!$this->checkAllocationActivation($server, $a_content_id))
102  {
103  return true;
104  }
105  try
106  {
107  $course = $this->readCourse($server,$a_content_id);
108  $GLOBALS['ilLog']->write(__METHOD__.': '. print_r($course,true));
109  $this->doUpdate($a_content_id, $course);
110  return true;
111  }
112  catch(ilECSConnectorException $e)
113  {
114  $GLOBALS['ilLog']->write(__METHOD__.': Course creation failed with mesage ' . $e->getMessage());
115  return false;
116  }
117  return true;
118  }
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 125 of file class.ilECSCmsCourseCommandQueueHandler.php.

126  {
127  // nothing todo
128  return true;
129  }

◆ handleUpdate()

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

Handle update.

Parameters
ilECSSetting$server
type$a_content_id

Implements ilECSCommandQueueHandler.

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

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

137  {
138  if(!$this->checkAllocationActivation($server, $a_content_id))
139  {
140  return true;
141  }
142 
143  try
144  {
145  $course = $this->readCourse($server,$a_content_id);
146  $this->doUpdate($a_content_id, $course);
147  return true;
148  }
149  catch(ilECSConnectorException $e)
150  {
151  $GLOBALS['ilLog']->write(__METHOD__.': Course creation failed with mesage ' . $e->getMessage());
152  return false;
153  }
154  return true;
155  }
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 177 of file class.ilECSCmsCourseCommandQueueHandler.php.

Referenced by handleCreate(), and handleUpdate().

178  {
179  try
180  {
181  include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseConnector.php';
182  $crs_reader = new ilECSCourseConnector($server);
183  return $crs_reader->getCourse($a_content_id,$a_details);
184  }
185  catch(ilECSConnectorException $e)
186  {
187  throw $e;
188  }
189 
190  }
+ 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: