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
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ protected function readAssignments($course, $course_member): array
// the sequence number in the course ressource
$sequence_number = (int) $pgroup->num;
// find parallel group with by sequence number
$tmp_pgroup = $course->groups[$sequence_number];
$tmp_pgroup = $course->groups[$sequence_number] ?? null;
if (is_object($tmp_pgroup) && $tmp_pgroup->id !== '') {
$this->log->debug('Found parallel group with id: ' . $tmp_pgroup->id . ': for sequence number: ' . $sequence_number);

// @todo check hierarchy of roles
$assigned[$tmp_pgroup->id][$member->personID] = array(
$assigned[$pgroup->id][$member->personID] = array(
'id' => $member->personID,
'role' => $pgroup->role
);
Expand Down Expand Up @@ -459,7 +459,7 @@ private function readCourseMember(ilECSSetting $server, $a_content_id)
*/
private function readCourse($course_member)
{
$ecs_id = ilECSImportManager::getInstance()->lookupEContentIdByContentId(
$ecs_id = ilECSImportManager::getInstance()->lookupLatestEContentIdByContentId(
$this->getServer()->getServerId(),
$this->getMid(),
$course_member->lectureID
Expand Down
14 changes: 14 additions & 0 deletions Services/WebServices/ECS/classes/class.ilECSImportManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@ public function lookupEContentIdByContentId($a_server_id, $a_mid, $a_content_id)
return 0;
}

public function lookupLatestEContentIdByContentId($a_server_id, $a_mid, $a_content_id): int
{
$query = 'SELECT * from ecs_import ' .
'WHERE server_id = ' . $this->db->quote($a_server_id, 'integer') . ' ' .
'AND mid = ' . $this->db->quote($a_mid, 'integer') . ' ' .
'AND content_id = ' . $this->db->quote($a_content_id, 'text') . ' ' .
'ORDER BY econtent_id DESC';
$res = $this->db->query($query);
if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
return (int) $row->econtent_id;
}
return 0;
}

/**
* get all imported links
*
Expand Down