ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Repository.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25
27{
28 public function __construct(protected ilDBInterface $db)
29 {
30 }
31
32 public function isBlockShownForObject(int $obj_id): bool
33 {
34 $query = 'SELECT show_block FROM ut_progress_block WHERE obj_id = ' .
35 $this->db->quote($obj_id, ilDBConstants::T_INTEGER);
36
37 $res = $this->db->query($query);
38 if ($row = $this->db->fetchAssoc($res)) {
39 return (bool) ($row['show_block'] ?? false);
40 }
41 return false;
42 }
43
44 public function setShowBlockForObject(int $obj_id, bool $show): void
45 {
46 $query = 'INSERT INTO ut_progress_block (obj_id, show_block) VALUES (' .
47 $this->db->quote($obj_id, ilDBConstants::T_INTEGER) . ', ' .
48 $this->db->quote($show, ilDBConstants::T_INTEGER) .
49 ') ON DUPLICATE KEY UPDATE show_block = ' .
50 $this->db->quote($show, ilDBConstants::T_INTEGER);
51
52 $this->db->manipulate($query);
53 }
54}
Class ilDBConstants.
Interface ilDBInterface.
$res
Definition: ltiservices.php:69