ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLMObjTranslation Class Reference

Translation information on lm object. More...

+ Collaboration diagram for ilLMObjTranslation:

Public Member Functions

 __construct ($a_id=0, $a_lang="")
 Constructor. More...
 
 setId ($a_val)
 Set Id. More...
 
 getId ()
 Get Id. More...
 
 setLang ($a_val)
 Set lang. More...
 
 getLang ()
 Get lang. More...
 
 setTitle ($a_val)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 setShortTitle ($a_val)
 Set short title. More...
 
 getShortTitle ()
 Get short title. More...
 
 getCreateDate ()
 Get create date. More...
 
 getLastUpdate ()
 Get update date. More...
 
 read ()
 Read. More...
 
 save ()
 Save (inserts if not existing, otherwise updates) More...
 

Static Public Member Functions

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

Protected Attributes

 $db
 
 $lang
 
 $title
 
 $short_title
 
 $create_date
 
 $last_update
 

Detailed Description

Translation information on lm object.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
int$a_idobject id (page, chapter)
string$a_langlanguage code

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

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

32  {
33  global $DIC;
34 
35  $this->db = $DIC->database();
36  if ($a_id > 0 && $a_lang != "") {
37  $this->setId($a_id);
38  $this->setLang($a_lang);
39  $this->read();
40  }
41  }
global $DIC
Definition: saml.php:7
+ Here is the call graph for this function:

Member Function Documentation

◆ copy()

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

Copy all translations of an object.

Parameters
int$a_source_idsource id
int$a_target_idtarget

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

References $DIC, and $ilDB.

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

222  {
223  global $DIC;
224 
225  $ilDB = $DIC->database();
226 
227  $set = $ilDB->query(
228  "SELECT * FROM lm_data_transl " .
229  " WHERE id = " . $ilDB->quote($a_source_id, "integer")
230  );
231  while ($rec = $ilDB->fetchAssoc($set)) {
232  $lmobjtrans = new ilLMObjTranslation($a_target_id, $rec["lang"]);
233  $lmobjtrans->setTitle($rec["title"]);
234  $lmobjtrans->setShortTitle($rec["short_title"]);
235  $lmobjtrans->save();
236  }
237  }
global $DIC
Definition: saml.php:7
global $ilDB
Translation information on lm object.
+ Here is the caller graph for this function:

◆ exists()

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

Check for existence.

Parameters
int$a_idobject id (page, chapter)
string$a_langlanguage code
Returns
bool true/false

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

References $DIC, and $ilDB.

199  {
200  global $DIC;
201 
202  $ilDB = $DIC->database();
203 
204  $set = $ilDB->query(
205  "SELECT * FROM lm_data_transl " .
206  " WHERE id = " . $ilDB->quote($a_id, "integer") .
207  " AND lang = " . $ilDB->quote($a_lang, "text")
208  );
209  if ($rec = $ilDB->fetchAssoc($set)) {
210  return true;
211  }
212  return false;
213  }
global $DIC
Definition: saml.php:7
global $ilDB

◆ getCreateDate()

ilLMObjTranslation::getCreateDate ( )

Get create date.

Returns
string create date

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

References $create_date.

129  {
130  return $this->create_date;
131  }

◆ getId()

ilLMObjTranslation::getId ( )

Get Id.

Returns
int id

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

References $id.

Referenced by save().

59  {
60  return $this->id;
61  }
if(!array_key_exists('StateId', $_REQUEST)) $id
+ Here is the caller graph for this function:

◆ getLang()

ilLMObjTranslation::getLang ( )

Get lang.

Returns
string language

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

References $lang.

Referenced by save().

79  {
80  return $this->lang;
81  }
+ Here is the caller graph for this function:

◆ getLastUpdate()

ilLMObjTranslation::getLastUpdate ( )

Get update date.

Returns
string update date

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

References $last_update.

139  {
140  return $this->last_update;
141  }

◆ getShortTitle()

ilLMObjTranslation::getShortTitle ( )

Get short title.

Returns
string short title

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

References $short_title.

119  {
120  return $this->short_title;
121  }

◆ getTitle()

ilLMObjTranslation::getTitle ( )

Get title.

Returns
string title

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

References $title.

99  {
100  return $this->title;
101  }

◆ read()

ilLMObjTranslation::read ( )

Read.

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

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

Referenced by __construct().

147  {
148  $ilDB = $this->db;
149 
150  $set = $ilDB->query(
151  "SELECT * FROM lm_data_transl " .
152  " WHERE id = " . $ilDB->quote($this->getId(), "integer") .
153  " AND lang = " . $ilDB->quote($this->getLang(), "text")
154  );
155  $rec = $ilDB->fetchAssoc($set);
156  $this->setTitle($rec["title"]);
157  $this->setShortTitle($rec["short_title"]);
158  $this->create_date = $rec["create_date"];
159  $this->last_update = $rec["last_update"];
160  }
setShortTitle($a_val)
Set short title.
setTitle($a_val)
Set title.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilLMObjTranslation::save ( )

Save (inserts if not existing, otherwise updates)

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

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

166  {
167  $ilDB = $this->db;
168 
169  if (!self::exists($this->getId(), $this->getLang())) {
170  $ilDB->manipulate("INSERT INTO lm_data_transl " .
171  "(id, lang, title, short_title, create_date, last_update) VALUES (" .
172  $ilDB->quote($this->getId(), "integer") . "," .
173  $ilDB->quote($this->getLang(), "text") . "," .
174  $ilDB->quote($this->getTitle(), "text") . "," .
175  $ilDB->quote($this->getShortTitle(), "text") . "," .
176  $ilDB->now() . "," .
177  $ilDB->now() .
178  ")");
179  } else {
180  $ilDB->manipulate(
181  "UPDATE lm_data_transl SET " .
182  " title = " . $ilDB->quote($this->getTitle(), "text") . "," .
183  " short_title = " . $ilDB->quote($this->getShortTitle(), "text") . "," .
184  " last_update = " . $ilDB->now() .
185  " WHERE id = " . $ilDB->quote($this->getId(), "integer") .
186  " AND lang = " . $ilDB->quote($this->getLang(), "text")
187  );
188  }
189  }
global $ilDB
+ Here is the call graph for this function:

◆ setId()

ilLMObjTranslation::setId (   $a_val)

Set Id.

Parameters
int$a_valid

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

Referenced by __construct().

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

◆ setLang()

ilLMObjTranslation::setLang (   $a_val)

Set lang.

Parameters
string$a_vallanguage

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

Referenced by __construct().

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

◆ setShortTitle()

ilLMObjTranslation::setShortTitle (   $a_val)

Set short title.

Parameters
string$a_valshort title

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

Referenced by read().

109  {
110  $this->short_title = $a_val;
111  }
+ Here is the caller graph for this function:

◆ setTitle()

ilLMObjTranslation::setTitle (   $a_val)

Set title.

Parameters
string$a_valtitle

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

Referenced by read().

89  {
90  $this->title = $a_val;
91  }
+ Here is the caller graph for this function:

Field Documentation

◆ $create_date

ilLMObjTranslation::$create_date
protected

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

Referenced by getCreateDate().

◆ $db

ilLMObjTranslation::$db
protected

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

Referenced by read(), and save().

◆ $lang

ilLMObjTranslation::$lang
protected

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

Referenced by getLang().

◆ $last_update

ilLMObjTranslation::$last_update
protected

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

Referenced by getLastUpdate().

◆ $short_title

ilLMObjTranslation::$short_title
protected

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

Referenced by getShortTitle().

◆ $title

ilLMObjTranslation::$title
protected

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

Referenced by getTitle().


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