ILIAS  release_8 Revision v8.24
class.ReadingTimeDBRepo.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2022 ILIAS open source, GPLv3, see LICENSE */
4
6
11{
15 protected $db;
16
17 public function __construct()
18 {
20 global $DIC;
21 $this->db = $DIC->database();
22 }
23
24 public function isActivated(int $lm_id): bool
25 {
26 $db = $this->db;
27 $set = $db->queryF(
28 "SELECT act_est_reading_time FROM il_blog " .
29 " WHERE id = %s ",
30 ["integer"],
31 [$lm_id]
32 );
33 if ($rec = $db->fetchAssoc($set)) {
34 return (bool) $rec["act_est_reading_time"];
35 }
36 return false;
37 }
38
39 public function activate(int $lm_id, bool $activated): void
40 {
41 $db = $this->db;
42 $db->update(
43 "il_blog",
44 [
45 "act_est_reading_time" => ["integer", $activated]
46 ],
47 [ // where
48 "id" => ["integer", $lm_id]
49 ]
50 );
51 }
52}
__construct()
Constructor setup ILIAS global object @access public.
Definition: class.ilias.php:62
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...