19 declare(strict_types=1);
37 $db = $DIC->database();
42 public function isDone(
int $activeId): bool
44 $result = $this->db->queryF(
45 "SELECT done FROM " . self::TABLE_NAME .
" WHERE active_id = %s AND done = 1",
50 return $result->numRows() === 1;
53 public function exists(
int $activeId): bool
55 $result = $this->db->queryF(
56 "SELECT active_id FROM " . self::TABLE_NAME .
" WHERE active_id = %s",
61 return $result->numRows() === 1;
64 public function setDone(
int $activeId,
bool $done): void
66 if ($this->
exists($activeId)) {
67 $this->db->manipulateF(
68 "UPDATE " . self::TABLE_NAME .
" SET done = %s WHERE active_id = %s",
69 [
"integer",
"integer"],
75 $this->db->manipulateF(
76 "INSERT INTO " . self::TABLE_NAME .
" (active_id, done) VALUES (%s, %s)",
77 [
"integer",
"integer"],
__construct(?\ilDBInterface $db=null)
setDone(int $activeId, bool $done)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null