ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ILIAS\Exercise\Submission\SubmissionRepository Class Reference
+ Inheritance diagram for ILIAS\Exercise\Submission\SubmissionRepository:
+ Collaboration diagram for ILIAS\Exercise\Submission\SubmissionRepository:

Public Member Functions

 __construct (protected IRSSWrapper $irss, protected InternalDataService $data, ?\ilDBInterface $db=null)
 
 getAllEntriesOfAssignment (int $ass_id)
 
 getSubmissionsOfTeam (int $ass_id, bool $type_uses_uploads, bool $type_uses_print_versions, int $team_id, ?array $submit_ids=null, bool $only_valid=false, ?string $min_timestamp=null, bool $print_versions=false)
 
 getSubmissionsOfUsers (int $ass_id, bool $type_uses_uploads, bool $type_uses_print_versions, array $user_ids, ?array $submit_ids=null, bool $only_valid=false, ?string $min_timestamp=null, bool $print_versions=false)
 
 getById (int $id)
 
 getUserId (int $submission_id)
 
 getAllSubmissionIdsOfOwner (int $ass_id, int $user_id)
 
 hasSubmissions (int $assignment_id)
 
 updateWebDirAccessTime (int $assignment_id, int $member_id)
 
 getUserSubmissionState (int $user_id, array $assignment_ids)
 Checks if a user has submitted anything for a number of assignments. More...
 
 updateLate (int $return_id, bool $late)
 
 getMaxAmountOfSubmittedFiles (int $obj_id, int $ass_id, int $user_id=0)
 Get the number of max amount of files submitted by a single user in the assignment. More...
 
 getUsersWithSubmission (int $ass_id)
 Get all user ids, that have submitted something. More...
 
 addLocalFile (int $obj_id, int $ass_id, int $user_id, int $team_id, string $file, string $filename, bool $is_late, ResourceStakeholder $stakeholder)
 
 addUpload (int $obj_id, int $ass_id, int $user_id, int $team_id, UploadResult $result, string $filename, bool $is_late, ResourceStakeholder $stakeholder)
 
 addZipUpload (int $obj_id, int $ass_id, int $user_id, int $team_id, UploadResult $result, bool $is_late, ResourceStakeholder $stakeholder, int $remaining_allowed)
 
 delete (int $id, ResourceStakeholder $stakeholder)
 
 deliverFile (int $ass_id, int $user_id, string $rid, string $filetitle="")
 
 getStream (int $ass_id, string $rid)
 

Protected Member Functions

 getSubmissions (string $where, int $ass_id, bool $type_uses_uploads, bool $type_uses_print_versions, ?array $submit_ids=null, bool $only_valid=false, ?string $min_timestamp=null, bool $print_versions=false)
 
 getSubmissionFromRecord (array $rec)
 

Protected Attributes

const TABLE_NAME = "exc_returned"
 
 $log
 
ilDBInterface $db
 

Detailed Description

Definition at line 30 of file class.SubmissionRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Exercise\Submission\SubmissionRepository::__construct ( protected IRSSWrapper  $irss,
protected InternalDataService  $data,
?\ilDBInterface  $db = null 
)

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

References ILIAS\Exercise\Submission\SubmissionRepository\$db, and $DIC.

40  {
41  global $DIC;
42  $this->log = $DIC->logger()->exc();
43  $this->db = (is_null($db))
44  ? $DIC->database()
45  : $db;
46  }
global $DIC
Definition: shib_login.php:26

Member Function Documentation

◆ addLocalFile()

ILIAS\Exercise\Submission\SubmissionRepository::addLocalFile ( int  $obj_id,
int  $ass_id,
int  $user_id,
int  $team_id,
string  $file,
string  $filename,
bool  $is_late,
ResourceStakeholder  $stakeholder 
)

Definition at line 341 of file class.SubmissionRepository.php.

References ILIAS\Exercise\Submission\SubmissionRepository\$db, $info, ILIAS\Exercise\Submission\Submission\$rid, ilFileUtils\getValidFilename(), and ilUtil\now().

350  : bool {
351  $db = $this->db;
352  $rid = $this->irss->importLocalFile(
353  $file,
354  $filename,
355  $stakeholder
356  );
358 
359  if ($rid !== "") {
360  $info = $this->irss->getResourceInfo($rid);
361  $next_id = $db->nextId("exc_returned");
362  $query = sprintf(
363  "INSERT INTO exc_returned " .
364  "(returned_id, obj_id, user_id, filename, filetitle, mimetype, ts, ass_id, late, team_id, rid) " .
365  "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
366  $db->quote($next_id, "integer"),
367  $db->quote($obj_id, "integer"),
368  $db->quote($user_id, "integer"),
369  $db->quote($filename, "text"),
370  $db->quote($filename, "text"),
371  $db->quote($info->getMimeType(), "text"),
372  $db->quote(\ilUtil::now(), "timestamp"),
373  $db->quote($ass_id, "integer"),
374  $db->quote($is_late, "integer"),
375  $db->quote($team_id, "integer"),
376  $db->quote($rid, "text")
377  );
378  $db->manipulate($query);
379  return true;
380  }
381  return false;
382  }
static getValidFilename(string $a_filename)
quote($value, string $type)
static now()
Return current timestamp in Y-m-d H:i:s format.
nextId(string $table_name)
$filename
Definition: buildRTE.php:78
$info
Definition: entry_point.php:21
manipulate(string $query)
Run a (write) Query on the database.
+ Here is the call graph for this function:

◆ addUpload()

ILIAS\Exercise\Submission\SubmissionRepository::addUpload ( int  $obj_id,
int  $ass_id,
int  $user_id,
int  $team_id,
UploadResult  $result,
string  $filename,
bool  $is_late,
ResourceStakeholder  $stakeholder 
)

Definition at line 400 of file class.SubmissionRepository.php.

References ILIAS\Exercise\Submission\SubmissionRepository\$db, $info, ILIAS\Exercise\Submission\Submission\$rid, ilFileUtils\getValidFilename(), and ilUtil\now().

409  : bool {
410  $db = $this->db;
411  $rid = $this->irss->importFileFromUploadResult(
412  $result,
413  $stakeholder
414  );
416 
417  if ($rid !== "") {
418  $info = $this->irss->getResourceInfo($rid);
419  $next_id = $db->nextId("exc_returned");
420  $query = sprintf(
421  "INSERT INTO exc_returned " .
422  "(returned_id, obj_id, user_id, filename, filetitle, mimetype, ts, ass_id, late, team_id, rid) " .
423  "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
424  $db->quote($next_id, "integer"),
425  $db->quote($obj_id, "integer"),
426  $db->quote($user_id, "integer"),
427  $db->quote($filename, "text"),
428  $db->quote($filename, "text"),
429  $db->quote($info->getMimeType(), "text"),
430  $db->quote(\ilUtil::now(), "timestamp"),
431  $db->quote($ass_id, "integer"),
432  $db->quote($is_late, "integer"),
433  $db->quote($team_id, "integer"),
434  $db->quote($rid, "text")
435  );
436  $db->manipulate($query);
437  return true;
438  }
439  return false;
440  }
static getValidFilename(string $a_filename)
quote($value, string $type)
static now()
Return current timestamp in Y-m-d H:i:s format.
nextId(string $table_name)
$filename
Definition: buildRTE.php:78
$info
Definition: entry_point.php:21
manipulate(string $query)
Run a (write) Query on the database.
+ Here is the call graph for this function:

◆ addZipUpload()

ILIAS\Exercise\Submission\SubmissionRepository::addZipUpload ( int  $obj_id,
int  $ass_id,
int  $user_id,
int  $team_id,
UploadResult  $result,
bool  $is_late,
ResourceStakeholder  $stakeholder,
int  $remaining_allowed 
)
Exceptions
ilExcTooManyFilesSubmittedException

Definition at line 445 of file class.SubmissionRepository.php.

References ILIAS\Exercise\Submission\SubmissionRepository\$db, $DIC, $filename, $info, ILIAS\Exercise\Submission\Submission\$rid, and ilUtil\now().

454  : array {
455  global $DIC;
456 
457  $db = $this->db;
458  $filenames = [];
459  $this->log->debug("5");
460  $rid = $this->irss->importFileFromUploadResult(
461  $result,
462  $stakeholder
463  );
464  $this->log->debug("6");
465  $stream = $this->irss->stream($rid);
466 
467  if ($remaining_allowed !== -1 &&
468  $remaining_allowed < $DIC->archives()->unzip($stream)->getAmountOfFiles()) {
469  throw new ilExcTooManyFilesSubmittedException("Too many files submitted.");
470  }
471 
472  foreach ($DIC->archives()->unzip($stream)->getFileStreams() as $stream) {
473  $this->log->debug("7");
474  $rid = $this->irss->importStream(
475  $stream,
476  $stakeholder
477  );
478  $info = $this->irss->getResourceInfo($rid);
479  $filename = $info->getTitle();
480  $this->log->debug("8");
481  if ($rid !== "") {
482  $this->log->debug("9");
483  $info = $this->irss->getResourceInfo($rid);
484  $next_id = $db->nextId("exc_returned");
485  $query = sprintf(
486  "INSERT INTO exc_returned " .
487  "(returned_id, obj_id, user_id, filename, filetitle, mimetype, ts, ass_id, late, team_id, rid) " .
488  "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
489  $db->quote($next_id, "integer"),
490  $db->quote($obj_id, "integer"),
491  $db->quote($user_id, "integer"),
492  $db->quote($filename, "text"),
493  $db->quote($filename, "text"),
494  $db->quote($info->getMimeType(), "text"),
495  $db->quote(\ilUtil::now(), "timestamp"),
496  $db->quote($ass_id, "integer"),
497  $db->quote($is_late, "integer"),
498  $db->quote($team_id, "integer"),
499  $db->quote($rid, "text")
500  );
501  $db->manipulate($query);
502  $filenames[] = $filename;
503  }
504  }
505  return $filenames;
506  }
quote($value, string $type)
static now()
Return current timestamp in Y-m-d H:i:s format.
nextId(string $table_name)
global $DIC
Definition: shib_login.php:26
$filename
Definition: buildRTE.php:78
$info
Definition: entry_point.php:21
manipulate(string $query)
Run a (write) Query on the database.
+ Here is the call graph for this function:

◆ delete()

ILIAS\Exercise\Submission\SubmissionRepository::delete ( int  $id,
ResourceStakeholder  $stakeholder 
)

Definition at line 508 of file class.SubmissionRepository.php.

References ILIAS\Exercise\Submission\Submission\$rid.

511  : void {
512  $set = $this->db->queryF(
513  "SELECT rid FROM exc_returned " .
514  " WHERE returned_id = %s ",
515  ["integer"],
516  [$id]
517  );
518  if ($rec = $this->db->fetchAssoc($set)) {
519  $rid = (string) ($rec["rid"] ?? "");
520  if ($rid !== "") {
521  $this->irss->deleteResource(
522  $rid,
523  $stakeholder
524  );
525  }
526  $this->db->manipulateF(
527  "DELETE FROM exc_returned WHERE " .
528  " returned_id = %s",
529  ["integer"],
530  [$id]
531  );
532  }
533  }

◆ deliverFile()

ILIAS\Exercise\Submission\SubmissionRepository::deliverFile ( int  $ass_id,
int  $user_id,
string  $rid,
string  $filetitle = "" 
)

Definition at line 535 of file class.SubmissionRepository.php.

540  : void {
541  if ($filetitle !== "") {
542  $this->irss->renameCurrentRevision($rid, $filetitle);
543  }
544  $this->irss->deliverFile($rid);
545  }

◆ getAllEntriesOfAssignment()

ILIAS\Exercise\Submission\SubmissionRepository::getAllEntriesOfAssignment ( int  $ass_id)

Definition at line 48 of file class.SubmissionRepository.php.

48  : array
49  {
50  $recs = [];
51  $set = $this->db->queryF(
52  "SELECT * FROM exc_returned " .
53  " WHERE ass_id = %s ",
54  ["integer"],
55  [$ass_id]
56  );
57  while ($rec = $this->db->fetchAssoc($set)) {
58  $recs[] = $rec;
59  }
60  return $recs;
61  }

◆ getAllSubmissionIdsOfOwner()

ILIAS\Exercise\Submission\SubmissionRepository::getAllSubmissionIdsOfOwner ( int  $ass_id,
int  $user_id 
)

Definition at line 206 of file class.SubmissionRepository.php.

References ILIAS\Repository\int().

206  : array
207  {
208  $set = $this->db->queryF(
209  "SELECT returned_id FROM exc_returned " .
210  " WHERE ass_id = %s AND user_id = %s",
211  ["integer", "integer"],
212  [$ass_id, $user_id]
213  );
214  $user_ids = [];
215  while ($rec = $this->db->fetchAssoc($set)) {
216  $user_ids[] = (int) $rec["returned_id"];
217  }
218  return $user_ids;
219  }
+ Here is the call graph for this function:

◆ getById()

ILIAS\Exercise\Submission\SubmissionRepository::getById ( int  $id)

Definition at line 183 of file class.SubmissionRepository.php.

References ILIAS\Exercise\Submission\SubmissionRepository\getSubmissionFromRecord(), and null.

185  : ?Submission {
186  $sql = "SELECT * FROM exc_returned" .
187  " WHERE returned_id = " . $this->db->quote($id, "integer");
188  $result = $this->db->query($sql);
189  if ($row = $this->db->fetchAssoc($result)) {
190  return $this->getSubmissionFromRecord($row);
191  }
192  return null;
193  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getMaxAmountOfSubmittedFiles()

ILIAS\Exercise\Submission\SubmissionRepository::getMaxAmountOfSubmittedFiles ( int  $obj_id,
int  $ass_id,
int  $user_id = 0 
)

Get the number of max amount of files submitted by a single user in the assignment.

Used to add columns to the excel.

Definition at line 299 of file class.SubmissionRepository.php.

References ILIAS\Exercise\Submission\SubmissionRepository\$db, ILIAS\Exercise\Submission\Submission\$user_id, and ilDBInterface\quote().

303  : int {
304  $db = $this->db;
305 
306  $and = "";
307  if ($user_id > 0) {
308  $and = " AND user_id = " . $db->quote($user_id, "integer");
309  }
310 
311  $set = $db->queryF(
312  "SELECT MAX(max_num) AS max" .
313  " FROM (SELECT COUNT(user_id) AS max_num FROM exc_returned" .
314  " WHERE obj_id= %s AND ass_id= %s " . $and . " AND mimetype IS NOT NULL" .
315  " GROUP BY user_id) AS COUNTS",
316  ["integer", "integer"],
317  [$obj_id, $ass_id]
318  );
319  $row = $db->fetchAssoc($set);
320  return (int) $row['max'];
321  }
fetchAssoc(ilDBStatement $statement)
quote($value, string $type)
queryF(string $query, array $types, array $values)
+ Here is the call graph for this function:

◆ getStream()

ILIAS\Exercise\Submission\SubmissionRepository::getStream ( int  $ass_id,
string  $rid 
)

Definition at line 547 of file class.SubmissionRepository.php.

550  : ?FileStream {
551  return $this->irss->stream($rid);
552  }

◆ getSubmissionFromRecord()

ILIAS\Exercise\Submission\SubmissionRepository::getSubmissionFromRecord ( array  $rec)
protected

Definition at line 384 of file class.SubmissionRepository.php.

Referenced by ILIAS\Exercise\Submission\SubmissionRepository\getById(), and ILIAS\Exercise\Submission\SubmissionRepository\getSubmissions().

384  : Submission
385  {
386  return $this->data->submission(
387  (int) $rec["returned_id"],
388  (int) $rec["ass_id"],
389  (int) $rec["user_id"],
390  (int) $rec["team_id"],
391  (string) $rec["filetitle"],
392  (string) $rec["atext"],
393  (string) $rec["rid"],
394  (string) $rec["mimetype"],
395  (string) $rec["ts"],
396  (bool) $rec["late"]
397  );
398  }
+ Here is the caller graph for this function:

◆ getSubmissions()

ILIAS\Exercise\Submission\SubmissionRepository::getSubmissions ( string  $where,
int  $ass_id,
bool  $type_uses_uploads,
bool  $type_uses_print_versions,
?array  $submit_ids = null,
bool  $only_valid = false,
?string  $min_timestamp = null,
bool  $print_versions = false 
)
protected
Returns
<Submission>

Definition at line 118 of file class.SubmissionRepository.php.

References ILIAS\Exercise\Submission\SubmissionRepository\getSubmissionFromRecord().

Referenced by ILIAS\Exercise\Submission\SubmissionRepository\getSubmissionsOfTeam(), and ILIAS\Exercise\Submission\SubmissionRepository\getSubmissionsOfUsers().

127  : \Generator {
128  $sql = "SELECT * FROM exc_returned" .
129  " WHERE ass_id = " . $this->db->quote($ass_id, "integer");
130  $sql .= " AND " . $where;
131 
132  if ($submit_ids) {
133  $sql .= " AND " . $this->db->in("returned_id", $submit_ids, false, "integer");
134  }
135 
136  if ($min_timestamp) {
137  $sql .= " AND ts > " . $this->db->quote($min_timestamp, "timestamp");
138  }
139 
140  $result = $this->db->query($sql);
141  $delivered_files = array();
142  while ($row = $this->db->fetchAssoc($result)) {
143  // blog/portfolio/text submissions
144  if ($only_valid &&
145  !$row["filename"] &&
146  !(trim((string) $row["atext"]))) {
147  continue;
148  }
149 
150  //$row["owner_id"] = $row["user_id"];
151  $row["timestamp"] = $row["ts"];
152  /*
153  $row["timestamp14"] = substr($row["ts"], 0, 4) .
154  substr($row["ts"], 5, 2) . substr($row["ts"], 8, 2) .
155  substr($row["ts"], 11, 2) . substr($row["ts"], 14, 2) .
156  substr($row["ts"], 17, 2);*/
157 
158  $row["rid"] = (string) $row["rid"];
159 
160  // see 22301, 22719
161  if ($row["rid"] !== "" || (!$type_uses_uploads)) {
162  $ok = true;
163 
164  if ($type_uses_print_versions) {
165  $is_print_version = false;
166  if (str_ends_with($row["filetitle"], "print")) {
167  $is_print_version = true;
168  }
169  if (str_ends_with($row["filetitle"], "print.zip")) {
170  $is_print_version = true;
171  }
172  if ($is_print_version != $print_versions) {
173  $ok = false;
174  }
175  }
176  if ($ok) {
177  yield $this->getSubmissionFromRecord($row);
178  }
179  }
180  }
181  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSubmissionsOfTeam()

ILIAS\Exercise\Submission\SubmissionRepository::getSubmissionsOfTeam ( int  $ass_id,
bool  $type_uses_uploads,
bool  $type_uses_print_versions,
int  $team_id,
?array  $submit_ids = null,
bool  $only_valid = false,
?string  $min_timestamp = null,
bool  $print_versions = false 
)
Returns
<Submission>

Definition at line 66 of file class.SubmissionRepository.php.

References ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from(), and ILIAS\Exercise\Submission\SubmissionRepository\getSubmissions().

75  : \Generator {
76  $where = " team_id = " . $this->db->quote($team_id, "integer") . " ";
77  yield from $this->getSubmissions(
78  $where,
79  $ass_id,
80  $type_uses_uploads,
81  $type_uses_print_versions,
82  $submit_ids,
83  $only_valid,
84  $min_timestamp,
85  $print_versions
86  );
87  }
getSubmissions(string $where, int $ass_id, bool $type_uses_uploads, bool $type_uses_print_versions, ?array $submit_ids=null, bool $only_valid=false, ?string $min_timestamp=null, bool $print_versions=false)
+ Here is the call graph for this function:

◆ getSubmissionsOfUsers()

ILIAS\Exercise\Submission\SubmissionRepository::getSubmissionsOfUsers ( int  $ass_id,
bool  $type_uses_uploads,
bool  $type_uses_print_versions,
array  $user_ids,
?array  $submit_ids = null,
bool  $only_valid = false,
?string  $min_timestamp = null,
bool  $print_versions = false 
)
Returns
<Submission>

Definition at line 92 of file class.SubmissionRepository.php.

References ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from(), and ILIAS\Exercise\Submission\SubmissionRepository\getSubmissions().

101  : \Generator {
102  $where = " " . $this->db->in("user_id", $user_ids, false, "integer") . " ";
103  yield from $this->getSubmissions(
104  $where,
105  $ass_id,
106  $type_uses_uploads,
107  $type_uses_print_versions,
108  $submit_ids,
109  $only_valid,
110  $min_timestamp,
111  $print_versions
112  );
113  }
getSubmissions(string $where, int $ass_id, bool $type_uses_uploads, bool $type_uses_print_versions, ?array $submit_ids=null, bool $only_valid=false, ?string $min_timestamp=null, bool $print_versions=false)
+ Here is the call graph for this function:

◆ getUserId()

ILIAS\Exercise\Submission\SubmissionRepository::getUserId ( int  $submission_id)

Implements ILIAS\Exercise\Submission\SubmissionRepositoryInterface.

Definition at line 196 of file class.SubmissionRepository.php.

References $q.

196  : int
197  {
198  $q = "SELECT user_id FROM exc_returned " .
199  " WHERE returned_id = " . $this->db->quote($submission_id, "integer");
200  $usr_set = $this->db->query($q);
201 
202  $rec = $this->db->fetchAssoc($usr_set);
203  return (int) ($rec["user_id"] ?? 0);
204  }
$q
Definition: shib_logout.php:23

◆ getUserSubmissionState()

ILIAS\Exercise\Submission\SubmissionRepository::getUserSubmissionState ( int  $user_id,
array  $assignment_ids 
)

Checks if a user has submitted anything for a number of assignments.

This function should be performant, because it is being used for task determination. It assumes, that team db entries only exist for team assignment types and thus does not read the assignment types at all.

Definition at line 247 of file class.SubmissionRepository.php.

References ILIAS\Exercise\Submission\SubmissionRepository\$db, ILIAS\Exercise\Submission\Submission\$id, ILIAS\Exercise\Submission\Submission\$user_id, ILIAS\Repository\int(), and ilDBInterface\queryF().

247  : array
248  {
249  $db = $this->db;
250 
251  $submitted = [];
252  foreach ($assignment_ids as $id) {
253  $submitted[(int) $id] = false;
254  }
255 
256  $set = $db->queryF(
257  "SELECT ass_id FROM exc_returned " .
258  " WHERE " . $db->in("ass_id", $assignment_ids, false, "integer") .
259  " AND user_id = %s " .
260  " AND (filename IS NOT NULL OR atext IS NOT NULL)" .
261  " AND ts IS NOT NULL",
262  ["integer"],
263  [$user_id]
264  );
265  while ($rec = $db->fetchAssoc($set)) {
266  $submitted[(int) $rec["ass_id"]] = true;
267  }
268 
269  $set = $db->queryF(
270  "SELECT ret.ass_id FROM exc_returned ret JOIN il_exc_team team " .
271  " ON (ret.team_id = team.id AND ret.ass_id = team.ass_id) " .
272  " WHERE " . $db->in("ret.ass_id", $assignment_ids, false, "integer") .
273  " AND team.user_id = %s " .
274  " AND (ret.filename IS NOT NULL OR ret.atext IS NOT NULL)" .
275  " AND ret.ts IS NOT NULL",
276  ["integer"],
277  [$user_id]
278  );
279  while ($rec = $db->fetchAssoc($set)) {
280  $submitted[(int) $rec["ass_id"]] = true;
281  }
282 
283  return $submitted;
284  }
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)
in(string $field, array $values, bool $negate=false, string $type="")
+ Here is the call graph for this function:

◆ getUsersWithSubmission()

ILIAS\Exercise\Submission\SubmissionRepository::getUsersWithSubmission ( int  $ass_id)

Get all user ids, that have submitted something.

Returns
int[]

Definition at line 327 of file class.SubmissionRepository.php.

References ILIAS\Exercise\Submission\SubmissionRepository\$db, ILIAS\Repository\int(), and ilDBInterface\query().

327  : array
328  {
329  $db = $this->db;
330  $user_ids = [];
331  $set = $db->query("SELECT DISTINCT(user_id)" .
332  " FROM exc_returned" .
333  " WHERE ass_id = " . $db->quote($ass_id, "integer") .
334  " AND (filename IS NOT NULL OR atext IS NOT NULL)");
335  while ($row = $db->fetchAssoc($set)) {
336  $user_ids[] = (int) $row["user_id"];
337  }
338  return $user_ids;
339  }
fetchAssoc(ilDBStatement $statement)
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
+ Here is the call graph for this function:

◆ hasSubmissions()

ILIAS\Exercise\Submission\SubmissionRepository::hasSubmissions ( int  $assignment_id)

Implements ILIAS\Exercise\Submission\SubmissionRepositoryInterface.

Definition at line 222 of file class.SubmissionRepository.php.

References $res.

222  : int
223  {
224  $query = "SELECT * FROM exc_returned " .
225  " WHERE ass_id = " . $this->db->quote($assignment_id, "integer") .
226  " AND (filename IS NOT NULL OR atext IS NOT NULL)" .
227  " AND ts IS NOT NULL";
228  $res = $this->db->query($query);
229  return $res->numRows();
230  }
$res
Definition: ltiservices.php:66

◆ updateLate()

ILIAS\Exercise\Submission\SubmissionRepository::updateLate ( int  $return_id,
bool  $late 
)

Definition at line 286 of file class.SubmissionRepository.php.

289  : void {
290  $this->db->manipulate("UPDATE exc_returned" .
291  " SET late = " . $this->db->quote((int) $late, "integer") .
292  " WHERE returned_id = " . $this->db->quote($return_id, "integer"));
293  }

◆ updateWebDirAccessTime()

ILIAS\Exercise\Submission\SubmissionRepository::updateWebDirAccessTime ( int  $assignment_id,
int  $member_id 
)

Definition at line 233 of file class.SubmissionRepository.php.

References ilUtil\now().

233  : void
234  {
235  $this->db->manipulate("UPDATE exc_returned " .
236  " SET web_dir_access_time = " . $this->db->quote(\ilUtil::now(), "timestamp") .
237  " WHERE ass_id = " . $this->db->quote($assignment_id, "integer") .
238  " AND user_id = " . $this->db->quote($member_id, "integer"));
239  }
static now()
Return current timestamp in Y-m-d H:i:s format.
+ Here is the call graph for this function:

Field Documentation

◆ $db

◆ $log

ILIAS\Exercise\Submission\SubmissionRepository::$log
protected

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

◆ TABLE_NAME

const ILIAS\Exercise\Submission\SubmissionRepository::TABLE_NAME = "exc_returned"
protected

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


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