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

Import related features for learning modules. More...

+ Collaboration diagram for ilLMImportGUI:

Public Member Functions

 __construct (ilObjLearningModule $a_lm)
 
 executeCommand ()
 
 showTranslationImportForm ()
 
 initTranslationImportForm ()
 
 importTranslation ()
 

Protected Attributes

ilCtrl $ctrl
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilObjLearningModule $lm
 
EditingGUIRequest $request
 

Detailed Description

Import related features for learning modules.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 25 of file class.ilLMImportGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilLMImportGUI::__construct ( ilObjLearningModule  $a_lm)

Definition at line 32 of file class.ilLMImportGUI.php.

33 {
34 global $DIC;
35
36 $this->request = $DIC
37 ->learningModule()
38 ->internal()
39 ->gui()
40 ->editing()
41 ->request();
42
43
44 $this->ctrl = $DIC->ctrl();
45 $this->lng = $DIC->language();
46 $this->tpl = $DIC["tpl"];
47 $this->lm = $a_lm;
48 }
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilLMImportGUI::executeCommand ( )

Definition at line 50 of file class.ilLMImportGUI.php.

50 : void
51 {
52 $ilCtrl = $this->ctrl;
53
54 $cmd = $ilCtrl->getCmd("showTranslationImportForm");
55
56 if (in_array($cmd, array("showTranslationImportForm", "importTranslation"))) {
57 $this->$cmd();
58 }
59 }
getCmd(?string $fallback_command=null)
@inheritDoc

References $ctrl, and ilCtrl\getCmd().

+ Here is the call graph for this function:

◆ importTranslation()

ilLMImportGUI::importTranslation ( )

Definition at line 106 of file class.ilLMImportGUI.php.

106 : void
107 {
108 $ilCtrl = $this->ctrl;
110
111 $imp = new ilImport();
112 $conf = $imp->getConfig("components/ILIAS/LearningModule");
113
114 $target_lang = $this->request->getImportLang();
115 $ot = $this->lm->getObjectProperties()->getPropertyTranslations();
116 if ($target_lang == $ot->getBaseLanguage() || $target_lang == "") {
117 $this->tpl->setOnScreenMessage('failure', $lng->txt("cont_transl_master_language_not_allowed"), true);
118 $ilCtrl->redirect($this, "showTranslationImportForm");
119 }
120
121 $conf->setTranslationImportMode($this->lm, $target_lang);
122 $imp->importObject(
123 null,
124 $_FILES["importfile"]["tmp_name"],
125 $_FILES["importfile"]["name"],
126 "lm",
127 "components/ILIAS/LearningModule"
128 );
129 //echo "h"; exit;
130 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
131 $ilCtrl->redirect($this, "showTranslationImportForm");
132 }
Import class.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...

References $ctrl, $lng, and ilLanguage\txt().

+ Here is the call graph for this function:

◆ initTranslationImportForm()

ilLMImportGUI::initTranslationImportForm ( )

Definition at line 71 of file class.ilLMImportGUI.php.

72 {
74 $ilCtrl = $this->ctrl;
75
76 $options = [];
77
78 $lng->loadLanguageModule("meta");
79
80 $form = new ilPropertyFormGUI();
81
82 // import file
83 $fi = new ilFileInputGUI($lng->txt("file"), "importfile");
84 $fi->setSuffixes(array("zip"));
85 $fi->setRequired(true);
86 $fi->setSize(30);
87 $form->addItem($fi);
88
89 $ot = $this->lm->getObjectProperties()->getPropertyTranslations();
90 foreach ($ot->getLanguages() as $l) {
91 if ($l->getLanguageCode() !== $ot->getBaseLanguage()) {
92 $options[$l->getLanguageCode()] = $lng->txt("meta_l_" . $l->getLanguageCode());
93 }
94 }
95 $si = new ilSelectInputGUI($lng->txt("cont_import_lang"), "import_lang");
96 $si->setOptions($options);
97 $form->addItem($si);
98
99 $form->addCommandButton("importTranslation", $lng->txt("import"));
100 $form->setTitle($lng->txt("cont_import_trans"));
101 $form->setFormAction($ilCtrl->getFormAction($this));
102
103 return $form;
104 }
This class represents a file property in a property form.
loadLanguageModule(string $a_module)
Load language module.
This class represents a property form user interface.
This class represents a selection list property in a property form.

References $ctrl, $lng, ilLanguage\loadLanguageModule(), and ilLanguage\txt().

Referenced by showTranslationImportForm().

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

◆ showTranslationImportForm()

ilLMImportGUI::showTranslationImportForm ( )

Definition at line 61 of file class.ilLMImportGUI.php.

61 : void
62 {
65
66 $this->tpl->setOnScreenMessage('info', $lng->txt("cont_trans_import_info"));
67 $form = $this->initTranslationImportForm();
68 $tpl->setContent($form->getHTML());
69 }
ilGlobalTemplateInterface $tpl
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
setContent(string $a_html)
Sets content for standard template.

References $lng, $tpl, initTranslationImportForm(), ILIAS\UICore\GlobalTemplate\setContent(), ILIAS\UICore\GlobalTemplate\setOnScreenMessage(), and ilLanguage\txt().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilLMImportGUI::$ctrl
protected

◆ $lm

ilObjLearningModule ilLMImportGUI::$lm
protected

Definition at line 30 of file class.ilLMImportGUI.php.

◆ $lng

ilLanguage ilLMImportGUI::$lng
protected

◆ $request

EditingGUIRequest ilLMImportGUI::$request
protected

Definition at line 31 of file class.ilLMImportGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilLMImportGUI::$tpl
protected

Definition at line 29 of file class.ilLMImportGUI.php.

Referenced by showTranslationImportForm().


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