Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion components/ILIAS/Course/classes/class.ilCourseXMLParser.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

declare(strict_types=0);
/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -17,6 +16,8 @@
*
*********************************************************************/

declare(strict_types=0);

/**
* Course XML Parser
* @author Stefan Meyer <smeyer.ilias@gmx.de>
Expand Down Expand Up @@ -54,6 +55,12 @@ class ilCourseXMLParser extends ilMDSaxParser implements ilSaxSubsetParser
protected ilCourseWaitingList $course_waiting_list;
protected ?ilAdvancedMDValueParser $adv_md_handler = null;
protected array $course_members_array = [];
protected array $xml_mentioned_member_ids = [];

public function getProcessedMemberIds(): array
{
return $this->xml_mentioned_member_ids;
}

public function __construct(ilObjCourse $a_course_obj, string $a_xml_file = '')
{
Expand Down Expand Up @@ -440,6 +447,9 @@ private function handleTutor(array $a_attribs, array $id_data): void
*/
private function handleMember(array $a_attribs, array $id_data): void
{
if (!empty($id_data['usr_id'])) {
$this->xml_mentioned_member_ids[] = $id_data['usr_id'];
}
if (!isset($a_attribs['action']) || $a_attribs['action'] == 'Attach') {
// if action not set, or set and attach
if (!array_key_exists($id_data['usr_id'], $this->course_members_array)) {
Expand Down
58 changes: 32 additions & 26 deletions components/ILIAS/soap/classes/class.ilSoapCourseAdministration.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
<?php
/*
+-----------------------------------------------------------------------------+
| ILIAS open source |
+-----------------------------------------------------------------------------+
| Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software |
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
+-----------------------------------------------------------------------------+
*/

/**
* Soap course administration methods
* @author Stefan Meyer <smeyer.ilias@gmx.de>
* @version $Id$
* @package ilias
*/
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*********************************************************************/

class ilSoapCourseAdministration extends ilSoapAdministration
{
Expand Down Expand Up @@ -375,6 +363,15 @@ public function updateCourse(string $sid, int $course_id, string $xml)
$md = new ilMD($tmp_course->getId(), 0, 'crs');
$md->deleteAll();

$course_participants = ilCourseParticipants::_getInstanceByObjId($tmp_course->getId());
$all_members = $course_participants->getParticipants();
$blocked_users = [];
foreach ($all_members as $usr_id) {
if ($course_participants->isBlocked($usr_id)) {
$blocked_users[] = $usr_id;
}
}

ilCourseParticipants::_deleteAllEntries($tmp_course->getId());

ilCourseWaitingList::_deleteAll($tmp_course->getId());
Expand All @@ -384,6 +381,15 @@ public function updateCourse(string $sid, int $course_id, string $xml)
$xml_parser->setMode(ilCourseXMLParser::MODE_SOAP);
$xml_parser->setXMLContent($xml);
$xml_parser->startParsing();

$xml_processed_members = $xml_parser->getProcessedMemberIds();
$xml_lookup = array_flip($xml_processed_members);
$fresh_participants = ilCourseParticipants::_getInstanceByObjId($tmp_course->getId());
foreach ($blocked_users as $usr_id) {
if (!isset($xml_lookup[$usr_id]) && $fresh_participants->isMember($usr_id)) {
$fresh_participants->updateBlocked($usr_id, true);
}
}
$tmp_course->MDUpdateListener('General');

return true;
Expand Down
Loading