ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
ilObjLanguageExtGUI Class Reference

Class ilObjLanguageExtGUI. More...

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

Public Member Functions

 ilObjLanguageExtGUI ($a_data, $a_id=0, $a_call_by_reference=false)
 Constructor. More...
 
 assignObject ()
 Assign the extended language object. More...
 
 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 (&$tabs_gui)
 
 Get tabs for admin mode

(Overwritten from ilObjectGUI, called by prepareOutput) More...

 
 addAdminLocatorItems ()
 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
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public. More...
 
executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ($in_rep=false)
 cancel action and go back to previous page public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 editObject ()
 edit object More...
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 list childs of current object More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 

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 ()
 
 prepareOutput ()
 prepare output More...
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 showMountWebfolderIcon ()
 
 setTabs ()
 set admin tabs public More...
 
 setAdminTabs ()
 set admin tabs public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 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)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste More...
 
 getTabs (&$tabs_gui)
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings ($column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

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
 

Detailed Description

Member Function Documentation

◆ addAdminLocatorItems()

ilObjLanguageExtGUI::addAdminLocatorItems ( )

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

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

References ilObjLanguageAccess\_isPageTranslation().

821  {
822  global $ilLocator;
823 
825  {
826  parent::addAdminLocatorItems(true); // #13881
827 
828  $ilLocator->addItem($this->lng->txt("languages"),
829  $this->ctrl->getLinkTargetByClass("ilobjlanguagefoldergui", ""));
830 
831  $ilLocator->addItem($this->lng->txt("meta_l_". $this->object->getTitle()),
832  $this->ctrl->getLinkTarget($this, "view"));
833  }
834  }
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 886 of file class.ilObjLanguageExtGUI.php.

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

Referenced by saveNewEntryObject().

887  {
888  global $tpl;
889 
890  $id = trim($_GET["eid"]);
891 
892  if(!$a_form)
893  {
894  $a_form = $this->initAddNewEntryForm($id);
895  }
896 
897  $tpl->setContent($a_form->getHTML());
898  }
$_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 317 of file class.ilObjLanguageExtGUI.php.

References getViewTable(), and viewObject().

318  {
319  $table_gui = $this->getViewTable();
320  $table_gui->writeFilterToSession(); // writes filter to session
321  $table_gui->resetOffset(); // sets record offest to 0 (first page)
322  $this->viewObject();
323  }
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 860 of file class.ilObjLanguageExtGUI.php.

References $ilCtrl, and $res.

Referenced by viewObject().

861  {
862  global $ilCtrl;
863 
864  if(!is_array($a_missing) ||
865  !sizeof($a_missing))
866  {
867  return;
868  }
869 
870  $res = array('<h3>'.$this->lng->txt("adm_missing_entries").'</h3>', '<ul>');
871 
872  foreach($a_missing as $entry)
873  {
874  $ilCtrl->setParameter($this, "eid", $entry);
875  $res[] = '<li>'.$entry.
876  ' <a href="'.$ilCtrl->getLinkTarget($this, "addNewEntry").
877  '">'.$this->lng->txt("adm_missing_entry_add_action").'</a></li>';
878  $ilCtrl->setParameter($this, "eid", "");
879  }
880 
881  $res[] = '</ul>';
882 
883  return implode("\n", $res);
884  }
global $ilCtrl
Definition: ilias.php:18
+ 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 471 of file class.ilObjLanguageExtGUI.php.

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

472  {
473  // save the selected scope
474  $this->session["export"]["scope"] = ilUtil::stripSlashes($_POST["scope"]);
475 
476  $filename = 'ilias_' . $this->object->key . '_'
477  . str_replace(".", "_", substr(ILIAS_VERSION, 0, strpos(ILIAS_VERSION, " ")))
478  . "-" . date('Y-m-d')
479  . ".lang.".$this->session["export"]["scope"];
480 
481  $global_file_obj = $this->object->getGlobalLanguageFile();
482  $local_file_obj = new ilLanguageFile($filename, $this->object->key, $_POST["scope"]);
483 
484  if ($_POST["scope"] == 'global')
485  {
486  $local_file_obj->setParam("author", $global_file_obj->getParam('author'));
487  $local_file_obj->setParam("version", $global_file_obj->getParam('version'));
488  $local_file_obj->setAllValues($this->object->getAllValues());
489  if ($this->langmode)
490  {
491  $local_file_obj->setAllComments($this->object->getAllRemarks());
492  }
493  }
494  elseif ($_POST["scope"] == 'local')
495  {
496  $local_file_obj->setParam("based_on", $global_file_obj->getParam('version'));
497  $local_file_obj->setAllValues($this->object->getChangedValues());
498  if ($this->langmode)
499  {
500  $local_file_obj->setAllComments($this->object->getAllRemarks());
501  }
502  }
503  elseif ($_POST["scope"] == 'added') // langmode only
504  {
505  $local_file_obj->setParam("author", $global_file_obj->getParam('author'));
506  $local_file_obj->setParam("version", $global_file_obj->getParam('version'));
507  $local_file_obj->setAllValues($this->object->getAddedValues());
508  $local_file_obj->setAllComments($this->object->getAllRemarks());
509  }
510  elseif ($_POST["scope"] == 'unchanged')
511  {
512  $local_file_obj->setParam("author", $global_file_obj->getParam('author'));
513  $local_file_obj->setParam("version", $global_file_obj->getParam('version'));
514  $local_file_obj->setAllValues($this->object->getUnchangedValues());
515  if ($this->langmode)
516  {
517  $local_file_obj->setAllComments($this->object->getAllRemarks());
518  }
519  }
520  elseif ($_POST["scope"] == 'merged') // langmode only
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->getMergedValues());
525  $local_file_obj->setAllComments($this->object->getMergedRemarks());
526  }
527 
528  ilUtil::deliverData($local_file_obj->build(), $filename);
529  }
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
$_POST['username']
Definition: cron.php:12
const ILIAS_VERSION
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$filename
Definition: buildRTE.php:89
Class ilLanguageFile.
+ 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  }
exit
Definition: login.php:54
$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 429 of file class.ilObjLanguageExtGUI.php.

References ilFormPropertyGUI\setInfo().

430  {
431  require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
432  $form = new ilPropertyFormGUI();
433  $form->setFormAction($this->ctrl->getFormAction($this));
434  $form->setTitle($this->lng->txt("language_export_file"));
435  $form->setPreventDoubleSubmission(false);
436  $form->addCommandButton('download',$this->lng->txt("download"));
437 
438  $rg = new ilRadioGroupInputGUI($this->lng->txt("language_file_scope"), "scope");
439  $ro = new ilRadioOption($this->lng->txt("language_scope_global"), "global");
440  $ro->setInfo($this->lng->txt("language_scope_global_info"));
441  $rg->addOption($ro);
442  $ro = new ilRadioOption($this->lng->txt("language_scope_local"), "local");
443  $ro->setInfo($this->lng->txt("language_scope_local_info"));
444  $rg->addOption($ro);
445  if ($this->langmode)
446  {
447  $ro = new ilRadioOption($this->lng->txt("language_scope_added"), "added");
448  $ro->setInfo($this->lng->txt("language_scope_added_info"));
449  $rg->addOption($ro);
450  }
451  $ro = new ilRadioOption($this->lng->txt("language_scope_unchanged"), "unchanged");
452  $ro->setInfo($this->lng->txt("language_scope_unchanged_info"));
453  $rg->addOption($ro);
454  if ($this->langmode)
455  {
456  $ro = new ilRadioOption($this->lng->txt("language_scope_merged"), "merged");
457  $ro->setInfo($this->lng->txt("language_scope_merged_info"));
458  $rg->addOption($ro);
459  }
460 
461  $rg->setValue($this->session["export"]["scope"] ? $this->session["export"]["scope"] : "global");
462  $form->addItem($rg);
463 
464  $this->tpl->setContent($form->getHTML());
465  }
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 ( $tabs_gui)

 Get tabs for admin mode

(Overwritten from ilObjectGUI, called by prepareOutput)

Parameters
objecttabs gui object

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

References ilObjLanguageAccess\_isPageTranslation().

786  {
788  {
789  $tabs_gui->addTarget("edit",
790  $this->ctrl->getLinkTarget($this, "view"),
791  array("","view","cancel","save"));
792 
793  $tabs_gui->addTarget("export",
794  $this->ctrl->getLinkTarget($this, "export"),
795  array("export","download"));
796 
797  $tabs_gui->addTarget("import",
798  $this->ctrl->getLinkTarget($this, "import"),
799  array("import","upload"));
800 
801  $tabs_gui->addTarget("language_maintain",
802  $this->ctrl->getLinkTarget($this, "maintain"),
803  array("maintain"));
804 
805  $tabs_gui->addTarget("settings",
806  $this->ctrl->getLinkTarget($this, "settings"),
807  array("settings"));
808 
809  $tabs_gui->addTarget("language_statistics",
810  $this->ctrl->getLinkTarget($this, "statistics"),
811  array("statistics"));
812  }
813  }
static _isPageTranslation()
Check if the current request is a page translation.
+ 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.

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  }
+ Here is the caller graph for this function:

◆ ilObjLanguageExtGUI()

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

Constructor.

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

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

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

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

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  $this->ilObjectGUI($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  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_GET["client_id"]
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
static _lookupId($a_key)
Lookup the object ID for a language key.
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ importObject()

ilObjLanguageExtGUI::importObject ( )

Show the screen to import a language file.

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

References ilFormPropertyGUI\setInfo().

371  {
372  require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
373  $form = new ilPropertyFormGUI();
374  $form->setFormAction($this->ctrl->getFormAction($this));
375  $form->setTitle($this->lng->txt("language_import_file"));
376  $form->addCommandButton('upload',$this->lng->txt("upload"));
377 
378  $fu = new ilFileInputGUI($this->lng->txt("file"), "userfile");
379  $form->addItem($fu);
380 
381  $rg = new ilRadioGroupInputGUI($this->lng->txt("language_mode_existing"), "mode_existing");
382  $ro = new ilRadioOption($this->lng->txt("language_mode_existing_keepall"), "keepall");
383  $ro->setInfo($this->lng->txt("language_mode_existing_keepall_info"));
384  $rg->addOption($ro);
385  $ro = new ilRadioOption($this->lng->txt("language_mode_existing_keepnew"), "keepnew");
386  $ro->setInfo($this->lng->txt("language_mode_existing_keepnew_info"));
387  $rg->addOption($ro);
388  $ro = new ilRadioOption($this->lng->txt("language_mode_existing_replace"), "replace");
389  $ro->setInfo($this->lng->txt("language_mode_existing_replace_info"));
390  $rg->addOption($ro);
391  $ro = new ilRadioOption($this->lng->txt("language_mode_existing_delete"), "delete");
392  $ro->setInfo($this->lng->txt("language_mode_existing_delete_info"));
393  $rg->addOption($ro);
394  $rg->setValue($this->session["import"]["mode_existing"] ? $this->session["import"]["mode_existing"] : "keepall");
395  $form->addItem($rg);
396 
397  $this->tpl->setContent($form->getHTML());
398  }
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 900 of file class.ilObjLanguageExtGUI.php.

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

Referenced by addNewEntryObject(), and saveNewEntryObject().

901  {
902  global $ilCtrl;
903 
904  if(!$a_id)
905  {
906  $a_id = $_POST["id"];
907  }
908 
909  if(!$a_id ||
910  !in_array($a_id, ilObjLanguageAccess::_getSavedTopics()))
911  {
912  $ilCtrl->redirect($this, "view");
913  }
914 
915  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
916  $form = new ilPropertyFormGUI();
917  $form->setFormAction($ilCtrl->getFormAction($this, "saveNewEntry"));
918  $form->setTitle($this->lng->txt("adm_missing_entry_add"));
919 
921  $options = array_combine($mods, $mods);
922 
923  $mod = new ilSelectInputGUI(ucfirst($this->lng->txt("module")), "mod");
924  $mod->setOptions(array(""=>$this->lng->txt("please_select"))+$options);
925  $mod->setRequired(true);
926  $form->addItem($mod);
927 
928  $id = new ilTextInputGUI(ucfirst($this->lng->txt("identifier")), "id");
929  $id->setValue($a_id);
930  $id->setDisabled(true);
931  $form->addItem($id);
932 
933  foreach ($this->lng->getInstalledLanguages() as $lang_key)
934  {
935  $trans = new ilTextInputGUI($this->lng->txt("meta_l_".$lang_key), "trans_".$lang_key);
936  if(in_array($lang_key, array("de", "en")))
937  {
938  $trans->setRequired(true);
939  }
940  $form->addItem($trans);
941  }
942 
943  $form->addCommandButton("saveNewEntry", $this->lng->txt("save"));
944  $form->addCommandButton("view", $this->lng->txt("cancel"));
945 
946  return $form;
947  }
$_POST['username']
Definition: cron.php:12
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.
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 573 of file class.ilObjLanguageExtGUI.php.

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

574  {
575  if (isset($_POST["maintain"]))
576  {
577  $this->session["maintain"] = ilUtil::stripSlashes($_POST["maintain"]);
578  }
579 
580  switch ($_POST["maintain"])
581  {
582  // save the local changes to the local language file
583  case "save":
584  $lang_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang.local';
585 
586  if ((is_file($lang_file) and is_writable($lang_file))
587  or (!file_exists($lang_file) and is_writable($this->object->getCustLangPath())))
588  {
589  // save a copy of the distributed language file
590  $orig_file = $this->object->getLangPath() . '/ilias_' . $this->object->key . '.lang';
591  $copy_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang';
592  @copy($orig_file, $copy_file);
593 
594  // save a backup of the old local language file
595  @rename($lang_file, $lang_file.".bak");
596 
597  // create and write the new local language file
598  $global_file_obj = $this->object->getGlobalLanguageFile();
599  $local_file_obj = new ilLanguageFile($lang_file, $this->object->key, 'local');
600  $local_file_obj->setParam('based_on', $global_file_obj->getParam('version'));
601  $local_file_obj->setAllValues($this->object->getChangedValues());
602  if ($this->langmode)
603  {
604  $local_file_obj->setAllComments($this->object->getAllRemarks());
605  }
606  $local_file_obj->write();
607 
608  $this->object->setLocal(true);
609  ilUtil::sendSuccess($this->lng->txt("language_saved_local") , true);
610  }
611  else
612  {
613  ilUtil::sendFailure($this->lng->txt("language_error_write_local") , true);
614  }
615  break;
616 
617  // load the content of the local language file
618  case "load":
619  $lang_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang.local';
620  if (is_file($lang_file) and is_readable($lang_file))
621  {
622  $this->object->importLanguageFile($lang_file, 'replace');
623  $this->object->setLocal(true);
624  ilUtil::sendSuccess($this->lng->txt("language_loaded_local") , true);
625  }
626  else
627  {
628  ilUtil::sendFailure($this->lng->txt("language_error_read_local") , true);
629  }
630  break;
631 
632  // revert the database to the default language file
633  case "clear":
634  $lang_file = $this->object->getLangPath() . '/ilias_' . $this->object->key . '.lang';
635  if (is_file($lang_file) and is_readable($lang_file))
636  {
637  $this->object->importLanguageFile($lang_file, 'delete');
638  $this->object->setLocal(false);
639  ilUtil::sendSuccess($this->lng->txt("language_cleared_local") , true);
640  }
641  else
642  {
643  ilUtil::sendFailure($this->lng->txt("language_error_clear_local") , true);
644  }
645  break;
646 
647  // delete local additions in the datavase (langmode only)
648  case "delete_added":
649  ilObjLanguageExt::_deleteValues($this->object->key, $this->object->getAddedValues());
650  break;
651 
652  // merge local changes back to the global language file (langmode only)
653  case "merge":
654 
655  $orig_file = $this->object->getLangPath() . '/ilias_' . $this->object->key . '.lang';
656  $copy_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang';
657 
658  if (is_file($orig_file) and is_writable($orig_file))
659  {
660  // save a copy of the global language file
661  @copy($orig_file, $copy_file);
662 
663  // modify and write the new global file
664  $global_file_obj = $this->object->getGlobalLanguageFile();
665  $global_file_obj->setAllValues($this->object->getMergedValues());
666  $global_file_obj->setAllComments($this->object->getMergedRemarks());
667  $global_file_obj->write();
668  ilUtil::sendSuccess($this->lng->txt("language_merged_global") , true);
669  }
670  else
671  {
672  ilUtil::sendFailure($this->lng->txt("language_error_write_global") , true);
673  }
674  break;
675 
676  // remove the local language file (langmode only)
677  case "remove_local_file":
678  $lang_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang.local';
679 
680  if (!is_file($lang_file))
681  {
682  $this->object->setLocal(false);
683  ilUtil::sendFailure($this->lng->txt("language_error_local_missed") , true);
684  }
685  elseif (@unlink($lang_file))
686  {
687  $this->object->setLocal(false);
688  ilUtil::sendSuccess($this->lng->txt("language_local_file_deleted") , true);
689  }
690  else
691  {
692  ilUtil::sendFailure($this->lng->txt("language_error_delete_local") , true);
693  }
694  break;
695  }
696 
697  $this->ctrl->redirect($this,"maintain");
698  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static _deleteValues($a_lang_key, $a_values=array())
Delete a set of translation in the database.
static 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.
Class ilLanguageFile.
+ Here is the call graph for this function:

◆ maintainObject()

ilObjLanguageExtGUI::maintainObject ( )

Process the language maintenance.

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

References ilFormPropertyGUI\setInfo().

536  {
537  require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
538  $form = new ilPropertyFormGUI();
539  $form->setFormAction($this->ctrl->getFormAction($this));
540  $form->setTitle($this->lng->txt("language_maintenance"));
541  $form->setPreventDoubleSubmission(false);
542  $form->addCommandButton('maintainExecute',$this->lng->txt("language_process_maintenance"));
543 
544  $rg = new ilRadioGroupInputGUI($this->lng->txt("language_maintain_local_changes"), "maintain");
545  $ro = new ilRadioOption($this->lng->txt("language_save_local_changes"), "save");
546  $ro->setInfo(sprintf($this->lng->txt("language_save_local_changes_info"),$this->object->key));
547  $rg->addOption($ro);
548  $ro = new ilRadioOption($this->lng->txt("language_load_local_changes"), "load");
549  $ro->setInfo(sprintf($this->lng->txt("language_load_local_changes_info"),$this->object->key));
550  $rg->addOption($ro);
551  $ro = new ilRadioOption($this->lng->txt("language_clear_local_changes"), "clear");
552  $ro->setInfo(sprintf($this->lng->txt("language_clear_local_changes_info"),$this->object->key));
553  $rg->addOption($ro);
554  if ($this->langmode)
555  {
556  $ro = new ilRadioOption($this->lng->txt("language_delete_local_additions"), "delete_added");
557  $ro->setInfo(sprintf($this->lng->txt("language_delete_local_additions_info"), $this->object->key));
558  $rg->addOption($ro);
559  $ro = new ilRadioOption($this->lng->txt("language_merge_local_changes"), "merge");
560  $ro->setInfo(sprintf($this->lng->txt("language_merge_local_changes_info"), $this->object->key));
561  $rg->addOption($ro);
562  $ro = new ilRadioOption($this->lng->txt("language_remove_local_file"), "remove_local_file");
563  $ro->setInfo(sprintf($this->lng->txt("language_remove_local_file_info"), $this->object->key));
564  $rg->addOption($ro);
565  }
566  $rg->setValue($this->session["maintain"]);
567  $form->addItem($rg);
568 
569  $this->tpl->setContent($form->getHTML());
570  }
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 328 of file class.ilObjLanguageExtGUI.php.

References getViewTable(), and viewObject().

329  {
330  $table_gui = $this->getViewTable();
331  $table_gui->resetOffset(); // sets record offest to 0 (first page)
332  $table_gui->resetFilter(); // clears filter
333  $this->viewObject();
334  }
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 949 of file class.ilObjLanguageExtGUI.php.

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

950  {
951  global $ilCtrl, $ilUser, $ilDB;
952 
953  $form = $this->initAddNewEntryForm();
954  if($form->checkInput())
955  {
956  $mod = $form->getInput("mod");
957  $id = $form->getInput("id");
958 
959  $lang = array();
960  foreach ($this->lng->getInstalledLanguages() as $lang_key)
961  {
962  $trans = trim($form->getInput("trans_".$lang_key));
963  if($trans)
964  {
965  // add single entry
967  $mod,
968  $id,
969  $lang_key,
970  $trans,
971  date("Y-m-d H:i:s"),
972  $ilUser->getLogin()
973  );
974 
975  // add to serialized module
976  $set = $ilDB->query("SELECT lang_array FROM lng_modules".
977  " WHERE lang_key = ".$ilDB->quote($lang_key, "text").
978  " AND module = ".$ilDB->quote($mod, "text"));
979  $row = $ilDB->fetchAssoc($set);
980  $entries = unserialize($row["lang_array"]);
981  if(is_array($entries))
982  {
983  $entries[$id] = $trans;
984  ilObjLanguage::replaceLangModule($lang_key, $mod, $entries);
985  }
986  }
987  }
988 
989  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
990  $ilCtrl->redirect($this, "view");
991  }
992 
993  $form->setValuesByPost();
994  $this->addNewEntryObject($form);
995  }
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
global $ilUser
Definition: imgupload.php:15
global $ilDB
addNewEntryObject(ilPropertyFormGUI $a_form=null)
+ Here is the call graph for this function:

◆ saveObject()

ilObjLanguageExtGUI::saveObject ( )

Save the changed translations.

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

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

340  {
341  // prepare the values to be saved
342  $save_array = array();
343  $remarks_array = array();
344  foreach ($_POST as $key => $value)
345  {
346  $keys = explode($this->lng->separator, ilUtil::stripSlashes($key, false));
347 
348  if (count($keys) == 2)
349  {
350  // avoid line breaks
351  $value = preg_replace("/(\015\012)|(\015)|(\012)/","<br />",$value);
352  $value = ilUtil::stripSlashes($value, false);
353  $save_array[$key] = $value;
354 
355  $remarks_array[$key] = $_POST[$key.$this->lng->separator."comment"];
356  }
357  }
358 
359  // save the translations
360  ilObjLanguageExt::_saveValues($this->object->key, $save_array, $remarks_array);
361 
362  // view the list
363  $this->viewObject();
364  }
$_POST['username']
Definition: cron.php:12
viewObject()
Show the edit screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static _saveValues($a_lang_key, $a_values=array(), $a_remarks=array())
Save a set of translation in the database.
+ Here is the call graph for this function:

◆ settingsObject()

ilObjLanguageExtGUI::settingsObject ( )

Set the language settings.

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

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

704  {
705  global $ilSetting;
706 
707  $translate_key = "lang_translate_". $this->object->key;
708 
709  // save and get the page translation setting
710  if (!empty($_POST))
711  {
712  $ilSetting->set($translate_key, (bool) $_POST["translation"]);
713  ilUtil::sendSuccess($this->lng->txt("settings_saved"));
714  }
715  $translate = $ilSetting->get($translate_key, false);
716 
717  require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
718  $form = new ilPropertyFormGUI();
719  $form->setFormAction($this->ctrl->getFormAction($this));
720  $form->setTitle($this->lng->txt("language_settings"));
721  $form->setPreventDoubleSubmission(false);
722  $form->addCommandButton('settings',$this->lng->txt("language_change_settings"));
723 
724  $ci = new ilCheckboxInputGUI($this->lng->txt("language_translation_enabled"), "translation");
725  $ci->setChecked((bool) $translate);
726  $ci->setInfo($this->lng->txt("language_note_translation"));
727  $form->addItem($ci);
728 
729  $this->tpl->setContent($form->getHTML());
730  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
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:40
+ 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 841 of file class.ilObjLanguageExtGUI.php.

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

842  {
844  {
845  $this->tpl->setHeaderPageTitle($this->lng->txt("translation"));
846  $this->tpl->setTitle($this->lng->txt("translation"). " ".$this->lng->txt("meta_l_".$this->object->key));
847  }
848  else
849  {
850  $this->tpl->setTitle($this->lng->txt("meta_l_".$this->object->key));
851  }
852  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lngf.svg"), $this->lng->txt("obj_" . $this->object->getType()));
853  }
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)
+ Here is the call graph for this function:

◆ statisticsObject()

ilObjLanguageExtGUI::statisticsObject ( )

Print out statistics about the language.

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

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

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

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

405  {
406  // save form inputs for next display
407  $this->session["import"]["mode_existing"] = ilUtil::stripSlashes($_POST['mode_existing']);
408 
409  if ($_POST['cmd']['upload'])
410  {
411  $file = $_FILES['userfile']['tmp_name'].'x';
412 
413  if (ilUtil::moveUploadedFile($_FILES['userfile']['tmp_name'],
414  $_FILES['userfile']['name'],
415  $file))
416  {
417  $this->object->importLanguageFile($file,$_POST['mode_existing']);
418  ilUtil::sendSuccess(sprintf($this->lng->txt("language_file_imported"), $_FILES['userfile']['name']) , true);
419  }
420  }
421 
422  $this->ctrl->redirect($this, 'import');
423  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
print $file
$_POST['username']
Definition: cron.php:12
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
+ 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(), buildMissingEntries(), getViewTable(), 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 
204  if (!isset($compare_content))
205  {
206  $compare_content = ilObjLanguageExt::_getValues(
207  $compare, $filter_modules);
208 
209  $compare_comments = ilObjLanguageExt::_getRemarks($compare);
210  }
211 
212  switch ($filter_mode)
213  {
214  case "changed":
215  $translations = $this->object->getChangedValues(
216  $filter_modules, $filter_pattern);
217  break;
218 
219  case "added": //langmode only
220  $translations = $this->object->getAddedValues(
221  $filter_modules, $filter_pattern);
222  break;
223 
224  case "unchanged":
225  $translations = $this->object->getUnchangedValues(
226  $filter_modules, $filter_pattern);
227  break;
228 
229  case "commented":
230  $translations = $this->object->getCommentedValues(
231  $filter_modules, $filter_pattern);
232  break;
233 
234  case "dbremarks":
235  $translations = $this->object->getAllValues(
236  $filter_modules, $filter_pattern);
237 
238  $translations = array_intersect_key($translations, $remarks);
239  break;
240 
241  case "equal":
242  $translations = $this->object->getAllValues(
243  $filter_modules, $filter_pattern);
244 
245  $translations = array_intersect_assoc($translations, $compare_content);
246  break;
247 
248  case "different":
249  $translations = $this->object->getAllValues(
250  $filter_modules, $filter_pattern);
251 
252  $translations = array_diff_assoc($translations, $compare_content);
253  break;
254 
255  case "conflicts":
256  $former_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang';
257  if (!is_readable($former_file))
258  {
259  ilUtil::sendFailure(sprintf($this->lng->txt("language_former_file_missing"), $former_file)
260  .'<br />'. $this->lng->txt("language_former_file_description") , false);
261  $translations = array();
262  break;
263  }
264  $global_file_obj = $this->object->getGlobalLanguageFile();
265  $former_file_obj = new ilLanguageFile($former_file);
266  $former_file_obj->read();
267  $global_changes = array_diff_assoc(
268  $global_file_obj->getAllValues(),
269  $former_file_obj->getAllValues());
270  if (!count($global_changes))
271  {
272  ilUtil::sendInfo(sprintf($this->lng->txt("language_former_file_equal"), $former_file)
273  .'<br />'. $this->lng->txt("language_former_file_description") , false);
274  $translations = array();
275  break;
276  }
277  $translations = $this->object->getChangedValues(
278  $filter_modules, $filter_pattern);
279 
280  $translations = array_intersect_key($translations, $global_changes);
281  break;
282 
283  case "all":
284  default:
285  $translations = $this->object->getAllValues(
286  $filter_modules, $filter_pattern);
287  }
288  }
289 
290  // prepare the the data for the table
291  $data = array();
292  foreach($translations as $name => $translation)
293  {
294  $keys = explode($this->lng->separator, $name);
295  $row = array();
296 
297  $row["module"] = $keys[0];
298  $row["topic"] = $keys[1];
299  $row["name"] = $name;
300  $row["translation"] = $translation;
301  $row["comment"] = $comments[$name];
302  $row["default"] = $compare_content[$name];
303  $row["default_comment"] = $compare_comments[$name];
304 
305  $data[] = $row;
306  }
307 
308  // render and show the table
309  $table_gui->setData($data);
310  $tpl->setContent($table_gui->getHTML().
311  $this->buildMissingEntries($missing_entries));
312  }
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.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
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: