ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilECSEnrolmentStatusCommandQueueHandler.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once './Services/WebServices/ECS/interfaces/interface.ilECSCommandQueueHandler.php';
6include_once './Services/WebServices/ECS/classes/class.ilECSSetting.php';
7include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
8
9
16{
17 private $server = null;
18 private $mid = 0;
19
24
29 {
30 $this->server = $server;
31 $this->recommended_content_manager = new ilRecommendedContentManager();
32 }
33
38 public function getServer()
39 {
40 return $this->server;
41 }
42
47 public function getMid()
48 {
49 return $this->mid;
50 }
51
57 public function checkAllocationActivation(ilECSSetting $server, $a_content_id)
58 {
59 }
60
61
67 public function handleCreate(ilECSSetting $server, $a_content_id)
68 {
69 try {
70 include_once './Services/WebServices/ECS/classes/Connectors/class.ilECSEnrolmentStatus.php';
71 include_once './Services/WebServices/ECS/classes/Connectors/class.ilECSEnrolmentStatusConnector.php';
72 $enrolment_con = new ilECSEnrolmentStatusConnector($server);
73 $status = $enrolment_con->getEnrolmentStatus($a_content_id);
74 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': ' . print_r($status, true));
75 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': ' . $status->getPersonIdType());
76 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': ' . $status->getPersonId());
77 switch ($status->getPersonIdType()) {
79 $id_arr = ilUtil::parseImportId($status->getPersonId());
80 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Handling status change to ' . $status->getStatus() . ' for user ' . $id_arr['id']);
81 $this->doUpdate($id_arr['id'], $status);
82 break;
83
84
85
86 default:
87 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': not implemented yes: person id type: ' . $status->getPersonIdType());
88 break;
89 }
90 } catch (ilECSConnectorException $e) {
91 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Enrolment status change failed with messsage: ' . $e->getMessage());
92 }
93 return true;
94 }
95
101 public function handleDelete(ilECSSetting $server, $a_content_id)
102 {
103 // nothing todo
104 return true;
105 }
106
112 public function handleUpdate(ilECSSetting $server, $a_content_id)
113 {
114 // Shouldn't happen
115 return true;
116 }
117
118
124 protected function doUpdate($a_usr_id, ilECSEnrolmentStatus $status)
125 {
126 include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
127 $obj_ids = ilECSImport::lookupObjIdsByContentId($status->getId());
128 $obj_id = end($obj_ids);
129 $ref_ids = ilObject::_getAllReferences($obj_id);
130 $ref_id = end($ref_ids);
131
132
133 if (!$ref_id) {
134 // Remote object not found
135 return true;
136 }
137
138 switch ($status->getStatus()) {
140 // nothing todo in the moment: maybe send mail
141 break;
142
144 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Add recommended content: ' . $a_usr_id . ' ' . $ref_id . ' ' . $obj_id);
145 // deactivated for now, see discussion at
146 // https://docu.ilias.de/goto_docu_wiki_wpage_5620_1357.html
147 //$this->recommended_content_manager->addObjectRecommendation($a_usr_id, $ref_id);
148 break;
149
154 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Remove recommended content: ' . $a_usr_id . ' ' . $ref_id . ' ' . $obj_id);
155 $this->recommended_content_manager->removeObjectRecommendation($a_usr_id, $ref_id);
156 break;
157 }
158 return true;
159 }
160}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
handleUpdate(ilECSSetting $server, $a_content_id)
Handle update.
doUpdate($a_usr_id, ilECSEnrolmentStatus $status)
Perform update.
handleDelete(ilECSSetting $server, $a_content_id)
Handle delete.
handleCreate(ilECSSetting $server, $a_content_id)
Handle create.
checkAllocationActivation(ilECSSetting $server, $a_content_id)
Check if course allocation is activated for one recipient of the.
Connector for course member ressource.
static lookupObjIdsByContentId($a_content_id)
static _getAllReferences($a_id)
get all reference ids of object
Recommended content manager (business logic)
static parseImportId($a_import_id)
Parse an ilias import id Typically of type il_[IL_INST_ID]_[OBJ_TYPE]_[OBJ_ID] returns array( 'orig' ...
Interface for all command queue handler classes.