ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilObjLanguageExtGUI Class Reference

Class ilObjLanguageExtGUI. More...

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

Public Member Functions

 __construct ($a_data, $a_id=0, $a_call_by_reference=false)
 Constructor. More...
 
 assignObject ()
 Assign the extended language object. More...
 
 getId ()
 get the language object id (needed for filter serialization) More...
 
 executeCommand ()
 execute command More...
 
 cancelObject ()
 Cancel the current action. More...
 
 viewObject ()
 Show the edit screen. More...
 
 applyFilterObject ()
 Apply filter. More...
 
 resetFilterObject ()
 Reset filter. 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...
 
 maintainExecuteObject ()
 
 settingsObject ()
 Set the language settings. More...
 
 statisticsObject ()
 Print out statistics about the language. More...
 
 getAdminTabs ()
 Get tabs for admin mode (Overwritten from ilObjectGUI, called by prepareOutput) More...
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 Set the locator for admin mode (Overwritten from ilObjectGUI, called by prepareOutput) More...
 
 setTitleAndDescription ()
 Set the Title and the description (Overwritten from ilObjectGUI, called by prepareOutput) More...
 
 addNewEntryObject (ilPropertyFormGUI $a_form=null)
 
 saveNewEntryObject ()
 
- Public Member Functions inherited from ilObjectGUI
 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...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 getAdminTabs ()
 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 ()
 cancel action and go back to previous page @access public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object 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...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 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...
 

Protected Member Functions

 getViewTable ()
 Get the table to view language entries. More...
 
 buildMissingEntries (array $a_missing=null)
 
 initAddNewEntryForm ($a_id=null)
 
- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 
 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 @access public More...
 
 setAdminTabs ()
 set admin tabs @access 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...
 
 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...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) 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, $a_catch_errors=true)
 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...
 
 getTabs ()
 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 (ilColumnGUI $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...
 

Additional Inherited Members

- 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...
 
- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $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 Attributes inherited from ilObjectGUI
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $rbacsystem
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 

Detailed Description

Class ilObjLanguageExtGUI.

This class is a replacement for ilObjLanguageGUI which is currently not used in ILIAS.

Author
Fred Neumann fred..nosp@m.neum.nosp@m.ann@f.nosp@m.im.u.nosp@m.ni-er.nosp@m.lang.nosp@m.en.de
Version
Id
class.ilObjLanguageExtGUI.php

@ilCtrl_Calls ilObjLanguageExtGUI: @ilCtrl_IsCalledBy ilObjLanguageExtGUI: ilPersonalDesktopGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilObjLanguageExtGUI::__construct (   $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 40 of file class.ilObjLanguageExtGUI.php.

41 {
42 global $lng, $ilCtrl, $ilClientIniFile;
43
44 // language maintenance strings are defined in administration
45 $lng->loadLanguageModule("administration");
46 $lng->loadLanguageModule("meta");
47
48 // view mode ('translate' or empty) determins available table filters
49 $ilCtrl->saveParameter($this, "view_mode");
50
51 // type and id of get the bound object
52 $this->type = "lng";
53 if (!$this->id = $_GET['obj_id']) {
54 $this->id = ilObjLanguageAccess::_lookupId($lng->getUserLanguage());
55 }
56
57 // do all generic GUI initialisations
58 parent::__construct($a_data, $this->id, false, true);
59
60 // initialize the array to store session variables for extended language maintenance
61 if (!is_array($_SESSION['lang_ext_maintenance'])) {
62 $_SESSION['lang_ext_maintenance'] = array();
63 }
64 $this->session =&$_SESSION['lang_ext_maintenance'];
65
66
67 // read the lang mode
68 $this->langmode = $ilClientIniFile->readVariable("system", "LANGMODE");
69 }
$_GET["client_id"]
$_SESSION["AccountId"]
static _lookupId($a_key)
Lookup the object ID for a language key.
global $ilCtrl
Definition: ilias.php:18

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addAdminLocatorItems()

ilObjLanguageExtGUI::addAdminLocatorItems (   $a_do_not_add_object = false)

Set the locator for admin mode (Overwritten from ilObjectGUI, called by prepareOutput)

Reimplemented from ilObjectGUI.

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

827 {
828 global $ilLocator;
829
831 parent::addAdminLocatorItems(true); // #13881
832
833 $ilLocator->addItem(
834 $this->lng->txt("languages"),
835 $this->ctrl->getLinkTargetByClass("ilobjlanguagefoldergui", "")
836 );
837
838 $ilLocator->addItem(
839 $this->lng->txt("meta_l_" . $this->object->getTitle()),
840 $this->ctrl->getLinkTarget($this, "view")
841 );
842 }
843 }
static _isPageTranslation()
Check if the current request is a page translation.

References ilObjLanguageAccess\_isPageTranslation().

+ Here is the call graph for this function:

◆ addNewEntryObject()

ilObjLanguageExtGUI::addNewEntryObject ( ilPropertyFormGUI  $a_form = null)

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

891 {
892 global $tpl;
893
894 $id = trim($_GET["eid"]);
895
896 if (!$a_form) {
897 $a_form = $this->initAddNewEntryForm($id);
898 }
899
900 $tpl->setContent($a_form->getHTML());
901 }
if(!array_key_exists('StateId', $_REQUEST)) $id

References $_GET, $id, ilObjectGUI\$tpl, and initAddNewEntryForm().

Referenced by saveNewEntryObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyFilterObject()

ilObjLanguageExtGUI::applyFilterObject ( )

Apply filter.

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

346 {
347 $table_gui = $this->getViewTable();
348 $table_gui->writeFilterToSession(); // writes filter to session
349 $table_gui->resetOffset(); // sets record offest to 0 (first page)
350 $this->viewObject();
351 }
getViewTable()
Get the table to view language entries.
viewObject()
Show the edit screen.

References getViewTable(), and viewObject().

+ 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)

Reimplemented from ilObjectGUI.

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

79 {
80 require_once("Services/Language/classes/class.ilObjLanguageExt.php");
81 $this->object = new ilObjLanguageExt($this->id);
82 }
Class ilObjLanguageExt.

◆ buildMissingEntries()

ilObjLanguageExtGUI::buildMissingEntries ( array  $a_missing = null)
protected

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

867 {
868 global $ilCtrl;
869
870 if (!is_array($a_missing) ||
871 !sizeof($a_missing)) {
872 return;
873 }
874
875 $res = array('<h3>' . $this->lng->txt("adm_missing_entries") . '</h3>', '<ul>');
876
877 foreach ($a_missing as $entry) {
878 $ilCtrl->setParameter($this, "eid", $entry);
879 $res[] = '<li>' . $entry .
880 ' <a href="' . $ilCtrl->getLinkTarget($this, "addNewEntry") .
881 '">' . $this->lng->txt("adm_missing_entry_add_action") . '</a></li>';
882 $ilCtrl->setParameter($this, "eid", "");
883 }
884
885 $res[] = '</ul>';
886
887 return implode("\n", $res);
888 }
foreach($_POST as $key=> $value) $res

References $ilCtrl, and $res.

◆ cancelObject()

ilObjLanguageExtGUI::cancelObject ( )

Cancel the current action.

Reimplemented from ilObjectGUI.

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

116 {
117 $this->viewObject();
118 }

References viewObject().

+ Here is the call graph for this function:

◆ downloadObject()

ilObjLanguageExtGUI::downloadObject ( )

Download a language file.

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

520 {
521 // save the selected scope
522 $this->session["export"]["scope"] = ilUtil::stripSlashes($_POST["scope"]);
523
524 $filename = 'ilias_' . $this->object->key . '_'
525 . str_replace(".", "_", substr(ILIAS_VERSION, 0, strpos(ILIAS_VERSION, " ")))
526 . "-" . date('Y-m-d')
527 . ".lang." . $this->session["export"]["scope"];
528
529 $global_file_obj = $this->object->getGlobalLanguageFile();
530 $local_file_obj = new ilLanguageFile($filename, $this->object->key, $_POST["scope"]);
531
532 if ($_POST["scope"] == 'global') {
533 $local_file_obj->setParam("author", $global_file_obj->getParam('author'));
534 $local_file_obj->setParam("version", $global_file_obj->getParam('version'));
535 $local_file_obj->setAllValues($this->object->getAllValues());
536 if ($this->langmode) {
537 $local_file_obj->setAllComments($this->object->getAllRemarks());
538 }
539 } elseif ($_POST["scope"] == 'local') {
540 $local_file_obj->setParam("based_on", $global_file_obj->getParam('version'));
541 $local_file_obj->setAllValues($this->object->getChangedValues());
542 if ($this->langmode) {
543 $local_file_obj->setAllComments($this->object->getAllRemarks());
544 }
545 } elseif ($_POST["scope"] == 'added') { // langmode only
546 $local_file_obj->setParam("author", $global_file_obj->getParam('author'));
547 $local_file_obj->setParam("version", $global_file_obj->getParam('version'));
548 $local_file_obj->setAllValues($this->object->getAddedValues());
549 $local_file_obj->setAllComments($this->object->getAllRemarks());
550 } elseif ($_POST["scope"] == 'unchanged') {
551 $local_file_obj->setParam("author", $global_file_obj->getParam('author'));
552 $local_file_obj->setParam("version", $global_file_obj->getParam('version'));
553 $local_file_obj->setAllValues($this->object->getUnchangedValues());
554 if ($this->langmode) {
555 $local_file_obj->setAllComments($this->object->getAllRemarks());
556 }
557 } elseif ($_POST["scope"] == 'merged') { // langmode only
558 $local_file_obj->setParam("author", $global_file_obj->getParam('author'));
559 $local_file_obj->setParam("version", $global_file_obj->getParam('version'));
560 $local_file_obj->setAllValues($this->object->getMergedValues());
561 $local_file_obj->setAllComments($this->object->getMergedRemarks());
562 }
563
564 ilUtil::deliverData($local_file_obj->build(), $filename);
565 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
$_POST["username"]
Class ilLanguageFile.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
const ILIAS_VERSION

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

+ Here is the call graph for this function:

◆ executeCommand()

ilObjLanguageExtGUI::executeCommand ( )

execute command

Reimplemented from ilObjectGUI.

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

97 {
98 global $ilHelp;
99
101 $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
102 exit;
103 }
104
105 $cmd = $this->ctrl->getCmd("view") . "Object";
106 $this->$cmd();
107
108 $ilHelp->setScreenIdComponent("lng");
109 }
static _checkMaintenance()
Permission check for language maintenance (import/export)

References ilObjLanguageAccess\_checkMaintenance(), and exit.

+ Here is the call graph for this function:

◆ exportObject()

ilObjLanguageExtGUI::exportObject ( )

Show the screen to export a language file.

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

480 {
481 require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
482 $form = new ilPropertyFormGUI();
483 $form->setFormAction($this->ctrl->getFormAction($this));
484 $form->setTitle($this->lng->txt("language_export_file"));
485 $form->setPreventDoubleSubmission(false);
486 $form->addCommandButton('download', $this->lng->txt("download"));
487
488 $rg = new ilRadioGroupInputGUI($this->lng->txt("language_file_scope"), "scope");
489 $ro = new ilRadioOption($this->lng->txt("language_scope_global"), "global");
490 $ro->setInfo($this->lng->txt("language_scope_global_info"));
491 $rg->addOption($ro);
492 $ro = new ilRadioOption($this->lng->txt("language_scope_local"), "local");
493 $ro->setInfo($this->lng->txt("language_scope_local_info"));
494 $rg->addOption($ro);
495 if ($this->langmode) {
496 $ro = new ilRadioOption($this->lng->txt("language_scope_added"), "added");
497 $ro->setInfo($this->lng->txt("language_scope_added_info"));
498 $rg->addOption($ro);
499 }
500 $ro = new ilRadioOption($this->lng->txt("language_scope_unchanged"), "unchanged");
501 $ro->setInfo($this->lng->txt("language_scope_unchanged_info"));
502 $rg->addOption($ro);
503 if ($this->langmode) {
504 $ro = new ilRadioOption($this->lng->txt("language_scope_merged"), "merged");
505 $ro->setInfo($this->lng->txt("language_scope_merged_info"));
506 $rg->addOption($ro);
507 }
508
509 $rg->setValue($this->session["export"]["scope"] ? $this->session["export"]["scope"] : "global");
510 $form->addItem($rg);
511
512 $this->tpl->setContent($form->getHTML());
513 }
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
if(isset($_POST['submit'])) $form

References $form.

◆ getAdminTabs()

ilObjLanguageExtGUI::getAdminTabs ( )

Get tabs for admin mode (Overwritten from ilObjectGUI, called by prepareOutput)

Parameters
objecttabs gui object

Reimplemented from ilObjectGUI.

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

781 {
783 $this->tabs_gui->addTarget(
784 "edit",
785 $this->ctrl->getLinkTarget($this, "view"),
786 array("","view","cancel","save")
787 );
788
789 $this->tabs_gui->addTarget(
790 "export",
791 $this->ctrl->getLinkTarget($this, "export"),
792 array("export","download")
793 );
794
795 $this->tabs_gui->addTarget(
796 "import",
797 $this->ctrl->getLinkTarget($this, "import"),
798 array("import","upload")
799 );
800
801 $this->tabs_gui->addTarget(
802 "language_maintain",
803 $this->ctrl->getLinkTarget($this, "maintain"),
804 array("maintain")
805 );
806
807 $this->tabs_gui->addTarget(
808 "settings",
809 $this->ctrl->getLinkTarget($this, "settings"),
810 array("settings")
811 );
812
813 $this->tabs_gui->addTarget(
814 "language_statistics",
815 $this->ctrl->getLinkTarget($this, "statistics"),
816 array("statistics")
817 );
818 }
819 }

References ilObjLanguageAccess\_isPageTranslation().

+ Here is the call graph for this function:

◆ getId()

ilObjLanguageExtGUI::getId ( )

get the language object id (needed for filter serialization)

Returns
int language object id

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

89 {
90 return $this->id;
91 }

References $id.

◆ getViewTable()

ilObjLanguageExtGUI::getViewTable ( )
protected

Get the table to view language entries.

Returns
ilLanguageExtTableGUI

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

126 {
127 // create and configure the table object
128 include_once './Services/Language/classes/class.ilLanguageExtTableGUI.php';
129 $table_gui = new ilLanguageExtTableGUI($this, 'view', array(
130 'langmode' => $this->langmode,
131 'lang_key'=> $this->object->key,
132 ));
133
134 return $table_gui;
135 }

Referenced by applyFilterObject(), resetFilterObject(), and viewObject().

+ Here is the caller graph for this function:

◆ importObject()

ilObjLanguageExtGUI::importObject ( )

Show the screen to import a language file.

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

405 {
406 require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
407 $form = new ilPropertyFormGUI();
408 $form->setFormAction($this->ctrl->getFormAction($this));
409 $form->setTitle($this->lng->txt("language_import_file"));
410 $form->addCommandButton('upload', $this->lng->txt("upload"));
411
412 $fu = new ilFileInputGUI($this->lng->txt("file"), "userfile");
413 $form->addItem($fu);
414
415 $rg = new ilRadioGroupInputGUI($this->lng->txt("language_mode_existing"), "mode_existing");
416 $ro = new ilRadioOption($this->lng->txt("language_mode_existing_keepall"), "keepall");
417 $ro->setInfo($this->lng->txt("language_mode_existing_keepall_info"));
418 $rg->addOption($ro);
419 $ro = new ilRadioOption($this->lng->txt("language_mode_existing_keepnew"), "keepnew");
420 $ro->setInfo($this->lng->txt("language_mode_existing_keepnew_info"));
421 $rg->addOption($ro);
422 $ro = new ilRadioOption($this->lng->txt("language_mode_existing_replace"), "replace");
423 $ro->setInfo($this->lng->txt("language_mode_existing_replace_info"));
424 $rg->addOption($ro);
425 $ro = new ilRadioOption($this->lng->txt("language_mode_existing_delete"), "delete");
426 $ro->setInfo($this->lng->txt("language_mode_existing_delete_info"));
427 $rg->addOption($ro);
428 $rg->setValue($this->session["import"]["mode_existing"] ? $this->session["import"]["mode_existing"] : "keepall");
429 $form->addItem($rg);
430
431 $this->tpl->setContent($form->getHTML());
432 }
This class represents a file property in a property form.

References $form.

◆ initAddNewEntryForm()

ilObjLanguageExtGUI::initAddNewEntryForm (   $a_id = null)
protected

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

904 {
905 global $ilCtrl;
906
907 if (!$a_id) {
908 $a_id = $_POST["id"];
909 }
910
911 if (!$a_id ||
912 !in_array($a_id, ilObjLanguageAccess::_getSavedTopics())) {
913 $ilCtrl->redirect($this, "view");
914 }
915
916 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
917 $form = new ilPropertyFormGUI();
918 $form->setFormAction($ilCtrl->getFormAction($this, "saveNewEntry"));
919 $form->setTitle($this->lng->txt("adm_missing_entry_add"));
920
922 $options = array_combine($mods, $mods);
923
924 $mod = new ilSelectInputGUI(ucfirst($this->lng->txt("module")), "mod");
925 $mod->setOptions(array(""=>$this->lng->txt("please_select"))+$options);
926 $mod->setRequired(true);
927 $form->addItem($mod);
928
929 $id = new ilTextInputGUI(ucfirst($this->lng->txt("identifier")), "id");
930 $id->setValue($a_id);
931 $id->setDisabled(true);
932 $form->addItem($id);
933
934 foreach ($this->lng->getInstalledLanguages() as $lang_key) {
935 $trans = new ilTextInputGUI($this->lng->txt("meta_l_" . $lang_key), "trans_" . $lang_key);
936 if (in_array($lang_key, array("de", "en"))) {
937 $trans->setRequired(true);
938 }
939 $form->addItem($trans);
940 }
941
942 $form->addCommandButton("saveNewEntry", $this->lng->txt("save"));
943 $form->addCommandButton("view", $this->lng->txt("cancel"));
944
945 return $form;
946 }
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
static _getSavedTopics()
Get the stored topics from the user session.
static _getSavedModules()
Get the stored modules from the user session.
This class represents a selection list property in a property form.
This class represents a text property in a property form.

References $_POST, $form, $id, $ilCtrl, $options, ilObjLanguageAccess\_getSavedModules(), and ilObjLanguageAccess\_getSavedTopics().

Referenced by addNewEntryObject(), and saveNewEntryObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maintainExecuteObject()

ilObjLanguageExtGUI::maintainExecuteObject ( )

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

609 {
610 if (isset($_POST["maintain"])) {
611 $this->session["maintain"] = ilUtil::stripSlashes($_POST["maintain"]);
612 }
613
614 switch ($_POST["maintain"]) {
615 // save the global language file for merge after
616 case "save_dist":
617
618 // save a copy of the distributed language file
619 $orig_file = $this->object->getLangPath() . '/ilias_' . $this->object->key . '.lang';
620 $copy_file = $this->object->getDataPath() . '/ilias_' . $this->object->key . '.lang';
621 if (@copy($orig_file, $copy_file)) {
622 ilUtil::sendSuccess($this->lng->txt("language_saved_dist"), true);
623 } else {
624 ilUtil::sendFailure($this->lng->txt("language_save_dist_failed"), true);
625 }
626 break;
627
628 // load the content of the local language file
629 case "load":
630 $lang_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang.local';
631 if (is_file($lang_file) and is_readable($lang_file)) {
632 $this->object->importLanguageFile($lang_file, 'replace');
633 $this->object->setLocal(true);
634 ilUtil::sendSuccess($this->lng->txt("language_loaded_local"), true);
635 } else {
636 ilUtil::sendFailure($this->lng->txt("language_error_read_local"), true);
637 }
638 break;
639
640 // revert the database to the default language file
641 case "clear":
642 $lang_file = $this->object->getLangPath() . '/ilias_' . $this->object->key . '.lang';
643 if (is_file($lang_file) and is_readable($lang_file)) {
644 $this->object->importLanguageFile($lang_file, 'delete');
645 $this->object->setLocal(false);
646 ilUtil::sendSuccess($this->lng->txt("language_cleared_local"), true);
647 } else {
648 ilUtil::sendFailure($this->lng->txt("language_error_clear_local"), true);
649 }
650 break;
651
652 // delete local additions in the datavase (langmode only)
653 case "delete_added":
654 ilObjLanguageExt::_deleteValues($this->object->key, $this->object->getAddedValues());
655 break;
656
657 // merge local changes back to the global language file (langmode only)
658 case "merge":
659
660 $orig_file = $this->object->getLangPath() . '/ilias_' . $this->object->key . '.lang';
661 $copy_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang';
662
663 if (is_file($orig_file) and is_writable($orig_file)) {
664 // save a copy of the global language file
665 @copy($orig_file, $copy_file);
666
667 // modify and write the new global file
668 $global_file_obj = $this->object->getGlobalLanguageFile();
669 $global_file_obj->setAllValues($this->object->getMergedValues());
670 $global_file_obj->setAllComments($this->object->getMergedRemarks());
671 $global_file_obj->write();
672 ilUtil::sendSuccess($this->lng->txt("language_merged_global"), true);
673 } else {
674 ilUtil::sendFailure($this->lng->txt("language_error_write_global"), true);
675 }
676 break;
677
678 // remove the local language file (langmode only)
679 case "remove_local_file":
680 $lang_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang.local';
681
682 if (!is_file($lang_file)) {
683 $this->object->setLocal(false);
684 ilUtil::sendFailure($this->lng->txt("language_error_local_missed"), true);
685 } elseif (@unlink($lang_file)) {
686 $this->object->setLocal(false);
687 ilUtil::sendSuccess($this->lng->txt("language_local_file_deleted"), true);
688 } else {
689 ilUtil::sendFailure($this->lng->txt("language_error_delete_local"), true);
690 }
691 break;
692 }
693
694 $this->ctrl->redirect($this, "maintain");
695 }
static _deleteValues($a_lang_key, $a_values=array())
Delete a set of translation in the database.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

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

+ Here is the call graph for this function:

◆ maintainObject()

ilObjLanguageExtGUI::maintainObject ( )

Process the language maintenance.

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

572 {
573 require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
574 $form = new ilPropertyFormGUI();
575 $form->setFormAction($this->ctrl->getFormAction($this));
576 $form->setTitle($this->lng->txt("language_maintenance"));
577 $form->setPreventDoubleSubmission(false);
578 $form->addCommandButton('maintainExecute', $this->lng->txt("language_process_maintenance"));
579
580 $rg = new ilRadioGroupInputGUI($this->lng->txt("language_maintain_local_changes"), "maintain");
581 $ro = new ilRadioOption($this->lng->txt("language_load_local_changes"), "load");
582 $ro->setInfo(sprintf($this->lng->txt("language_load_local_changes_info"), $this->object->key));
583 $rg->addOption($ro);
584 $ro = new ilRadioOption($this->lng->txt("language_clear_local_changes"), "clear");
585 $ro->setInfo(sprintf($this->lng->txt("language_clear_local_changes_info"), $this->object->key));
586 $rg->addOption($ro);
587 if ($this->langmode) {
588 $ro = new ilRadioOption($this->lng->txt("language_delete_local_additions"), "delete_added");
589 $ro->setInfo(sprintf($this->lng->txt("language_delete_local_additions_info"), $this->object->key));
590 $rg->addOption($ro);
591 $ro = new ilRadioOption($this->lng->txt("language_remove_local_file"), "remove_local_file");
592 $ro->setInfo(sprintf($this->lng->txt("language_remove_local_file_info"), $this->object->key));
593 $rg->addOption($ro);
594 $ro = new ilRadioOption($this->lng->txt("language_merge_local_changes"), "merge");
595 $ro->setInfo(sprintf($this->lng->txt("language_merge_local_changes_info"), $this->object->key));
596 $rg->addOption($ro);
597 }
598 $ro = new ilRadioOption($this->lng->txt("language_save_dist"), "save_dist");
599 $ro->setInfo(sprintf($this->lng->txt("language_save_dist_info"), $this->object->key));
600 $rg->addOption($ro);
601 $rg->setValue($this->session["maintain"]);
602 $form->addItem($rg);
603
604 $this->tpl->setContent($form->getHTML());
605 }
sprintf('%.4f', $callTime)

References $form, and sprintf.

◆ resetFilterObject()

ilObjLanguageExtGUI::resetFilterObject ( )

Reset filter.

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

357 {
358 $table_gui = $this->getViewTable();
359 $table_gui->resetOffset(); // sets record offest to 0 (first page)
360 $table_gui->resetFilter(); // clears filter
361 $this->viewObject();
362 }

References getViewTable(), and viewObject().

+ Here is the call graph for this function:

◆ saveNewEntryObject()

ilObjLanguageExtGUI::saveNewEntryObject ( )

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

949 {
950 global $ilCtrl, $ilUser, $ilDB;
951
952 $form = $this->initAddNewEntryForm();
953 if ($form->checkInput()) {
954 $mod = $form->getInput("mod");
955 $id = $form->getInput("id");
956
957 $lang = array();
958 foreach ($this->lng->getInstalledLanguages() as $lang_key) {
959 $trans = trim($form->getInput("trans_" . $lang_key));
960 if ($trans) {
961 // add single entry
963 $mod,
964 $id,
965 $lang_key,
966 $trans,
967 date("Y-m-d H:i:s"),
968 $ilUser->getLogin()
969 );
970
971 // add to serialized module
972 $set = $ilDB->query("SELECT lang_array FROM lng_modules" .
973 " WHERE lang_key = " . $ilDB->quote($lang_key, "text") .
974 " AND module = " . $ilDB->quote($mod, "text"));
975 $row = $ilDB->fetchAssoc($set);
976 $entries = unserialize($row["lang_array"]);
977 if (is_array($entries)) {
978 $entries[$id] = $trans;
979 ilObjLanguage::replaceLangModule($lang_key, $mod, $entries);
980 }
981 }
982 }
983
984 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
985 $ilCtrl->redirect($this, "view");
986 }
987
988 $form->setValuesByPost();
989 $this->addNewEntryObject($form);
990 }
addNewEntryObject(ilPropertyFormGUI $a_form=null)
static replaceLangEntry( $a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null, $a_remarks=null)
Replace lang entry.
$lang
Definition: consent.php:3
global $ilDB
$ilUser
Definition: imgupload.php:18

References $form, $id, $ilCtrl, $ilDB, $ilUser, $lang, $row, addNewEntryObject(), date, initAddNewEntryForm(), ilObjLanguage\replaceLangEntry(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ saveObject()

ilObjLanguageExtGUI::saveObject ( )

Save the changed translations.

Reimplemented from ilObjectGUI.

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

368 {
369 // prepare the values to be saved
370 $save_array = array();
371 $remarks_array = array();
372 foreach ($_POST as $key => $value) {
373 // mantis #25237
374 // @see https://php.net/manual/en/language.variables.external.php
375 $key = str_replace('_POSTDOT_', '.', $key);
376 $key = str_replace('_POSTSPACE_', ' ', $key);
377
378 // example key of variable: 'common#:#access'
379 // example key of comment: 'common#:#access#:#comment'
380 $keys = explode($this->lng->separator, ilUtil::stripSlashes($key, false));
381
382 if (count($keys) == 2) {
383 // avoid line breaks
384 $value = preg_replace("/(\015\012)|(\015)|(\012)/", "<br />", $value);
385 $value = ilUtil::stripSlashes($value, false);
386 $save_array[$key] = $value;
387
388 // the comment has the key of the language with the suffix
389 $remarks_array[$key] = $_POST[$key . $this->lng->separator . "comment"];
390 }
391 }
392
393 // save the translations
394 ilObjLanguageExt::_saveValues($this->object->key, $save_array, $remarks_array);
395
396 // view the list
397 $this->viewObject();
398 }
static _saveValues($a_lang_key, $a_values=array(), $a_remarks=array())
Save a set of translation in the database.
$key
Definition: croninfo.php:18
$keys

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

+ Here is the call graph for this function:

◆ settingsObject()

ilObjLanguageExtGUI::settingsObject ( )

Set the language settings.

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

701 {
702 global $ilSetting;
703
704 $translate_key = "lang_translate_" . $this->object->key;
705
706 // save and get the page translation setting
707 if (!empty($_POST)) {
708 $ilSetting->set($translate_key, (bool) $_POST["translation"]);
709 ilUtil::sendSuccess($this->lng->txt("settings_saved"));
710 }
711 $translate = $ilSetting->get($translate_key, false);
712
713 require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
714 $form = new ilPropertyFormGUI();
715 $form->setFormAction($this->ctrl->getFormAction($this));
716 $form->setTitle($this->lng->txt("language_settings"));
717 $form->setPreventDoubleSubmission(false);
718 $form->addCommandButton('settings', $this->lng->txt("language_change_settings"));
719
720 $ci = new ilCheckboxInputGUI($this->lng->txt("language_translation_enabled"), "translation");
721 $ci->setChecked((bool) $translate);
722 $ci->setInfo($this->lng->txt("language_note_translation"));
723 $form->addItem($ci);
724
725 $this->tpl->setContent($form->getHTML());
726 }
This class represents a checkbox property in a property form.
global $ilSetting
Definition: privfeed.php:17

References $_POST, $form, $ilSetting, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ setTitleAndDescription()

ilObjLanguageExtGUI::setTitleAndDescription ( )

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

Reimplemented from ilObjectGUI.

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

851 {
853 $this->tpl->setHeaderPageTitle($this->lng->txt("translation"));
854 $this->tpl->setTitle($this->lng->txt("translation") . " " . $this->lng->txt("meta_l_" . $this->object->key));
855 } else {
856 $this->tpl->setTitle($this->lng->txt("meta_l_" . $this->object->key));
857 }
858 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lngf.svg"), $this->lng->txt("obj_" . $this->object->getType()));
859 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

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

+ Here is the call graph for this function:

◆ statisticsObject()

ilObjLanguageExtGUI::statisticsObject ( )

Print out statistics about the language.

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

732 {
733 $modules = ilObjLanguageExt::_getModules($this->object->key);
734
735 $data = array();
736 $total = array("module"=>'',"all"=>0,"changed"=>0, "unchanged"=>0);
737 foreach ($modules as $module) {
738 $row = array();
739 $row['module'] = $module;
740 $row['all'] = count($this->object->getAllValues(array($module)));
741 $row['changed'] = count($this->object->getChangedValues(array($module)));
742 $row['unchanged'] = $row['all']-$row['changed'];
743 $total['all'] += $row['all'];
744 $total['changed'] += $row['changed'];
745 $total['unchanged'] += $row['unchanged'];
746 $data[] = $row;
747 }
748 $total['module'] = "<b>" . $this->lng->txt("language_all_modules") . "</b>";
749 $total['all'] = "<b>" . $total['all'] . "</b>";
750 $total['changed'] = "<b>" . $total['changed'] . "</b>";
751 $total['unchanged'] = "<b>" . $total['unchanged'] . "</b>";
752 $data[] = $total;
753
754 // create and configure the table object
755 include_once 'Services/Table/classes/class.ilTable2GUI.php';
756 $table_gui = new ilTable2GUI($this, "statistics");
757 $table_gui->setRowTemplate("tpl.lang_statistics_row.html", "Services/Language");
758 $table_gui->setEnableTitle(false);
759 $table_gui->setEnableNumInfo(false);
760 $table_gui->setLimit(count($data));
761 $table_gui->setExportFormats(array(ilTable2GUI::EXPORT_EXCEL));
762
763 $table_gui->addColumn(ucfirst($this->lng->txt("module")), "", "25%");
764 $table_gui->addColumn($this->lng->txt("language_scope_global"), "", "25%");
765 $table_gui->addColumn($this->lng->txt("language_scope_local"), "", "25%");
766 $table_gui->addColumn($this->lng->txt("language_scope_unchanged"), "", "25%");
767
768 $table_gui->setData($data);
769
770 $this->tpl->setContent($table_gui->getHTML());
771 }
$total
Definition: Utf8Test.php:87
static _getModules($a_lang_key)
Get all modules of a language.
Class ilTable2GUI.
if($modEnd===false) $module
Definition: module.php:59

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

+ Here is the call graph for this function:

◆ uploadObject()

ilObjLanguageExtGUI::uploadObject ( )

Process an uploaded language file.

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

439 {
440 global $DIC;
441
442 // save form inputs for next display
443 $this->session["import"]["mode_existing"] = ilUtil::stripSlashes($_POST['mode_existing']);
444
445 try {
446 $upload = $DIC->upload();
447 $upload->process();
448
449 if (!$upload->hasUploads()) {
450 throw new ilException($DIC->language()->txt("upload_error_file_not_found"));
451 }
452 $UploadResult = $upload->getResults()[$_FILES['userfile']['tmp_name']];
453
454 $ProcessingStatus = $UploadResult->getStatus();
455 if ($ProcessingStatus->getCode() === ProcessingStatus::REJECTED) {
456 throw new ilException($ProcessingStatus->getMessage());
457 }
458
459 // todo: refactor when importLanguageFile() is able to work with the new Filesystem service
460 $tempfile = ilUtil::ilTempnam() . '.sec';
461 $upload->moveOneFileTo($UploadResult, '', Location::TEMPORARY, basename($tempfile), true);
462 $this->object->importLanguageFile($tempfile, $_POST['mode_existing']);
463
464 $tempfs = $DIC->filesystem()->temp();
465 $tempfs->delete(basename($tempfile));
466 } catch (Exception $e) {
467 ilUtil::sendFailure($e->getMessage(), true);
468 $this->ctrl->redirect($this, 'import');
469 }
470
471 ilUtil::sendSuccess(sprintf($this->lng->txt("language_file_imported"), $_FILES['userfile']['name']), true);
472 $this->ctrl->redirect($this, 'import');
473 }
Base class for ILIAS Exception handling.
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
global $DIC
Definition: saml.php:7

References $_POST, $DIC, ilUtil\ilTempnam(), ilUtil\sendFailure(), ilUtil\sendSuccess(), sprintf, and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ viewObject()

ilObjLanguageExtGUI::viewObject ( )

Show the edit screen.

Reimplemented from ilObjectGUI.

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

141 {
142 global $tpl;
143
144 // get the view table
145 $table_gui = $this->getViewTable();
146
147 // get the remarks in database
148 $comments = $this->object->getAllRemarks();
149
150 // set the language to compare with
151 // get the default values if the compare language is the same
152 $compare = $table_gui->getFilterItemByPostVar('compare')->getValue();
153 if ($compare == $this->object->key) {
154 $compare_object = $this->object->getGlobalLanguageFile();
155 $compare_content = $compare_object->getAllValues();
156 $compare_comments = $compare_object->getAllComments();
157 }
158
159 // page translation mode:
160 // - the table is filtered by a list of modules and topics
162 // get the selection of modules and topics from request or session
165
166 // first call for translation
167 if ($_GET['reset_offset']) {
168 $table_gui->resetOffset();
169 }
170
171 if (!isset($compare_content)) {
172 $compare_content = ilObjLanguageExt::_getValues(
173 $compare,
174 $modules,
175 $topics
176 );
177
178 $compare_comments = ilObjLanguageExt::_getRemarks($compare);
179 }
180
181 $translations = ilObjLanguageExt::_getValues(
182 $this->object->key,
183 $modules,
184 $topics
185 );
186
187 // enable adding new entries
188 $db_found = array();
189 foreach ($translations as $name => $translation) {
190 $keys = explode($this->lng->separator, $name);
191 $db_found[] = $keys[1];
192 }
193 $missing_entries = array_diff($topics, $db_found);
194 }
195 // normal view mode:
196 // - the table is filtered manually by module, mode and pattern
197 else {
198 $filter_mode = $table_gui->getFilterItemByPostVar('mode')->getValue();
199 $filter_pattern = $table_gui->getFilterItemByPostVar('pattern')->getValue();
200 $filter_module = $table_gui->getFilterItemByPostVar('module')->getValue();
201 $filter_module = $filter_module == 'all' ? '' : $filter_module;
202 $filter_modules = $filter_module ? array($filter_module) : array();
203 $filter_identifier = $table_gui->getFilterItemByPostVar('identifier')->getValue();
204 $filter_topics = $filter_identifier ? array($filter_identifier) : array();
205
206 if (!isset($compare_content)) {
207 $compare_content = ilObjLanguageExt::_getValues(
208 $compare,
209 $filter_modules,
210 $filter_topics
211 );
212
213 $compare_comments = ilObjLanguageExt::_getRemarks($compare);
214 }
215
216 switch ($filter_mode) {
217 case "changed":
218 $translations = $this->object->getChangedValues(
219 $filter_modules,
220 $filter_pattern,
221 $filter_topics
222 );
223 break;
224
225 case "added": //langmode only
226 $translations = $this->object->getAddedValues(
227 $filter_modules,
228 $filter_pattern,
229 $filter_topics
230 );
231 break;
232
233 case "unchanged":
234 $translations = $this->object->getUnchangedValues(
235 $filter_modules,
236 $filter_pattern,
237 $filter_topics
238 );
239 break;
240
241 case "commented":
242 $translations = $this->object->getCommentedValues(
243 $filter_modules,
244 $filter_pattern,
245 $filter_topics
246 );
247 break;
248
249 case "dbremarks":
250 $translations = $this->object->getAllValues(
251 $filter_modules,
252 $filter_pattern,
253 $filter_topics
254 );
255
256 $translations = array_intersect_key($translations, $remarks);
257 break;
258
259 case "equal":
260 $translations = $this->object->getAllValues(
261 $filter_modules,
262 $filter_pattern,
263 $filter_topics
264 );
265
266 $translations = array_intersect_assoc($translations, $compare_content);
267 break;
268
269 case "different":
270 $translations = $this->object->getAllValues(
271 $filter_modules,
272 $filter_pattern,
273 $filter_topics
274 );
275
276 $translations = array_diff_assoc($translations, $compare_content);
277 break;
278
279 case "conflicts":
280 $former_file = $this->object->getDataPath() . '/ilias_' . $this->object->key . '.lang';
281 if (!is_readable($former_file)) {
282 ilUtil::sendFailure(sprintf($this->lng->txt("language_former_file_missing"), $former_file)
283 . '<br />' . $this->lng->txt("language_former_file_description"), false);
284 $translations = array();
285 break;
286 }
287 $global_file_obj = $this->object->getGlobalLanguageFile();
288 $former_file_obj = new ilLanguageFile($former_file);
289 $former_file_obj->read();
290 $global_changes = array_diff_assoc(
291 $global_file_obj->getAllValues(),
292 $former_file_obj->getAllValues()
293 );
294 if (!count($global_changes)) {
295 ilUtil::sendInfo(sprintf($this->lng->txt("language_former_file_equal"), $former_file)
296 . '<br />' . $this->lng->txt("language_former_file_description"), false);
297 $translations = array();
298 break;
299 }
300 $translations = $this->object->getChangedValues(
301 $filter_modules,
302 $filter_pattern,
303 $filter_topics
304 );
305
306 $translations = array_intersect_key($translations, $global_changes);
307 break;
308
309 case "all":
310 default:
311 $translations = $this->object->getAllValues(
312 $filter_modules,
313 $filter_pattern,
314 $filter_topics
315 );
316 }
317 }
318
319 // prepare the the data for the table
320 $data = array();
321 foreach ($translations as $name => $translation) {
322 $keys = explode($this->lng->separator, $name);
323 $row = array();
324
325 $row["module"] = $keys[0];
326 $row["topic"] = $keys[1];
327 $row["name"] = $name;
328 $row["translation"] = $translation;
329 $row["comment"] = $comments[$name];
330 $row["default"] = $compare_content[$name];
331 $row["default_comment"] = $compare_comments[$name];
332
333 $data[] = $row;
334 }
335
336 // render and show the table
337 $table_gui->setData($data);
338 $tpl->setContent($table_gui->getHTML() .
339 $this->buildMissingEntries($missing_entries));
340 }
static _getRemarks($a_lang_key, $a_all_changed=false)
Get all remarks of a language.
static _getValues( $a_lang_key, $a_modules=array(), $a_topics=array(), $a_pattern='', $a_state='')
Get the translations of specified topics.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if($format !==null) $name
Definition: metadata.php:146

References $_GET, ilObjectGUI\$data, $keys, $name, $row, ilObjectGUI\$tpl, ilObjLanguageExt\_getRemarks(), ilObjLanguageAccess\_getSavedModules(), ilObjLanguageAccess\_getSavedTopics(), ilObjLanguageExt\_getValues(), ilObjLanguageAccess\_isPageTranslation(), getViewTable(), ilUtil\sendFailure(), ilUtil\sendInfo(), and sprintf.

Referenced by applyFilterObject(), cancelObject(), resetFilterObject(), and saveObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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