ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
Repository.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 use ilDBInterface;
24 use ilDBConstants;
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 }
$res
Definition: ltiservices.php:66