ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjLanguageExtGUI Class Reference

Class ilObjLanguageExtGUI. More...

+ Inheritance diagram for ilObjLanguageExtGUI:
+ Collaboration diagram for ilObjLanguageExtGUI:

Public Member Functions

 ilObjLanguageExtGUI ($a_data, $a_id=0, $a_call_by_reference=false)
 Constructor.
 assignObject ()
 Assign the extended language object.
executeCommand ()
 execute command
 cancelObject ()
 Cancel the current action.
 viewObject ()
 Show the edit screen.
 saveObject ()
 Save the changed translations.
 importObject ()
 Show the screen to import a language file.
 uploadObject ()
 Process an uploaded language file.
 exportObject ()
 Show the screen to export a language file.
 downloadObject ()
 Download a language file.
 maintainObject ()
 Process the language maintenance.
 settingsObject ()
 Set the language settings.
 statisticsObject ()
 Print out statistics about the language.
 getPar ($a_request_name, $a_default_value)
 Read a param that is either coming from GET, POST or is taken from the session variables of this GUI.
 getAdminTabs (&$tabs_gui)
 Get tabs for admin mode.
 prepareOutput ()
 Prepare the standard template for output (Overwritten from ilObjectGUI)
 addAdminLocatorItems ()
 Set the locator for admin mode (called from prepareOutput in parent class)
 setTitleAndDescription ()
 Set the Title and the description (Overwritten from ilObjectGUI, called by prepareOutput)
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public.
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not)
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui
 getCreationMode ()
 get creation mode
 showUpperIcon ()
 showMountWebfolderIcon ()
 setTabs ()
 set admin tabs public
 setAdminTabs ()
 set admin tabs public
 getHTML ()
 setActions ($a_actions="")
 set possible actions for objects in list.
 setSubObjects ($a_sub_objects="")
 set possible subobjects for this object.
 setLocator ()
 set Locator
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded)
 omitLocator ($a_omit=true)
 undeleteObject ()
 get object back from trash
 insertSavedNodes ($a_source_id, $a_dest_id, $a_tree_id, &$a_affected_ids)
 recursive method to insert all saved nodes of the clipboard (maybe this function could be moved to a rbac class ?)
 confirmedDeleteObject ()
 confirmed deletion if object -> objects are moved to trash
 cancelDeleteObject ()
 cancel deletion of object
 removeFromSystemObject ()
 remove objects from trash bin and all entries therefore every object needs a specific deleteObject() method
 removeDeletedNodes ($a_node_id, $a_checked, $a_delete_objects, &$a_affected_ids)
 remove already deleted objects within the objects in trash recursive function
 createObject ()
 create new object form
 cancelObject ($in_rep=false)
 cancel action and go back to previous page public
 editObject ()
 edit object
 displayEditForm ($fields)
 display edit form (usually called by editObject)
 updateObject ()
 updates object entry in object_data
 afterUpdate ()
 permObject ()
 show permissions of current node
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g.
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g.
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g.
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command
 permSaveObject ()
 save permissions
 isVisible ($a_ref_id, $a_type)
 displayList ()
 display object list
 deleteObject ($a_error=false)
 display deletion confirmation screen only for referenced objects.
 trashObject ()
 show trash content of object
 addRoleObject ()
 adds a local role This method is only called when choose the option 'you may add local roles'.
 showActions ($with_subobjects=false)
 show possible action (form buttons)
 getActions ()
 Get Actions.
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu)
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl.
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste
 getTabs (&$tabs_gui)
 get tabs abstract method.
 __showButton ($a_cmd, $a_text, $a_target= '')
 hitsperpageObject ()
__initTableGUI ()
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table
 __showClipboardTable ($a_result_set, $a_from="")
 infoObject ()
 __buildRoleFilterSelect ()
 __filterRoles ($a_roles, $a_filter)
 ownerObject ()
 changeOwnerObject ()
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning.
 fillCloneSearchTemplate ($a_tpl_varname, $a_type)
 Add an object search in case the number of existing objects is too big to offer a selection list.
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI.
 copyWizardHasOptions ($a_mode)
 Check if there is any modules specific option.
 getCenterColumnHTML ()
 Get center column.
 getRightColumnHTML ()
 Display right column.
 setColumnSettings ($column_gui)
 May be overwritten in subclasses.
 checkPermission ($a_perm, $a_cmd="")

Static Public Member Functions

static _isPageTranslation ()
 Check if the GUI is in page translation mode.
static _getTranslationLink ()
 Get the HTML code for calling the page translation.

Private Attributes

 $inputsize = 40

Additional Inherited Members

- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 $ilias
 $objDefinition
 $tpl
 $tree
 $lng
 $data
 $object
 $ref_id
 $obj_id
 $maxcount
 $formaction
 $return_location
 $target_frame
 $tab_target_script
 $actions
 $sub_objects
 $omit_locator = false
- Protected Member Functions inherited from ilObjectGUI
 searchCloneSourceObject ()
 Search clone source by title.
 buildCloneSelect ($existing_objs)
 Build a select box for clonable objects (permission write)

Detailed Description

Member Function Documentation

static ilObjLanguageExtGUI::_getTranslationLink ( )
static

Get the HTML code for calling the page translation.

Returns a hidden form with a link to the translation screen The HTML code can be added to the footer of every ILIAS page

static

Definition at line 911 of file class.ilObjLanguageExtGUI.php.

References $ilSetting, ilObjectGUI\$lng, ilObjectGUI\$tpl, and ilUtil\prepareFormOutput().

Referenced by ilTemplate\addILIASFooter().

{
global $ilSetting, $lng;
// prevent translation link on translation screen
// check setting of translation mode
if (self::_isPageTranslation()
or !$ilSetting->get("lang_translate_".$lng->getLangKey()))
{
return "";
}
// set the target for translation
// ref id must be given to prevent params being deleted by ilAdministrtionGUI
$action = "ilias.php"
."?ref_id=".ilobjLanguageAccess::_lookupLangFolderRefId()
."&baseClass=ilAdministrationGUI"
."&cmdClass=ilobjlanguageextgui"
."&view_mode=translate";
$tpl = new ilTemplate("tpl.translation_link.html",true,true, "Services/Language");
foreach($lng->getUsedModules() as $module => $dummy)
{
$tpl->setCurrentBlock("hidden");
$tpl->setVariable("NAME", "page_modules[]");
$tpl->setVariable("VALUE", ilUtil::prepareFormOutput($module));
$tpl->parseCurrentBlock();
}
foreach($lng->getUsedTopics() as $topic => $dummy)
{
$tpl->setCurrentBlock("hidden");
$tpl->setVariable("NAME", "page_topics[]");
$tpl->setVariable("VALUE", ilUtil::prepareFormOutput($topic));
$tpl->parseCurrentBlock();
}
$tpl->setVariable("ACTION", $action);
$tpl->setVariable("TXT_TRANSLATE",$lng->txt("translation"));
return $tpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjLanguageExtGUI::_isPageTranslation ( )
static

Check if the GUI is in page translation mode.

The page translation mode is used when the translation of a single page is called by the translation link on a page footer. The page translation screen is shown in a separate window. On this screen only the topics used on the calling page are shown for translation and only a save function for these topics is offered.

static

Returns
bool page translation (true or false)

Definition at line 897 of file class.ilObjLanguageExtGUI.php.

References $_GET.

Referenced by prepareOutput(), and viewObject().

{
return ($_GET['view_mode'] == "translate");
}

+ Here is the caller graph for this function:

ilObjLanguageExtGUI::addAdminLocatorItems ( )

Set the locator for admin mode (called from prepareOutput in parent class)

Reimplemented from ilObjectGUI.

Definition at line 853 of file class.ilObjLanguageExtGUI.php.

References ilObjectGUI\$tpl, and ilFrameTargetInfo\_getFrame().

{
global $ilLocator, $tpl;
$ilLocator->addItem($this->lng->txt("administration"),
$this->ctrl->getLinkTargetByClass("iladministrationgui", "frameset"),
$ilLocator->addItem($this->lng->txt("languages"),
$this->ctrl->getLinkTargetByClass("ilobjlanguagefoldergui", ""));
$ilLocator->addItem($this->lng->txt("meta_l_". $this->object->getTitle()),
$this->ctrl->getLinkTarget($this, "view"));
}

+ Here is the call graph for this function:

ilObjLanguageExtGUI::assignObject ( )

Assign the extended language object.

Overwritten from ilObjectGUI to use the extended language object. (Will be deleted when ilObjLanguageExt is merged with ilObjLanguage)

Reimplemented from ilObjectGUI.

Definition at line 99 of file class.ilObjLanguageExtGUI.php.

{
require_once("Services/Language/classes/class.ilObjLanguageExt.php");
$this->object =& new ilObjLanguageExt($this->id);
}
ilObjLanguageExtGUI::cancelObject ( )

Cancel the current action.

Definition at line 126 of file class.ilObjLanguageExtGUI.php.

References ilUtil\sendInfo(), and viewObject().

Referenced by uploadObject().

{
ilUtil::sendInfo($this->lng->txt("action_aborted"), false);
$this->viewObject();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjLanguageExtGUI::downloadObject ( )

Download a language file.

Definition at line 530 of file class.ilObjLanguageExtGUI.php.

References $filename, ilUtil\deliverData(), and ILIAS_VERSION.

{
$filename = 'ilias_' . $this->object->key . '_'
. str_replace(".", "_", substr(ILIAS_VERSION, 0, strpos(ILIAS_VERSION, " ")))
. "-" . date('Y-m-d')
. ".lang.".$_POST["scope"];
$global_file_obj = $this->object->getGlobalLanguageFile();
$local_file_obj = new ilLanguageFile($filename, $this->object->key, $_POST["scope"]);
if ($_POST["scope"] == 'global')
{
$local_file_obj->setParam("author", $global_file_obj->getParam('author'));
$local_file_obj->setParam("version", $global_file_obj->getParam('version'));
$local_file_obj->setAllValues($this->object->getAllValues());
}
elseif ($_POST["scope"] == 'local')
{
$local_file_obj->setParam("based_on", $global_file_obj->getParam('version'));
$local_file_obj->setAllValues($this->object->getChangedValues());
}
elseif ($_POST["scope"] == 'unchanged')
{
$local_file_obj->setParam("author", $global_file_obj->getParam('author'));
$local_file_obj->setParam("version", $global_file_obj->getParam('version'));
$local_file_obj->setAllValues($this->object->getUnchangedValues());
}
ilUtil::deliverData($local_file_obj->build(), $filename);
}

+ Here is the call graph for this function:

& ilObjLanguageExtGUI::executeCommand ( )

execute command

Reimplemented from ilObjectGUI.

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

References $cmd, ilObjLanguageAccess\_checkMaintenance(), and exit.

{
{
$this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
}
$cmd = $this->ctrl->getCmd("view")."Object";
$this->$cmd();
}

+ Here is the call graph for this function:

ilObjLanguageExtGUI::exportObject ( )

Show the screen to export a language file.

Definition at line 503 of file class.ilObjLanguageExtGUI.php.

{
$scope = $_POST["scope"] ? $_POST["scope"] : "global";
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lang_file_export.html", "Services/Language");
$this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
$this->tpl->setVariable("TXT_HEADER",$this->lng->txt("language_export_file"));
$this->tpl->setVariable("TXT_SCOPE",$this->lng->txt("language_file_scope"));
$this->tpl->setVariable("TXT_SCOPE_GLOBAL",$this->lng->txt("language_scope_global"));
$this->tpl->setVariable("TXT_SCOPE_LOCAL",$this->lng->txt("language_scope_local"));
$this->tpl->setVariable("TXT_SCOPE_UNCHANGED",$this->lng->txt("language_scope_unchanged"));
$this->tpl->setVariable("CHECKED_GLOBAL",$scope == 'global' ? 'checked="checked"' : '');
$this->tpl->setVariable("CHECKED_LOCAL",$scope == 'local' ? 'checked="checked"' : '');
$this->tpl->setVariable("CHECKED_UNCHANGED",$scope == 'unchanged' ? 'checked="checked"' : '');
$this->tpl->setVariable("TXT_DOWNLOAD",$this->lng->txt("download"));
$this->tpl->setVariable("CMD_DOWNLOAD","download");
$this->tpl->show();
}
ilObjLanguageExtGUI::getAdminTabs ( $tabs_gui)

Get tabs for admin mode.

Parameters
objecttabs gui object

Reimplemented from ilObjectGUI.

Definition at line 795 of file class.ilObjLanguageExtGUI.php.

{
global $rbacsystem;
$tabs_gui->addTarget("edit",
$this->ctrl->getLinkTarget($this, "view"),
array("","view","cancel","save"));
$tabs_gui->addTarget("export",
$this->ctrl->getLinkTarget($this, "export"),
array("export","download"));
$tabs_gui->addTarget("import",
$this->ctrl->getLinkTarget($this, "import"),
array("import","upload"));
$tabs_gui->addTarget("language_maintain",
$this->ctrl->getLinkTarget($this, "maintain"),
array("maintain"));
$tabs_gui->addTarget("settings",
$this->ctrl->getLinkTarget($this, "settings"),
array("settings"));
$tabs_gui->addTarget("language_statistics",
$this->ctrl->getLinkTarget($this, "statistics"),
array("statistics"));
}
ilObjLanguageExtGUI::getPar (   $a_request_name,
  $a_default_value 
)

Read a param that is either coming from GET, POST or is taken from the session variables of this GUI.

A request value is automatically saved in the session variables. Slashes are stripped from request values.

Parameters
stringname of the GET or POST or variable
mixeddefault value

Definition at line 745 of file class.ilObjLanguageExtGUI.php.

References $_GET, and ilUtil\stripSlashes().

Referenced by viewObject().

{
// get the parameter value
if (isset($_GET[$a_request_name]))
{
$param = $_GET[$a_request_name];
$from_request = true;
}
elseif (isset($_POST[$a_request_name]))
{
$param = $_POST[$a_request_name];
$from_request = true;
}
elseif (isset($this->session[$a_request_name]))
{
$param = $this->session[$a_request_name];
$from_request = false;
}
else
{
$param = $a_default_value;
$from_request = false;
}
// strip slashes from request parameters
if ($from_request)
{
if (is_array($param))
{
foreach ($param as $key => $value)
{
$param[$key] = ilUtil::stripSlashes($value);
}
}
else
{
$param = ilUtil::stripSlashes($param);
}
}
// make the parameter available to further requests
$this->session[$a_request_name] = $param;
return $param;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjLanguageExtGUI::ilObjLanguageExtGUI (   $a_data,
  $a_id = 0,
  $a_call_by_reference = false 
)

Constructor.

Note: The GET param 'obj_id' is the language object id The GET param 'ref_id' is the language folder (if present)

Parameters
mixeddata (ignored)
intid (ignored)
booleancall-by-reference (ignored)

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

References $_GET, $_SESSION, $ilCtrl, ilObjectGUI\$lng, ilObjLanguageAccess\_lookupId(), and ilObjectGUI\ilObjectGUI().

{
global $lng, $ilCtrl;
// language maintenance strings are defined in administration
$lng->loadLanguageModule("administration");
$lng->loadLanguageModule("meta");
// view mode ('translate' or empty) needed for prepareOutput()
$ilCtrl->saveParameter($this, "view_mode");
// type and id of get the bound object
$this->type = "lng";
if (! $this->id = $_GET['obj_id'])
{
$this->id = ilObjLanguageAccess::_lookupId($lng->getUserLanguage());
}
// do all generic GUI initialisations
$this->ilObjectGUI($a_data, $this->id, false, true);
// initialize the array to store GUI session variables
if (!is_array($_SESSION[get_class($this)]))
{
$_SESSION[get_class($this)] = array();
}
$this->session =& $_SESSION[get_class($this)];
}

+ Here is the call graph for this function:

ilObjLanguageExtGUI::importObject ( )

Show the screen to import a language file.

Reimplemented from ilObjectGUI.

Definition at line 451 of file class.ilObjLanguageExtGUI.php.

Referenced by uploadObject().

{
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lang_file_import.html", "Services/Language");
$this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
$this->tpl->setVariable("TXT_HEADER",$this->lng->txt("language_import_file"));
$this->tpl->setVariable("TXT_FILE",$this->lng->txt("file"));
$this->tpl->setVariable("TXT_MODE",$this->lng->txt("language_mode_existing"));
$this->tpl->setVariable("TXT_MODE_KEEPALL",$this->lng->txt("language_mode_existing_keepall"));
$this->tpl->setVariable("TXT_MODE_KEEPNEW",$this->lng->txt("language_mode_existing_keepnew"));
$this->tpl->setVariable("TXT_MODE_REPLACE",$this->lng->txt("language_mode_existing_replace"));
$this->tpl->setVariable("TXT_MODE_DELETE",$this->lng->txt("language_mode_existing_delete"));
$this->tpl->setVariable("TXT_UPLOAD",$this->lng->txt("upload"));
$this->tpl->setVariable("CMD_UPLOAD","upload");
$this->tpl->show();
}

+ Here is the caller graph for this function:

ilObjLanguageExtGUI::maintainObject ( )

Process the language maintenance.

Definition at line 565 of file class.ilObjLanguageExtGUI.php.

References ilUtil\sendInfo().

{
global $ilUser;
switch ($_POST["maintain"])
{
// save the local changes to the local language file
case "save":
$lang_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang.local';
if ((is_file($lang_file) and is_writable($lang_file))
or (!file_exists($lang_file) and is_writable($this->object->getCustLangPath())))
{
// save a copy of the distributed language file
$orig_file = $this->object->getLangPath() . '/ilias_' . $this->object->key . '.lang';
$copy_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang';
@copy($orig_file, $copy_file);
// save a backup of the old local language file
@rename($lang_file, $lang_file.".bak");
// create and write the new local language file
$global_file_obj = $this->object->getGlobalLanguageFile();
$local_file_obj = new ilLanguageFile($lang_file, $this->object->key, 'local');
$local_file_obj->setParam('based_on', $global_file_obj->getParam('version'));
$local_file_obj->setAllValues($this->object->getChangedValues());
$local_file_obj->write();
$this->object->setLocal(true);
ilUtil::sendInfo($this->lng->txt("language_saved_local") , false);
}
else
{
ilUtil::sendInfo($this->lng->txt("language_error_write_local") , false);
}
break;
// load the content of the local language file
case "load":
$lang_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang.local';
if (is_file($lang_file) and is_readable($lang_file))
{
$this->object->importLanguageFile($lang_file, 'replace');
$this->object->setLocal(true);
ilUtil::sendInfo($this->lng->txt("language_loaded_local") , false);
}
else
{
ilUtil::sendInfo($this->lng->txt("language_error_read_local") , false);
}
break;
// revert the database to the default language file
case "clear":
$lang_file = $this->object->getLangPath() . '/ilias_' . $this->object->key . '.lang';
if (is_file($lang_file) and is_readable($lang_file))
{
$this->object->importLanguageFile($lang_file, 'delete');
$this->object->setLocal(false);
ilUtil::sendInfo($this->lng->txt("language_cleared_local") , false);
}
else
{
ilUtil::sendInfo($this->lng->txt("language_error_clear_local") , false);
}
break;
}
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lang_maintenance.html", "Services/Language");
$this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
$this->tpl->setVariable("TXT_MAINTENANCE",$this->lng->txt("language_maintenance"));
$this->tpl->setVariable("TXT_MAINTAIN_LOCAL",$this->lng->txt("language_maintain_local_changes"));
$this->tpl->setVariable("TXT_SELECT",$this->lng->txt("please_select"));
$this->tpl->setVariable("TXT_SAVE",$this->lng->txt("language_save_local_changes"));
$this->tpl->setVariable("TXT_LOAD",$this->lng->txt("language_load_local_changes"));
$this->tpl->setVariable("TXT_CLEAR",$this->lng->txt("language_clear_local_changes"));
$this->tpl->setVariable("TXT_NOTE_SAVE",$this->lng->txt("language_note_save_local"));
$this->tpl->setVariable("TXT_MAINTAIN",$this->lng->txt("language_process_maintenance"));
$this->tpl->setVariable("VAR_MAINTAIN", "maintain");
$this->tpl->setVariable("CMD_MAINTAIN", "maintain");
$this->tpl->show();
}

+ Here is the call graph for this function:

ilObjLanguageExtGUI::prepareOutput ( )

Prepare the standard template for output (Overwritten from ilObjectGUI)

Reimplemented from ilObjectGUI.

Definition at line 829 of file class.ilObjLanguageExtGUI.php.

References _isPageTranslation(), and ilUtil\getImagePath().

{
if ($this->_isPageTranslation())
{
// show the pure translation page without menu, tabs etc.
$this->tpl->addBlockFile("CONTENT","content","tpl.adm_translate.html","Services/Language");
$this->tpl->setHeaderPageTitle($this->lng->txt("translation"));
$this->tpl->setTitle($this->lng->txt("translation"). " "
.$this->lng->txt("meta_l_".$this->object->key));
$this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lng_b.gif"),
$this->lng->txt("obj_" . $this->object->getType()));
}
else
{
// show the full page framework
}
}

+ Here is the call graph for this function:

ilObjLanguageExtGUI::saveObject ( )

Save the changed translations.

Reimplemented from ilObjectGUI.

Definition at line 424 of file class.ilObjLanguageExtGUI.php.

References ilObjLanguageExt\_saveValues(), ilUtil\stripSlashes(), and viewObject().

{
// prepare the values to be saved
$save_array = array();
foreach ($_POST as $key => $value)
{
$keys = explode("#:#", ilUtil::stripSlashes($key, false));
if (count($keys) == 2)
{
// avoid line breaks
$value = preg_replace("/(\015\012)|(\015)|(\012)/","<br />",$value);
$value = ilUtil::stripSlashes($value, false);
$save_array[$key] = $value;
}
}
// save the translations
ilObjLanguageExt::_saveValues($this->object->key, $save_array);
// view the list
$this->viewObject();
}

+ Here is the call graph for this function:

ilObjLanguageExtGUI::settingsObject ( )

Set the language settings.

Definition at line 651 of file class.ilObjLanguageExtGUI.php.

References $ilSetting.

{
global $ilSetting;
$translate_key = "lang_translate_". $this->object->key;
// save and get the page translation setting
switch ($_POST["translation"])
{
case "enable":
$ilSetting->set($translate_key, true);
break;
case "disable":
$ilSetting->set($translate_key, false);
}
$translate = $ilSetting->get($translate_key, false);
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lang_settings.html", "Services/Language");
$this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
$this->tpl->setVariable("TXT_SETTINGS",$this->lng->txt("language_settings"));
$this->tpl->setVariable("TXT_TRANSLATION",$this->lng->txt("language_translation_mode"));
$this->tpl->setVariable("TXT_TRANSLATION_ENABLED",$this->lng->txt("language_translation_enabled"));
$this->tpl->setVariable("TXT_TRANSLATION_DISABLED",$this->lng->txt("language_translation_disabled"));
$this->tpl->setVariable("CHECKED_ENABLE", $translate ? 'checked="checked"': '');
$this->tpl->setVariable("CHECKED_DISABLE", $translate ? '' : 'checked="checked"');
$this->tpl->setVariable("TXT_NOTE_TRANSLATION",$this->lng->txt("language_note_translation"));
$this->tpl->setVariable("TXT_CHANGE_SETTINGS",$this->lng->txt("language_change_settings"));
$this->tpl->setVariable("CMD_SETTINGS", "settings");
$this->tpl->show();
}
ilObjLanguageExtGUI::setTitleAndDescription ( )

Set the Title and the description (Overwritten from ilObjectGUI, called by prepareOutput)

Reimplemented from ilObjectGUI.

Definition at line 873 of file class.ilObjLanguageExtGUI.php.

References ilUtil\getImagePath().

{
$this->tpl->setTitle($this->lng->txt("meta_l_".$this->object->getTitle()));
// $this->tpl->setDescription($this->object->getLongDescription());
$this->tpl->setTitleIcon(ilUtil::getImagePath("icon_".$this->object->getType()."_b.gif"), $this->lng->txt("obj_" . $this->object->getType()));
}

+ Here is the call graph for this function:

ilObjLanguageExtGUI::statisticsObject ( )

Print out statistics about the language.

Definition at line 686 of file class.ilObjLanguageExtGUI.php.

References ilObjectGUI\$data, $total, and ilObjLanguageExt\_getModules().

{
$modules = ilObjLanguageExt::_getModules($this->object->key);
$data = array();
$total = array("",0,0,0);
foreach($modules as $module)
{
$row = array();
$row[0] = $module;
$row[1] = count($this->object->getAllValues(array($module)));
$row[2] = count($this->object->getChangedValues(array($module)));
$row[3] = $row[1]-$row[2];
$total[1] += $row[1];
$total[2] += $row[2];
$total[3] += $row[3];
$data[] = $row;
}
$total[0] = "<b>".$this->lng->txt("language_all_modules")."</b>";
$total[1] = "<b>".$total[1]."</b>";
$total[2] = "<b>".$total[2]."</b>";
$total[3] = "<b>".$total[3]."</b>";
// prepare the templates for output
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lang_statistics.html", "Services/Language");
$this->tpl->addBlockFile("TABLE_STATISTICS", "table_statistics", "tpl.table.html");
$this->tpl->addBlockFile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html");
// create and configure the table object
include_once 'Services/Table/classes/class.ilTableGUI.php';
$tbl = new ilTableGUI();
$tbl->disable('title');
$tbl->disable('sort');
$tbl->disable('numinfo');
$tbl->setHeaderNames(array($this->lng->txt("module"),
$this->lng->txt("language_scope_global"),
$this->lng->txt("language_scope_local"),
$this->lng->txt("language_scope_unchanged")));
$tbl->setColumnWidth(array( "25%", "25%", "25%", "25%"));
$tbl->setLimit(count($data));
$tbl->setData($data);
// show the table
$tbl->render();
$this->tpl->show();
}

+ Here is the call graph for this function:

ilObjLanguageExtGUI::uploadObject ( )

Process an uploaded language file.

Definition at line 474 of file class.ilObjLanguageExtGUI.php.

References $file, cancelObject(), importObject(), ilUtil\moveUploadedFile(), and ilUtil\sendInfo().

{
if ($_POST['cmd']['upload'])
{
$file = $_FILES['userfile']['tmp_name'].'x';
if (ilUtil::moveUploadedFile($_FILES['userfile']['tmp_name'],
$_FILES['userfile']['name'],
{
$this->object->importLanguageFile($file,$_POST['mode_existing']);
ilUtil::sendInfo(sprintf($this->lng->txt("language_file_imported"), $_FILES['userfile']['name']) , false);
$this->importObject();
}
else
{
$this->importObject();
}
}
else
{
$this->cancelObject();
}
}

+ Here is the call graph for this function:

ilObjLanguageExtGUI::viewObject ( )

Show the edit screen.

Reimplemented from ilObjectGUI.

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

References ilObjectGUI\$data, ilObjectGUI\$tpl, ilObjLanguageExt\_getModules(), ilObjLanguageExt\_getValues(), _isPageTranslation(), ilUtil\formSelect(), getPar(), ilUtil\prepareFormOutput(), ilUtil\sendInfo(), and ilUtil\sortArray().

Referenced by cancelObject(), and saveObject().

{
global $ilUser;
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lang_edit_items.html", "Services/Language");
// set the language to compare with
$compare = $this->getPar('compare', $this->lng->getDefaultLanguage());
// get the default values if the compare language is the same
if ($compare == $this->object->key)
{
$compare_object = $this->object->getGlobalLanguageFile();
$compare_content = $compare_object->getAllValues();
$compare_comments = $compare_object->getAllComments();
$compare_note = " ". $this->lng->txt("language_default_entries");
}
// page translation mode:
// - the table is filtered by a list of modules and topics
// - all found entries are shown on the same page
if ($this->_isPageTranslation())
{
$offset = 0;
$limit = 0;
$modules = $this->getPar("page_modules", array());
$topics = $this->getPar("page_topics", array());
if (!isset($compare_content))
{
$compare_content = ilObjLanguageExt::_getValues(
$compare, $modules, $topics);
}
$this->object->key, $modules, $topics);
}
// normal view mode:
// - the table is filtered manually by module, mode and pattern
// - found entries are paged by maximum list length
// - the filter selection is shown
else
{
$offset = $this->getPar('offset','0');
$limit = $ilUser->getPref("hits_per_page");
$filter_mode = $this->getPar('filter_mode','all');
$filter_pattern = $this->getPar('filter_pattern','');
$filter_module = $this->getPar('filter_module','administration');
$filter_modules = $filter_module ? array($filter_module) : array();
if (!isset($compare_content))
{
$compare_content = ilObjLanguageExt::_getValues(
$compare, $filter_modules);
}
switch ($filter_mode)
{
case "changed":
$translations = $this->object->getChangedValues(
$filter_modules, $filter_pattern);
break;
case "unchanged":
$translations = $this->object->getUnchangedValues(
$filter_modules, $filter_pattern);
break;
case "commented":
$translations = $this->object->getCommentedValues(
$filter_modules, $filter_pattern);
break;
case "equal":
$translations = $this->object->getAllValues(
$filter_modules, $filter_pattern);
$translations = array_intersect_assoc($translations, $compare_content);
break;
case "different":
$translations = $this->object->getAllValues(
$filter_modules, $filter_pattern);
$translations = array_diff_assoc($translations, $compare_content);
break;
case "conflicts":
$former_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang';
if (!is_readable($former_file))
{
ilUtil::sendInfo(sprintf($this->lng->txt("language_former_file_missing"), $former_file)
.'<br />'. $this->lng->txt("language_former_file_description") , false);
$translations = array();
break;
}
$global_file_obj = $this->object->getGlobalLanguageFile();
$former_file_obj = new ilLanguageFile($former_file);
$former_file_obj->read();
$global_changes = array_diff_assoc(
$global_file_obj->getAllValues(),
$former_file_obj->getAllValues());
if (!count($global_changes))
{
ilUtil::sendInfo(sprintf($this->lng->txt("language_former_file_equal"), $former_file)
.'<br />'. $this->lng->txt("language_former_file_description") , false);
$translations = array();
break;
}
$translations = $this->object->getChangedValues(
$filter_modules, $filter_pattern);
$translations = array_intersect_key($translations, $global_changes);
break;
case "all":
default:
$translations = $this->object->getAllValues(
$filter_modules, $filter_pattern);
}
// show the filter section
$this->tpl->setCurrentBlock("filter");
// filter by language module
$options = array();
$options[""] = $this->lng->txt("language_all_modules");
$modules = ilObjLanguageExt::_getModules($this->object->key);
foreach ($modules as $mod)
{
$options[$mod] = $mod;
}
$this->tpl->setVariable("SELECT_MODULE",
ilUtil::formSelect($filter_module, "filter_module", $options, false, true));
// filter by mode
$options = array();
$options["all"] = $this->lng->txt("language_scope_global");
$options["changed"] = $this->lng->txt("language_scope_local");
$options["unchanged"] = $this->lng->txt("language_scope_unchanged");
$options["equal"] = $this->lng->txt("language_scope_equal");
$options["different"] = $this->lng->txt("language_scope_different");
$options["commented"] = $this->lng->txt("language_scope_commented");
$options["conflicts"] = $this->lng->txt("language_scope_conflicts");
$this->tpl->setVariable("SELECT_MODE",
ilUtil::formSelect($filter_mode, "filter_mode", $options, false, true));
// filter by pattern
$this->tpl->setVariable("PATTERN_NAME", "filter_pattern");
$this->tpl->setVariable("PATTERN_VALUE", ilUtil::prepareFormOutput($filter_pattern));
// and general filter variables
$this->tpl->setVariable("FILTER_ACTION", $this->ctrl->getFormAction($this));
$this->tpl->setVariable("TXT_FILTER", $this->lng->txt("filter"));
$this->tpl->setVariable("OFFSET_NAME", "offset");
$this->tpl->setVariable("OFFSET_VALUE", "0");
$this->tpl->setVariable("TXT_APPLY_FILTER", $this->lng->txt("apply_filter"));
$this->tpl->setVariable("CMD_FILTER", "view");
$this->tpl->parseCurrentBlock();
}
// show the compare section
$this->tpl->setCurrentBlock("compare");
$this->tpl->setVariable("COMPARE_ACTION", $this->ctrl->getFormAction($this));
$this->tpl->setVariable("TXT_COMPARE", $this->lng->txt("language_compare"));
$this->tpl->setVariable("TXT_CHANGE", $this->lng->txt("change"));
$options = array();
$langlist = $this->lng->getInstalledLanguages();
foreach ($langlist as $lang_key)
{
$options[$lang_key] = $this->lng->txt("meta_l_".$lang_key);
}
$this->tpl->setVariable("SELECT_COMPARE",
ilUtil::formSelect($compare, "compare", $options, false, true,1));
$this->tpl->setVariable("CMD_COMPARE", "view");
$this->tpl->parseCurrentBlock();
// prepare the dataset for the output table
$sort_by = $this->getPar('sort_by','translation');
$sort_order = $this->getPar('sort_order','asc');
$list = array();
foreach($translations as $name => $translation)
{
$keys = explode("#:#", $name);
$data = array();
$data["module"] = $keys[0];
$data["topic"] = str_replace('_', ' ', $keys[1]);
$data["name"] = $name;
$data["translation"] = $translation;
$data["default"] = $compare_content[$name];
$data["comment"] = $compare_comments[$name];
$list[] = $data;
}
$list = ilUtil::sortArray($list, $sort_by, $sort_order);
if ($limit > 0)
{
$list = array_slice($list, $offset, $limit);
}
// create and configure the table object
include_once 'Services/Table/classes/class.ilTableGUI.php';
$tbl = new ilTableGUI();
$tbl->disable('title');
$tbl->setHeaderNames(array($this->lng->txt("module"),
$this->lng->txt("identifier"),
$this->lng->txt("meta_l_".$this->object->key),
$this->lng->txt("meta_l_".$compare).$compare_note));
$tbl->setHeaderVars(array("module",
"topic",
"translation",
"default"),
$this->ctrl->getParameterArray($this));
$tbl->setColumnWidth(array( "10%",
"20%",
"40%",
"30%"));
$tbl->setOrderColumn($sort_by);
$tbl->setOrderDirection($sort_order);
$tbl->setLimit($limit);
$tbl->setOffset($offset);
$tbl->setMaxCount(count($translations));
// prepare the table template
$tpl =& new ilTemplate("tpl.table.html", true, true);
$tpl->setCurrentBlock("tbl_form_header");
$tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("tbl_action_btn");
$tpl->setVariable("BTN_NAME",'save');
$tpl->setVariable("BTN_VALUE",$this->lng->txt('save'));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("tbl_action_row");
$tpl->setVariable("COLUMN_COUNTS","4");
$tpl->parseCurrentBlock();
// render the table rows
$tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.lang_items_row.html", "Services/Language");
foreach ($list as $data)
{
if (strlen($data["translation"]) <= $this->inputsize)
{
$tpl->setCurrentBlock("input");
$tpl->setVariable("I_NAME", ilUtil::prepareFormOutput($data["name"]));
$tpl->setVariable("I_SIZE", $this->inputsize);
$tpl->setVariable("I_USER_VALUE", ilUtil::prepareFormOutput($data["translation"]));
}
else
{
$tpl->setCurrentBlock("textarea");
$tpl->setVariable("T_ROWS", ceil(strlen($data["translation"]) / $this->inputsize));
$tpl->setVariable("T_SIZE", $this->inputsize);
$tpl->setVariable("T_NAME", ilUtil::prepareFormOutput($data["name"]));
$tpl->setVariable("T_USER_VALUE", ilUtil::prepareFormOutput($data["translation"]));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("row");
$tpl->setVariable("MODULE", ilUtil::prepareFormOutput($data["module"]));
$tpl->setVariable("TOPIC", ilUtil::prepareFormOutput($data["topic"]));
$tpl->setVariable("DEFAULT_VALUE", ilUtil::prepareFormOutput($data["default"]));
$tpl->setVariable("COMMENT", ilUtil::prepareFormOutput($data["comment"]));
$tpl->parseCurrentBlock();
}
// render and show the table
$tbl->setTemplate($tpl);
$tbl->render();
$this->tpl->setVariable("TRANSLATION_TABLE", $tpl->get());
$this->tpl->show();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilObjLanguageExtGUI::$inputsize = 40
private

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


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