ILIAS  release_4-4 Revision
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. More...
 
 assignObject ()
 Assign the extended language object. More...
 
executeCommand ()
 execute command More...
 
 cancelObject ()
 Cancel the current action. More...
 
 viewObject ()
 Show the edit screen. More...
 
 saveObject ()
 Save the changed translations. More...
 
 importObject ()
 Show the screen to import a language file. More...
 
 uploadObject ()
 Process an uploaded language file. More...
 
 exportObject ()
 Show the screen to export a language file. More...
 
 downloadObject ()
 Download a language file. More...
 
 maintainObject ()
 Process the language maintenance. More...
 
 settingsObject ()
 Set the language settings. More...
 
 statisticsObject ()
 Print out statistics about the language. More...
 
 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. More...
 
 getAdminTabs (&$tabs_gui)
 Get tabs for admin mode. More...
 
 prepareOutput ()
 Prepare the standard template for output (Overwritten from ilObjectGUI) More...
 
 addAdminLocatorItems ()
 Set the locator for admin mode (called from prepareOutput in parent class) More...
 
 setTitleAndDescription ()
 Set the Title and the description (Overwritten from ilObjectGUI, called by prepareOutput) More...
 
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public. More...
 
executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 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 More...
 
 getCreationMode ()
 get creation mode More...
 
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ($in_rep=false)
 cancel action and go back to previous page public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 editObject ()
 edit object More...
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 list childs of current object More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 

Static Public Member Functions

static _isPageTranslation ()
 Check if the GUI is in page translation mode. More...
 
static _getTranslationLink ()
 Get the HTML code for calling the page translation. More...
 
- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 

Private Attributes

 $inputsize = 50
 
 $commentsize = 30
 

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
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 
 prepareOutput ()
 prepare output More...
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 showMountWebfolderIcon ()
 
 setTabs ()
 set admin tabs public More...
 
 setAdminTabs ()
 set admin tabs public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste More...
 
 getTabs (&$tabs_gui)
 get tabs abstract method. More...
 
 __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 More...
 
 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 More...
 
 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. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings ($column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Detailed Description

Member Function Documentation

◆ _getTranslationLink()

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 1032 of file class.ilObjLanguageExtGUI.php.

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

Referenced by ilTemplate\addILIASFooter().

1033  {
1034  global $ilSetting, $lng;
1035 
1036  // prevent translation link on translation screen
1037  // check setting of translation mode
1038  if (self::_isPageTranslation()
1039  or !$ilSetting->get("lang_translate_".$lng->getLangKey()))
1040  {
1041  return "";
1042  }
1043 
1044  // set the target for translation
1045  // ref id must be given to prevent params being deleted by ilAdministrtionGUI
1046  $action = "ilias.php"
1047  ."?ref_id=".ilobjLanguageAccess::_lookupLangFolderRefId()
1048  ."&baseClass=ilAdministrationGUI"
1049  ."&cmdClass=ilobjlanguageextgui"
1050  ."&view_mode=translate";
1051 
1052  $tpl = new ilTemplate("tpl.translation_link.html",true,true, "Services/Language");
1053 
1054  foreach($lng->getUsedModules() as $module => $dummy)
1055  {
1056  $tpl->setCurrentBlock("hidden");
1057  $tpl->setVariable("NAME", "page_modules[]");
1058  $tpl->setVariable("VALUE", ilUtil::prepareFormOutput($module));
1059  $tpl->parseCurrentBlock();
1060  }
1061 
1062  foreach($lng->getUsedTopics() as $topic => $dummy)
1063  {
1064  $tpl->setCurrentBlock("hidden");
1065  $tpl->setVariable("NAME", "page_topics[]");
1066  $tpl->setVariable("VALUE", ilUtil::prepareFormOutput($topic));
1067  $tpl->parseCurrentBlock();
1068  }
1069 
1070  $tpl->setVariable("ACTION", $action);
1071  $tpl->setVariable("TXT_TRANSLATE",$lng->txt("translation"));
1072 
1073  return $tpl->get();
1074  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
special template class to simplify handling of ITX/PEAR
global $ilSetting
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _isPageTranslation()

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 1018 of file class.ilObjLanguageExtGUI.php.

References $_GET.

Referenced by prepareOutput(), and viewObject().

1019  {
1020  return ($_GET['view_mode'] == "translate");
1021  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ addAdminLocatorItems()

ilObjLanguageExtGUI::addAdminLocatorItems ( )

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

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

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

975  {
976  global $ilLocator, $tpl;
977 
978  $ilLocator->addItem($this->lng->txt("administration"),
979  $this->ctrl->getLinkTargetByClass("iladministrationgui", "frameset"),
980  ilFrameTargetInfo::_getFrame("MainContent"));
981 
982  $ilLocator->addItem($this->lng->txt("languages"),
983  $this->ctrl->getLinkTargetByClass("ilobjlanguagefoldergui", ""));
984 
985  $ilLocator->addItem($this->lng->txt("meta_l_". $this->object->getTitle()),
986  $this->ctrl->getLinkTarget($this, "view"));
987  }
static _getFrame($a_class, $a_type='')
Get content frame name.
+ Here is the call graph for this function:

◆ assignObject()

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)

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

85  {
86  require_once("Services/Language/classes/class.ilObjLanguageExt.php");
87  $this->object =& new ilObjLanguageExt($this->id);
88  }
Class ilObjLanguageExt.

◆ cancelObject()

ilObjLanguageExtGUI::cancelObject ( )

Cancel the current action.

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

References viewObject().

Referenced by uploadObject().

116  {
117  $this->viewObject();
118  }
viewObject()
Show the edit screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ downloadObject()

ilObjLanguageExtGUI::downloadObject ( )

Download a language file.

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

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

566  {
567  $filename = 'ilias_' . $this->object->key . '_'
568  . str_replace(".", "_", substr(ILIAS_VERSION, 0, strpos(ILIAS_VERSION, " ")))
569  . "-" . date('Y-m-d')
570  . ".lang.".$_POST["scope"];
571 
572  $global_file_obj = $this->object->getGlobalLanguageFile();
573  $local_file_obj = new ilLanguageFile($filename, $this->object->key, $_POST["scope"]);
574 
575  if ($_POST["scope"] == 'global')
576  {
577  $local_file_obj->setParam("author", $global_file_obj->getParam('author'));
578  $local_file_obj->setParam("version", $global_file_obj->getParam('version'));
579  $local_file_obj->setAllValues($this->object->getAllValues());
580  if ($this->langmode)
581  {
582  $local_file_obj->setAllComments($this->object->getAllRemarks());
583  }
584  }
585  elseif ($_POST["scope"] == 'local')
586  {
587  $local_file_obj->setParam("based_on", $global_file_obj->getParam('version'));
588  $local_file_obj->setAllValues($this->object->getChangedValues());
589  if ($this->langmode)
590  {
591  $local_file_obj->setAllComments($this->object->getAllRemarks());
592  }
593  }
594  elseif ($_POST["scope"] == 'added') // langmode only
595  {
596  $local_file_obj->setParam("author", $global_file_obj->getParam('author'));
597  $local_file_obj->setParam("version", $global_file_obj->getParam('version'));
598  $local_file_obj->setAllValues($this->object->getAddedValues());
599  $local_file_obj->setAllComments($this->object->getAllRemarks());
600  }
601  elseif ($_POST["scope"] == 'unchanged')
602  {
603  $local_file_obj->setParam("author", $global_file_obj->getParam('author'));
604  $local_file_obj->setParam("version", $global_file_obj->getParam('version'));
605  $local_file_obj->setAllValues($this->object->getUnchangedValues());
606  if ($this->langmode)
607  {
608  $local_file_obj->setAllComments($this->object->getAllRemarks());
609  }
610  }
611  elseif ($_POST["scope"] == 'merged') // langmode only
612  {
613  $local_file_obj->setParam("author", $global_file_obj->getParam('author'));
614  $local_file_obj->setParam("version", $global_file_obj->getParam('version'));
615  $local_file_obj->setAllValues($this->object->getMergedValues());
616  $local_file_obj->setAllComments($this->object->getMergedRemarks());
617  }
618 
619  ilUtil::deliverData($local_file_obj->build(), $filename);
620  }
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
$_POST['username']
Definition: cron.php:12
const ILIAS_VERSION
$filename
Definition: buildRTE.php:89
Class ilLanguageFile.
+ Here is the call graph for this function:

◆ executeCommand()

& ilObjLanguageExtGUI::executeCommand ( )

execute command

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

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

95  {
96  global $ilHelp;
97 
99  {
100  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
101  exit;
102  }
103 
104  $cmd = $this->ctrl->getCmd("view")."Object";
105  $this->$cmd();
106 
107  $ilHelp->setScreenIdComponent("lng");
108 // exit;
109  }
exit
Definition: login.php:54
_checkMaintenance()
Permission check for language maintenance (import/export)
$cmd
Definition: sahs_server.php:35
+ Here is the call graph for this function:

◆ exportObject()

ilObjLanguageExtGUI::exportObject ( )

Show the screen to export a language file.

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

References $_POST.

530  {
531  $scope = $_POST["scope"] ? $_POST["scope"] : "global";
532 
533  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lang_file_export.html", "Services/Language");
534 
535  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
536  $this->tpl->setVariable("TXT_HEADER",$this->lng->txt("language_export_file"));
537 
538  $this->tpl->setVariable("TXT_SCOPE",$this->lng->txt("language_file_scope"));
539  $this->tpl->setVariable("TXT_SCOPE_GLOBAL",$this->lng->txt("language_scope_global"));
540  $this->tpl->setVariable("TXT_SCOPE_LOCAL",$this->lng->txt("language_scope_local"));
541  $this->tpl->setVariable("TXT_SCOPE_UNCHANGED",$this->lng->txt("language_scope_unchanged"));
542 
543  $this->tpl->setVariable("CHECKED_GLOBAL",$scope == 'global' ? 'checked="checked"' : '');
544  $this->tpl->setVariable("CHECKED_LOCAL",$scope == 'local' ? 'checked="checked"' : '');
545  $this->tpl->setVariable("CHECKED_UNCHANGED",$scope == 'unchanged' ? 'checked="checked"' : '');
546 
547  if ($this->langmode)
548  {
549  $this->tpl->setVariable("TXT_SCOPE_ADDED",$this->lng->txt("language_scope_added"));
550  $this->tpl->setVariable("CHECKED_ADDED",$scope == 'added' ? 'checked="checked"' : '');
551 
552  $this->tpl->setVariable("TXT_SCOPE_MERGED",$this->lng->txt("language_scope_merged"));
553  $this->tpl->setVariable("CHECKED_MERGED",$scope == 'merged' ? 'checked="checked"' : '');
554  }
555 
556  $this->tpl->setVariable("TXT_DOWNLOAD",$this->lng->txt("download"));
557  $this->tpl->setVariable("CMD_DOWNLOAD","download");
558 // $this->tpl->show();
559  }
$_POST['username']
Definition: cron.php:12

◆ getAdminTabs()

ilObjLanguageExtGUI::getAdminTabs ( $tabs_gui)

Get tabs for admin mode.

Parameters
objecttabs gui object

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

917  {
918  global $rbacsystem;
919 
920  $tabs_gui->addTarget("edit",
921  $this->ctrl->getLinkTarget($this, "view"),
922  array("","view","cancel","save"));
923 
924  $tabs_gui->addTarget("export",
925  $this->ctrl->getLinkTarget($this, "export"),
926  array("export","download"));
927 
928  $tabs_gui->addTarget("import",
929  $this->ctrl->getLinkTarget($this, "import"),
930  array("import","upload"));
931 
932  $tabs_gui->addTarget("language_maintain",
933  $this->ctrl->getLinkTarget($this, "maintain"),
934  array("maintain"));
935 
936  $tabs_gui->addTarget("settings",
937  $this->ctrl->getLinkTarget($this, "settings"),
938  array("settings"));
939 
940  $tabs_gui->addTarget("language_statistics",
941  $this->ctrl->getLinkTarget($this, "statistics"),
942  array("statistics"));
943  }

◆ getPar()

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 866 of file class.ilObjLanguageExtGUI.php.

References $_GET, $_POST, and ilUtil\stripSlashes().

Referenced by viewObject().

867  {
868  // get the parameter value
869  if (isset($_GET[$a_request_name]))
870  {
871  $param = $_GET[$a_request_name];
872  $from_request = true;
873  }
874  elseif (isset($_POST[$a_request_name]))
875  {
876  $param = $_POST[$a_request_name];
877  $from_request = true;
878  }
879  elseif (isset($this->session[$a_request_name]))
880  {
881  $param = $this->session[$a_request_name];
882  $from_request = false;
883  }
884  else
885  {
886  $param = $a_default_value;
887  $from_request = false;
888  }
889 
890  // strip slashes from request parameters
891  if ($from_request)
892  {
893  if (is_array($param))
894  {
895  foreach ($param as $key => $value)
896  {
897  $param[$key] = ilUtil::stripSlashes($value);
898  }
899  }
900  else
901  {
902  $param = ilUtil::stripSlashes($param);
903  }
904  }
905 
906  // make the parameter available to further requests
907  $this->session[$a_request_name] = $param;
908 
909  return $param;
910  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ilObjLanguageExtGUI()

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 44 of file class.ilObjLanguageExtGUI.php.

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

45  {
46  global $lng, $ilCtrl, $ilClientIniFile;
47 
48  // language maintenance strings are defined in administration
49  $lng->loadLanguageModule("administration");
50  $lng->loadLanguageModule("meta");
51 
52  // view mode ('translate' or empty) needed for prepareOutput()
53  $ilCtrl->saveParameter($this, "view_mode");
54 
55  // type and id of get the bound object
56  $this->type = "lng";
57  if (! $this->id = $_GET['obj_id'])
58  {
59  $this->id = ilObjLanguageAccess::_lookupId($lng->getUserLanguage());
60  }
61 
62  // do all generic GUI initialisations
63  $this->ilObjectGUI($a_data, $this->id, false, true);
64 
65  // initialize the array to store GUI session variables
66  if (!is_array($_SESSION[get_class($this)]))
67  {
68  $_SESSION[get_class($this)] = array();
69  }
70  $this->session =& $_SESSION[get_class($this)];
71 
72 
73  // read the lang mode
74  $this->langmode = $ilClientIniFile->readVariable("system","LANGMODE");
75  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_GET["client_id"]
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
global $ilCtrl
Definition: ilias.php:18
_lookupId($a_key)
Lookup the object ID for a language key.
+ Here is the call graph for this function:

◆ importObject()

ilObjLanguageExtGUI::importObject ( )

Show the screen to import a language file.

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

Referenced by uploadObject().

478  {
479  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lang_file_import.html", "Services/Language");
480 
481  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
482  $this->tpl->setVariable("TXT_HEADER",$this->lng->txt("language_import_file"));
483  $this->tpl->setVariable("TXT_FILE",$this->lng->txt("file"));
484 
485  $this->tpl->setVariable("TXT_MODE",$this->lng->txt("language_mode_existing"));
486  $this->tpl->setVariable("TXT_MODE_KEEPALL",$this->lng->txt("language_mode_existing_keepall"));
487  $this->tpl->setVariable("TXT_MODE_KEEPNEW",$this->lng->txt("language_mode_existing_keepnew"));
488  $this->tpl->setVariable("TXT_MODE_REPLACE",$this->lng->txt("language_mode_existing_replace"));
489  $this->tpl->setVariable("TXT_MODE_DELETE",$this->lng->txt("language_mode_existing_delete"));
490 
491  $this->tpl->setVariable("TXT_UPLOAD",$this->lng->txt("upload"));
492  $this->tpl->setVariable("CMD_UPLOAD","upload");
493 // $this->tpl->show();
494  }
+ Here is the caller graph for this function:

◆ maintainObject()

ilObjLanguageExtGUI::maintainObject ( )

Process the language maintenance.

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

References $_POST, $ilUser, ilObjLanguageExt\_deleteValues(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

627  {
628  global $ilUser;
629 
630  switch ($_POST["maintain"])
631  {
632  // save the local changes to the local language file
633  case "save":
634  $lang_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang.local';
635 
636  if ((is_file($lang_file) and is_writable($lang_file))
637  or (!file_exists($lang_file) and is_writable($this->object->getCustLangPath())))
638  {
639  // save a copy of the distributed language file
640  $orig_file = $this->object->getLangPath() . '/ilias_' . $this->object->key . '.lang';
641  $copy_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang';
642  @copy($orig_file, $copy_file);
643 
644  // save a backup of the old local language file
645  @rename($lang_file, $lang_file.".bak");
646 
647  // create and write the new local language file
648  $global_file_obj = $this->object->getGlobalLanguageFile();
649  $local_file_obj = new ilLanguageFile($lang_file, $this->object->key, 'local');
650  $local_file_obj->setParam('based_on', $global_file_obj->getParam('version'));
651  $local_file_obj->setAllValues($this->object->getChangedValues());
652  if ($this->langmode)
653  {
654  $local_file_obj->setAllComments($this->object->getAllRemarks());
655  }
656  $local_file_obj->write();
657 
658  $this->object->setLocal(true);
659  ilUtil::sendSuccess($this->lng->txt("language_saved_local") , false);
660  }
661  else
662  {
663  ilUtil::sendFailure($this->lng->txt("language_error_write_local") , false);
664  }
665  break;
666 
667  // load the content of the local language file
668  case "load":
669  $lang_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang.local';
670  if (is_file($lang_file) and is_readable($lang_file))
671  {
672  $this->object->importLanguageFile($lang_file, 'replace');
673  $this->object->setLocal(true);
674  ilUtil::sendSuccess($this->lng->txt("language_loaded_local") , false);
675  }
676  else
677  {
678  ilUtil::sendFailure($this->lng->txt("language_error_read_local") , false);
679  }
680  break;
681 
682  // revert the database to the default language file
683  case "clear":
684  $lang_file = $this->object->getLangPath() . '/ilias_' . $this->object->key . '.lang';
685  if (is_file($lang_file) and is_readable($lang_file))
686  {
687  $this->object->importLanguageFile($lang_file, 'delete');
688  $this->object->setLocal(false);
689  ilUtil::sendSuccess($this->lng->txt("language_cleared_local") , false);
690  }
691  else
692  {
693  ilUtil::sendFailure($this->lng->txt("language_error_clear_local") , false);
694  }
695  break;
696 
697  // delete local additions in the datavase (langmode only)
698  case "delete_added":
699  ilObjLanguageExt::_deleteValues($this->object->key, $this->object->getAddedValues());
700  break;
701 
702  // merge local changes back to the global language file (langmode only)
703  case "merge":
704 
705  $orig_file = $this->object->getLangPath() . '/ilias_' . $this->object->key . '.lang';
706  $copy_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang';
707 
708  if (is_file($orig_file) and is_writable($orig_file))
709  {
710  // save a copy of the global language file
711  @copy($orig_file, $copy_file);
712 
713  // modify and write the new global file
714  $global_file_obj = $this->object->getGlobalLanguageFile();
715  $global_file_obj->setAllValues($this->object->getMergedValues());
716  $global_file_obj->setAllComments($this->object->getMergedRemarks());
717  $global_file_obj->write();
718  ilUtil::sendSuccess($this->lng->txt("language_merged_global") , false);
719  }
720  else
721  {
722  ilUtil::sendFailure($this->lng->txt("language_error_write_global") , false);
723  }
724  break;
725 
726  // remove the local language file (langmode only)
727  case "remove_local_file":
728  $lang_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang.local';
729 
730  if (!is_file($lang_file))
731  {
732  $this->object->setLocal(false);
733  ilUtil::sendFailure($this->lng->txt("language_error_local_missed") , false);
734  }
735  elseif (@unlink($lang_file))
736  {
737  $this->object->setLocal(false);
738  ilUtil::sendSuccess($this->lng->txt("language_local_file_deleted") , false);
739  }
740  else
741  {
742  ilUtil::sendFailure($this->lng->txt("language_error_delete_local") , false);
743  }
744  break;
745 
746  }
747 
748  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lang_maintenance.html", "Services/Language");
749  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
750  $this->tpl->setVariable("TXT_MAINTENANCE",$this->lng->txt("language_maintenance"));
751  $this->tpl->setVariable("TXT_MAINTAIN_LOCAL",$this->lng->txt("language_maintain_local_changes"));
752  $this->tpl->setVariable("TXT_SELECT",$this->lng->txt("please_select"));
753  $this->tpl->setVariable("TXT_SAVE",$this->lng->txt("language_save_local_changes"));
754  $this->tpl->setVariable("TXT_LOAD",$this->lng->txt("language_load_local_changes"));
755  $this->tpl->setVariable("TXT_CLEAR",$this->lng->txt("language_clear_local_changes"));
756  if ($this->langmode)
757  {
758  $this->tpl->setVariable("TXT_DELETE_ADDED",$this->lng->txt("language_delete_local_additions"));
759  $this->tpl->setVariable("TXT_MERGE",$this->lng->txt("language_merge_local_changes"));
760  $this->tpl->setVariable("TXT_REMOVE_LOCAL_FILE",$this->lng->txt("language_remove_local_file"));
761  }
762  $this->tpl->setVariable("TXT_NOTE_SAVE",$this->lng->txt("language_note_save_local"));
763  $this->tpl->setVariable("TXT_MAINTAIN",$this->lng->txt("language_process_maintenance"));
764  $this->tpl->setVariable("VAR_MAINTAIN", "maintain");
765  $this->tpl->setVariable("CMD_MAINTAIN", "maintain");
766 // $this->tpl->show();
767  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static _deleteValues($a_lang_key, $a_values=array())
Delete a set of translation in the database.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilUser
Definition: imgupload.php:15
Class ilLanguageFile.
+ Here is the call graph for this function:

◆ prepareOutput()

ilObjLanguageExtGUI::prepareOutput ( )

Prepare the standard template for output (Overwritten from ilObjectGUI)

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

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

951  {
952  if ($this->_isPageTranslation())
953  {
954  // show the pure translation page without menu, tabs etc.
955  $this->tpl->addBlockFile("CONTENT","content","tpl.adm_translate.html","Services/Language");
956  $this->tpl->setHeaderPageTitle($this->lng->txt("translation"));
957  $this->tpl->setTitle($this->lng->txt("translation"). " "
958  .$this->lng->txt("meta_l_".$this->object->key));
959  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lng_b.png"),
960  $this->lng->txt("obj_" . $this->object->getType()));
961  }
962  else
963  {
964  // show the full page framework
965  parent::prepareOutput();
966  }
967  }
static _isPageTranslation()
Check if the GUI is in page translation mode.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:

◆ saveObject()

ilObjLanguageExtGUI::saveObject ( )

Save the changed translations.

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

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

447  {
448  // prepare the values to be saved
449  $save_array = array();
450  $remarks_array = array();
451  foreach ($_POST as $key => $value)
452  {
453  $keys = explode($this->lng->separator, ilUtil::stripSlashes($key, false));
454 
455  if (count($keys) == 2)
456  {
457  // avoid line breaks
458  $value = preg_replace("/(\015\012)|(\015)|(\012)/","<br />",$value);
459  $value = ilUtil::stripSlashes($value, false);
460  $save_array[$key] = $value;
461 
462  $remarks_array[$key] = $_POST[$key.$this->lng->separator."comment"];
463  }
464  }
465 
466  // save the translations
467  ilObjLanguageExt::_saveValues($this->object->key, $save_array, $remarks_array);
468 
469  // view the list
470  $this->viewObject();
471  }
$_POST['username']
Definition: cron.php:12
viewObject()
Show the edit screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static _saveValues($a_lang_key, $a_values=array(), $a_remarks=array())
Save a set of translation in the database.
+ Here is the call graph for this function:

◆ settingsObject()

ilObjLanguageExtGUI::settingsObject ( )

Set the language settings.

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

References $_POST, and $ilSetting.

773  {
774  global $ilSetting;
775 
776  $translate_key = "lang_translate_". $this->object->key;
777 
778  // save and get the page translation setting
779  switch ($_POST["translation"])
780  {
781  case "enable":
782  $ilSetting->set($translate_key, true);
783  break;
784  case "disable":
785  $ilSetting->set($translate_key, false);
786  }
787  $translate = $ilSetting->get($translate_key, false);
788 
789  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lang_settings.html", "Services/Language");
790 
791  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
792  $this->tpl->setVariable("TXT_SETTINGS",$this->lng->txt("language_settings"));
793  $this->tpl->setVariable("TXT_TRANSLATION",$this->lng->txt("language_translation_mode"));
794  $this->tpl->setVariable("TXT_TRANSLATION_ENABLED",$this->lng->txt("language_translation_enabled"));
795  $this->tpl->setVariable("TXT_TRANSLATION_DISABLED",$this->lng->txt("language_translation_disabled"));
796  $this->tpl->setVariable("CHECKED_ENABLE", $translate ? 'checked="checked"': '');
797  $this->tpl->setVariable("CHECKED_DISABLE", $translate ? '' : 'checked="checked"');
798  $this->tpl->setVariable("TXT_NOTE_TRANSLATION",$this->lng->txt("language_note_translation"));
799  $this->tpl->setVariable("TXT_CHANGE_SETTINGS",$this->lng->txt("language_change_settings"));
800  $this->tpl->setVariable("CMD_SETTINGS", "settings");
801 // $this->tpl->show();
802  }
$_POST['username']
Definition: cron.php:12
global $ilSetting
Definition: privfeed.php:40

◆ setTitleAndDescription()

ilObjLanguageExtGUI::setTitleAndDescription ( )

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

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

References ilUtil\getImagePath().

995  {
996  $this->tpl->setTitle($this->lng->txt("meta_l_".$this->object->getTitle()));
997  // $this->tpl->setDescription($this->object->getLongDescription());
998  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_".$this->object->getType()."_b.png"), $this->lng->txt("obj_" . $this->object->getType()));
999  }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:

◆ statisticsObject()

ilObjLanguageExtGUI::statisticsObject ( )

Print out statistics about the language.

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

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

808  {
809  $modules = ilObjLanguageExt::_getModules($this->object->key);
810 
811  $data = array();
812  $total = array("",0,0,0);
813  foreach($modules as $module)
814  {
815  $row = array();
816  $row[0] = $module;
817  $row[1] = count($this->object->getAllValues(array($module)));
818  $row[2] = count($this->object->getChangedValues(array($module)));
819  $row[3] = $row[1]-$row[2];
820  $total[1] += $row[1];
821  $total[2] += $row[2];
822  $total[3] += $row[3];
823  $data[] = $row;
824  }
825  $total[0] = "<b>".$this->lng->txt("language_all_modules")."</b>";
826  $total[1] = "<b>".$total[1]."</b>";
827  $total[2] = "<b>".$total[2]."</b>";
828  $total[3] = "<b>".$total[3]."</b>";
829  $data[] = $total;
830 
831  // prepare the templates for output
832  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lang_statistics.html", "Services/Language");
833  $this->tpl->addBlockFile("TABLE_STATISTICS", "table_statistics", "tpl.table.html");
834  $this->tpl->addBlockFile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html");
835 
836  // create and configure the table object
837  include_once 'Services/Table/classes/class.ilTableGUI.php';
838  $tbl = new ilTableGUI();
839  $tbl->disable('title');
840  $tbl->disable('sort');
841  $tbl->disable('numinfo');
842 
843  $tbl->setHeaderNames(array($this->lng->txt("module"),
844  $this->lng->txt("language_scope_global"),
845  $this->lng->txt("language_scope_local"),
846  $this->lng->txt("language_scope_unchanged")));
847  $tbl->setColumnWidth(array( "25%", "25%", "25%", "25%"));
848  $tbl->setLimit(count($data));
849  $tbl->setData($data);
850 
851  // show the table
852  $tbl->render();
853 // $this->tpl->show();
854  }
Class ilTableGUI.
static _getModules($a_lang_key)
Get all modules of a language.
+ Here is the call graph for this function:

◆ uploadObject()

ilObjLanguageExtGUI::uploadObject ( )

Process an uploaded language file.

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

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

501  {
502  if ($_POST['cmd']['upload'])
503  {
504  $file = $_FILES['userfile']['tmp_name'].'x';
505 
506  if (ilUtil::moveUploadedFile($_FILES['userfile']['tmp_name'],
507  $_FILES['userfile']['name'],
508  $file))
509  {
510  $this->object->importLanguageFile($file,$_POST['mode_existing']);
511  ilUtil::sendSuccess(sprintf($this->lng->txt("language_file_imported"), $_FILES['userfile']['name']) , false);
512  $this->importObject();
513  }
514  else
515  {
516  $this->importObject();
517  }
518  }
519  else
520  {
521  $this->cancelObject();
522  }
523  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
print $file
$_POST['username']
Definition: cron.php:12
cancelObject()
Cancel the current action.
importObject()
Show the screen to import a language file.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
+ Here is the call graph for this function:

◆ viewObject()

ilObjLanguageExtGUI::viewObject ( )

Show the edit screen.

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

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

Referenced by cancelObject(), and saveObject().

124  {
125  global $ilUser;
126 
127  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lang_edit_items.html", "Services/Language");
128 
129  // set the language to compare with
130  $compare = $this->getPar('compare', $this->lng->getDefaultLanguage());
131 
132  // get the default values if the compare language is the same
133  if ($compare == $this->object->key)
134  {
135  $compare_object = $this->object->getGlobalLanguageFile();
136  $compare_content = $compare_object->getAllValues();
137  $compare_comments = $compare_object->getAllComments();
138  $compare_note = " ". $this->lng->txt("language_default_entries");
139  }
140 
141  // get the remarks in database
142  $remarks = $this->object->getAllRemarks();
143 
144  // page translation mode:
145  // - the table is filtered by a list of modules and topics
146  // - all found entries are shown on the same page
147  if ($this->_isPageTranslation())
148  {
149  $offset = 0;
150  $limit = 0;
151 
152  $modules = $this->getPar("page_modules", array());
153  $topics = $this->getPar("page_topics", array());
154 
155  if (!isset($compare_content))
156  {
157  $compare_content = ilObjLanguageExt::_getValues(
158  $compare, $modules, $topics);
159 
160  $compare_comments = ilObjLanguageExt::_getRemarks($compare);
161  }
162 
163  $translations = ilObjLanguageExt::_getValues(
164  $this->object->key, $modules, $topics);
165  }
166  // normal view mode:
167  // - the table is filtered manually by module, mode and pattern
168  // - found entries are paged by maximum list length
169  // - the filter selection is shown
170  else
171  {
172  $offset = $this->getPar('offset','0');
173  $limit = $ilUser->getPref("hits_per_page");
174 
175  $filter_mode = $this->getPar('filter_mode','all');
176  $filter_pattern = $this->getPar('filter_pattern','');
177  $filter_module = $this->getPar('filter_module','administration');
178  $filter_modules = $filter_module ? array($filter_module) : array();
179 
180  if (!isset($compare_content))
181  {
182  $compare_content = ilObjLanguageExt::_getValues(
183  $compare, $filter_modules);
184 
185  $compare_comments = ilObjLanguageExt::_getRemarks($compare);
186  }
187 
188  switch ($filter_mode)
189  {
190  case "changed":
191  $translations = $this->object->getChangedValues(
192  $filter_modules, $filter_pattern);
193  break;
194 
195  case "added": //langmode only
196  $translations = $this->object->getAddedValues(
197  $filter_modules, $filter_pattern);
198  break;
199 
200  case "unchanged":
201  $translations = $this->object->getUnchangedValues(
202  $filter_modules, $filter_pattern);
203  break;
204 
205  case "commented":
206  $translations = $this->object->getCommentedValues(
207  $filter_modules, $filter_pattern);
208  break;
209 
210  case "dbremarks":
211  $translations = $this->object->getAllValues(
212  $filter_modules, $filter_pattern);
213 
214  $translations = array_intersect_key($translations, $remarks);
215  break;
216 
217  case "equal":
218  $translations = $this->object->getAllValues(
219  $filter_modules, $filter_pattern);
220 
221  $translations = array_intersect_assoc($translations, $compare_content);
222  break;
223 
224  case "different":
225  $translations = $this->object->getAllValues(
226  $filter_modules, $filter_pattern);
227 
228  $translations = array_diff_assoc($translations, $compare_content);
229  break;
230 
231  case "conflicts":
232  $former_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang';
233  if (!is_readable($former_file))
234  {
235  ilUtil::sendFailure(sprintf($this->lng->txt("language_former_file_missing"), $former_file)
236  .'<br />'. $this->lng->txt("language_former_file_description") , false);
237  $translations = array();
238  break;
239  }
240  $global_file_obj = $this->object->getGlobalLanguageFile();
241  $former_file_obj = new ilLanguageFile($former_file);
242  $former_file_obj->read();
243  $global_changes = array_diff_assoc(
244  $global_file_obj->getAllValues(),
245  $former_file_obj->getAllValues());
246  if (!count($global_changes))
247  {
248  ilUtil::sendInfo(sprintf($this->lng->txt("language_former_file_equal"), $former_file)
249  .'<br />'. $this->lng->txt("language_former_file_description") , false);
250  $translations = array();
251  break;
252  }
253  $translations = $this->object->getChangedValues(
254  $filter_modules, $filter_pattern);
255 
256  $translations = array_intersect_key($translations, $global_changes);
257  break;
258 
259  case "all":
260  default:
261  $translations = $this->object->getAllValues(
262  $filter_modules, $filter_pattern);
263  }
264 
265  // show the filter section
266  $this->tpl->setCurrentBlock("filter");
267 
268  // filter by language module
269  $options = array();
270  $options[""] = $this->lng->txt("language_all_modules");
271  $modules = ilObjLanguageExt::_getModules($this->object->key);
272  foreach ($modules as $mod)
273  {
274  $options[$mod] = $mod;
275  }
276  $this->tpl->setVariable("SELECT_MODULE",
277  ilUtil::formSelect($filter_module, "filter_module", $options, false, true));
278 
279  // filter by mode
280  $options = array();
281  $options["all"] = $this->lng->txt("language_scope_global");
282  $options["changed"] = $this->lng->txt("language_scope_local");
283  if ($this->langmode)
284  {
285  $options["added"] = $this->lng->txt("language_scope_added");
286  }
287  $options["unchanged"] = $this->lng->txt("language_scope_unchanged");
288  $options["equal"] = $this->lng->txt("language_scope_equal");
289  $options["different"] = $this->lng->txt("language_scope_different");
290  $options["commented"] = $this->lng->txt("language_scope_commented");
291  if ($this->langmode)
292  {
293  $options["dbremarks"] = $this->lng->txt("language_scope_dbremarks");
294  }
295  $options["conflicts"] = $this->lng->txt("language_scope_conflicts");
296  $this->tpl->setVariable("SELECT_MODE",
297  ilUtil::formSelect($filter_mode, "filter_mode", $options, false, true));
298 
299  // filter by pattern
300  $this->tpl->setVariable("PATTERN_NAME", "filter_pattern");
301  $this->tpl->setVariable("PATTERN_VALUE", ilUtil::prepareFormOutput($filter_pattern));
302 
303  // and general filter variables
304  $this->tpl->setVariable("FILTER_ACTION", $this->ctrl->getFormAction($this));
305  $this->tpl->setVariable("TXT_FILTER", $this->lng->txt("filter"));
306  $this->tpl->setVariable("OFFSET_NAME", "offset");
307  $this->tpl->setVariable("OFFSET_VALUE", "0");
308  $this->tpl->setVariable("TXT_APPLY_FILTER", $this->lng->txt("apply_filter"));
309  $this->tpl->setVariable("CMD_FILTER", "view");
310  $this->tpl->parseCurrentBlock();
311  }
312 
313  // show the compare section
314  $this->tpl->setCurrentBlock("compare");
315  $this->tpl->setVariable("COMPARE_ACTION", $this->ctrl->getFormAction($this));
316  $this->tpl->setVariable("TXT_COMPARE", $this->lng->txt("language_compare"));
317  $this->tpl->setVariable("TXT_CHANGE", $this->lng->txt("change"));
318  $options = array();
319  $langlist = $this->lng->getInstalledLanguages();
320  foreach ($langlist as $lang_key)
321  {
322  $options[$lang_key] = $this->lng->txt("meta_l_".$lang_key);
323  }
324  $this->tpl->setVariable("SELECT_COMPARE",
325  ilUtil::formSelect($compare, "compare", $options, false, true,1));
326  $this->tpl->setVariable("CMD_COMPARE", "view");
327  $this->tpl->parseCurrentBlock();
328 
329  // prepare the dataset for the output table
330  $sort_by = $this->getPar('sort_by','translation');
331  $sort_order = $this->getPar('sort_order','asc');
332 
333  $list = array();
334  foreach($translations as $name => $translation)
335  {
336  $keys = explode($this->lng->separator, $name);
337  $data = array();
338 
339  $data["module"] = $keys[0];
340  $data["topic"] = $keys[1];
341  $data["name"] = $name;
342  $data["translation"] = $translation;
343  $data["default"] = $compare_content[$name];
344  $data["default_comment"] = $compare_comments[$name];
345 
346  $list[] = $data;
347  }
348  $list = ilUtil::sortArray($list, $sort_by, $sort_order);
349  if ($limit > 0)
350  {
351  $list = array_slice($list, $offset, $limit);
352  }
353 
354  // create and configure the table object
355  include_once 'Services/Table/classes/class.ilTableGUI.php';
356  $tbl = new ilTableGUI();
357 
358  $tbl->disable('title');
359 
360  $tbl->setHeaderNames(array($this->lng->txt("module"),
361  $this->lng->txt("identifier"),
362  $this->lng->txt("meta_l_".$this->object->key),
363  $this->lng->txt("meta_l_".$compare).$compare_note));
364 
365  $tbl->setHeaderVars(array("module",
366  "topic",
367  "translation",
368  "default"),
369  $this->ctrl->getParameterArray($this));
370 
371 
372  $tbl->setColumnWidth(array( "10%",
373  "20%",
374  "40%",
375  "30%"));
376 
377  $tbl->setOrderColumn($sort_by);
378  $tbl->setOrderDirection($sort_order);
379  $tbl->setLimit($limit);
380  $tbl->setOffset($offset);
381  $tbl->setMaxCount(count($translations));
382 
383 
384  // prepare the table template
385  $tpl =& new ilTemplate("tpl.table.html", true, true);
386  $tpl->setCurrentBlock("tbl_form_header");
387  $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
388  $tpl->parseCurrentBlock();
389 
390  $tpl->setCurrentBlock("tbl_action_btn");
391  $tpl->setVariable("BTN_NAME",'save');
392  $tpl->setVariable("BTN_VALUE",$this->lng->txt('save'));
393  $tpl->parseCurrentBlock();
394 
395  $tpl->setCurrentBlock("tbl_action_row");
396  $tpl->setVariable("COLUMN_COUNTS","4");
397  $tpl->parseCurrentBlock();
398 
399  // render the table rows
400  $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.lang_items_row.html", "Services/Language");
401  foreach ($list as $data)
402  {
403  if ($this->langmode)
404  {
405  $tpl->setCurrentBlock('comment');
406  $tpl->setVariable("COM_ID", ilUtil::prepareFormOutput($data["name"].$this->lng->separator."comment"));
407  $tpl->setVariable("COM_NAME", ilUtil::prepareFormOutput($data["name"].$this->lng->separator."comment"));
408  $tpl->setVariable("COM_VALUE", ilUtil::prepareFormOutput($remarks[$data["name"]]));
409  $tpl->setVariable("COM_SIZE", $this->commentsize);
410  $tpl->setVariable("COM_MAX", 250);
411  $tpl->setVariable("TXT_COMMENT", $this->lng->txt('comment'));
412  $tpl->parseCurrentBlock();
413  }
414  else
415  {
416  $tpl->setCurrentBlock('hidden_comment');
417  $tpl->setVariable("COM_NAME", ilUtil::prepareFormOutput($data["name"].$this->lng->separator."comment"));
418  $tpl->setVariable("COM_VALUE", ilUtil::prepareFormOutput($remarks[$data["name"]]));
419  $tpl->parseCurrentBlock();
420  }
421 
422  $tpl->setCurrentBlock("row");
423  $tpl->setVariable("T_ROWS", ceil(strlen($data["translation"]) / $this->inputsize));
424  $tpl->setVariable("T_SIZE", $this->inputsize);
425  $tpl->setVariable("T_NAME", ilUtil::prepareFormOutput($data["name"]));
426  $tpl->setVariable("T_USER_VALUE", ilUtil::prepareFormOutput($data["translation"]));
427 
428  $tpl->setVariable("MODULE", ilUtil::prepareFormOutput($data["module"]));
429  $tpl->setVariable("TOPIC", ilUtil::prepareFormOutput($data["topic"]));
430  $tpl->setVariable("DEFAULT_VALUE", ilUtil::prepareFormOutput($data["default"]));
431  $tpl->setVariable("COMMENT", ilUtil::prepareFormOutput($data["default_comment"]));
432  $tpl->parseCurrentBlock();
433  }
434 
435  // render and show the table
436  $tbl->setTemplate($tpl);
437  $tbl->render();
438  $this->tpl->setVariable("TRANSLATION_TABLE", $tpl->get());
439 // $this->tpl->show();
440  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static _getRemarks($a_lang_key, $a_all_changed=false)
Get all remarks of a language.
Class ilTableGUI.
static _isPageTranslation()
Check if the GUI is in page translation mode.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!is_array($argv)) $options
static formSelect($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
special template class to simplify handling of ITX/PEAR
static _getValues($a_lang_key, $a_modules=array(), $a_topics=array(), $a_pattern='', $a_state='')
Get the translations of specified topics.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilUser
Definition: imgupload.php:15
Class ilLanguageFile.
static _getModules($a_lang_key)
Get all modules of a 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...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $commentsize

ilObjLanguageExtGUI::$commentsize = 30
private

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

◆ $inputsize

ilObjLanguageExtGUI::$inputsize = 50
private

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


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