ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilExAssignmentTeam Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilExAssignmentTeam:

Public Member Functions

 __construct (?int $a_id=null)
 
 getId ()
 
 createTeam (int $a_assignment_id, int $a_user_id)
 
 getMembers ()
 
 getMembersOfAllTeams ()
 Get members for all teams of assignment. More...
 
 addTeamMember (int $a_user_id, ?int $a_exc_ref_id=null)
 
 removeTeamMember (int $a_user_id, ?int $a_exc_ref_id=null)
 
 writeLog (int $a_action, ?string $a_details=null)
 
 getLog ()
 
 sendNotification (int $a_exc_ref_id, int $a_user_id, string $a_action)
 Send notification about team status. More...
 
 createRandomTeams (int $a_exercise_id, int $a_assignment_id, int $a_number_teams, int $a_min_participants)
 Create random teams for assignment type "team upload" following specific rules. More...
 

Static Public Member Functions

static getInstanceByUserId (int $a_assignment_id, int $a_user_id, bool $a_create_on_demand=false)
 
static getInstancesFromMap (int $a_assignment_id)
 
static getTeamId (int $a_assignment_id, int $a_user_id, bool $a_create_on_demand=false)
 
static getAssignmentTeamMap (int $a_ass_id)
 
static writeTeamLog (int $a_team_id, int $a_action, ?string $a_details=null)
 Add entry to team log. More...
 
static getAdoptableTeamAssignments (int $a_exercise_id, ?int $a_exclude_ass_id=null, ?int $a_user_id=null)
 
static adoptTeams (int $a_source_ass_id, int $a_target_ass_id, ?int $a_user_id=null, ?int $a_exc_ref_id=null)
 
static getAdoptableGroups (int $a_exc_ref_id)
 
static getGroupMembersMap (int $a_exc_ref_id)
 

Data Fields

const TEAM_LOG_CREATE_TEAM = 1
 
const TEAM_LOG_ADD_MEMBER = 2
 
const TEAM_LOG_REMOVE_MEMBER = 3
 
const TEAM_LOG_ADD_FILE = 4
 
const TEAM_LOG_REMOVE_FILE = 5
 

Protected Member Functions

 read (int $a_id)
 
 cleanLog ()
 Remove obsolete log entries. More...
 

Protected Attributes

ILIAS Exercise Team TeamManager $team_manager
 
ILIAS Exercise Team TeamDBRepository $repo
 
ilDBInterface $db
 
ilObjUser $user
 
int $id = null
 
int $assignment_id
 
array $members = array()
 

Private Member Functions

 setId (?int $a_id)
 

Detailed Description

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 Exercise assignment team

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 25 of file class.ilExAssignmentTeam.php.

Constructor & Destructor Documentation

◆ __construct()

ilExAssignmentTeam::__construct ( ?int  $a_id = null)

Definition at line 41 of file class.ilExAssignmentTeam.php.

References $DIC, read(), and ILIAS\Repository\user().

42  {
43  global $DIC;
44  $this->db = $DIC->database();
45  $this->user = $DIC->user();
46  $this->repo = $DIC->exercise()->internal()->repo()->team();
47  $this->team_manager = $DIC->exercise()->internal()->domain()->team();
48  if ($a_id) {
49  $this->read($a_id);
50  }
51  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ addTeamMember()

ilExAssignmentTeam::addTeamMember ( int  $a_user_id,
?int  $a_exc_ref_id = null 
)
Exceptions
ilExcUnknownAssignmentTypeException

Definition at line 187 of file class.ilExAssignmentTeam.php.

References $db, $ilDB, ilObjUser\_lookupFullname(), getMembersOfAllTeams(), read(), sendNotification(), and writeLog().

Referenced by createRandomTeams().

190  : bool {
191  $ilDB = $this->db;
192 
193  if (!$this->id) {
194  return false;
195  }
196 
197  // must not be in any team already
198  if (!in_array($a_user_id, $this->getMembersOfAllTeams())) {
199 
200  // get team status...
201  $status = $this->team_manager->getStatusForTeam($this->id);
202 
203  $this->repo->addUser(
204  $this->id,
205  $this->assignment_id,
206  $a_user_id
207  );
208 
209  // ...set status for new team member
210  $mem_stat = new ilExAssignmentMemberStatus(
211  $this->assignment_id,
212  $a_user_id
213  );
214  $mem_stat->setStatus($status);
215  $mem_stat->update();
216 
217 
218  if ($a_exc_ref_id) {
219  $this->sendNotification($a_exc_ref_id, $a_user_id, "add");
220  }
221 
222  $this->writeLog(
223  self::TEAM_LOG_ADD_MEMBER,
224  ilObjUser::_lookupFullname($a_user_id)
225  );
226 
227  $this->read($this->id);
228 
229  return true;
230  }
231 
232  return false;
233  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupFullname(int $a_user_id)
sendNotification(int $a_exc_ref_id, int $a_user_id, string $a_action)
Send notification about team status.
writeLog(int $a_action, ?string $a_details=null)
getMembersOfAllTeams()
Get members for all teams of assignment.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ adoptTeams()

static ilExAssignmentTeam::adoptTeams ( int  $a_source_ass_id,
int  $a_target_ass_id,
?int  $a_user_id = null,
?int  $a_exc_ref_id = null 
)
static
Exceptions
ilExcUnknownAssignmentTypeException

Definition at line 437 of file class.ilExAssignmentTeam.php.

References $user_id, getId(), ilExcIndividualDeadline\getInstance(), and null.

Referenced by ilExSubmissionTeamGUI\createAdoptedTeamObject(), and ilExAssignmentEditorGUI\generateTeams().

442  : void {
443  $teams = array();
444 
445  $old_team = null;
446  foreach (self::getAssignmentTeamMap($a_source_ass_id) as $user_id => $team_id) {
447  $teams[$team_id][] = $user_id;
448 
449  if ($a_user_id && $user_id == $a_user_id) {
450  $old_team = $team_id;
451  }
452  }
453 
454  if ($a_user_id) {
455  // no existing team (in source) or user already in team (in current)
456  if (!$old_team ||
457  self::getInstanceByUserId($a_target_ass_id, $a_user_id)->getId()) {
458  return;
459  }
460  }
461 
462  $current_map = self::getAssignmentTeamMap($a_target_ass_id);
463 
464  foreach ($teams as $team_id => $user_ids) {
465  if (!$old_team || $team_id == $old_team) {
466  // only not assigned users
467  $missing = array();
468  foreach ($user_ids as $user_id) {
469  if (!array_key_exists($user_id, $current_map)) {
470  $missing[] = $user_id;
471  }
472  }
473 
474  if ($missing !== []) {
475  // create new team
476  $first = array_shift($missing);
477  $new_team = self::getInstanceByUserId($a_target_ass_id, $first, true);
478 
479  // give new team starting time of original user
480  if ($a_user_id > 0 && $old_team > 0) {
481  $idl = ilExcIndividualDeadline::getInstance($a_target_ass_id, $a_user_id);
482  if ($idl->getStartingTimestamp()) {
483  $idl_team = ilExcIndividualDeadline::getInstance($a_target_ass_id, $new_team->getId(), true);
484  $idl_team->setStartingTimestamp($idl->getStartingTimestamp());
485  $idl_team->save();
486  }
487  }
488 
489  if ($a_exc_ref_id) {
490  // getTeamId() does NOT send notification
491  $new_team->sendNotification($a_exc_ref_id, $first, "add");
492  }
493 
494  foreach ($missing as $user_id) {
495  $new_team->addTeamMember($user_id, $a_exc_ref_id);
496  }
497  }
498  }
499  }
500  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getInstance(int $a_ass_id, int $a_participant_id, bool $a_is_team=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanLog()

ilExAssignmentTeam::cleanLog ( )
protected

Remove obsolete log entries.

As there is no proper team deletion event, we are doing it this way

Definition at line 332 of file class.ilExAssignmentTeam.php.

References $db, $ilDB, and $q.

Referenced by getLog().

332  : void
333  {
334  $ilDB = $this->db;
335 
336  // #18179
337 
338  // see also #31565
339  $obsolete_teams = [];
340  $set = $ilDB->query("SELECT DISTINCT l.team_id as id FROM il_exc_team_log as l LEFT JOIN il_exc_team as t ON (l.team_id = t.id) WHERE t.id IS NULL;");
341  while ($row = $ilDB->fetchAssoc($set)) {
342  $obsolete_teams[] = $row["id"];
343  }
344 
345  if (count($obsolete_teams) > 0) {
346  $q = "DELETE FROM il_exc_team_log" .
347  " WHERE " . $ilDB->in("team_id", $obsolete_teams, false, "integer");
348  $ilDB->manipulate($q);
349  }
350  }
$q
Definition: shib_logout.php:21
+ Here is the caller graph for this function:

◆ createRandomTeams()

ilExAssignmentTeam::createRandomTeams ( int  $a_exercise_id,
int  $a_assignment_id,
int  $a_number_teams,
int  $a_min_participants 
)

Create random teams for assignment type "team upload" following specific rules.

example:

  • total exercise members : 9 members
  • total number of teams to create (defined via form): 4 groups
  • number of users per team –> 9 / 4 = 2 users
  • users to spread over groups –> 9 % 4 = 1 user
  • final teams: 3 teams of 2 users and 1 team of 3 users.
    Exceptions
    ilExcUnknownAssignmentTypeException
    Exception

Definition at line 555 of file class.ilExAssignmentTeam.php.

References $exercise, addTeamMember(), createTeam(), and setId().

560  : void {
561  //just in case...
562  if (count(self::getAssignmentTeamMap($a_assignment_id))) {
563  return;
564  }
565  $exercise = new ilObjExercise($a_exercise_id, false);
566  $obj_exc_members = new ilExerciseMembers($exercise);
567  $members = $obj_exc_members->getMembers();
568  $total_exc_members = count($members);
569  $number_of_teams = $a_number_teams;
570  if (!$number_of_teams) {
571  if ($a_min_participants) {
572  $number_of_teams = round($total_exc_members / $a_min_participants);
573  } else {
574  $number_of_teams = random_int(1, $total_exc_members);
575  }
576  }
577  $members_per_team = round($total_exc_members / $number_of_teams);
578  shuffle($members);
579  for ($i = 0;$i < $number_of_teams;$i++) {
580  $members_counter = 0;
581  while (!empty($members) && $members_counter < $members_per_team) {
582  $member_id = array_pop($members);
583  if ($members_counter == 0) {
584  $team_id = $this->createTeam($a_assignment_id, $member_id);
585  $this->setId($team_id);
586  $this->assignment_id = $a_assignment_id;
587  } else {
588  $this->addTeamMember($member_id);
589  }
590  $members_counter++;
591  }
592  }
593  //get the new teams, remove duplicates.
594  $teams = array_unique(array_values(self::getAssignmentTeamMap($a_assignment_id)));
595  shuffle($teams);
596  while (!empty($members)) {
597  $member_id = array_pop($members);
598  $team_id = array_pop($teams);
599  $this->setId($team_id);
600  $this->addTeamMember($member_id);
601  }
602  }
createTeam(int $a_assignment_id, int $a_user_id)
addTeamMember(int $a_user_id, ?int $a_exc_ref_id=null)
Class ilObjExercise.
+ Here is the call graph for this function:

◆ createTeam()

ilExAssignmentTeam::createTeam ( int  $a_assignment_id,
int  $a_user_id 
)

Definition at line 146 of file class.ilExAssignmentTeam.php.

References $id, and ilObjUser\_lookupFullname().

Referenced by createRandomTeams().

149  : int {
150 
151  $id = $this->team_manager->create(
152  $a_assignment_id,
153  $a_user_id
154  );
155 
156  self::writeTeamLog($id, self::TEAM_LOG_CREATE_TEAM);
157  self::writeTeamLog(
158  $id,
159  self::TEAM_LOG_ADD_MEMBER,
160  ilObjUser::_lookupFullname($a_user_id)
161  );
162  return $id;
163  }
static _lookupFullname(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdoptableGroups()

static ilExAssignmentTeam::getAdoptableGroups ( int  $a_exc_ref_id)
static
Parameters
int$a_exc_ref_id
Returns
int[] group obj ids

Definition at line 510 of file class.ilExAssignmentTeam.php.

References $DIC, and $res.

Referenced by ilExerciseManagementGUI\membersObject().

510  : array
511  {
512  global $DIC;
513 
514  $tree = $DIC->repositoryTree();
515 
516  $res = array();
517 
518  $parent_ref_id = $tree->getParentId($a_exc_ref_id);
519  if ($parent_ref_id) {
520  foreach ($tree->getChildsByType($parent_ref_id, "grp") as $group) {
521  $res[] = $group["obj_id"];
522  }
523  }
524 
525  return $res;
526  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getAdoptableTeamAssignments()

static ilExAssignmentTeam::getAdoptableTeamAssignments ( int  $a_exercise_id,
?int  $a_exclude_ass_id = null,
?int  $a_user_id = null 
)
static

Definition at line 383 of file class.ilExAssignmentTeam.php.

References $data, $res, $user_id, ilExAssignment\getAssignmentDataOfExercise(), null, ilArrayUtil\sortArray(), and ilExAssignment\TYPE_UPLOAD_TEAM.

Referenced by ilExSubmissionTeamGUI\createTeamObject(), ilExSubmissionTeamGUI\getAdoptForm(), and ilExAssignmentEditorGUI\initAssignmentForm().

387  : array {
388  $res = array();
389 
391  foreach ($data as $row) {
392  if ($a_exclude_ass_id && $row["id"] == $a_exclude_ass_id) {
393  continue;
394  }
395 
396  if ($row["type"] == ilExAssignment::TYPE_UPLOAD_TEAM) {
397  $map = self::getAssignmentTeamMap($row["id"]);
398 
399  if ($a_user_id && !array_key_exists($a_user_id, $map)) {
400  continue;
401  }
402 
403  if ($map !== []) {
404  $user_team = null;
405  if ($a_user_id) {
406  $user_team_id = $map[$a_user_id];
407  $user_team = array();
408  foreach ($map as $user_id => $team_id) {
409  if ($user_id != $a_user_id &&
410  $user_team_id == $team_id) {
411  $user_team[] = $user_id;
412  }
413  }
414  }
415 
416  if (!$a_user_id ||
417  count($user_team)) {
418  $res[$row["id"]] = array(
419  "title" => $row["title"],
420  "teams" => count(array_flip($map)),
421  );
422 
423  if ($a_user_id) {
424  $res[$row["id"]]["user_team"] = $user_team;
425  }
426  }
427  }
428  }
429  }
430 
431  return ilArrayUtil::sortArray($res, "title", "asc", false, true);
432  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getAssignmentDataOfExercise(int $a_exc_id)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAssignmentTeamMap()

static ilExAssignmentTeam::getAssignmentTeamMap ( int  $a_ass_id)
static

Definition at line 267 of file class.ilExAssignmentTeam.php.

References $DIC.

Referenced by ILIAS\Exercise\Submission\SubmissionManager\copySubmissionsToDir(), ilExerciseManagementGUI\createTeamsFromGroupsObject(), ilExAssignmentEditorGUI\generateTeams(), ilExSubmissionTeamGUI\getAdoptForm(), ilExAssignmentEditorGUI\initAssignmentForm(), ilAssignmentsPerParticipantTableGUI\parseData(), and ilParticipantsPerAssignmentTableGUI\parseData().

267  : array
268  {
269  global $DIC;
270 
271  $repo = $DIC->exercise()->internal()->repo()->team();
272  return $repo->getUserTeamMap($a_ass_id);
273  }
global $DIC
Definition: shib_login.php:22
ILIAS Exercise Team TeamDBRepository $repo
+ Here is the caller graph for this function:

◆ getGroupMembersMap()

static ilExAssignmentTeam::getGroupMembersMap ( int  $a_exc_ref_id)
static

Definition at line 528 of file class.ilExAssignmentTeam.php.

References $res, ilObject\_lookupTitle(), and ilArrayUtil\sortArray().

Referenced by ilExerciseManagementGUI\createTeamsFromGroupsObject(), and ilExerciseManagementGUI\initGroupForm().

528  : array
529  {
530  $res = array();
531 
532  foreach (self::getAdoptableGroups($a_exc_ref_id) as $grp_obj_id) {
533  $members_obj = new ilGroupParticipants($grp_obj_id);
534 
535  $res[$grp_obj_id] = array(
536  "title" => ilObject::_lookupTitle($grp_obj_id)
537  ,"members" => $members_obj->getMembers()
538  );
539  }
540 
541  return ilArrayUtil::sortArray($res, "title", "asc", false, true);
542  }
$res
Definition: ltiservices.php:66
static _lookupTitle(int $obj_id)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getId()

ilExAssignmentTeam::getId ( )

Definition at line 81 of file class.ilExAssignmentTeam.php.

References $id.

Referenced by adoptTeams().

81  : ?int
82  {
83  return $this->id;
84  }
+ Here is the caller graph for this function:

◆ getInstanceByUserId()

static ilExAssignmentTeam::getInstanceByUserId ( int  $a_assignment_id,
int  $a_user_id,
bool  $a_create_on_demand = false 
)
static

Definition at line 53 of file class.ilExAssignmentTeam.php.

References $id.

Referenced by ilExSubmission\__construct(), ilExerciseManagementGUI\createTeamsFromGroupsObject(), ilExerciseManagementGUI\createTeamsObject(), ilExerciseManagementGUI\dissolveTeamsObject(), ilExcRepoObjAssignmentInfo\getInfo(), and ilExcAssMemberState\getInstanceByIds().

57  : self {
58  $id = self::getTeamId($a_assignment_id, $a_user_id, $a_create_on_demand);
59  return new self($id);
60  }
+ Here is the caller graph for this function:

◆ getInstancesFromMap()

static ilExAssignmentTeam::getInstancesFromMap ( int  $a_assignment_id)
static

Definition at line 62 of file class.ilExAssignmentTeam.php.

References $members, $res, and $user_id.

Referenced by ilExerciseManagementGUI\initIndividualDeadlineForm(), and ilParticipantsPerAssignmentTableGUI\parseData().

62  : array
63  {
64  $teams = array();
65  foreach (self::getAssignmentTeamMap($a_assignment_id) as $user_id => $team_id) {
66  $teams[$team_id][] = $user_id;
67  }
68 
69  $res = array();
70  foreach ($teams as $team_id => $members) {
71  $team = new self();
72  $team->id = $team_id;
73  $team->assignment_id = $a_assignment_id;
74  $team->members = $members;
75  $res[$team_id] = $team;
76  }
77 
78  return $res;
79  }
$res
Definition: ltiservices.php:66
+ Here is the caller graph for this function:

◆ getLog()

ilExAssignmentTeam::getLog ( )

Definition at line 309 of file class.ilExAssignmentTeam.php.

References $db, $ilDB, $res, and cleanLog().

309  : array
310  {
311  $ilDB = $this->db;
312 
313  $this->cleanLog();
314 
315  $res = array();
316 
317  $sql = "SELECT * FROM il_exc_team_log" .
318  " WHERE team_id = " . $ilDB->quote($this->id, "integer") .
319  " ORDER BY tstamp DESC";
320  $set = $ilDB->query($sql);
321  while ($row = $ilDB->fetchAssoc($set)) {
322  $res[] = $row;
323  }
324  return $res;
325  }
$res
Definition: ltiservices.php:66
cleanLog()
Remove obsolete log entries.
+ Here is the call graph for this function:

◆ getMembers()

ilExAssignmentTeam::getMembers ( )

Definition at line 166 of file class.ilExAssignmentTeam.php.

References $members.

166  : array
167  {
168  return $this->members;
169  }

◆ getMembersOfAllTeams()

ilExAssignmentTeam::getMembersOfAllTeams ( )

Get members for all teams of assignment.

Returns
int[] user ids

Definition at line 175 of file class.ilExAssignmentTeam.php.

Referenced by addTeamMember().

175  : array
176  {
177  return iterator_to_array(
178  $this->repo->getAllMemberIdsOfAssignment($this->assignment_id)
179  );
180  }
+ Here is the caller graph for this function:

◆ getTeamId()

static ilExAssignmentTeam::getTeamId ( int  $a_assignment_id,
int  $a_user_id,
bool  $a_create_on_demand = false 
)
static

Definition at line 105 of file class.ilExAssignmentTeam.php.

References $DIC, $id, $ilDB, ilObjUser\_lookupFullname(), and ilExcIndividualDeadline\getInstance().

Referenced by ilExAssignment\canParticipantReceiveFeedback(), ilExSubmissionTeamGUI\createAdoptedTeamObject(), ilExSubmissionTeamGUI\createSingleMemberTeamObject(), ilExSubmissionTeamGUI\createTeamObject(), ilExAssignment\getPersonalDeadline(), and ilExerciseSubmissionTableGUI\parseColumns().

109  : ?int {
110  global $DIC;
111 
112  $ilDB = $DIC->database();
113  $repo = $DIC->exercise()->internal()->repo()->team();
114  $manager = $DIC->exercise()->internal()->domain()->team();
115 
116  $id = $repo->getTeamForMember($a_assignment_id, $a_user_id);
117 
118  if (!$id && $a_create_on_demand) {
119 
120  $id = $manager->create(
121  $a_assignment_id,
122  $a_user_id
123  );
124 
125  // get starting timestamp (relative deadlines) from individual deadline
126  $idl = ilExcIndividualDeadline::getInstance($a_assignment_id, $a_user_id);
127 
128  // set starting timestamp for created team
129  if ($idl->getStartingTimestamp() > 0) {
130  $idl_team = ilExcIndividualDeadline::getInstance($a_assignment_id, $id, true);
131  $idl_team->setStartingTimestamp($idl->getStartingTimestamp());
132  $idl_team->save();
133  }
134 
135  self::writeTeamLog($id, self::TEAM_LOG_CREATE_TEAM);
136  self::writeTeamLog(
137  $id,
138  self::TEAM_LOG_ADD_MEMBER,
139  ilObjUser::_lookupFullname($a_user_id)
140  );
141  }
142 
143  return $id;
144  }
static _lookupFullname(int $a_user_id)
global $DIC
Definition: shib_login.php:22
ILIAS Exercise Team TeamDBRepository $repo
static getInstance(int $a_ass_id, int $a_participant_id, bool $a_is_team=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilExAssignmentTeam::read ( int  $a_id)
protected

Definition at line 91 of file class.ilExAssignmentTeam.php.

References $db, $ilDB, and setId().

Referenced by __construct(), addTeamMember(), and removeTeamMember().

91  : void
92  {
93  $ilDB = $this->db;
94 
95  // #18094
96  $this->members = [];
97  $this->setId($a_id);
98  foreach ($this->repo->getMembers($a_id) as $member) {
99  $this->assignment_id = $member->getAssignmentId();
100  $this->members[] = $member->getUserId();
101  }
102  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeTeamMember()

ilExAssignmentTeam::removeTeamMember ( int  $a_user_id,
?int  $a_exc_ref_id = null 
)
Exceptions
ilExcUnknownAssignmentTypeException

Definition at line 238 of file class.ilExAssignmentTeam.php.

References $db, $ilDB, ilObjUser\_lookupFullname(), read(), sendNotification(), and writeLog().

Referenced by ilExSubmission\deleteUser().

241  : void {
242  $ilDB = $this->db;
243 
244  if (!$this->id) {
245  return;
246  }
247 
248  $this->repo->removeUser(
249  $this->id,
250  $this->assignment_id,
251  $a_user_id
252  );
253 
254  if ($a_exc_ref_id) {
255  $this->sendNotification($a_exc_ref_id, $a_user_id, "rmv");
256  }
257 
258  $this->writeLog(
259  self::TEAM_LOG_REMOVE_MEMBER,
260  ilObjUser::_lookupFullname($a_user_id)
261  );
262 
263  $this->read($this->id);
264  }
static _lookupFullname(int $a_user_id)
sendNotification(int $a_exc_ref_id, int $a_user_id, string $a_action)
Send notification about team status.
writeLog(int $a_action, ?string $a_details=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendNotification()

ilExAssignmentTeam::sendNotification ( int  $a_exc_ref_id,
int  $a_user_id,
string  $a_action 
)

Send notification about team status.

Exceptions
ilExcUnknownAssignmentTypeException

Definition at line 356 of file class.ilExAssignmentTeam.php.

References $user.

Referenced by addTeamMember(), and removeTeamMember().

360  : void {
361  $ilUser = $this->user;
362 
363  // no need to notify current user
364  if (!$a_exc_ref_id ||
365  $ilUser->getId() == $a_user_id) {
366  return;
367  }
368  $ass = new ilExAssignment($this->assignment_id);
369 
370  $ntf = new ilSystemNotification();
371  $ntf->setLangModules(array("exc"));
372  $ntf->setRefId($a_exc_ref_id);
373  $ntf->setChangedByUserId($ilUser->getId());
374  $ntf->setSubjectLangId('exc_team_notification_subject_' . $a_action);
375  $ntf->setIntroductionLangId('exc_team_notification_body_' . $a_action);
376  $ntf->addAdditionalInfo("exc_assignment", $ass->getTitle());
377  $ntf->setGotoLangId('exc_team_notification_link');
378  $ntf->setReasonLangId('exc_team_notification_reason');
379  $ntf->sendMailAndReturnRecipients(array($a_user_id));
380  }
Exercise assignment.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ setId()

ilExAssignmentTeam::setId ( ?int  $a_id)
private

Definition at line 86 of file class.ilExAssignmentTeam.php.

Referenced by createRandomTeams(), and read().

86  : void
87  {
88  $this->id = $a_id;
89  }
+ Here is the caller graph for this function:

◆ writeLog()

ilExAssignmentTeam::writeLog ( int  $a_action,
?string  $a_details = null 
)

Definition at line 275 of file class.ilExAssignmentTeam.php.

Referenced by addTeamMember(), and removeTeamMember().

278  : void {
279  self::writeTeamLog($this->id, $a_action, $a_details);
280  }
+ Here is the caller graph for this function:

◆ writeTeamLog()

static ilExAssignmentTeam::writeTeamLog ( int  $a_team_id,
int  $a_action,
?string  $a_details = null 
)
static

Add entry to team log.

Definition at line 285 of file class.ilExAssignmentTeam.php.

References $DIC, and $ilDB.

289  : void {
290  global $DIC;
291 
292  $ilDB = $DIC->database();
293  $ilUser = $DIC->user();
294  $id = $ilDB->nextId('il_exc_team_log');
295 
296  $fields = array(
297  "log_id" => array("integer", $id),
298  "team_id" => array("integer", $a_team_id),
299  "user_id" => array("integer", $ilUser->getId()),
300  "action" => array("integer", $a_action),
301  "details" => array("text", $a_details),
302  "tstamp" => array("integer", time())
303  );
304 
305  $ilDB->insert("il_exc_team_log", $fields);
306  }
global $DIC
Definition: shib_login.php:22

Field Documentation

◆ $assignment_id

int ilExAssignmentTeam::$assignment_id
protected

Definition at line 38 of file class.ilExAssignmentTeam.php.

◆ $db

ilDBInterface ilExAssignmentTeam::$db
protected

Definition at line 35 of file class.ilExAssignmentTeam.php.

Referenced by addTeamMember(), cleanLog(), getLog(), read(), and removeTeamMember().

◆ $id

int ilExAssignmentTeam::$id = null
protected

Definition at line 37 of file class.ilExAssignmentTeam.php.

Referenced by createTeam(), getId(), getInstanceByUserId(), and getTeamId().

◆ $members

array ilExAssignmentTeam::$members = array()
protected

Definition at line 39 of file class.ilExAssignmentTeam.php.

Referenced by getInstancesFromMap(), and getMembers().

◆ $repo

ILIAS Exercise Team TeamDBRepository ilExAssignmentTeam::$repo
protected

Definition at line 33 of file class.ilExAssignmentTeam.php.

◆ $team_manager

ILIAS Exercise Team TeamManager ilExAssignmentTeam::$team_manager
protected

Definition at line 32 of file class.ilExAssignmentTeam.php.

◆ $user

ilObjUser ilExAssignmentTeam::$user
protected

Definition at line 36 of file class.ilExAssignmentTeam.php.

Referenced by sendNotification().

◆ TEAM_LOG_ADD_FILE

◆ TEAM_LOG_ADD_MEMBER

const ilExAssignmentTeam::TEAM_LOG_ADD_MEMBER = 2

Definition at line 28 of file class.ilExAssignmentTeam.php.

Referenced by ilExAssignmentTeamLogTableGUI\getItems().

◆ TEAM_LOG_CREATE_TEAM

const ilExAssignmentTeam::TEAM_LOG_CREATE_TEAM = 1

Definition at line 27 of file class.ilExAssignmentTeam.php.

Referenced by ilExAssignmentTeamLogTableGUI\getItems().

◆ TEAM_LOG_REMOVE_FILE

const ilExAssignmentTeam::TEAM_LOG_REMOVE_FILE = 5

◆ TEAM_LOG_REMOVE_MEMBER

const ilExAssignmentTeam::TEAM_LOG_REMOVE_MEMBER = 3

Definition at line 29 of file class.ilExAssignmentTeam.php.

Referenced by ilExAssignmentTeamLogTableGUI\getItems().


The documentation for this class was generated from the following file: