ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.UsageDBRepository.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
27{
28 protected \ilDBInterface $db;
29
30 public function __construct(\ilDBInterface $db)
31 {
32 $this->db = $db;
33 }
34
36 string $a_type,
37 int $a_id,
38 int $a_usage_hist_nr,
39 string $a_lang = "-"
40 ): array {
41 $db = $this->db;
42
43 $and_hist = " AND usage_hist_nr > 0 AND usage_hist_nr <= " . $db->quote($a_usage_hist_nr, "integer");
44
45 $mob_ids = array();
46 $set = $db->query("SELECT DISTINCT(id) FROM mob_usage" .
47 " WHERE usage_type = " . $db->quote($a_type, "text") .
48 " AND usage_id = " . $db->quote($a_id, "integer") .
49 " AND usage_lang = " . $db->quote($a_lang, "text") .
50 $and_hist);
51
52 while ($row = $db->fetchAssoc($set)) {
53 $mob_ids[] = $row["id"];
54 }
55 return $mob_ids;
56 }
57
59 string $a_type,
60 int $a_id,
61 int $a_usage_hist_nr,
62 string $a_lang = "-"
63 ): void {
64 $db = $this->db;
65
66 $and_hist = " AND usage_hist_nr > 0 AND usage_hist_nr <= " . $db->quote($a_usage_hist_nr, "integer");
67 $q = "DELETE FROM mob_usage WHERE usage_type = " .
68 $db->quote($a_type, "text") .
69 " AND usage_id= " . $db->quote($a_id, "integer") .
70 " AND usage_lang = " . $db->quote($a_lang, "text") .
71 $and_hist;
72 $db->manipulate($q);
73 }
74}
deleteHistoryUsagesLowerEqualThan(string $a_type, int $a_id, int $a_usage_hist_nr, string $a_lang="-")
getHistoryUsagesLowerEqualThan(string $a_type, int $a_id, int $a_usage_hist_nr, string $a_lang="-")
Interface ilDBInterface.
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
fetchAssoc(ilDBStatement $statement)
$q
Definition: shib_logout.php:23