ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilExcSubmissionRepository.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
11 {
12  const TABLE_NAME = "exc_returned";
13 
17  protected $db;
18 
23  public function __construct(ilDBInterface $db = null)
24  {
25  global $DIC;
26 
27  $this->db = (is_null($db))
28  ? $DIC->database()
29  : $db;
30  }
31 
35  public function getUserId(int $submission_id) : int
36  {
37  $q = "SELECT user_id FROM " . self::TABLE_NAME .
38  " WHERE returned_id = " . $this->db->quote($submission_id, "integer");
39  $usr_set = $this->db->query($q);
40  return $this->db->fetchAssoc($usr_set);
41  }
42 
46  public function hasSubmissions(int $ass_id) : int
47  {
48  $query = "SELECT * FROM " . self::TABLE_NAME .
49  " WHERE ass_id = " . $this->db->quote($ass_id, "integer") .
50  " AND (filename IS NOT NULL OR atext IS NOT NULL)" .
51  " AND ts IS NOT NULL";
52  $res = $this->db->query($query);
53  return (int) $res->numRows($res);
54  }
55 
61  public function updateWebDirAccessTime(int $assignment_id, int $member_id)
62  {
63  $this->db->manipulate("UPDATE " . self::TABLE_NAME .
64  " SET web_dir_access_time = " . $this->db->quote(ilUtil::now(), "timestamp") .
65  " WHERE ass_id = " . $this->db->quote($assignment_id, "integer") .
66  " AND user_id = " . $this->db->quote($member_id, "integer"));
67  }
68 }
__construct(ilDBInterface $db=null)
ilExcSubmissionRepository constructor.
hasSubmissions(int $ass_id)
Get number of submissions from assignment id.int
getUserId(int $submission_id)
Get User who submitted.int
static now()
Return current timestamp in Y-m-d H:i:s format.
updateWebDirAccessTime(int $assignment_id, int $member_id)
Update web_dir_access_time.
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query