ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 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...
 
 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 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...
 
 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
 
 $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 Attributes inherited from ilObjectGUI
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 

Detailed Description

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

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

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

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

References ilObjLanguageAccess\_isPageTranslation().

812  {
813  global $ilLocator;
814 
816  {
817  parent::addAdminLocatorItems(true); // #13881
818 
819  $ilLocator->addItem($this->lng->txt("languages"),
820  $this->ctrl->getLinkTargetByClass("ilobjlanguagefoldergui", ""));
821 
822  $ilLocator->addItem($this->lng->txt("meta_l_". $this->object->getTitle()),
823  $this->ctrl->getLinkTarget($this, "view"));
824  }
825  }
static _isPageTranslation()
Check if the current request is a page translation.
+ Here is the call graph for this function:

◆ addNewEntryObject()

ilObjLanguageExtGUI::addNewEntryObject ( ilPropertyFormGUI  $a_form = null)

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

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

Referenced by saveNewEntryObject().

878  {
879  global $tpl;
880 
881  $id = trim($_GET["eid"]);
882 
883  if(!$a_form)
884  {
885  $a_form = $this->initAddNewEntryForm($id);
886  }
887 
888  $tpl->setContent($a_form->getHTML());
889  }
$_GET["client_id"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyFilterObject()

ilObjLanguageExtGUI::applyFilterObject ( )

Apply filter.

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

References getViewTable(), and viewObject().

320  {
321  $table_gui = $this->getViewTable();
322  $table_gui->writeFilterToSession(); // writes filter to session
323  $table_gui->resetOffset(); // sets record offest to 0 (first page)
324  $this->viewObject();
325  }
viewObject()
Show the edit screen.
getViewTable()
Get the table to view language entries.
+ 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 77 of file class.ilObjLanguageExtGUI.php.

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

◆ buildMissingEntries()

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

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

References $ilCtrl, $res, and array.

Referenced by viewObject().

852  {
853  global $ilCtrl;
854 
855  if(!is_array($a_missing) ||
856  !sizeof($a_missing))
857  {
858  return;
859  }
860 
861  $res = array('<h3>'.$this->lng->txt("adm_missing_entries").'</h3>', '<ul>');
862 
863  foreach($a_missing as $entry)
864  {
865  $ilCtrl->setParameter($this, "eid", $entry);
866  $res[] = '<li>'.$entry.
867  ' <a href="'.$ilCtrl->getLinkTarget($this, "addNewEntry").
868  '">'.$this->lng->txt("adm_missing_entry_add_action").'</a></li>';
869  $ilCtrl->setParameter($this, "eid", "");
870  }
871 
872  $res[] = '</ul>';
873 
874  return implode("\n", $res);
875  }
global $ilCtrl
Definition: ilias.php:18
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ cancelObject()

ilObjLanguageExtGUI::cancelObject ( )

Cancel the current action.

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

References viewObject().

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

◆ downloadObject()

ilObjLanguageExtGUI::downloadObject ( )

Download a language file.

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

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

482  {
483  // save the selected scope
484  $this->session["export"]["scope"] = ilUtil::stripSlashes($_POST["scope"]);
485 
486  $filename = 'ilias_' . $this->object->key . '_'
487  . str_replace(".", "_", substr(ILIAS_VERSION, 0, strpos(ILIAS_VERSION, " ")))
488  . "-" . date('Y-m-d')
489  . ".lang.".$this->session["export"]["scope"];
490 
491  $global_file_obj = $this->object->getGlobalLanguageFile();
492  $local_file_obj = new ilLanguageFile($filename, $this->object->key, $_POST["scope"]);
493 
494  if ($_POST["scope"] == 'global')
495  {
496  $local_file_obj->setParam("author", $global_file_obj->getParam('author'));
497  $local_file_obj->setParam("version", $global_file_obj->getParam('version'));
498  $local_file_obj->setAllValues($this->object->getAllValues());
499  if ($this->langmode)
500  {
501  $local_file_obj->setAllComments($this->object->getAllRemarks());
502  }
503  }
504  elseif ($_POST["scope"] == 'local')
505  {
506  $local_file_obj->setParam("based_on", $global_file_obj->getParam('version'));
507  $local_file_obj->setAllValues($this->object->getChangedValues());
508  if ($this->langmode)
509  {
510  $local_file_obj->setAllComments($this->object->getAllRemarks());
511  }
512  }
513  elseif ($_POST["scope"] == 'added') // langmode only
514  {
515  $local_file_obj->setParam("author", $global_file_obj->getParam('author'));
516  $local_file_obj->setParam("version", $global_file_obj->getParam('version'));
517  $local_file_obj->setAllValues($this->object->getAddedValues());
518  $local_file_obj->setAllComments($this->object->getAllRemarks());
519  }
520  elseif ($_POST["scope"] == 'unchanged')
521  {
522  $local_file_obj->setParam("author", $global_file_obj->getParam('author'));
523  $local_file_obj->setParam("version", $global_file_obj->getParam('version'));
524  $local_file_obj->setAllValues($this->object->getUnchangedValues());
525  if ($this->langmode)
526  {
527  $local_file_obj->setAllComments($this->object->getAllRemarks());
528  }
529  }
530  elseif ($_POST["scope"] == 'merged') // langmode only
531  {
532  $local_file_obj->setParam("author", $global_file_obj->getParam('author'));
533  $local_file_obj->setParam("version", $global_file_obj->getParam('version'));
534  $local_file_obj->setAllValues($this->object->getMergedValues());
535  $local_file_obj->setAllComments($this->object->getMergedRemarks());
536  }
537 
538  ilUtil::deliverData($local_file_obj->build(), $filename);
539  }
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
const ILIAS_VERSION
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Create new PHPExcel object
obj_idprivate
Class ilLanguageFile.
$_POST["username"]
+ Here is the call graph for this function:

◆ executeCommand()

ilObjLanguageExtGUI::executeCommand ( )

execute command

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

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

96  {
97  global $ilHelp;
98 
100  {
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  }
$cmd
Definition: sahs_server.php:35
static _checkMaintenance()
Permission check for language maintenance (import/export)
+ Here is the call graph for this function:

◆ exportObject()

ilObjLanguageExtGUI::exportObject ( )

Show the screen to export a language file.

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

References ilFormPropertyGUI\setInfo().

440  {
441  require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
442  $form = new ilPropertyFormGUI();
443  $form->setFormAction($this->ctrl->getFormAction($this));
444  $form->setTitle($this->lng->txt("language_export_file"));
445  $form->setPreventDoubleSubmission(false);
446  $form->addCommandButton('download',$this->lng->txt("download"));
447 
448  $rg = new ilRadioGroupInputGUI($this->lng->txt("language_file_scope"), "scope");
449  $ro = new ilRadioOption($this->lng->txt("language_scope_global"), "global");
450  $ro->setInfo($this->lng->txt("language_scope_global_info"));
451  $rg->addOption($ro);
452  $ro = new ilRadioOption($this->lng->txt("language_scope_local"), "local");
453  $ro->setInfo($this->lng->txt("language_scope_local_info"));
454  $rg->addOption($ro);
455  if ($this->langmode)
456  {
457  $ro = new ilRadioOption($this->lng->txt("language_scope_added"), "added");
458  $ro->setInfo($this->lng->txt("language_scope_added_info"));
459  $rg->addOption($ro);
460  }
461  $ro = new ilRadioOption($this->lng->txt("language_scope_unchanged"), "unchanged");
462  $ro->setInfo($this->lng->txt("language_scope_unchanged_info"));
463  $rg->addOption($ro);
464  if ($this->langmode)
465  {
466  $ro = new ilRadioOption($this->lng->txt("language_scope_merged"), "merged");
467  $ro->setInfo($this->lng->txt("language_scope_merged_info"));
468  $rg->addOption($ro);
469  }
470 
471  $rg->setValue($this->session["export"]["scope"] ? $this->session["export"]["scope"] : "global");
472  $form->addItem($rg);
473 
474  $this->tpl->setContent($form->getHTML());
475  }
This class represents an option in a radio group.
This class represents a property form user interface.
setInfo($a_info)
Set Information Text.
This class represents a property in a property form.
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjLanguageExtGUI::getAdminTabs ( )

 Get tabs for admin mode

(Overwritten from ilObjectGUI, called by prepareOutput)

Parameters
objecttabs gui object

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

References ilObjLanguageAccess\_isPageTranslation(), and array.

777  {
779  {
780  $this->tabs_gui->addTarget("edit",
781  $this->ctrl->getLinkTarget($this, "view"),
782  array("","view","cancel","save"));
783 
784  $this->tabs_gui->addTarget("export",
785  $this->ctrl->getLinkTarget($this, "export"),
786  array("export","download"));
787 
788  $this->tabs_gui->addTarget("import",
789  $this->ctrl->getLinkTarget($this, "import"),
790  array("import","upload"));
791 
792  $this->tabs_gui->addTarget("language_maintain",
793  $this->ctrl->getLinkTarget($this, "maintain"),
794  array("maintain"));
795 
796  $this->tabs_gui->addTarget("settings",
797  $this->ctrl->getLinkTarget($this, "settings"),
798  array("settings"));
799 
800  $this->tabs_gui->addTarget("language_statistics",
801  $this->ctrl->getLinkTarget($this, "statistics"),
802  array("statistics"));
803  }
804  }
static _isPageTranslation()
Check if the current request is a page translation.
Create styles array
The data for the language used.
+ 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 87 of file class.ilObjLanguageExtGUI.php.

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

◆ getViewTable()

ilObjLanguageExtGUI::getViewTable ( )
protected

Get the table to view language entries.

Returns
ilLanguageExtTableGUI

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

References array, and object.

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

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  }
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
+ Here is the caller graph for this function:

◆ importObject()

ilObjLanguageExtGUI::importObject ( )

Show the screen to import a language file.

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

References ilFormPropertyGUI\setInfo().

381  {
382  require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
383  $form = new ilPropertyFormGUI();
384  $form->setFormAction($this->ctrl->getFormAction($this));
385  $form->setTitle($this->lng->txt("language_import_file"));
386  $form->addCommandButton('upload',$this->lng->txt("upload"));
387 
388  $fu = new ilFileInputGUI($this->lng->txt("file"), "userfile");
389  $form->addItem($fu);
390 
391  $rg = new ilRadioGroupInputGUI($this->lng->txt("language_mode_existing"), "mode_existing");
392  $ro = new ilRadioOption($this->lng->txt("language_mode_existing_keepall"), "keepall");
393  $ro->setInfo($this->lng->txt("language_mode_existing_keepall_info"));
394  $rg->addOption($ro);
395  $ro = new ilRadioOption($this->lng->txt("language_mode_existing_keepnew"), "keepnew");
396  $ro->setInfo($this->lng->txt("language_mode_existing_keepnew_info"));
397  $rg->addOption($ro);
398  $ro = new ilRadioOption($this->lng->txt("language_mode_existing_replace"), "replace");
399  $ro->setInfo($this->lng->txt("language_mode_existing_replace_info"));
400  $rg->addOption($ro);
401  $ro = new ilRadioOption($this->lng->txt("language_mode_existing_delete"), "delete");
402  $ro->setInfo($this->lng->txt("language_mode_existing_delete_info"));
403  $rg->addOption($ro);
404  $rg->setValue($this->session["import"]["mode_existing"] ? $this->session["import"]["mode_existing"] : "keepall");
405  $form->addItem($rg);
406 
407  $this->tpl->setContent($form->getHTML());
408  }
This class represents an option in a radio group.
This class represents a property form user interface.
This class represents a file property in a property form.
setInfo($a_info)
Set Information Text.
This class represents a property in a property form.
+ Here is the call graph for this function:

◆ initAddNewEntryForm()

ilObjLanguageExtGUI::initAddNewEntryForm (   $a_id = null)
protected

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

References $_POST, $ilCtrl, $options, ilObjLanguageAccess\_getSavedModules(), ilObjLanguageAccess\_getSavedTopics(), array, and ilFormPropertyGUI\setRequired().

Referenced by addNewEntryObject(), and saveNewEntryObject().

892  {
893  global $ilCtrl;
894 
895  if(!$a_id)
896  {
897  $a_id = $_POST["id"];
898  }
899 
900  if(!$a_id ||
901  !in_array($a_id, ilObjLanguageAccess::_getSavedTopics()))
902  {
903  $ilCtrl->redirect($this, "view");
904  }
905 
906  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
907  $form = new ilPropertyFormGUI();
908  $form->setFormAction($ilCtrl->getFormAction($this, "saveNewEntry"));
909  $form->setTitle($this->lng->txt("adm_missing_entry_add"));
910 
912  $options = array_combine($mods, $mods);
913 
914  $mod = new ilSelectInputGUI(ucfirst($this->lng->txt("module")), "mod");
915  $mod->setOptions(array(""=>$this->lng->txt("please_select"))+$options);
916  $mod->setRequired(true);
917  $form->addItem($mod);
918 
919  $id = new ilTextInputGUI(ucfirst($this->lng->txt("identifier")), "id");
920  $id->setValue($a_id);
921  $id->setDisabled(true);
922  $form->addItem($id);
923 
924  foreach ($this->lng->getInstalledLanguages() as $lang_key)
925  {
926  $trans = new ilTextInputGUI($this->lng->txt("meta_l_".$lang_key), "trans_".$lang_key);
927  if(in_array($lang_key, array("de", "en")))
928  {
929  $trans->setRequired(true);
930  }
931  $form->addItem($trans);
932  }
933 
934  $form->addCommandButton("saveNewEntry", $this->lng->txt("save"));
935  $form->addCommandButton("view", $this->lng->txt("cancel"));
936 
937  return $form;
938  }
This class represents a selection list property in a property form.
This class represents a property form user interface.
static _getSavedModules()
Get the stored modules from the user session.
global $ilCtrl
Definition: ilias.php:18
if(!is_array($argv)) $options
This class represents a text property in a property form.
static _getSavedTopics()
Get the stored topics from the user session.
Create styles array
The data for the language used.
$_POST["username"]
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maintainExecuteObject()

ilObjLanguageExtGUI::maintainExecuteObject ( )

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

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

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

◆ maintainObject()

ilObjLanguageExtGUI::maintainObject ( )

Process the language maintenance.

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

References ilFormPropertyGUI\setInfo().

546  {
547  require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
548  $form = new ilPropertyFormGUI();
549  $form->setFormAction($this->ctrl->getFormAction($this));
550  $form->setTitle($this->lng->txt("language_maintenance"));
551  $form->setPreventDoubleSubmission(false);
552  $form->addCommandButton('maintainExecute',$this->lng->txt("language_process_maintenance"));
553 
554  $rg = new ilRadioGroupInputGUI($this->lng->txt("language_maintain_local_changes"), "maintain");
555  $ro = new ilRadioOption($this->lng->txt("language_load_local_changes"), "load");
556  $ro->setInfo(sprintf($this->lng->txt("language_load_local_changes_info"),$this->object->key));
557  $rg->addOption($ro);
558  $ro = new ilRadioOption($this->lng->txt("language_clear_local_changes"), "clear");
559  $ro->setInfo(sprintf($this->lng->txt("language_clear_local_changes_info"),$this->object->key));
560  $rg->addOption($ro);
561  if ($this->langmode)
562  {
563  $ro = new ilRadioOption($this->lng->txt("language_delete_local_additions"), "delete_added");
564  $ro->setInfo(sprintf($this->lng->txt("language_delete_local_additions_info"), $this->object->key));
565  $rg->addOption($ro);
566  $ro = new ilRadioOption($this->lng->txt("language_remove_local_file"), "remove_local_file");
567  $ro->setInfo(sprintf($this->lng->txt("language_remove_local_file_info"), $this->object->key));
568  $rg->addOption($ro);
569  $ro = new ilRadioOption($this->lng->txt("language_merge_local_changes"), "merge");
570  $ro->setInfo(sprintf($this->lng->txt("language_merge_local_changes_info"), $this->object->key));
571  $rg->addOption($ro);
572  }
573  $ro = new ilRadioOption($this->lng->txt("language_save_dist"), "save_dist");
574  $ro->setInfo(sprintf($this->lng->txt("language_save_dist_info"),$this->object->key));
575  $rg->addOption($ro);
576  $rg->setValue($this->session["maintain"]);
577  $form->addItem($rg);
578 
579  $this->tpl->setContent($form->getHTML());
580  }
This class represents an option in a radio group.
This class represents a property form user interface.
setInfo($a_info)
Set Information Text.
This class represents a property in a property form.
+ Here is the call graph for this function:

◆ resetFilterObject()

ilObjLanguageExtGUI::resetFilterObject ( )

Reset filter.

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

References getViewTable(), and viewObject().

331  {
332  $table_gui = $this->getViewTable();
333  $table_gui->resetOffset(); // sets record offest to 0 (first page)
334  $table_gui->resetFilter(); // clears filter
335  $this->viewObject();
336  }
viewObject()
Show the edit screen.
getViewTable()
Get the table to view language entries.
+ Here is the call graph for this function:

◆ saveNewEntryObject()

ilObjLanguageExtGUI::saveNewEntryObject ( )

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

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

941  {
942  global $ilCtrl, $ilUser, $ilDB;
943 
944  $form = $this->initAddNewEntryForm();
945  if($form->checkInput())
946  {
947  $mod = $form->getInput("mod");
948  $id = $form->getInput("id");
949 
950  $lang = array();
951  foreach ($this->lng->getInstalledLanguages() as $lang_key)
952  {
953  $trans = trim($form->getInput("trans_".$lang_key));
954  if($trans)
955  {
956  // add single entry
958  $mod,
959  $id,
960  $lang_key,
961  $trans,
962  date("Y-m-d H:i:s"),
963  $ilUser->getLogin()
964  );
965 
966  // add to serialized module
967  $set = $ilDB->query("SELECT lang_array FROM lng_modules".
968  " WHERE lang_key = ".$ilDB->quote($lang_key, "text").
969  " AND module = ".$ilDB->quote($mod, "text"));
970  $row = $ilDB->fetchAssoc($set);
971  $entries = unserialize($row["lang_array"]);
972  if(is_array($entries))
973  {
974  $entries[$id] = $trans;
975  ilObjLanguage::replaceLangModule($lang_key, $mod, $entries);
976  }
977  }
978  }
979 
980  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
981  $ilCtrl->redirect($this, "view");
982  }
983 
984  $form->setValuesByPost();
985  $this->addNewEntryObject($form);
986  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static replaceLangEntry($a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null, $a_remarks=null)
Replace lang entry.
global $ilCtrl
Definition: ilias.php:18
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
global $ilDB
addNewEntryObject(ilPropertyFormGUI $a_form=null)
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
+ Here is the call graph for this function:

◆ saveObject()

ilObjLanguageExtGUI::saveObject ( )

Save the changed translations.

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

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

342  {
343  // prepare the values to be saved
344  $save_array = array();
345  $remarks_array = array();
346  foreach ($_POST as $key => $value)
347  {
348  // mantis #25237
349  // @see https://php.net/manual/en/language.variables.external.php
350  $key = str_replace('_POSTDOT_', '.', $key);
351  $key = str_replace('_POSTSPACE_', ' ', $key);
352 
353  // example key of variable: 'common#:#access'
354  // example key of comment: 'common#:#access#:#comment'
355  $keys = explode($this->lng->separator, ilUtil::stripSlashes($key, false));
356 
357  if (count($keys) == 2)
358  {
359  // avoid line breaks
360  $value = preg_replace("/(\015\012)|(\015)|(\012)/","<br />",$value);
361  $value = ilUtil::stripSlashes($value, false);
362  $save_array[$key] = $value;
363 
364  // the comment has the key of the language with the suffix
365  $remarks_array[$key] = $_POST[$key.$this->lng->separator."comment"];
366  }
367  }
368 
369  // save the translations
370  ilObjLanguageExt::_saveValues($this->object->key, $save_array, $remarks_array);
371 
372  // view the list
373  $this->viewObject();
374  }
viewObject()
Show the edit screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Create styles array
The data for the language used.
static _saveValues($a_lang_key, $a_values=array(), $a_remarks=array())
Save a set of translation in the database.
Create new PHPExcel object
obj_idprivate
$_POST["username"]
+ Here is the call graph for this function:

◆ settingsObject()

ilObjLanguageExtGUI::settingsObject ( )

Set the language settings.

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

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

695  {
696  global $ilSetting;
697 
698  $translate_key = "lang_translate_". $this->object->key;
699 
700  // save and get the page translation setting
701  if (!empty($_POST))
702  {
703  $ilSetting->set($translate_key, (bool) $_POST["translation"]);
704  ilUtil::sendSuccess($this->lng->txt("settings_saved"));
705  }
706  $translate = $ilSetting->get($translate_key, false);
707 
708  require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
709  $form = new ilPropertyFormGUI();
710  $form->setFormAction($this->ctrl->getFormAction($this));
711  $form->setTitle($this->lng->txt("language_settings"));
712  $form->setPreventDoubleSubmission(false);
713  $form->addCommandButton('settings',$this->lng->txt("language_change_settings"));
714 
715  $ci = new ilCheckboxInputGUI($this->lng->txt("language_translation_enabled"), "translation");
716  $ci->setChecked((bool) $translate);
717  $ci->setInfo($this->lng->txt("language_note_translation"));
718  $form->addItem($ci);
719 
720  $this->tpl->setContent($form->getHTML());
721  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
This class represents a property form user interface.
This class represents a checkbox property in a property form.
setChecked($a_checked)
Set Checked.
global $ilSetting
Definition: privfeed.php:17
$_POST["username"]
+ Here is the call graph for this function:

◆ setTitleAndDescription()

ilObjLanguageExtGUI::setTitleAndDescription ( )

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

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

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

833  {
835  {
836  $this->tpl->setHeaderPageTitle($this->lng->txt("translation"));
837  $this->tpl->setTitle($this->lng->txt("translation"). " ".$this->lng->txt("meta_l_".$this->object->key));
838  }
839  else
840  {
841  $this->tpl->setTitle($this->lng->txt("meta_l_".$this->object->key));
842  }
843  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lngf.svg"), $this->lng->txt("obj_" . $this->object->getType()));
844  }
static _isPageTranslation()
Check if the current request is a page translation.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ statisticsObject()

ilObjLanguageExtGUI::statisticsObject ( )

Print out statistics about the language.

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

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

727  {
728  $modules = ilObjLanguageExt::_getModules($this->object->key);
729 
730  $data = array();
731  $total = array("module"=>'',"all"=>0,"changed"=>0, "unchanged"=>0);
732  foreach($modules as $module)
733  {
734  $row = array();
735  $row['module'] = $module;
736  $row['all'] = count($this->object->getAllValues(array($module)));
737  $row['changed'] = count($this->object->getChangedValues(array($module)));
738  $row['unchanged'] = $row['all']-$row['changed'];
739  $total['all'] += $row['all'];
740  $total['changed'] += $row['changed'];
741  $total['unchanged'] += $row['unchanged'];
742  $data[] = $row;
743  }
744  $total['module'] = "<b>".$this->lng->txt("language_all_modules")."</b>";
745  $total['all'] = "<b>".$total['all']."</b>";
746  $total['changed'] = "<b>".$total['changed']."</b>";
747  $total['unchanged'] = "<b>".$total['unchanged']."</b>";
748  $data[] = $total;
749 
750  // create and configure the table object
751  include_once 'Services/Table/classes/class.ilTable2GUI.php';
752  $table_gui = new ilTable2GUI($this, "statistics");
753  $table_gui->setRowTemplate("tpl.lang_statistics_row.html","Services/Language");
754  $table_gui->setEnableTitle(false);
755  $table_gui->setEnableNumInfo(false);
756  $table_gui->setLimit(count($data));
757  $table_gui->setExportFormats(array(ilTable2GUI::EXPORT_EXCEL));
758 
759  $table_gui->addColumn(ucfirst($this->lng->txt("module")), "", "25%");
760  $table_gui->addColumn($this->lng->txt("language_scope_global"), "", "25%");
761  $table_gui->addColumn($this->lng->txt("language_scope_local"), "", "25%");
762  $table_gui->addColumn($this->lng->txt("language_scope_unchanged"), "", "25%");
763 
764  $table_gui->setData($data);
765 
766  $this->tpl->setContent($table_gui->getHTML());
767  }
$total
Definition: Utf8Test.php:87
Class ilTable2GUI.
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
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 414 of file class.ilObjLanguageExtGUI.php.

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

415  {
416  // save form inputs for next display
417  $this->session["import"]["mode_existing"] = ilUtil::stripSlashes($_POST['mode_existing']);
418 
419  if ($_POST['cmd']['upload'])
420  {
421  $file = $_FILES['userfile']['tmp_name'].'x';
422 
423  if (ilUtil::moveUploadedFile($_FILES['userfile']['tmp_name'],
424  $_FILES['userfile']['name'],
425  $file))
426  {
427  $this->object->importLanguageFile($file,$_POST['mode_existing']);
428  ilUtil::sendSuccess(sprintf($this->lng->txt("language_file_imported"), $_FILES['userfile']['name']) , true);
429  }
430  }
431 
432  $this->ctrl->redirect($this, 'import');
433  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
$_POST["username"]
+ Here is the call graph for this function:

◆ viewObject()

ilObjLanguageExtGUI::viewObject ( )

Show the edit screen.

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

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

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

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  {
155  $compare_object = $this->object->getGlobalLanguageFile();
156  $compare_content = $compare_object->getAllValues();
157  $compare_comments = $compare_object->getAllComments();
158  }
159 
160  // page translation mode:
161  // - the table is filtered by a list of modules and topics
163  {
164  // get the selection of modules and topics from request or session
167 
168  // first call for translation
169  if ($_GET['reset_offset'])
170  {
171  $table_gui->resetOffset();
172  }
173 
174  if (!isset($compare_content))
175  {
176  $compare_content = ilObjLanguageExt::_getValues(
177  $compare, $modules, $topics);
178 
179  $compare_comments = ilObjLanguageExt::_getRemarks($compare);
180  }
181 
182  $translations = ilObjLanguageExt::_getValues(
183  $this->object->key, $modules, $topics);
184 
185  // enable adding new entries
186  $db_found = array();
187  foreach($translations as $name => $translation)
188  {
189  $keys = explode($this->lng->separator, $name);
190  $db_found[] = $keys[1];
191  }
192  $missing_entries = array_diff($topics, $db_found);
193  }
194  // normal view mode:
195  // - the table is filtered manually by module, mode and pattern
196  else
197  {
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  {
208  $compare_content = ilObjLanguageExt::_getValues(
209  $compare, $filter_modules, $filter_topics);
210 
211  $compare_comments = ilObjLanguageExt::_getRemarks($compare);
212  }
213 
214  switch ($filter_mode)
215  {
216  case "changed":
217  $translations = $this->object->getChangedValues(
218  $filter_modules, $filter_pattern, $filter_topics);
219  break;
220 
221  case "added": //langmode only
222  $translations = $this->object->getAddedValues(
223  $filter_modules, $filter_pattern, $filter_topics);
224  break;
225 
226  case "unchanged":
227  $translations = $this->object->getUnchangedValues(
228  $filter_modules, $filter_pattern, $filter_topics);
229  break;
230 
231  case "commented":
232  $translations = $this->object->getCommentedValues(
233  $filter_modules, $filter_pattern, $filter_topics);
234  break;
235 
236  case "dbremarks":
237  $translations = $this->object->getAllValues(
238  $filter_modules, $filter_pattern, $filter_topics);
239 
240  $translations = array_intersect_key($translations, $remarks);
241  break;
242 
243  case "equal":
244  $translations = $this->object->getAllValues(
245  $filter_modules, $filter_pattern, $filter_topics);
246 
247  $translations = array_intersect_assoc($translations, $compare_content);
248  break;
249 
250  case "different":
251  $translations = $this->object->getAllValues(
252  $filter_modules, $filter_pattern, $filter_topics);
253 
254  $translations = array_diff_assoc($translations, $compare_content);
255  break;
256 
257  case "conflicts":
258  $former_file = $this->object->getDataPath() . '/ilias_' . $this->object->key . '.lang';
259  if (!is_readable($former_file))
260  {
261  ilUtil::sendFailure(sprintf($this->lng->txt("language_former_file_missing"), $former_file)
262  .'<br />'. $this->lng->txt("language_former_file_description") , false);
263  $translations = array();
264  break;
265  }
266  $global_file_obj = $this->object->getGlobalLanguageFile();
267  $former_file_obj = new ilLanguageFile($former_file);
268  $former_file_obj->read();
269  $global_changes = array_diff_assoc(
270  $global_file_obj->getAllValues(),
271  $former_file_obj->getAllValues());
272  if (!count($global_changes))
273  {
274  ilUtil::sendInfo(sprintf($this->lng->txt("language_former_file_equal"), $former_file)
275  .'<br />'. $this->lng->txt("language_former_file_description") , false);
276  $translations = array();
277  break;
278  }
279  $translations = $this->object->getChangedValues(
280  $filter_modules, $filter_pattern, $filter_topics);
281 
282  $translations = array_intersect_key($translations, $global_changes);
283  break;
284 
285  case "all":
286  default:
287  $translations = $this->object->getAllValues(
288  $filter_modules, $filter_pattern, $filter_topics);
289  }
290  }
291 
292  // prepare the the data for the table
293  $data = array();
294  foreach($translations as $name => $translation)
295  {
296  $keys = explode($this->lng->separator, $name);
297  $row = array();
298 
299  $row["module"] = $keys[0];
300  $row["topic"] = $keys[1];
301  $row["name"] = $name;
302  $row["translation"] = $translation;
303  $row["comment"] = $comments[$name];
304  $row["default"] = $compare_content[$name];
305  $row["default_comment"] = $compare_comments[$name];
306 
307  $data[] = $row;
308  }
309 
310  // render and show the table
311  $table_gui->setData($data);
312  $tpl->setContent($table_gui->getHTML().
313  $this->buildMissingEntries($missing_entries));
314  }
static _getRemarks($a_lang_key, $a_all_changed=false)
Get all remarks of a language.
static _isPageTranslation()
Check if the current request is a page translation.
$_GET["client_id"]
static _getSavedModules()
Get the stored modules from the user session.
getViewTable()
Get the table to view language entries.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _getValues($a_lang_key, $a_modules=array(), $a_topics=array(), $a_pattern='', $a_state='')
Get the translations of specified topics.
buildMissingEntries(array $a_missing=null)
static _getSavedTopics()
Get the stored topics from the user session.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Create new PHPExcel object
obj_idprivate
Class ilLanguageFile.
+ 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: