ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLMObjTranslation Class Reference

Translation information on lm object. More...

+ Collaboration diagram for ilLMObjTranslation:

Public Member Functions

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

Static Public Member Functions

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

Protected Attributes

 $lang
 $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

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

Constructor.

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

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

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

{
if ($a_id > 0 && $a_lang != "")
{
$this->setId($a_id);
$this->setLang($a_lang);
$this->read();
}
}

+ Here is the call graph for this function:

Member Function Documentation

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 189 of file class.ilLMObjTranslation.php.

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM lm_data_transl ".
" WHERE id = ".$ilDB->quote($a_source_id, "integer")
);
while ($rec = $ilDB->fetchAssoc($set))
{
$lmobjtrans = new ilLMObjTranslation($a_target_id, $rec["lang"]);
$lmobjtrans->setTitle($rec["title"]);
$lmobjtrans->save();
}
}
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 168 of file class.ilLMObjTranslation.php.

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM lm_data_transl ".
" WHERE id = ".$ilDB->quote($a_id, "integer").
" AND lang = ".$ilDB->quote($a_lang, "text")
);
if($rec = $ilDB->fetchAssoc($set))
{
return true;
}
return false;
}
ilLMObjTranslation::getCreateDate ( )

Get create date.

Returns
string create date

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

References $create_date.

{
}
ilLMObjTranslation::getId ( )

Get Id.

Returns
int id

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

Referenced by save().

{
return $this->id;
}

+ Here is the caller graph for this function:

ilLMObjTranslation::getLang ( )

Get lang.

Returns
string language

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

References $lang.

Referenced by save().

{
return $this->lang;
}

+ Here is the caller graph for this function:

ilLMObjTranslation::getLastUpdate ( )

Get update date.

Returns
string update date

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

References $last_update.

{
}
ilLMObjTranslation::getTitle ( )

Get title.

Returns
string title

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

References $title.

{
return $this->title;
}
ilLMObjTranslation::read ( )

Read.

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

References setTitle().

Referenced by __construct().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM lm_data_transl ".
" WHERE id = ".$ilDB->quote($this->getId(), "integer").
" AND lang = ".$ilDB->quote($this->getLang(), "text")
);
$rec = $ilDB->fetchAssoc($set);
$this->setTitle($rec["title"]);
$this->create_date = $rec["create_date"];
$this->last_update = $rec["last_update"];
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLMObjTranslation::save ( )

Save (inserts if not existing, otherwise updates)

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

References getId(), and getLang().

{
global $ilDB;
if (!self::exists($this->getId(), $this->getLang()))
{
$ilDB->manipulate("INSERT INTO lm_data_transl ".
"(id, lang, title, create_date, last_update) VALUES (".
$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote($this->getLang(), "text").",".
$ilDB->quote($this->getTitle(), "text").",".
$ilDB->now().",".
$ilDB->now().
")");
}
else
{
$ilDB->manipulate("UPDATE lm_data_transl SET ".
" title = ".$ilDB->quote($this->getTitle(), "text").",".
" last_update = ".$ilDB->now().
" WHERE id = ".$ilDB->quote($this->getId(), "integer").
" AND lang = ".$ilDB->quote($this->getLang(), "text")
);
}
}

+ Here is the call graph for this function:

ilLMObjTranslation::setId (   $a_val)

Set Id.

Parameters
int$a_valid

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

Referenced by __construct().

{
$this->id = $a_val;
}

+ Here is the caller graph for this function:

ilLMObjTranslation::setLang (   $a_val)

Set lang.

Parameters
string$a_vallanguage

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

Referenced by __construct().

{
$this->lang = $a_val;
}

+ Here is the caller graph for this function:

ilLMObjTranslation::setTitle (   $a_val)

Set title.

Parameters
string$a_valtitle

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

Referenced by read().

{
$this->title = $a_val;
}

+ Here is the caller graph for this function:

Field Documentation

ilLMObjTranslation::$create_date
protected

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

Referenced by getCreateDate().

ilLMObjTranslation::$lang
protected

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

Referenced by getLang().

ilLMObjTranslation::$last_update
protected

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

Referenced by getLastUpdate().

ilLMObjTranslation::$title
protected

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

Referenced by getTitle().


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