ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilAdvancedMDRecordTranslation.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
10 {
11  public const TABLE_NAME = 'adv_md_record_int';
12 
16  private $record_id;
17 
21  private $title;
22 
26  private $description;
27 
31  private $lang_key;
32 
33 
37  private $db;
38 
42  public function __construct(int $record_id, string $title, string $description, string $lang_key)
43  {
44  global $DIC;
45 
46  $this->db = $DIC->database();
47 
48  $this->record_id = $record_id;
49  $this->title = $title;
50  $this->description = $description;
51  $this->lang_key = $lang_key;
52  }
53 
57  public function setTitle(string $title) : void
58  {
59  $this->title = $title;
60  }
61 
65  public function setDescription(string $description) : void
66  {
67  $this->description = $description;
68  }
69 
73  public function setLangDefault(bool $lang_default) : void
74  {
75  $this->lang_default = $lang_default;
76  }
77 
78 
82  public function getRecordId() : int
83  {
84  return $this->record_id;
85  }
86 
87  public function setRecordId(int $record_id) : void
88  {
89  $this->record_id = $record_id;
90  }
91 
95  public function getTitle() : string
96  {
97  return $this->title;
98  }
99 
103  public function getDescription() : string
104  {
105  return $this->description;
106  }
107 
111  public function getLangKey() : string
112  {
113  return $this->lang_key;
114  }
115 
116 
117  public function update()
118  {
119  $query = 'update ' . self::TABLE_NAME . ' ' .
120  'set title = ' . $this->db->quote($this->getTitle(), ilDBConstants::T_TEXT) . ', ' .
121  'description = ' . $this->db->quote($this->getDescription(), ilDBConstants::T_TEXT) . ' ' .
122  'where record_id = ' . $this->db->quote($this->getRecordId(), ilDBConstants::T_INTEGER) . ' ' .
123  'and lang_code = ' . $this->db->quote($this->getLangKey(), ilDBConstants::T_TEXT);
124 
125  $this->db->manipulate($query);
126  }
127 
128  public function delete()
129  {
130  $query = 'delete from ' . self::TABLE_NAME . ' ' .
131  'where record_id = ' . $this->db->quote($this->getRecordId(), ilDBConstants::T_INTEGER) . ' and ' .
132  'lang_code = ' . $this->db->quote($this->getLangKey(), ilDBConstants::T_TEXT);
133  $this->db->manipulate($query);
134  }
135 
136  public function insert()
137  {
138  $query = 'insert into ' . self::TABLE_NAME . ' (record_id, title, lang_code, description) ' .
139  'values ( ' .
140  $this->db->quote($this->getRecordId(), ilDBConstants::T_INTEGER) . ', ' .
141  $this->db->quote($this->getTitle() , ilDBConstants::T_TEXT) . ', ' .
142  $this->db->quote($this->getLangKey(), ilDBConstants::T_TEXT) . ', ' .
143  $this->db->quote($this->getDescription(), ilDBConstants::T_TEXT) . ' ' .
144  ')';
145  $this->db->manipulate($query);
146  }
147 
148 }
__construct(int $record_id, string $title, string $description, string $lang_key)
ilAdvancedMDRecordTranslation constructor.
global $DIC
Definition: goto.php:24
Class ilAdvancedMDRecordTranslation.
$query