ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
TeamManager.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Exercise\Team;
22 
27 
29 {
33 
34  public function __construct(
35  InternalRepoService $repo,
36  InternalDomainService $domain,
37  protected \ilExcTutorTeamFeedbackFileStakeholder $feedback_stakeholder
38  ) {
39  $this->repo = $repo->team();
40  $this->domain = $domain;
41  $this->feedback_repo = $repo->tutorFeedbackFileTeam();
42  }
43 
44  public function create(
45  int $ass_id,
46  int $first_user
47  ): int {
48  $id = $this->repo->create();
49  $this->repo->addUser($id, $ass_id, $first_user);
50  $this->domain->assignment()->tutorFeedbackFile($ass_id)->createCollection($first_user);
51  return $id;
52  }
53 
54  public function getTeamForMember(int $ass_id, int $user_id): ?int
55  {
56  return $this->repo->getTeamForMember($ass_id, $user_id);
57  }
58 
59  public function getStatusForTeam(int $team_id): string
60  {
61  $members = iterator_to_array($this->repo->getMembers($team_id));
62  $ass_id = $this->getAssignmentForTeam($team_id);
63  $mem_status = new \ilExAssignmentMemberStatus(
64  $ass_id,
65  current($members)->getUserId()
66  );
67  return $mem_status->getStatus();
68  }
69 
70  public function getAssignmentForTeam(int $team_id): int
71  {
72  return $this->repo->getAssignmentForTeam($team_id);
73  }
74 
75  public function deleteTeamsOfAssignment(int $ass_id): void
76  {
77  foreach ($this->repo->getTeamIdsOfAssignment($ass_id) as $team_id) {
78  $this->repo->deleteTeamLog($team_id);
79  $this->feedback_repo->deleteTeamCollection(
80  $team_id,
81  $this->feedback_stakeholder
82  );
83  $this->repo->deleteTeam($team_id);
84  }
85  }
86 
87 }
getTeamForMember(int $ass_id, int $user_id)
Definition: TeamManager.php:54
create(int $ass_id, int $first_user)
Definition: TeamManager.php:44
InternalDomainService $domain
Definition: TeamManager.php:32
__construct(InternalRepoService $repo, InternalDomainService $domain, protected \ilExcTutorTeamFeedbackFileStakeholder $feedback_stakeholder)
Definition: TeamManager.php:34
Table exc_team_data: Team Table il_exc_team: Team participants (holds the sequence due to historic re...
TutorFeedbackFileTeamRepository $feedback_repo
Definition: TeamManager.php:30
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23