ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilLMObjTranslation Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilLMObjTranslation:

Public Member Functions

 __construct (int $a_id=0, string $a_lang="")
 
 setId (int $a_val)
 
 getId ()
 
 setLang (string $a_val)
 
 getLang ()
 
 setTitle (string $a_val)
 
 getTitle ()
 
 setShortTitle (string $a_val)
 
 getShortTitle ()
 
 getCreateDate ()
 
 getLastUpdate ()
 
 read ()
 
 save ()
 

Static Public Member Functions

static exists (int $a_id, string $a_lang)
 Check for existence. More...
 
static copy (string $a_source_id, string $a_target_id)
 Copy all translations of an object. More...
 

Protected Attributes

int $id = 0
 
ilDBInterface $db
 
string $lang = ""
 
string $title = ""
 
string $short_title = ""
 
string $create_date = ""
 
string $last_update = ""
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Translation information on lm object

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 24 of file class.ilLMObjTranslation.php.

Constructor & Destructor Documentation

◆ __construct()

ilLMObjTranslation::__construct ( int  $a_id = 0,
string  $a_lang = "" 
)

Definition at line 34 of file class.ilLMObjTranslation.php.

References $DIC, read(), setId(), and setLang().

37  {
38  global $DIC;
39 
40  $this->db = $DIC->database();
41  if ($a_id > 0 && $a_lang != "") {
42  $this->setId($a_id);
43  $this->setLang($a_lang);
44  $this->read();
45  }
46  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ copy()

static ilLMObjTranslation::copy ( string  $a_source_id,
string  $a_target_id 
)
static

Copy all translations of an object.

Definition at line 165 of file class.ilLMObjTranslation.php.

References $DIC, and $ilDB.

Referenced by ilStructureObject\copy(), and ilLMPageObject\copy().

168  : void {
169  global $DIC;
170 
171  $ilDB = $DIC->database();
172 
173  $set = $ilDB->query(
174  "SELECT * FROM lm_data_transl " .
175  " WHERE id = " . $ilDB->quote($a_source_id, "integer")
176  );
177  while ($rec = $ilDB->fetchAssoc($set)) {
178  $lmobjtrans = new ilLMObjTranslation($a_target_id, $rec["lang"]);
179  $lmobjtrans->setTitle((string) $rec["title"]);
180  $lmobjtrans->setShortTitle((string) $rec["short_title"]);
181  $lmobjtrans->save();
182  }
183  }
global $DIC
Definition: shib_login.php:22
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ exists()

static ilLMObjTranslation::exists ( int  $a_id,
string  $a_lang 
)
static

Check for existence.

Definition at line 143 of file class.ilLMObjTranslation.php.

References $DIC, and $ilDB.

146  : bool {
147  global $DIC;
148 
149  $ilDB = $DIC->database();
150 
151  $set = $ilDB->query(
152  "SELECT * FROM lm_data_transl " .
153  " WHERE id = " . $ilDB->quote($a_id, "integer") .
154  " AND lang = " . $ilDB->quote($a_lang, "text")
155  );
156  if ($rec = $ilDB->fetchAssoc($set)) {
157  return true;
158  }
159  return false;
160  }
global $DIC
Definition: shib_login.php:22

◆ getCreateDate()

ilLMObjTranslation::getCreateDate ( )

Definition at line 88 of file class.ilLMObjTranslation.php.

References $create_date.

88  : string
89  {
90  return $this->create_date;
91  }

◆ getId()

ilLMObjTranslation::getId ( )

Definition at line 53 of file class.ilLMObjTranslation.php.

References $id.

Referenced by save().

53  : int
54  {
55  return $this->id;
56  }
+ Here is the caller graph for this function:

◆ getLang()

ilLMObjTranslation::getLang ( )

Definition at line 63 of file class.ilLMObjTranslation.php.

References $lang.

Referenced by save().

63  : string
64  {
65  return $this->lang;
66  }
+ Here is the caller graph for this function:

◆ getLastUpdate()

ilLMObjTranslation::getLastUpdate ( )

Definition at line 93 of file class.ilLMObjTranslation.php.

References $last_update.

93  : string
94  {
95  return $this->last_update;
96  }

◆ getShortTitle()

ilLMObjTranslation::getShortTitle ( )

Definition at line 83 of file class.ilLMObjTranslation.php.

References $short_title.

83  : string
84  {
85  return $this->short_title;
86  }

◆ getTitle()

ilLMObjTranslation::getTitle ( )

Definition at line 73 of file class.ilLMObjTranslation.php.

References $title.

Referenced by ilStructureObject\_getPresentationTitle(), and ilLMPageObject\_getPresentationTitle().

73  : string
74  {
75  return $this->title;
76  }
+ Here is the caller graph for this function:

◆ read()

ilLMObjTranslation::read ( )

Definition at line 98 of file class.ilLMObjTranslation.php.

References $db, $ilDB, setShortTitle(), and setTitle().

Referenced by __construct().

98  : void
99  {
100  $ilDB = $this->db;
101 
102  $set = $ilDB->query(
103  "SELECT * FROM lm_data_transl " .
104  " WHERE id = " . $ilDB->quote($this->getId(), "integer") .
105  " AND lang = " . $ilDB->quote($this->getLang(), "text")
106  );
107  $rec = $ilDB->fetchAssoc($set);
108  $this->setTitle($rec["title"] ?? "");
109  $this->setShortTitle($rec["short_title"] ?? "");
110  $this->create_date = ($rec["create_date"] ?? 0);
111  $this->last_update = ($rec["last_update"] ?? 0);
112  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilLMObjTranslation::save ( )

Definition at line 114 of file class.ilLMObjTranslation.php.

References $db, $ilDB, getId(), and getLang().

114  : void
115  {
116  $ilDB = $this->db;
117 
118  if (!self::exists($this->getId(), $this->getLang())) {
119  $ilDB->manipulate("INSERT INTO lm_data_transl " .
120  "(id, lang, title, short_title, create_date, last_update) VALUES (" .
121  $ilDB->quote($this->getId(), "integer") . "," .
122  $ilDB->quote($this->getLang(), "text") . "," .
123  $ilDB->quote($this->getTitle(), "text") . "," .
124  $ilDB->quote($this->getShortTitle(), "text") . "," .
125  $ilDB->now() . "," .
126  $ilDB->now() .
127  ")");
128  } else {
129  $ilDB->manipulate(
130  "UPDATE lm_data_transl SET " .
131  " title = " . $ilDB->quote($this->getTitle(), "text") . "," .
132  " short_title = " . $ilDB->quote($this->getShortTitle(), "text") . "," .
133  " last_update = " . $ilDB->now() .
134  " WHERE id = " . $ilDB->quote($this->getId(), "integer") .
135  " AND lang = " . $ilDB->quote($this->getLang(), "text")
136  );
137  }
138  }
+ Here is the call graph for this function:

◆ setId()

ilLMObjTranslation::setId ( int  $a_val)

Definition at line 48 of file class.ilLMObjTranslation.php.

Referenced by __construct().

48  : void
49  {
50  $this->id = $a_val;
51  }
+ Here is the caller graph for this function:

◆ setLang()

ilLMObjTranslation::setLang ( string  $a_val)

Definition at line 58 of file class.ilLMObjTranslation.php.

Referenced by __construct().

58  : void
59  {
60  $this->lang = $a_val;
61  }
+ Here is the caller graph for this function:

◆ setShortTitle()

ilLMObjTranslation::setShortTitle ( string  $a_val)

Definition at line 78 of file class.ilLMObjTranslation.php.

Referenced by read().

78  : void
79  {
80  $this->short_title = $a_val;
81  }
+ Here is the caller graph for this function:

◆ setTitle()

ilLMObjTranslation::setTitle ( string  $a_val)

Definition at line 68 of file class.ilLMObjTranslation.php.

Referenced by read().

68  : void
69  {
70  $this->title = $a_val;
71  }
+ Here is the caller graph for this function:

Field Documentation

◆ $create_date

string ilLMObjTranslation::$create_date = ""
protected

Definition at line 31 of file class.ilLMObjTranslation.php.

Referenced by getCreateDate().

◆ $db

ilDBInterface ilLMObjTranslation::$db
protected

Definition at line 27 of file class.ilLMObjTranslation.php.

Referenced by read(), and save().

◆ $id

int ilLMObjTranslation::$id = 0
protected

Definition at line 26 of file class.ilLMObjTranslation.php.

Referenced by getId().

◆ $lang

string ilLMObjTranslation::$lang = ""
protected

Definition at line 28 of file class.ilLMObjTranslation.php.

Referenced by getLang().

◆ $last_update

string ilLMObjTranslation::$last_update = ""
protected

Definition at line 32 of file class.ilLMObjTranslation.php.

Referenced by getLastUpdate().

◆ $short_title

string ilLMObjTranslation::$short_title = ""
protected

Definition at line 30 of file class.ilLMObjTranslation.php.

Referenced by getShortTitle().

◆ $title

string ilLMObjTranslation::$title = ""
protected

Definition at line 29 of file class.ilLMObjTranslation.php.

Referenced by getTitle().


The documentation for this class was generated from the following file: