ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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)
 
 getMemberIds (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 183 of file TeamDBRepository.php.

183  : void
184  {
185  $this->db->manipulateF(
186  "DELETE FROM il_exc_team WHERE " .
187  " id = %s ",
188  ["integer"],
189  [
190  $team_id
191  ]
192  );
193  $this->db->manipulateF(
194  "DELETE FROM exc_team_data WHERE " .
195  " id = %s ",
196  ["integer"],
197  [
198  $team_id
199  ]
200  );
201  }

◆ deleteTeamLog()

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

Definition at line 203 of file TeamDBRepository.php.

203  : void
204  {
205  $this->db->manipulateF(
206  "DELETE FROM il_exc_team_log WHERE " .
207  " team_id = %s ",
208  ["integer"],
209  [
210  $team_id
211  ]
212  );
213  }

◆ getAllMemberIdsOfAssignment()

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

Definition at line 128 of file TeamDBRepository.php.

128  : \Generator
129  {
130  $set = $this->db->queryF(
131  "SELECT DISTINCT user_id FROM il_exc_team " .
132  " WHERE ass_id = %s ",
133  ["integer"],
134  [$assignment_id]
135  );
136  while ($rec = $this->db->fetchAssoc($set)) {
137  yield (int) $rec["user_id"];
138  }
139  }

◆ getAssignmentForTeam()

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

Definition at line 156 of file TeamDBRepository.php.

156  : int
157  {
158  $set = $this->db->queryF(
159  "SELECT ass_id FROM il_exc_team " .
160  " WHERE id = %s ",
161  ["integer"],
162  [$team_id]
163  );
164  $rec = $this->db->fetchAssoc($set);
165  return (int) ($rec["ass_id"] ?? 0);
166  }

◆ getMemberIds()

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

Definition at line 97 of file TeamDBRepository.php.

References ILIAS\Repository\int().

97  : array
98  {
99  $set = $this->db->queryF(
100  "SELECT user_id FROM il_exc_team " .
101  " WHERE id = %s ",
102  ["integer"],
103  [$team_id]
104  );
105  $ids = [];
106  while ($rec = $this->db->fetchAssoc($set)) {
107  $ids[] = (int) $rec["user_id"];
108  }
109  return $ids;
110  }
+ Here is the call graph for this function:

◆ 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 113 of file TeamDBRepository.php.

References null.

113  : ?int
114  {
115  $set = $this->db->queryF(
116  "SELECT id FROM il_exc_team " .
117  " WHERE ass_id = %s AND user_id = %s",
118  ["integer", "integer"],
119  [$ass_id, $user_id]
120  );
121  $rec = $this->db->fetchAssoc($set);
122  if (isset($rec["id"])) {
123  return (int) $rec["id"];
124  }
125  return null;
126  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getTeamIdsOfAssignment()

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

Definition at line 168 of file TeamDBRepository.php.

References ILIAS\Repository\int().

168  : array
169  {
170  $set = $this->db->queryF(
171  "SELECT DISTINCT(id) FROM il_exc_team " .
172  " WHERE ass_id = %s ",
173  ["integer"],
174  [$ass_id]
175  );
176  $team_ids = [];
177  while ($rec = $this->db->fetchAssoc($set)) {
178  $team_ids[] = (int) $rec["id"];
179  }
180  return $team_ids;
181  }
+ Here is the call graph for this function:

◆ getUserTeamMap()

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

Definition at line 141 of file TeamDBRepository.php.

References ILIAS\Repository\int().

141  : array
142  {
143  $map = [];
144  $set = $this->db->queryF(
145  "SELECT * FROM il_exc_team " .
146  " WHERE ass_id = %s ",
147  ["integer"],
148  [$assignment_id]
149  );
150  while ($rec = $this->db->fetchAssoc($set)) {
151  $map[(int) $rec["user_id"]] = (int) $rec["id"];
152  }
153  return $map;
154  }
+ 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: