ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\Exercise\Team\TeamDBRepository Class Reference

Table exc_team_data: Team Table il_exc_team: Team participants (holds the sequence due to historic reasons) More...

+ Collaboration diagram for ILIAS\Exercise\Team\TeamDBRepository:

Public Member Functions

 __construct (\ilDBInterface $db, InternalDataService $data)
 
 create ()
 
 addUser (int $team_id, int $ass_id, int $user_id)
 
 removeUser (int $team_id, int $ass_id, int $user_id)
 
 getMembers (int $team_id)
 
 getTeamForMember (int $ass_id, int $user_id)
 
 getAllMemberIdsOfAssignment (int $assignment_id)
 
 getUserTeamMap (int $assignment_id)
 
 getAssignmentForTeam (int $team_id)
 
 getTeamIdsOfAssignment (int $ass_id)
 
 deleteTeam (int $team_id)
 
 deleteTeamLog (int $team_id)
 

Protected Attributes

InternalDataService $data
 
ilDBInterface $db
 

Detailed Description

Table exc_team_data: Team Table il_exc_team: Team participants (holds the sequence due to historic reasons)

Definition at line 29 of file TeamDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Exercise\Team\TeamDBRepository::__construct ( \ilDBInterface  $db,
InternalDataService  $data 
)

Definition at line 34 of file TeamDBRepository.php.

References ILIAS\Exercise\Team\TeamDBRepository\$data, and ILIAS\Exercise\Team\TeamDBRepository\$db.

37  {
38  $this->db = $db;
39  $this->data = $data;
40  }

Member Function Documentation

◆ addUser()

ILIAS\Exercise\Team\TeamDBRepository::addUser ( int  $team_id,
int  $ass_id,
int  $user_id 
)

Definition at line 51 of file TeamDBRepository.php.

51  : void
52  {
53  $this->db->insert("il_exc_team", [
54  "id" => ["integer", $team_id],
55  "ass_id" => ["integer", $ass_id],
56  "user_id" => ["integer", $user_id]
57  ]);
58  }

◆ create()

ILIAS\Exercise\Team\TeamDBRepository::create ( )

Definition at line 42 of file TeamDBRepository.php.

References $id.

42  : int
43  {
44  $id = $this->db->nextId("il_exc_team");
45  $this->db->insert("exc_team_data", [
46  "id" => ["integer", $id]
47  ]);
48  return $id;
49  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ deleteTeam()

ILIAS\Exercise\Team\TeamDBRepository::deleteTeam ( int  $team_id)

Definition at line 164 of file TeamDBRepository.php.

164  : void
165  {
166  $this->db->manipulateF(
167  "DELETE FROM il_exc_team WHERE " .
168  " id = %s ",
169  ["integer"],
170  [
171  $team_id
172  ]
173  );
174  $this->db->manipulateF(
175  "DELETE FROM exc_team_data WHERE " .
176  " id = %s ",
177  ["integer"],
178  [
179  $team_id
180  ]
181  );
182  }

◆ deleteTeamLog()

ILIAS\Exercise\Team\TeamDBRepository::deleteTeamLog ( int  $team_id)

Definition at line 184 of file TeamDBRepository.php.

184  : void
185  {
186  $this->db->manipulateF(
187  "DELETE FROM il_exc_team_log WHERE " .
188  " team_id = %s ",
189  ["integer"],
190  [
191  $team_id
192  ]
193  );
194  }

◆ getAllMemberIdsOfAssignment()

ILIAS\Exercise\Team\TeamDBRepository::getAllMemberIdsOfAssignment ( int  $assignment_id)

Definition at line 109 of file TeamDBRepository.php.

109  : \Generator
110  {
111  $set = $this->db->queryF(
112  "SELECT DISTINCT user_id FROM il_exc_team " .
113  " WHERE ass_id = %s ",
114  ["integer"],
115  [$assignment_id]
116  );
117  while ($rec = $this->db->fetchAssoc($set)) {
118  yield (int) $rec["user_id"];
119  }
120  }

◆ getAssignmentForTeam()

ILIAS\Exercise\Team\TeamDBRepository::getAssignmentForTeam ( int  $team_id)

Definition at line 137 of file TeamDBRepository.php.

137  : int
138  {
139  $set = $this->db->queryF(
140  "SELECT ass_id FROM il_exc_team " .
141  " WHERE id = %s ",
142  ["integer"],
143  [$team_id]
144  );
145  $rec = $this->db->fetchAssoc($set);
146  return (int) ($rec["ass_id"] ?? 0);
147  }

◆ getMembers()

ILIAS\Exercise\Team\TeamDBRepository::getMembers ( int  $team_id)
Returns
[TeamMember]

Definition at line 77 of file TeamDBRepository.php.

77  : \Generator
78  {
79  $set = $this->db->queryF(
80  "SELECT * FROM il_exc_team " .
81  " WHERE id = %s ",
82  ["integer"],
83  [$team_id]
84  );
85  while ($rec = $this->db->fetchAssoc($set)) {
86  yield $this->data->teamMember(
87  (int) $rec["id"],
88  (int) $rec["ass_id"],
89  (int) $rec["user_id"]
90  );
91  }
92  }

◆ getTeamForMember()

ILIAS\Exercise\Team\TeamDBRepository::getTeamForMember ( int  $ass_id,
int  $user_id 
)

Definition at line 94 of file TeamDBRepository.php.

94  : ?int
95  {
96  $set = $this->db->queryF(
97  "SELECT id FROM il_exc_team " .
98  " WHERE ass_id = %s AND user_id = %s",
99  ["integer", "integer"],
100  [$ass_id, $user_id]
101  );
102  $rec = $this->db->fetchAssoc($set);
103  if (isset($rec["id"])) {
104  return (int) $rec["id"];
105  }
106  return null;
107  }

◆ getTeamIdsOfAssignment()

ILIAS\Exercise\Team\TeamDBRepository::getTeamIdsOfAssignment ( int  $ass_id)

Definition at line 149 of file TeamDBRepository.php.

References ILIAS\Repository\int().

149  : array
150  {
151  $set = $this->db->queryF(
152  "SELECT DISTINCT(id) FROM il_exc_team " .
153  " WHERE ass_id = %s ",
154  ["integer"],
155  [$ass_id]
156  );
157  $team_ids = [];
158  while ($rec = $this->db->fetchAssoc($set)) {
159  $team_ids[] = (int) $rec["id"];
160  }
161  return $team_ids;
162  }
+ Here is the call graph for this function:

◆ getUserTeamMap()

ILIAS\Exercise\Team\TeamDBRepository::getUserTeamMap ( int  $assignment_id)

Definition at line 122 of file TeamDBRepository.php.

References ILIAS\Repository\int().

122  : array
123  {
124  $map = [];
125  $set = $this->db->queryF(
126  "SELECT * FROM il_exc_team " .
127  " WHERE ass_id = %s ",
128  ["integer"],
129  [$assignment_id]
130  );
131  while ($rec = $this->db->fetchAssoc($set)) {
132  $map[(int) $rec["user_id"]] = (int) $rec["id"];
133  }
134  return $map;
135  }
+ Here is the call graph for this function:

◆ removeUser()

ILIAS\Exercise\Team\TeamDBRepository::removeUser ( int  $team_id,
int  $ass_id,
int  $user_id 
)

Definition at line 60 of file TeamDBRepository.php.

60  : void
61  {
62  $this->db->manipulateF(
63  "DELETE FROM il_exc_team WHERE " .
64  " id = %s AND ass_id = %s AND user_id = %s",
65  ["integer", "integer", "integer"],
66  [
67  $team_id,
68  $ass_id,
69  $user_id
70  ]
71  );
72  }

Field Documentation

◆ $data

InternalDataService ILIAS\Exercise\Team\TeamDBRepository::$data
protected

◆ $db

ilDBInterface ILIAS\Exercise\Team\TeamDBRepository::$db
protected

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