ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
20
25 {
26 $this->server = $server;
27 }
28
33 public function getServer()
34 {
35 return $this->server;
36 }
37
42 public function getMid()
43 {
44 return $this->mid;
45 }
46
52 public function checkAllocationActivation(ilECSSetting $server, $a_content_id)
53 {
54
55 }
56
57
63 public function handleCreate(ilECSSetting $server, $a_content_id)
64 {
65 try
66 {
67 include_once './Services/WebServices/ECS/classes/Connectors/class.ilECSEnrolmentStatus.php';
68 include_once './Services/WebServices/ECS/classes/Connectors/class.ilECSEnrolmentStatusConnector.php';
69 $enrolment_con = new ilECSEnrolmentStatusConnector($server);
70 $status = $enrolment_con->getEnrolmentStatus($a_content_id);
71 $GLOBALS['ilLog']->write(__METHOD__.': '.print_r($status,TRUE));
72 $GLOBALS['ilLog']->write(__METHOD__.': '.$status->getPersonIdType());
73 $GLOBALS['ilLog']->write(__METHOD__.': '.$status->getPersonId());
74 switch($status->getPersonIdType())
75 {
77 $id_arr = ilUtil::parseImportId($status->getPersonId());
78 $GLOBALS['ilLog']->write(__METHOD__.': Handling status change to '.$status->getStatus().' for user '.$id_arr['id']);
79 $this->doUpdate($id_arr['id'],$status);
80 break;
81
82
83
84 default:
85 $GLOBALS['ilLog']->write(__METHOD__.': not implemented yes: person id type: '.$status->getPersonIdType());
86 break;
87 }
88
89 }
91 {
92 $GLOBALS['ilLog']->write(__METHOD__.': Enrolment status change failed with messsage: '.$e->getMessage());
93 }
94 return TRUE;
95 }
96
102 public function handleDelete(ilECSSetting $server, $a_content_id)
103 {
104 // nothing todo
105 return true;
106 }
107
113 public function handleUpdate(ilECSSetting $server, $a_content_id)
114 {
115 // Shouldn't happen
116 return true;
117 }
118
119
125 protected function doUpdate($a_usr_id, ilECSEnrolmentStatus $status)
126 {
127 include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
128 $obj_ids = ilECSImport::lookupObjIdsByContentId($status->getId());
129 $obj_id = end($obj_ids);
130 $ref_ids = ilObject::_getAllReferences($obj_id);
131 $ref_id = end($ref_ids);
132
133
134 if(!$ref_id)
135 {
136 // Remote object not found
137 return TRUE;
138 }
139
140 switch($status->getStatus())
141 {
143 // nothing todo in the moment: maybe send mail
144 break;
145
147 $GLOBALS['ilLog']->write(__METHOD__.': Add desktop item: '.$a_usr_id.' '.$ref_id.' '.$obj_id);
149 break;
150
155 $GLOBALS['ilLog']->write(__METHOD__.': Remove desktop item: '.$a_usr_id.' '.$ref_id.' '.$obj_id);
157 break;
158 }
159 return TRUE;
160 }
161
162
163}
164?>
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 _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user's personal desktop
static _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user's personal desktop
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
static parseImportId($a_import_id)
Parse an ilias import id Typically of type il_[IL_INST_ID]_[OBJ_TYPE]_[OBJ_ID] returns array( 'orig' ...
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
Interface for all command queue handler classes.
$ref_id
Definition: sahs_server.php:39