ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ReadingTimeDBRepo.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()
31 {
32 global $DIC;
33 $this->db = $DIC->database();
34 }
35
36 public function isActivated(int $lm_id): bool
37 {
38 $db = $this->db;
39 $set = $db->queryF(
40 "SELECT act_est_reading_time FROM il_blog " .
41 " WHERE id = %s ",
42 ["integer"],
43 [$lm_id]
44 );
45 if ($rec = $db->fetchAssoc($set)) {
46 return (bool) $rec["act_est_reading_time"];
47 }
48 return false;
49 }
50
51 public function activate(int $lm_id, bool $activated): void
52 {
53 $db = $this->db;
54 $db->update(
55 "il_blog",
56 [
57 "act_est_reading_time" => ["integer", $activated]
58 ],
59 [ // where
60 "id" => ["integer", $lm_id]
61 ]
62 );
63 }
64}
update(string $table_name, array $values, array $where)
@description $where MUST contain existing columns only.
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)
global $DIC
Definition: shib_login.php:26