ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilExcMemberRepository.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
12{
13
17 protected $db;
18
24 public function __construct(\ilDBInterface $db = null)
25 {
26 global $DIC;
27
28 $this->db = (is_null($db))
29 ? $DIC->database()
30 : $db;
31 }
32
39 public function getExerciseIdsOfUser(int $user_id) : array
40 {
41 $db = $this->db;
42
43 $set = $db->queryF(
44 "SELECT DISTINCT obj_id FROM exc_members " .
45 " WHERE usr_id = %s ",
46 array("integer"),
47 array($user_id)
48 );
49 $ids = [];
50 while ($rec = $db->fetchAssoc($set)) {
51 $ids[] = $rec["obj_id"];
52 }
53
54 return $ids;
55 }
56}
An exception for terminatinating execution or to throw for unit testing.
This should hold all accesses to exc_members table in the future.
__construct(\ilDBInterface $db=null)
Constructor.
getExerciseIdsOfUser(int $user_id)
Get all exercise IDs of a user.
Interface ilDBInterface.
$DIC
Definition: xapitoken.php:46