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

Class ilTranslationGUI. More...

+ Collaboration diagram for ilTranslationGUI:

Public Member Functions

 executeCommand ()
 editTranslations ($a_get_post_values=false, $a_add=false)
 saveTranslations ()
 Save title and translations.
 addTranslation ()
 Add a translation.
 deleteTranslations ()
 Remove translation.

Data Fields

 $tpl

Protected Attributes

 $ctrl
 $ilAccess
 $lng
 $ilObjOrgUnitGui
 $ilObjectOrgUnit

Detailed Description

Member Function Documentation

ilTranslationGUI::addTranslation ( )

Add a translation.

Definition at line 159 of file class.ilTranslationGUI.php.

References $_POST, and editTranslations().

{
if($_POST["title"])
{
$k = max(array_keys($_POST["title"]));
$k++;
$_POST["title"][$k] = "";
$this->editTranslations(true);
}
else
{
$this->editTranslations(false, true);
}
}

+ Here is the call graph for this function:

ilTranslationGUI::deleteTranslations ( )

Remove translation.

Definition at line 178 of file class.ilTranslationGUI.php.

References $_POST, editTranslations(), saveTranslations(), and ilUtil\sendFailure().

{
foreach($_POST["title"] as $k => $v)
{
if ($_POST["check"][$k])
{
// default translation cannot be deleted
if($k != $_POST["default"])
{
unset($_POST["title"][$k]);
unset($_POST["desc"][$k]);
unset($_POST["lang"][$k]);
}
else
{
ilUtil::sendFailure($this->lng->txt("msg_no_default_language"));
return $this->editTranslations();
}
}
}
$this->saveTranslations();
}

+ Here is the call graph for this function:

ilTranslationGUI::editTranslations (   $a_get_post_values = false,
  $a_add = false 
)

Definition at line 71 of file class.ilTranslationGUI.php.

References $_POST.

Referenced by addTranslation(), deleteTranslations(), and saveTranslations().

{
$this->lng->loadLanguageModule($this->ilObjectOrgUnit->getType());
$table = new ilObjectTranslationTableGUI($this, "editTranslations", true,
"Translation");
if ($a_get_post_values)
{
$vals = array();
foreach($_POST["title"] as $k => $v)
{
$vals[] = array("title" => $v,
"desc" => $_POST["desc"][$k],
"lang" => $_POST["lang"][$k],
"default" => ($_POST["default"] == $k));
}
$table->setData($vals);
}
else
{
$data = $this->ilObjectOrgUnit->getTranslations();
foreach($data["Fobject"] as $k => $v)
{
$data["Fobject"][$k]["default"] = ($k == $data["default_language"]);
}
if($a_add)
{
$data["Fobject"][++$k]["title"] = "";
}
$table->setData($data["Fobject"]);
}
$this->tpl->setContent($table->getHTML());
}

+ Here is the caller graph for this function:

ilTranslationGUI::executeCommand ( )

Definition at line 64 of file class.ilTranslationGUI.php.

References $cmd.

{
$cmd = $this->ctrl->getCmd();
$this->$cmd();
}
ilTranslationGUI::saveTranslations ( )

Save title and translations.

Definition at line 109 of file class.ilTranslationGUI.php.

References $_POST, editTranslations(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilUtil\stripSlashes().

Referenced by deleteTranslations().

{
// default language set?
if (!isset($_POST["default"]))
{
ilUtil::sendFailure($this->lng->txt("msg_no_default_language"));
return $this->editTranslations(true);
}
// all languages set?
if (array_key_exists("",$_POST["lang"]))
{
ilUtil::sendFailure($this->lng->txt("msg_no_language_selected"));
return $this->editTranslations(true);
}
// no single language is selected more than once?
if (count(array_unique($_POST["lang"])) < count($_POST["lang"]))
{
ilUtil::sendFailure($this->lng->txt("msg_multi_language_selected"));
return $this->editTranslations(true);
}
// save the stuff
$this->ilObjectOrgUnit->removeTranslations();
foreach($_POST["title"] as $k => $v)
{
// update object data if default
$is_default = ($_POST["default"] == $k);
if($is_default)
{
$this->ilObjectOrgUnit->setTitle(ilUtil::stripSlashes($v));
$this->ilObjectOrgUnit->setDescription(ilUtil::stripSlashes($_POST["desc"][$k]));
$this->ilObjectOrgUnit->update();
}
$this->ilObjectOrgUnit->addTranslation(
$is_default);
}
ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
$this->ctrl->redirect($this, "editTranslations");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilTranslationGUI::$ctrl
protected

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

ilTranslationGUI::$ilAccess
protected

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

ilTranslationGUI::$ilObjectOrgUnit
protected

Definition at line 37 of file class.ilTranslationGUI.php.

ilTranslationGUI::$ilObjOrgUnitGui
protected

Definition at line 33 of file class.ilTranslationGUI.php.

ilTranslationGUI::$lng
protected

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

ilTranslationGUI::$tpl

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


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