/** * Perform update * @param type $a_content_id * @param type $course */ protected function doUpdate($a_usr_id, ilECSEnrolmentStatus $status) { include_once './Services/WebServices/ECS/classes/class.ilECSImport.php'; $obj_ids = ilECSImport::lookupObjIdsByContentId($status->getId()); $obj_id = end($obj_ids); $ref_ids = ilObject::_getAllReferences($obj_id); $ref_id = end($ref_ids); if (!$ref_id) { // Remote object not found return TRUE; } switch ($status->getStatus()) { case ilECSEnrolmentStatus::STATUS_PENDING: // nothing todo in the moment: maybe send mail break; case ilECSEnrolmentStatus::STATUS_ACTIVE: $GLOBALS['ilLog']->write(__METHOD__ . ': Add desktop item: ' . $a_usr_id . ' ' . $ref_id . ' ' . $obj_id); ilObjUser::_addDesktopItem($a_usr_id, $ref_id, ilObject::_lookupType($obj_id)); break; case ilECSEnrolmentStatus::STATUS_ACCOUNT_DEACTIVATED: case ilECSEnrolmentStatus::STATUS_DENIED: case ilECSEnrolmentStatus::STATUS_REJECTED: case ilECSEnrolmentStatus::STATUS_UNSUBSCRIBED: $GLOBALS['ilLog']->write(__METHOD__ . ': Remove desktop item: ' . $a_usr_id . ' ' . $ref_id . ' ' . $obj_id); ilObjUser::_dropDesktopItem($a_usr_id, $ref_id, ilObject::_lookupType($obj_id)); break; } return TRUE; }