ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjLanguageFolderGUI Class Reference

Class ilObjLanguageFolderGUI. More...

+ Inheritance diagram for ilObjLanguageFolderGUI:
+ Collaboration diagram for ilObjLanguageFolderGUI:

Public Member Functions

 viewObject ()
 show installed languages More...
 
 installObject (array $ids)
 install languages More...
 
 installLocalObject (array $ids)
 Install local language modifications. More...
 
 uninstallObject (array $ids)
 uninstall language More...
 
 uninstallChangesObject (array $ids)
 Uninstall local changes in the database. More...
 
 refreshObject ()
 update all installed languages More...
 
 refreshSelectedObject (array $ids)
 update selected languages More...
 
 setUserLanguageObject (array $ids)
 set user language More...
 
 setSystemLanguageObject (array $ids)
 set the system language More...
 
 checkLanguageObject ()
 check all languages More...
 
 out ()
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 executeCommand ()
 
 confirmRefreshObject ()
 
 confirmRefreshSelectedObject (array $a_ids=[])
 
 confirmUninstallObject ()
 
 confirmUninstallChangesObject ()
 
 getActions ()
 Get Actions. More...
 
 listDeprecatedObject ()
 Download deprecated lang entries. More...
 
 downloadDeprecatedObject ()
 Download deprecated lang entries. More...
 
- Public Member Functions inherited from ilObject
 getObjectProperties ()
 
 flushObjectProperties ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $description)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id, int $new_obj_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 
- Public Member Functions inherited from ilObjectGUI
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 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...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Protected Member Functions

 buildConfirmModal (array $ids, string $title, string $action, string $text, string $add_text='')
 
 getTabs ()
 Retrieves and adds tabs based on user permissions. More...
 
 getCommandFromQueryToken (string $param)
 
 editFolderObject (array $ids)
 
 disableLanguageDetectionObject ()
 Disable language detection. More...
 
 enableLanguageDetectionObject ()
 Enable language detection. More...
 
 getUrl (string $action, ?array $lang_ids=null)
 
- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 createActionDispatcherGUI ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $form)
 
 getTitleForCreationFormPage ()
 
 getCreationFormTitle ()
 
 initCreateForm (string $new_type)
 
 didacticTemplatesToForm ()
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 retrieveAdditionalDidacticTemplateOptions ()
 
 addAdoptContentLinkToToolbar ()
 
 addImportButtonToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 parseDidacticTemplateVar (string $var, string $type)
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 routeImportCmdObject ()
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 deleteUploadedImportFile (string $path_to_uploaded_file_in_temp_dir)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 @abstract overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $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 ["ref_id"] value of the request More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 getCreatableObjectTypes ()
 
 buildAddNewItemElements (array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
 
 buildGroup (string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
 

Protected Attributes

ilLanguageFolderTable $languageFolderTable
 
ILIAS Data Factory $df
 
URLBuilder $url_builder
 
URLBuilderToken $action_token
 
URLBuilderToken $id_token
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
LOMServices $lom_services
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
GlobalHttpState $http
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Refinery $refinery
 
ilFavouritesManager $favourites
 
CustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Filesystem $temp_file_system
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

Private Member Functions

 getIdsFromQueryToken ()
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", ?int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static getIconForType (string $type)
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, ?\ilDBInterface $ilDB=null)
 
- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 
- Data Fields inherited from ilObjectGUI
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 

Detailed Description

Member Function Documentation

◆ buildConfirmModal()

ilObjLanguageFolderGUI::buildConfirmModal ( array  $ids,
string  $title,
string  $action,
string  $text,
string  $add_text = '' 
)
protected

Definition at line 143 of file class.ilObjLanguageFolderGUI.php.

144 {
146 $title = $this->lng->txt($title);
147 $items = [];
148
149 if (!empty($ids)) {
150 $message = $this->lng->txt($text);
151
152 $some_changed = false;
153 foreach ($ids as $id) {
154 $lang_key = ilObject::_lookupTitle((int) $id);
155 $lang_title = $this->lng->txt("meta_l_" . $lang_key);
156 $last_change = ilObjLanguage::_getLastLocalChange($lang_key);
157 if (!empty($last_change)) {
158 $some_changed = true;
159 $lang_title .= " (" . $this->lng->txt("last_change") . " "
161 $last_change,
163 'UTC'
164 )) . ")";
165 }
166 $items[] = $f->modal()->interruptiveItem()->standard($id, $lang_title);
167 }
168 $form_action = $this->getUrl($action, $ids);
169
170 if ($some_changed) {
171 $message .= "<br />" . $this->lng->txt($add_text);
172 }
173 } else {
174 $message = $this->lng->txt("no_checkbox");
175 $form_action = '';
176 }
177 $modal = $f->modal()->interruptive(
178 $title,
179 $message,
181 );
182 if (!empty($items)) {
183 $modal = $modal->withAffectedItems($items)
184 ->withActionButtonLabel($title);
185 } else {
186 $modal = $modal->withActionButtonLabel($this->lng->txt('ok'));
187 }
188 return $modal;
189 }
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
getUrl(string $action, ?array $lang_ids=null)
static _getLastLocalChange(string $a_key)
get the date of the last local change $a_key language key Return change_date "yyyy-mm-dd hh:mm:ss"
UIFactory $ui_factory
string $title
static _lookupTitle(int $obj_id)
$message
Definition: xapiexit.php:31

References Vendor\Package\$f, ilObjectGUI\$form_action, ilObjectGUI\$id, $message, ilObject\$title, ilObjectGUI\$ui_factory, ilObjLanguage\_getLastLocalChange(), ilObject\_lookupTitle(), ilDatePresentation\formatDate(), getUrl(), IL_CAL_DATETIME, and ILIAS\Repository\lng().

Referenced by executeCommand(), and viewObject().

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

◆ checkLanguageObject()

ilObjLanguageFolderGUI::checkLanguageObject ( )

check all languages

Definition at line 485 of file class.ilObjLanguageFolderGUI.php.

485 : void
486 {
487 $this->checkPermission("write");
488 $this->data = $this->object->checkAllLanguages();
489 $this->out();
490 }
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)

References ilObjectGUI\checkPermission(), and out().

Referenced by executeCommand().

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

◆ confirmRefreshObject()

ilObjLanguageFolderGUI::confirmRefreshObject ( )

Definition at line 684 of file class.ilObjLanguageFolderGUI.php.

684 : array
685 {
686 $this->checkPermission("write");
687
688 $languages = ilObject::_getObjectsByType("lng");
689
690 $ids = [];
691 foreach ($languages as $lang) {
692 $langObj = new ilObjLanguage((int) $lang["obj_id"], false);
693 if ($langObj->isInstalled()) {
694 $ids[] = (string) $lang["obj_id"];
695 }
696 }
697 return $ids;
698 }
Class ilObjLanguage.
static _getObjectsByType(string $obj_type="", ?int $owner=null)
$lang
Definition: xapiexit.php:25

References $lang, ilObject\_getObjectsByType(), and ilObjectGUI\checkPermission().

Referenced by executeCommand(), and viewObject().

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

◆ confirmRefreshSelectedObject()

ilObjLanguageFolderGUI::confirmRefreshSelectedObject ( array  $a_ids = [])

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

700 : void
701 {
702 $this->checkPermission("write");
703 $this->lng->loadLanguageModule("meta");
704
705 $header = '';
706 $ids = [];
707 if (!empty($a_ids)) {
708 $ids = $a_ids;
709 $header = $this->lng->txt("lang_refresh_confirm");
710 } elseif (!empty($post_id = $this->getIdsFromQueryToken())) {
711 $ids = $post_id;
712 $header = $this->lng->txt("lang_refresh_confirm_selected");
713 } else {
714 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
715 $this->ctrl->redirect($this, "view");
716 }
717
718 $conf_screen = new ilConfirmationGUI();
719 $some_changed = false;
720 foreach ($ids as $id) {
721 $lang_key = ilObject::_lookupTitle((int) $id);
722 $lang_title = $this->lng->txt("meta_l_" . $lang_key);
723 $last_change = ilObjLanguage::_getLastLocalChange($lang_key);
724 if (!empty($last_change)) {
725 $some_changed = true;
726 $lang_title .= " (" . $this->lng->txt("last_change") . " "
728 }
729 $conf_screen->addItem("id[]", (string) $id, $lang_title);
730 }
731
732 $conf_screen->setFormAction($this->ctrl->getFormAction($this));
733 if ($some_changed) {
734 $header .= "<br />" . $this->lng->txt("lang_refresh_confirm_info");
735 }
736 $conf_screen->setHeaderText($header);
737 $conf_screen->setCancel($this->lng->txt("cancel"), "view");
738 $conf_screen->setConfirm($this->lng->txt("ok"), "refreshSelected");
739 $this->tpl->setContent($conf_screen->getHTML());
740 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilObjectGUI\$id, ilObjLanguage\_getLastLocalChange(), ilObject\_lookupTitle(), ilObjectGUI\checkPermission(), ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), getIdsFromQueryToken(), IL_CAL_DATETIME, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ confirmUninstallChangesObject()

ilObjLanguageFolderGUI::confirmUninstallChangesObject ( )

Definition at line 759 of file class.ilObjLanguageFolderGUI.php.

759 : void
760 {
761 $this->checkPermission('write');
762
763 $this->lng->loadLanguageModule("meta");
764 $conf_screen = new ilConfirmationGUI();
765 $conf_screen->setFormAction($this->ctrl->getFormAction($this));
766 $conf_screen->setHeaderText($this->lng->txt("lang_uninstall_changes_confirm"));
767 foreach ($this->getIdsFromQueryToken() as $id) {
768 $lang_title = ilObject::_lookupTitle($id);
769 $conf_screen->addItem("id[]", (string) $id, $this->lng->txt("meta_l_" . $lang_title));
770 }
771 $conf_screen->setCancel($this->lng->txt("cancel"), "view");
772 $conf_screen->setConfirm($this->lng->txt("ok"), "uninstallChanges");
773 $this->tpl->setContent($conf_screen->getHTML());
774 }

References ilObjectGUI\$id, ilObject\_lookupTitle(), ilObjectGUI\checkPermission(), ILIAS\Repository\ctrl(), getIdsFromQueryToken(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ confirmUninstallObject()

ilObjLanguageFolderGUI::confirmUninstallObject ( )

Definition at line 742 of file class.ilObjLanguageFolderGUI.php.

742 : void
743 {
744 $this->checkPermission("write");
745
746 $this->lng->loadLanguageModule("meta");
747 $conf_screen = new ilConfirmationGUI();
748 $conf_screen->setFormAction($this->ctrl->getFormAction($this));
749 $conf_screen->setHeaderText($this->lng->txt("lang_uninstall_confirm"));
750 foreach ($this->getIdsFromQueryToken() as $id) {
751 $lang_title = ilObject::_lookupTitle((int) $id);
752 $conf_screen->addItem("id[]", $id, $this->lng->txt("meta_l_" . $lang_title));
753 }
754 $conf_screen->setCancel($this->lng->txt("cancel"), "view");
755 $conf_screen->setConfirm($this->lng->txt("ok"), "uninstall");
756 $this->tpl->setContent($conf_screen->getHTML());
757 }

References ilObjectGUI\$id, ilObject\_lookupTitle(), ilObjectGUI\checkPermission(), ILIAS\Repository\ctrl(), getIdsFromQueryToken(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ disableLanguageDetectionObject()

ilObjLanguageFolderGUI::disableLanguageDetectionObject ( )
protected

Disable language detection.

Definition at line 835 of file class.ilObjLanguageFolderGUI.php.

835 : void
836 {
837 $this->settings->set("lang_detection", '0');
838 $this->tpl->setOnScreenMessage('success', $this->lng->txt("saved_successfully"));
839 $this->viewObject();
840 }
viewObject()
show installed languages

References ILIAS\Repository\lng(), ILIAS\Repository\settings(), and viewObject().

+ Here is the call graph for this function:

◆ downloadDeprecatedObject()

ilObjLanguageFolderGUI::downloadDeprecatedObject ( )

Download deprecated lang entries.

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

877 : void
878 {
879 include_once "./Services/Language/classes/class.ilLangDeprecated.php";
880 $d = new ilLangDeprecated();
881 $res = "";
882 foreach ($d->getDeprecatedLangVars() as $key => $mod) {
883 $res .= $mod . "," . $key . "\n";
884 }
885
886 ilUtil::deliverData($res, "lang_deprecated.csv");
887 }
Search for deprecated lang vars.
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
$res
Definition: ltiservices.php:69

References Vendor\Package\$d, $res, and ilUtil\deliverData().

+ Here is the call graph for this function:

◆ editFolderObject()

ilObjLanguageFolderGUI::editFolderObject ( array  $ids)
protected

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

826 : void
827 {
828 $this->ctrl->setParameterByClass("ilobjlanguageextgui", "obj_id", current($ids));
829 $this->ctrl->redirectByClass("ilobjlanguageextgui");
830 }

References ILIAS\Repository\ctrl().

Referenced by executeCommand().

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

◆ enableLanguageDetectionObject()

ilObjLanguageFolderGUI::enableLanguageDetectionObject ( )
protected

Enable language detection.

Definition at line 845 of file class.ilObjLanguageFolderGUI.php.

845 : void
846 {
847 $this->settings->set("lang_detection", '1');
848 $this->tpl->setOnScreenMessage('success', $this->lng->txt("saved_successfully"));
849 $this->viewObject();
850 }

References ILIAS\Repository\lng(), ILIAS\Repository\settings(), and viewObject().

+ Here is the call graph for this function:

◆ executeCommand()

ilObjLanguageFolderGUI::executeCommand ( )

Reimplemented from ilObjectGUI.

Definition at line 517 of file class.ilObjLanguageFolderGUI.php.

517 : void
518 {
519 // always check read permission, needed write permissions are checked in the *Object functions
520 $this->checkPermission("read", "", $this->type, $this->ref_id);
521
522 $next_class = $this->ctrl->getNextClass($this);
523 $cmd = $this->ctrl->getCmd();
524 $this->prepareOutput();
525
526 switch ($next_class) {
527 case "ilpermissiongui":
528 include_once "Services/AccessControl/classes/class.ilPermissionGUI.php";
529 $perm_gui = new ilPermissionGUI($this);
530 $this->tabs_gui->activateTab("perm_settings");
531 $this->ctrl->forwardCommand($perm_gui);
532 break;
533
534 default:
535 $this->tabs_gui->activateTab("settings");
536
537 if ($action = $this->getCommandFromQueryToken($this->action_token->getName())) {
538 $this->checkPermission("write");
539 $this->lng->loadLanguageModule("meta");
542 switch ($action) {
543 case 'confirmRefresh':
544 $ids = $this->confirmRefreshObject();
545 $this->refreshSelectedObject($ids);
546 break;
547 case 'checkLanguage':
548 $this->checkLanguageObject();
549 break;
550 case 'refresh':
551 $ids = $this->getIdsFromQueryToken();
552 if (current($ids) === 'ALL_OBJECTS') {
553 array_shift($ids);
554 $languages = ilObject::_getObjectsByType("lng");
555 foreach ($languages as $lang) {
556 $langObj = new ilObjLanguage((int) $lang["obj_id"], false);
557 if ($langObj->isInstalled()) {
558 $ids[] = (string) $lang["obj_id"];
559 }
560 }
561 }
562 $modal = $this->buildConfirmModal(
563 $ids,
564 $action,
565 'refreshConfirmed',
566 'lang_refresh_confirm_selected',
567 "lang_refresh_confirm_info"
568 );
569 echo($r->renderAsync([$modal]));
570 exit();
571 case 'refreshConfirmed':
572 $ids = $this->getIdsFromQueryToken();
573 $this->refreshSelectedObject($ids);
574 break;
575 case 'uninstall':
576 $ids = $this->getIdsFromQueryToken();
577 if (current($ids) === 'ALL_OBJECTS') {
578 array_shift($ids);
579 $languages = ilObject::_getObjectsByType("lng");
580 foreach ($languages as $lang) {
581 $langObj = new ilObjLanguage((int) $lang["obj_id"], false);
582 if ($langObj->isInstalled()) {
583 $ids[] = (string) $lang["obj_id"];
584 }
585 }
586 }
587 $modal = $this->buildConfirmModal(
588 $ids,
589 $action,
590 'uninstallConfirmed',
591 'lang_uninstall_confirm'
592 );
593 echo($r->renderAsync([$modal]));
594 exit();
595 case 'uninstallConfirmed':
596 $ids = $this->getIdsFromQueryToken();
597 $this->uninstallObject($ids);
598 break;
599 case 'install':
600 $ids = $this->getIdsFromQueryToken();
601 if (current($ids) === 'ALL_OBJECTS') {
602 array_shift($ids);
603 $languages = ilObject::_getObjectsByType("lng");
604 foreach ($languages as $lang) {
605 $langObj = new ilObjLanguage((int) $lang["obj_id"], false);
606 if (!$langObj->isInstalled()) {
607 $ids[] = (string) $lang["obj_id"];
608 }
609 }
610 }
611 $this->installObject($ids);
612 break;
613 case 'install_local':
614 $ids = $this->getIdsFromQueryToken();
615 if (current($ids) === 'ALL_OBJECTS') {
616 array_shift($ids);
617 $languages = ilObject::_getObjectsByType("lng");
618 foreach ($languages as $lang) {
619 $ids[] = (string) $lang["obj_id"];
620 }
621 }
622 $this->installLocalObject($ids);
623 break;
624 case 'lang_uninstall_changes':
625 $ids = $this->getIdsFromQueryToken();
626 if (current($ids) === 'ALL_OBJECTS') {
627 array_shift($ids);
628 $languages = ilObject::_getObjectsByType("lng");
629 foreach ($languages as $lang) {
630 $langObj = new ilObjLanguage((int) $lang["obj_id"], false);
631 if ($langObj->isInstalled()) {
632 $ids[] = (string) $lang["obj_id"];
633 }
634 }
635 }
636 $modal = $this->buildConfirmModal(
637 $ids,
638 $action,
639 'uninstallChanges',
640 'lang_uninstall_changes_confirm'
641 );
642 echo($r->renderAsync([$modal]));
643 exit();
644 case 'uninstallChanges':
645 $ids = $this->getIdsFromQueryToken();
646 $this->uninstallChangesObject($ids);
647 break;
648 case 'setSystemLanguage':
649 $ids = $this->getIdsFromQueryToken();
650 $this->setSystemLanguageObject($ids);
651 break;
652 case 'setUserLanguage':
653 $ids = $this->getIdsFromQueryToken();
654 $this->setUserLanguageObject($ids);
655 break;
656 case 'edit':
657 $ids = $this->getIdsFromQueryToken();
658 $this->editFolderObject($ids);
659 break;
660 }
661 }
662 if (!$cmd) {
663 $cmd = "view";
664 }
665 $cmd .= "Object";
666 $this->$cmd();
667
668 break;
669 }
670 }
uninstallObject(array $ids)
uninstall language
checkLanguageObject()
check all languages
buildConfirmModal(array $ids, string $title, string $action, string $text, string $add_text='')
installLocalObject(array $ids)
Install local language modifications.
setUserLanguageObject(array $ids)
set user language
uninstallChangesObject(array $ids)
Uninstall local changes in the database.
setSystemLanguageObject(array $ids)
set the system language
refreshSelectedObject(array $ids)
update selected languages
installObject(array $ids)
install languages
UIRenderer $ui_renderer
prepareOutput(bool $show_sub_objects=true)
exit

References Vendor\Package\$f, $lang, ilObjectGUI\$ui_factory, ilObjectGUI\$ui_renderer, ilObject\_getObjectsByType(), buildConfirmModal(), checkLanguageObject(), ilObjectGUI\checkPermission(), confirmRefreshObject(), ILIAS\Repository\ctrl(), editFolderObject(), exit, getCommandFromQueryToken(), getIdsFromQueryToken(), installLocalObject(), installObject(), ILIAS\Repository\lng(), ilObjectGUI\prepareOutput(), refreshSelectedObject(), setSystemLanguageObject(), setUserLanguageObject(), uninstallChangesObject(), and uninstallObject().

+ Here is the call graph for this function:

◆ getActions()

ilObjLanguageFolderGUI::getActions ( )

Get Actions.

Definition at line 779 of file class.ilObjLanguageFolderGUI.php.

779 : array
780 {
782 return [
783 'confirmRefreshSelected' => $f->table()->action()->standard(
784 $this->lng->txt("refresh"),
785 $this->url_builder->withParameter($this->action_token, "confirmRefreshSelected"),
786 $this->id_token
787 )->withAsync(),
788 'install' => $f->table()->action()->standard(
789 $this->lng->txt("install"),
790 $this->url_builder->withParameter($this->action_token, "install"),
791 $this->id_token
792 ),
793 'installLocal' => $f->table()->action()->standard(
794 $this->lng->txt("install_local"),
795 $this->url_builder->withParameter($this->action_token, "installLocal"),
796 $this->id_token
797 ),
798 'confirmUninstall' => $f->table()->action()->standard(
799 $this->lng->txt("uninstall"),
800 $this->url_builder->withParameter($this->action_token, "confirmUninstall"),
801 $this->id_token
802 ),
803 'confirmUninstallChanges' => $f->table()->action()->standard(
804 $this->lng->txt("lang_uninstall_changes"),
805 $this->url_builder->withParameter($this->action_token, "confirmUninstallChanges"),
806 $this->id_token
807 ),
808 'setSystemLanguage' => $f->table()->action()->single(
809 $this->lng->txt("setSystemLanguage"),
810 $this->url_builder->withParameter($this->action_token, "setSystemLanguage"),
811 $this->id_token
812 ),
813 'setUserLanguage' => $f->table()->action()->single(
814 $this->lng->txt("setUserLanguage"),
815 $this->url_builder->withParameter($this->action_token, "setUserLanguage"),
816 $this->id_token
817 ),
818 'editFolder' => $f->table()->action()->single(
819 $this->lng->txt("edit"),
820 $this->url_builder->withParameter($this->action_token, "editFolder"),
821 $this->id_token
822 ),
823 ];
824 }

References Vendor\Package\$f, ilObjectGUI\$ui_factory, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjLanguageFolderGUI::getAdminTabs ( )

administration tabs show only permissions and trash folder

Reimplemented from ilObjectGUI.

Definition at line 498 of file class.ilObjLanguageFolderGUI.php.

498 : void
499 {
500 $this->getTabs();
501 }
getTabs()
Retrieves and adds tabs based on user permissions.

References getTabs().

+ Here is the call graph for this function:

◆ getCommandFromQueryToken()

ilObjLanguageFolderGUI::getCommandFromQueryToken ( string  $param)
protected

Definition at line 672 of file class.ilObjLanguageFolderGUI.php.

672 : ?string
673 {
674 if (!$this->request_wrapper->has($param)) {
675 return null;
676 }
677 $trafo = $this->refinery->byTrying([
678 $this->refinery->kindlyTo()->null(),
679 $this->refinery->kindlyTo()->string()
680 ]);
681 return $this->request_wrapper->retrieve($param, $trafo);
682 }
$param
Definition: xapitoken.php:46

References $param, and ILIAS\Repository\refinery().

Referenced by executeCommand().

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

◆ getIdsFromQueryToken()

ilObjLanguageFolderGUI::getIdsFromQueryToken ( )
private

Definition at line 898 of file class.ilObjLanguageFolderGUI.php.

898 : array
899 {
900 $ids = [];
901 if ($this->request_wrapper->has($this->id_token->getName())) {
902 $ids = $this->request_wrapper->retrieve(
903 $this->id_token->getName(),
904 $this->refinery->custom()->transformation(fn($v) => $v)
905 );
906 }
907 return $ids;
908 }

Referenced by confirmRefreshSelectedObject(), confirmUninstallChangesObject(), confirmUninstallObject(), and executeCommand().

+ Here is the caller graph for this function:

◆ getTabs()

ilObjLanguageFolderGUI::getTabs ( )
protected

Retrieves and adds tabs based on user permissions.

Reimplemented from ilObjectGUI.

Definition at line 506 of file class.ilObjLanguageFolderGUI.php.

506 : void
507 {
508 if ($this->checkPermissionBool("read")) {
509 $this->tabs_gui->addTab("settings", $this->lng->txt("settings"), $this->ctrl->getLinkTarget($this, "view"));
510 }
511
512 if ($this->checkPermissionBool("edit_permission")) {
513 $this->tabs_gui->addTab("perm_settings", $this->lng->txt("perm_settings"), $this->ctrl->getLinkTargetByClass(array(self::class,"ilpermissiongui"), "perm"));
514 }
515 }
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)

References ilObjectGUI\checkPermissionBool(), and ILIAS\Repository\lng().

Referenced by getAdminTabs().

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

◆ getUrl()

ilObjLanguageFolderGUI::getUrl ( string  $action,
?array  $lang_ids = null 
)
protected

Definition at line 889 of file class.ilObjLanguageFolderGUI.php.

889 : string
890 {
891 $url_builder = $this->url_builder->withParameter($this->action_token, $action);
892 if($lang_ids) {
893 $url_builder = $url_builder->withParameter($this->id_token, $lang_ids);
894 }
895 return $url_builder->buildURI()->__toString();
896 }
buildURI()
Get a URI representation of the full URL including query string and fragment/hash.
Definition: URLBuilder.php:214
withParameter(URLBuilderToken $token, string|array $value)
Change an acquired parameter's value if the supplied token is valid.
Definition: URLBuilder.php:166

References $url_builder, ILIAS\UI\URLBuilder\buildURI(), and ILIAS\UI\URLBuilder\withParameter().

Referenced by buildConfirmModal().

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

◆ installLocalObject()

ilObjLanguageFolderGUI::installLocalObject ( array  $ids)

Install local language modifications.

Definition at line 231 of file class.ilObjLanguageFolderGUI.php.

231 : void
232 {
233 $this->checkPermission("write");
234 $this->lng->loadLanguageModule("meta");
235
236 foreach ($ids as $obj_id) {
237 $langObj = new ilObjLanguage((int) $obj_id);
238 $key = $langObj->install();
239
240 if ($key !== "") {
241 $lang_installed[] = $key;
242 }
243
244 unset($langObj);
245
246 $langObj = new ilObjLanguage((int) $obj_id);
247 $key = $langObj->install("local");
248
249 if ($key !== "") {
250 $local_installed[] = $key;
251 }
252
253 unset($langObj);
254 }
255
256 if (isset($lang_installed)) {
257 if (count($lang_installed) === 1) {
258 $this->data = $this->lng->txt("meta_l_" . $lang_installed[0]) . " " . strtolower($this->lng->txt("installed")) . ".";
259 } else {
260 $langnames = [];
261 foreach ($lang_installed as $lang_key) {
262 $langnames[] = $this->lng->txt("meta_l_" . $lang_key);
263 }
264 $this->data = implode(", ", $langnames) . " " . strtolower($this->lng->txt("installed")) . ".";
265 }
266 }
267
268 if (isset($local_installed)) {
269 if (count($local_installed) === 1) {
270 $this->data .= " " . $this->lng->txt("meta_l_" . $local_installed[0]) . " " . $this->lng->txt("local_language_file") . " " . strtolower($this->lng->txt("installed")) . ".";
271 } else {
272 $langnames = [];
273 foreach ($local_installed as $lang_key) {
274 $langnames[] = $this->lng->txt("meta_l_" . $lang_key);
275 }
276 $this->data .= " " . implode(", ", $langnames) . " " . $this->lng->txt("local_language_files") . " " . strtolower($this->lng->txt("installed")) . ".";
277 }
278 } else {
279 $this->data .= " " . $this->lng->txt("local_languages_already_installed");
280 }
281
282 $this->out();
283 }

References ilObjectGUI\$obj_id, ilObjectGUI\checkPermission(), ILIAS\Repository\lng(), and out().

Referenced by executeCommand().

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

◆ installObject()

ilObjLanguageFolderGUI::installObject ( array  $ids)

install languages

Definition at line 194 of file class.ilObjLanguageFolderGUI.php.

194 : void
195 {
196 $this->checkPermission("write");
197 $this->lng->loadLanguageModule("meta");
198
199 foreach ($ids as $obj_id) {
200 $langObj = new ilObjLanguage((int) $obj_id);
201 $key = $langObj->install();
202
203 if ($key !== "") {
204 $lang_installed[] = $key;
205 }
206
207 unset($langObj);
208 }
209
210 if (isset($lang_installed)) {
211 if (count($lang_installed) === 1) {
212 $this->data = $this->lng->txt("meta_l_" . $lang_installed[0]) . " " . strtolower($this->lng->txt("installed")) . ".";
213 } else {
214 $langnames = [];
215 foreach ($lang_installed as $lang_key) {
216 $langnames[] = $this->lng->txt("meta_l_" . $lang_key);
217 }
218 $this->data = implode(", ", $langnames) . " " . strtolower($this->lng->txt("installed")) . ".";
219 }
220 } else {
221 $this->data = $this->lng->txt("languages_already_installed");
222 }
223
224 $this->out();
225 }

References ilObjectGUI\$obj_id, ilObjectGUI\checkPermission(), ILIAS\Repository\lng(), and out().

Referenced by executeCommand().

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

◆ listDeprecatedObject()

ilObjLanguageFolderGUI::listDeprecatedObject ( )

Download deprecated lang entries.

Definition at line 855 of file class.ilObjLanguageFolderGUI.php.

855 : void
856 {
857 $button = $this->ui_factory->button()->standard(
858 $this->lng->txt("download"),
859 $this->ctrl->getLinkTarget($this, "downloadDeprecated")
860 );
861 $this->toolbar->addComponent($button);
862
863 include_once "./Services/Language/classes/class.ilLangDeprecated.php";
864
865 $d = new ilLangDeprecated();
866 $res = "";
867 foreach ($d->getDeprecatedLangVars() as $key => $mod) {
868 $res .= $mod . "," . $key . "\n";
869 }
870
871 $this->tpl->setContent("<pre>" . $res . "</pre>");
872 }

References Vendor\Package\$d, $res, ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

◆ out()

ilObjLanguageFolderGUI::out ( )

Definition at line 492 of file class.ilObjLanguageFolderGUI.php.

492 : void
493 {
494 $this->tpl->setOnScreenMessage('info', $this->data, true);
495 $this->ctrl->redirect($this, "view");
496 }

References ILIAS\Repository\ctrl().

Referenced by checkLanguageObject(), installLocalObject(), installObject(), refreshObject(), refreshSelectedObject(), setSystemLanguageObject(), setUserLanguageObject(), uninstallChangesObject(), and uninstallObject().

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

◆ refreshObject()

ilObjLanguageFolderGUI::refreshObject ( )

update all installed languages

Definition at line 368 of file class.ilObjLanguageFolderGUI.php.

368 : void
369 {
370 $this->checkPermission("write");
371
373 $this->data = $this->lng->txt("languages_updated");
374 $this->out();
375 }
static refreshAll()
Refresh all installed languages.

References ilObjectGUI\checkPermission(), ILIAS\Repository\lng(), out(), and ilObjLanguage\refreshAll().

+ Here is the call graph for this function:

◆ refreshSelectedObject()

ilObjLanguageFolderGUI::refreshSelectedObject ( array  $ids)

update selected languages

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

380 : void
381 {
382 $this->checkPermission("write");
383 $this->data = $this->lng->txt("selected_languages_updated");
384 $this->lng->loadLanguageModule("meta");
385
386 $refreshed = [];
387 foreach ($ids as $id) {
388 $langObj = new ilObjLanguage((int) $id, false);
389 if ($langObj->refresh()) {
390 $refreshed[] = $langObj->getKey();
391 $this->data .= "<br />" . $this->lng->txt("meta_l_" . $langObj->getKey());
392 }
393 unset($langObj);
394 }
395
397 $this->out();
398 }
static refreshPlugins(?array $a_lang_keys=null)
Refresh languages of activated plugins $a_lang_keys keys of languages to be refreshed (not yet suppor...

References ilObjectGUI\$id, ilObjectGUI\checkPermission(), ILIAS\Repository\lng(), out(), and ilObjLanguage\refreshPlugins().

Referenced by executeCommand().

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

◆ setSystemLanguageObject()

ilObjLanguageFolderGUI::setSystemLanguageObject ( array  $ids)

set the system language

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

446 : void
447 {
448 $this->checkPermission("write");
449 $this->lng->loadLanguageModule("meta");
450
451
452 if (count($ids) !== 1) {
453 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("choose_only_one_language") . "<br/>" . $this->lng->txt("action_aborted"), true);
454 $this->ctrl->redirect($this, "view");
455 }
456
457 $obj_id = current($ids);
458
459 $newSysLangObj = new ilObjLanguage((int) $obj_id);
460
461 if ($newSysLangObj->isSystemLanguage()) {
462 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("meta_l_" . $newSysLangObj->getKey()) . " " . $this->lng->txt("is_already_your") . " " . $this->lng->txt("system_language") . "<br/>" . $this->lng->txt("action_aborted"), true);
463 $this->ctrl->redirect($this, "view");
464 }
465
466 if (!$newSysLangObj->isInstalled()) {
467 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("meta_l_" . $newSysLangObj->getKey()) . " " . $this->lng->txt("language_not_installed") . "<br/>" . $this->lng->txt("action_aborted"), true);
468 $this->ctrl->redirect($this, "view");
469 }
470
471 $this->ilias->setSetting("language", $newSysLangObj->getKey());
472
473 // update ini-file
474 $this->ilias->ini->setVariable("language", "default", $newSysLangObj->getKey());
475 $this->ilias->ini->write();
476
477 $this->data = $this->lng->txt("system_language") . " " . $this->lng->txt("changed_to") . " " . $this->lng->txt("meta_l_" . $newSysLangObj->getKey()) . ".";
478
479 $this->out();
480 }
Class ilObjForumAdministration.

References ilObjectGUI\$obj_id, ilObjectGUI\checkPermission(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and out().

Referenced by executeCommand().

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

◆ setUserLanguageObject()

ilObjLanguageFolderGUI::setUserLanguageObject ( array  $ids)

set user language

Definition at line 403 of file class.ilObjLanguageFolderGUI.php.

403 : void
404 {
405 global $DIC;
406 $ilUser = $DIC->user();
407
408 $this->checkPermission("write");
409 $this->lng->loadLanguageModule("meta");
410
411 #require_once "./Services/User/classes/class.ilObjUser.php";
412
413
414 if (count($ids) !== 1) {
415 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("choose_only_one_language") . "<br/>" . $this->lng->txt("action_aborted"), true);
416 $this->ctrl->redirect($this, "view");
417 }
418
419 $obj_id = current($ids);
420
421 $newUserLangObj = new ilObjLanguage((int) $obj_id);
422
423 if ($newUserLangObj->isUserLanguage()) {
424 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("meta_l_" . $newUserLangObj->getKey()) . " " . $this->lng->txt("is_already_your") . " " . $this->lng->txt("user_language") . "<br/>" . $this->lng->txt("action_aborted"), true);
425 $this->ctrl->redirect($this, "view");
426 }
427
428 if (!$newUserLangObj->isInstalled()) {
429 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("meta_l_" . $newUserLangObj->getKey()) . " " . $this->lng->txt("language_not_installed") . "<br/>" . $this->lng->txt("action_aborted"), true);
430 $this->ctrl->redirect($this, "view");
431 }
432
433 $curUser = new ilObjUser($ilUser->getId());
434 $curUser->setLanguage($newUserLangObj->getKey());
435 $curUser->update();
436
437 $this->data = $this->lng->txt("user_language") . " " . $this->lng->txt("changed_to") . " " . $this->lng->txt("meta_l_" . $newUserLangObj->getKey()) . ".";
438
439 $this->out();
440 }
User class.
global $DIC
Definition: shib_login.php:26

References $DIC, ilObjectGUI\$obj_id, ilObjectGUI\checkPermission(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and out().

Referenced by executeCommand().

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

◆ uninstallChangesObject()

ilObjLanguageFolderGUI::uninstallChangesObject ( array  $ids)

Uninstall local changes in the database.

Definition at line 336 of file class.ilObjLanguageFolderGUI.php.

336 : void
337 {
338 $this->checkPermission("write");
339
340 $this->data = $this->lng->txt("selected_languages_updated");
341 $this->lng->loadLanguageModule("meta");
342 $refreshed = [];
343
344 foreach ($ids as $id) {
345 $langObj = new ilObjLanguage((int) $id, false);
346
347 if ($langObj->isInstalled()) {
348 if ($langObj->check()) {
349 $langObj->flush("all");
350 $langObj->insert();
351 $langObj->setTitle($langObj->getKey());
352 $langObj->setDescription("installed");
353 $langObj->update();
354 $refreshed[] = $langObj->getKey();
355 }
356 $this->data .= "<br />" . $this->lng->txt("meta_l_" . $langObj->getKey());
357 }
358
359 unset($langObj);
360 }
362 $this->out();
363 }

References ilObjectGUI\$id, ilObjectGUI\checkPermission(), ILIAS\Repository\lng(), out(), and ilObjLanguage\refreshPlugins().

Referenced by executeCommand().

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

◆ uninstallObject()

ilObjLanguageFolderGUI::uninstallObject ( array  $ids)

uninstall language

Definition at line 289 of file class.ilObjLanguageFolderGUI.php.

289 : void
290 {
291 $this->checkPermission('write');
292 $this->lng->loadLanguageModule("meta");
293
294 $sys_lang = false;
295 $usr_lang = false;
296
297 // uninstall all selected languages
298 foreach ($ids as $obj_id) {
299 $langObj = new ilObjLanguage((int) $obj_id);
300 if (!($sys_lang = $langObj->isSystemLanguage()) && !($usr_lang = $langObj->isUserLanguage())) {
301 $key = $langObj->uninstall();
302 if ($key !== "") {
303 $lang_uninstalled[] = $key;
304 }
305 }
306 unset($langObj);
307 }
308
309 // generate output message
310 if (isset($lang_uninstalled)) {
311 if (count($lang_uninstalled) === 1) {
312 $this->data = $this->lng->txt("meta_l_" . $lang_uninstalled[0]) . " " . $this->lng->txt("uninstalled");
313 } else {
314 $langnames = [];
315 foreach ($lang_uninstalled as $lang_key) {
316 $langnames[] = $this->lng->txt("meta_l_" . $lang_key);
317 }
318
319 $this->data = implode(", ", $langnames) . " " . $this->lng->txt("uninstalled");
320 }
321 } elseif ($sys_lang) {
322 $this->data = $this->lng->txt("cannot_uninstall_systemlanguage");
323 } elseif ($usr_lang) {
324 $this->data = $this->lng->txt("cannot_uninstall_language_in_use");
325 } else {
326 $this->data = $this->lng->txt("languages_already_uninstalled");
327 }
328
329 $this->out();
330 }

References ilObjectGUI\$obj_id, ilObjectGUI\checkPermission(), ILIAS\Repository\lng(), and out().

Referenced by executeCommand().

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

◆ viewObject()

ilObjLanguageFolderGUI::viewObject ( )

show installed languages

Reimplemented from ilObjectGUI.

Definition at line 74 of file class.ilObjLanguageFolderGUI.php.

74 : void
75 {
76 global $DIC;
77
78 $table = $this->languageFolderTable->getTable();
79
80 if ($this->checkPermissionBool("write")) {
81 // refresh
82 $ids = $this->confirmRefreshObject();
83 $modal = $this->buildConfirmModal(
84 $ids,
85 'refresh_languages',
86 'confirmRefresh',
87 'lang_refresh_confirm_selected',
88 "lang_refresh_confirm_info"
89 );
90 $refresh = $this->ui_factory->button()->standard(
91 $this->lng->txt("refresh_languages"),
92 ''
93 )->withOnClick($modal->getShowSignal());
94
95 $this->toolbar->addComponent($modal);
96 $this->toolbar->addComponent($refresh);
97
98 // check languages
99 $check = $this->ui_factory->button()->standard(
100 $this->lng->txt("check_languages"),
101 $this->getUrl("checkLanguage")
102 );
103 $this->toolbar->addComponent($check);
104 }
105
106 $ilClientIniFile = $DIC["ilClientIniFile"];
107 if ($ilClientIniFile->variableExists("system", "LANGUAGE_LOG")) {
108 $download = $this->ui_factory->button()->standard(
109 $this->lng->txt("lng_download_deprecated"),
110 $this->ctrl->getLinkTarget($this, "listDeprecated")
111 );
112 $this->toolbar->addComponent($download);
113 }
114
115 if ($this->checkPermissionBool("write")) {
116 $modal_on = $this->ui_factory->modal()->interruptive(
117 'ON',
118 $this->lng->txt("lng_enable_language_detection"),
119 $this->ctrl->getFormActionByClass(self::class, "enableLanguageDetection")
120 )
121 ->withActionButtonLabel($this->lng->txt('ok'));
122 $modal_off = $this->ui_factory->modal()->interruptive(
123 'OFF',
124 $this->lng->txt("lng_disable_language_detection"),
125 $this->ctrl->getFormActionByClass(self::class, "disableLanguageDetection")
126 )
127 ->withActionButtonLabel($this->lng->txt('ok'));
128 $toggleButton = $this->ui_factory->button()->toggle(
129 $this->lng->txt("language_detection"),
130 $modal_on->getShowSignal(),
131 $modal_off->getShowSignal(),
132 (bool) ($this->settings->get("lang_detection"))
133 )
134 ->withAriaLabel($this->lng->txt("lng_switch_language_detection"));
135 $this->toolbar->addComponent($modal_on);
136 $this->toolbar->addComponent($modal_off);
137 $this->toolbar->addComponent($toggleButton);
138 }
139
140 $this->tpl->setContent($this->ui_renderer->render($table->withRequest($this->request)));
141 }
$check
Definition: buildRTE.php:81

References $check, $DIC, buildConfirmModal(), ilObjectGUI\checkPermissionBool(), confirmRefreshObject(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

Referenced by disableLanguageDetectionObject(), and enableLanguageDetectionObject().

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

Field Documentation

◆ $action_token

URLBuilderToken ilObjLanguageFolderGUI::$action_token
protected

Definition at line 39 of file class.ilObjLanguageFolderGUI.php.

◆ $df

ILIAS Data Factory ilObjLanguageFolderGUI::$df
protected

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

◆ $id_token

URLBuilderToken ilObjLanguageFolderGUI::$id_token
protected

Definition at line 40 of file class.ilObjLanguageFolderGUI.php.

◆ $languageFolderTable

ilLanguageFolderTable ilObjLanguageFolderGUI::$languageFolderTable
protected

Definition at line 36 of file class.ilObjLanguageFolderGUI.php.

◆ $url_builder

URLBuilder ilObjLanguageFolderGUI::$url_builder
protected

Definition at line 38 of file class.ilObjLanguageFolderGUI.php.

Referenced by getUrl().


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