ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 ()
 
 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)
 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 ()
 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
 
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
 
ilObjectCustomIconFactory $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.

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

Referenced by executeCommand(), and viewObject().

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  )) . ")";
164  }
165  $items[] = $f->modal()->interruptiveItem()->standard($id, $lang_title);
166  }
167  $form_action = $this->getUrl($action, $ids);
168 
169  if ($some_changed) {
170  $message .= "<br />" . $this->lng->txt($add_text);
171  }
172  } else {
173  $message = $this->lng->txt("no_checkbox");
174  $form_action = '';
175  }
176  $modal = $f->modal()->interruptive(
177  $title,
178  $message,
180  );
181  if (!empty($items)) {
182  $modal = $modal->withAffectedItems($items)
183  ->withActionButtonLabel($title);
184  } else {
185  $modal = $modal->withActionButtonLabel($this->lng->txt('ok'));
186  }
187  return $modal;
188  }
string $title
const IL_CAL_DATETIME
getUrl(string $action, ?array $lang_ids=null)
UIFactory $ui_factory
static _lookupTitle(int $obj_id)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
$message
Definition: xapiexit.php:31
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" ...
+ 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 484 of file class.ilObjLanguageFolderGUI.php.

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

Referenced by executeCommand().

484  : void
485  {
486  $this->checkPermission("write");
487  $this->data = $this->object->checkAllLanguages();
488  $this->out();
489  }
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmRefreshObject()

ilObjLanguageFolderGUI::confirmRefreshObject ( )

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

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

Referenced by executeCommand(), and viewObject().

683  : array
684  {
685  $this->checkPermission("write");
686 
687  $languages = ilObject::_getObjectsByType("lng");
688 
689  $ids = [];
690  foreach ($languages as $lang) {
691  $langObj = new ilObjLanguage((int) $lang["obj_id"], false);
692  if ($langObj->isInstalled()) {
693  $ids[] = (string) $lang["obj_id"];
694  }
695  }
696  return $ids;
697  }
static _getObjectsByType(string $obj_type="", ?int $owner=null)
$lang
Definition: xapiexit.php:25
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ 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 699 of file class.ilObjLanguageFolderGUI.php.

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

699  : void
700  {
701  $this->checkPermission("write");
702  $this->lng->loadLanguageModule("meta");
703 
704  $header = '';
705  $ids = [];
706  if (!empty($a_ids)) {
707  $ids = $a_ids;
708  $header = $this->lng->txt("lang_refresh_confirm");
709  } elseif (!empty($post_id = $this->getIdsFromQueryToken())) {
710  $ids = $post_id;
711  $header = $this->lng->txt("lang_refresh_confirm_selected");
712  } else {
713  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
714  $this->ctrl->redirect($this, "view");
715  }
716 
717  $conf_screen = new ilConfirmationGUI();
718  $some_changed = false;
719  foreach ($ids as $id) {
720  $lang_key = ilObject::_lookupTitle((int) $id);
721  $lang_title = $this->lng->txt("meta_l_" . $lang_key);
722  $last_change = ilObjLanguage::_getLastLocalChange($lang_key);
723  if (!empty($last_change)) {
724  $some_changed = true;
725  $lang_title .= " (" . $this->lng->txt("last_change") . " "
726  . ilDatePresentation::formatDate(new ilDateTime($last_change, IL_CAL_DATETIME)) . ")";
727  }
728  $conf_screen->addItem("id[]", (string) $id, $lang_title);
729  }
730 
731  $conf_screen->setFormAction($this->ctrl->getFormAction($this));
732  if ($some_changed) {
733  $header .= "<br />" . $this->lng->txt("lang_refresh_confirm_info");
734  }
735  $conf_screen->setHeaderText($header);
736  $conf_screen->setCancel($this->lng->txt("cancel"), "view");
737  $conf_screen->setConfirm($this->lng->txt("ok"), "refreshSelected");
738  $this->tpl->setContent($conf_screen->getHTML());
739  }
const IL_CAL_DATETIME
static _lookupTitle(int $obj_id)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=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" ...
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ confirmUninstallChangesObject()

ilObjLanguageFolderGUI::confirmUninstallChangesObject ( )

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

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

758  : void
759  {
760  $this->checkPermission('write');
761 
762  $this->lng->loadLanguageModule("meta");
763  $conf_screen = new ilConfirmationGUI();
764  $conf_screen->setFormAction($this->ctrl->getFormAction($this));
765  $conf_screen->setHeaderText($this->lng->txt("lang_uninstall_changes_confirm"));
766  foreach ($this->getIdsFromQueryToken() as $id) {
767  $lang_title = ilObject::_lookupTitle($id);
768  $conf_screen->addItem("id[]", (string) $id, $this->lng->txt("meta_l_" . $lang_title));
769  }
770  $conf_screen->setCancel($this->lng->txt("cancel"), "view");
771  $conf_screen->setConfirm($this->lng->txt("ok"), "uninstallChanges");
772  $this->tpl->setContent($conf_screen->getHTML());
773  }
static _lookupTitle(int $obj_id)
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ confirmUninstallObject()

ilObjLanguageFolderGUI::confirmUninstallObject ( )

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

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

741  : void
742  {
743  $this->checkPermission("write");
744 
745  $this->lng->loadLanguageModule("meta");
746  $conf_screen = new ilConfirmationGUI();
747  $conf_screen->setFormAction($this->ctrl->getFormAction($this));
748  $conf_screen->setHeaderText($this->lng->txt("lang_uninstall_confirm"));
749  foreach ($this->getIdsFromQueryToken() as $id) {
750  $lang_title = ilObject::_lookupTitle((int) $id);
751  $conf_screen->addItem("id[]", $id, $this->lng->txt("meta_l_" . $lang_title));
752  }
753  $conf_screen->setCancel($this->lng->txt("cancel"), "view");
754  $conf_screen->setConfirm($this->lng->txt("ok"), "uninstall");
755  $this->tpl->setContent($conf_screen->getHTML());
756  }
static _lookupTitle(int $obj_id)
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ disableLanguageDetectionObject()

ilObjLanguageFolderGUI::disableLanguageDetectionObject ( )
protected

Disable language detection.

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

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

834  : void
835  {
836  $this->settings->set("lang_detection", '0');
837  $this->tpl->setOnScreenMessage('success', $this->lng->txt("saved_successfully"));
838  $this->viewObject();
839  }
viewObject()
show installed languages
+ Here is the call graph for this function:

◆ downloadDeprecatedObject()

ilObjLanguageFolderGUI::downloadDeprecatedObject ( )

Download deprecated lang entries.

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

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

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

◆ editFolderObject()

ilObjLanguageFolderGUI::editFolderObject ( array  $ids)
protected

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

References ILIAS\Repository\ctrl().

Referenced by executeCommand().

825  : void
826  {
827  $this->ctrl->setParameterByClass("ilobjlanguageextgui", "obj_id", current($ids));
828  $this->ctrl->redirectByClass("ilobjlanguageextgui");
829  }
+ 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 844 of file class.ilObjLanguageFolderGUI.php.

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

844  : void
845  {
846  $this->settings->set("lang_detection", '1');
847  $this->tpl->setOnScreenMessage('success', $this->lng->txt("saved_successfully"));
848  $this->viewObject();
849  }
viewObject()
show installed languages
+ Here is the call graph for this function:

◆ executeCommand()

ilObjLanguageFolderGUI::executeCommand ( )

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

References Vendor\Package\$f, $lang, $r, 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().

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

◆ getActions()

ilObjLanguageFolderGUI::getActions ( )

Get Actions.

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

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

778  : array
779  {
781  return [
782  'confirmRefreshSelected' => $f->table()->action()->standard(
783  $this->lng->txt("refresh"),
784  $this->url_builder->withParameter($this->action_token, "confirmRefreshSelected"),
786  )->withAsync(),
787  'install' => $f->table()->action()->standard(
788  $this->lng->txt("install"),
789  $this->url_builder->withParameter($this->action_token, "install"),
791  ),
792  'installLocal' => $f->table()->action()->standard(
793  $this->lng->txt("install_local"),
794  $this->url_builder->withParameter($this->action_token, "installLocal"),
796  ),
797  'confirmUninstall' => $f->table()->action()->standard(
798  $this->lng->txt("uninstall"),
799  $this->url_builder->withParameter($this->action_token, "confirmUninstall"),
801  ),
802  'confirmUninstallChanges' => $f->table()->action()->standard(
803  $this->lng->txt("lang_uninstall_changes"),
804  $this->url_builder->withParameter($this->action_token, "confirmUninstallChanges"),
806  ),
807  'setSystemLanguage' => $f->table()->action()->single(
808  $this->lng->txt("setSystemLanguage"),
809  $this->url_builder->withParameter($this->action_token, "setSystemLanguage"),
811  ),
812  'setUserLanguage' => $f->table()->action()->single(
813  $this->lng->txt("setUserLanguage"),
814  $this->url_builder->withParameter($this->action_token, "setUserLanguage"),
816  ),
817  'editFolder' => $f->table()->action()->single(
818  $this->lng->txt("edit"),
819  $this->url_builder->withParameter($this->action_token, "editFolder"),
821  ),
822  ];
823  }
UIFactory $ui_factory
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjLanguageFolderGUI::getAdminTabs ( )

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

References getTabs().

497  : void
498  {
499  $this->getTabs();
500  }
getTabs()
Retrieves and adds tabs based on user permissions.
+ Here is the call graph for this function:

◆ getCommandFromQueryToken()

ilObjLanguageFolderGUI::getCommandFromQueryToken ( string  $param)
protected

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

References null, and ILIAS\Repository\refinery().

Referenced by executeCommand().

671  : ?string
672  {
673  if (!$this->request_wrapper->has($param)) {
674  return null;
675  }
676  $trafo = $this->refinery->byTrying([
677  $this->refinery->kindlyTo()->null(),
678  $this->refinery->kindlyTo()->string()
679  ]);
680  return $this->request_wrapper->retrieve($param, $trafo);
681  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$param
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIdsFromQueryToken()

ilObjLanguageFolderGUI::getIdsFromQueryToken ( )
private

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

References ILIAS\Repository\refinery().

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

897  : array
898  {
899  $ids = [];
900  if ($this->request_wrapper->has($this->id_token->getName())) {
901  $ids = $this->request_wrapper->retrieve(
902  $this->id_token->getName(),
903  $this->refinery->custom()->transformation(fn($v) => $v)
904  );
905  }
906  return $ids;
907  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTabs()

ilObjLanguageFolderGUI::getTabs ( )
protected

Retrieves and adds tabs based on user permissions.

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

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

Referenced by getAdminTabs().

505  : void
506  {
507  if ($this->checkPermissionBool("read")) {
508  $this->tabs_gui->addTab("settings", $this->lng->txt("settings"), $this->ctrl->getLinkTarget($this, "view"));
509  }
510 
511  if ($this->checkPermissionBool("edit_permission")) {
512  $this->tabs_gui->addTab("perm_settings", $this->lng->txt("perm_settings"), $this->ctrl->getLinkTargetByClass(array(self::class,"ilpermissiongui"), "perm"));
513  }
514  }
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ 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 888 of file class.ilObjLanguageFolderGUI.php.

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

Referenced by buildConfirmModal(), and viewObject().

888  : string
889  {
890  $url_builder = $this->url_builder->withParameter($this->action_token, $action);
891  if($lang_ids) {
892  $url_builder = $url_builder->withParameter($this->id_token, $lang_ids);
893  }
894  return $url_builder->buildURI()->__toString();
895  }
buildURI()
Get a URI representation of the full URL including query string and fragment/hash.
Definition: URLBuilder.php:212
withParameter(URLBuilderToken $token, string|array $value)
Change an acquired parameter&#39;s value if the supplied token is valid.
Definition: URLBuilder.php:166
+ 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 230 of file class.ilObjLanguageFolderGUI.php.

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

Referenced by executeCommand().

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

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

Referenced by executeCommand().

193  : void
194  {
195  $this->checkPermission("write");
196  $this->lng->loadLanguageModule("meta");
197 
198  foreach ($ids as $obj_id) {
199  $langObj = new ilObjLanguage((int) $obj_id);
200  $key = $langObj->install();
201 
202  if ($key !== "") {
203  $lang_installed[] = $key;
204  }
205 
206  unset($langObj);
207  }
208 
209  if (isset($lang_installed)) {
210  if (count($lang_installed) === 1) {
211  $this->data = $this->lng->txt("meta_l_" . $lang_installed[0]) . " " . strtolower($this->lng->txt("installed")) . ".";
212  } else {
213  $langnames = [];
214  foreach ($lang_installed as $lang_key) {
215  $langnames[] = $this->lng->txt("meta_l_" . $lang_key);
216  }
217  $this->data = implode(", ", $langnames) . " " . strtolower($this->lng->txt("installed")) . ".";
218  }
219  } else {
220  $this->data = $this->lng->txt("languages_already_installed");
221  }
222 
223  $this->out();
224  }
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ 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 854 of file class.ilObjLanguageFolderGUI.php.

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

854  : void
855  {
856  $button = $this->ui_factory->button()->standard(
857  $this->lng->txt("download"),
858  $this->ctrl->getLinkTarget($this, "downloadDeprecated")
859  );
860  $this->toolbar->addComponent($button);
861 
862  include_once "./Services/Language/classes/class.ilLangDeprecated.php";
863 
864  $d = new ilLangDeprecated();
865  $res = "";
866  foreach ($d->getDeprecatedLangVars() as $key => $mod) {
867  $res .= $mod . "," . $key . "\n";
868  }
869 
870  $this->tpl->setContent("<pre>" . $res . "</pre>");
871  }
$res
Definition: ltiservices.php:66
Search for deprecated lang vars.
+ Here is the call graph for this function:

◆ out()

ilObjLanguageFolderGUI::out ( )

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

References ILIAS\Repository\ctrl().

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

491  : void
492  {
493  $this->tpl->setOnScreenMessage('info', $this->data, true);
494  $this->ctrl->redirect($this, "view");
495  }
+ 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 367 of file class.ilObjLanguageFolderGUI.php.

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

367  : void
368  {
369  $this->checkPermission("write");
370 
372  $this->data = $this->lng->txt("languages_updated");
373  $this->out();
374  }
static refreshAll()
Refresh all installed languages.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ refreshSelectedObject()

ilObjLanguageFolderGUI::refreshSelectedObject ( array  $ids)

update selected languages

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

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

Referenced by executeCommand().

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

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

Referenced by executeCommand().

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

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

Referenced by executeCommand().

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

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

Referenced by executeCommand().

335  : void
336  {
337  $this->checkPermission("write");
338 
339  $this->data = $this->lng->txt("selected_languages_updated");
340  $this->lng->loadLanguageModule("meta");
341  $refreshed = [];
342 
343  foreach ($ids as $id) {
344  $langObj = new ilObjLanguage((int) $id, false);
345 
346  if ($langObj->isInstalled()) {
347  if ($langObj->check()) {
348  $langObj->flush("all");
349  $langObj->insert();
350  $langObj->setTitle($langObj->getKey());
351  $langObj->setDescription("installed");
352  $langObj->update();
353  $refreshed[] = $langObj->getKey();
354  }
355  $this->data .= "<br />" . $this->lng->txt("meta_l_" . $langObj->getKey());
356  }
357 
358  unset($langObj);
359  }
360  ilObjLanguage::refreshPlugins($refreshed);
361  $this->out();
362  }
static refreshPlugins(?array $a_lang_keys=null)
Refresh languages of activated plugins $a_lang_keys keys of languages to be refreshed (not yet suppor...
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ 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 288 of file class.ilObjLanguageFolderGUI.php.

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

Referenced by executeCommand().

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

◆ viewObject()

ilObjLanguageFolderGUI::viewObject ( )

show installed languages

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

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

Referenced by disableLanguageDetectionObject(), and enableLanguageDetectionObject().

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  }
getUrl(string $action, ?array $lang_ids=null)
global $DIC
Definition: shib_login.php:22
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
buildConfirmModal(array $ids, string $title, string $action, string $text, string $add_text='')
$check
Definition: buildRTE.php:81
+ 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.

Referenced by getActions().

◆ $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.


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