ILIAS  release_8 Revision v8.24
class.ilAdvancedMDRecordTranslation.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
6
13{
14 public const TABLE_NAME = 'adv_md_record_int';
15
16 private int $record_id;
17 private string $title;
18 private string $description;
19 private string $lang_key;
20 private bool $lang_default = false;
21
23
24 public function __construct(
25 int $record_id,
26 string $title,
27 string $description,
28 string $lang_key,
29 bool $lang_default = false
30 ) {
31 global $DIC;
32
33 $this->db = $DIC->database();
34
35 $this->record_id = $record_id;
36 $this->title = $title;
37 $this->description = $description;
38 $this->lang_key = $lang_key;
39 $this->lang_default = $lang_default;
40 }
41
42 public function setTitle(string $title): void
43 {
44 $this->title = $title;
45 }
46
47 public function setDescription(string $description): void
48 {
49 $this->description = $description;
50 }
51
52 public function setLangDefault(bool $lang_default): void
53 {
54 $this->lang_default = $lang_default;
55 }
56
57 public function getLangDefault(): bool
58 {
60 }
61
62 public function getRecordId(): int
63 {
64 return $this->record_id;
65 }
66
67 public function setRecordId(int $record_id): void
68 {
69 $this->record_id = $record_id;
70 }
71
75 public function getTitle(): string
76 {
77 return $this->title;
78 }
79
83 public function getDescription(): string
84 {
85 return $this->description;
86 }
87
91 public function getLangKey(): string
92 {
93 return $this->lang_key;
94 }
95
96 public function update(): void
97 {
98 $query = 'update ' . self::TABLE_NAME . ' ' .
99 'set title = ' . $this->db->quote($this->getTitle(), ilDBConstants::T_TEXT) . ', ' .
100 'description = ' . $this->db->quote($this->getDescription(), ilDBConstants::T_TEXT) . ' ' .
101 'where record_id = ' . $this->db->quote($this->getRecordId(), ilDBConstants::T_INTEGER) . ' ' .
102 'and lang_code = ' . $this->db->quote($this->getLangKey(), ilDBConstants::T_TEXT);
103
104 $this->db->manipulate($query);
105 }
106
107 public function delete(): void
108 {
109 $query = 'delete from ' . self::TABLE_NAME . ' ' .
110 'where record_id = ' . $this->db->quote($this->getRecordId(), ilDBConstants::T_INTEGER) . ' and ' .
111 'lang_code = ' . $this->db->quote($this->getLangKey(), ilDBConstants::T_TEXT);
112 $this->db->manipulate($query);
113 }
114
115 public function insert(): void
116 {
117 $query = 'insert into ' . self::TABLE_NAME . ' (record_id, title, lang_code, description) ' .
118 'values ( ' .
119 $this->db->quote($this->getRecordId(), ilDBConstants::T_INTEGER) . ', ' .
120 $this->db->quote($this->getTitle(), ilDBConstants::T_TEXT) . ', ' .
121 $this->db->quote($this->getLangKey(), ilDBConstants::T_TEXT) . ', ' .
122 $this->db->quote($this->getDescription(), ilDBConstants::T_TEXT) . ' ' .
123 ')';
124 $this->db->manipulate($query);
125 }
126}
Class ilAdvancedMDRecordTranslation.
__construct(int $record_id, string $title, string $description, string $lang_key, bool $lang_default=false)
global $DIC
Definition: feed.php:28
Interface ilDBInterface.
$query