ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

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

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: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilLMImportGUI::executeCommand ( )

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

References $ctrl, and ilCtrl\getCmd().

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

◆ importTranslation()

ilLMImportGUI::importTranslation ( )

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

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

106  : void
107  {
108  $ilCtrl = $this->ctrl;
109  $lng = $this->lng;
110 
111  $imp = new ilImport();
112  $conf = $imp->getConfig("Modules/LearningModule");
113 
114  $target_lang = $this->request->getImportLang();
115  $ot = ilObjectTranslation::getInstance($this->lm->getId());
116  if ($target_lang == $ot->getMasterLanguage() || $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  "Modules/LearningModule"
128  );
129  //echo "h"; exit;
130  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
131  $ilCtrl->redirect($this, "showTranslationImportForm");
132  }
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(int $obj_id)
+ Here is the call graph for this function:

◆ initTranslationImportForm()

ilLMImportGUI::initTranslationImportForm ( )

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

References $ctrl, $lng, ilObjectTranslation\getInstance(), ilLanguage\loadLanguageModule(), ilFileInputGUI\setSuffixes(), and ilLanguage\txt().

Referenced by showTranslationImportForm().

72  {
73  $lng = $this->lng;
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 = ilObjectTranslation::getInstance($this->lm->getId());
90  foreach ($ot->getLanguages() as $l) {
91  if ($l->getLanguageCode() !== $ot->getMasterLanguage()) {
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  }
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...
This class represents a file property in a property form.
setSuffixes(array $a_suffixes)
loadLanguageModule(string $a_module)
Load language module.
static getInstance(int $obj_id)
+ 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.

References $lng, $tpl, initTranslationImportForm(), ilGlobalTemplateInterface\setContent(), ilGlobalTemplateInterface\setOnScreenMessage(), and ilLanguage\txt().

61  : void
62  {
63  $lng = $this->lng;
64  $tpl = $this->tpl;
65 
66  $this->tpl->setOnScreenMessage('info', $lng->txt("cont_trans_import_info"));
67  $form = $this->initTranslationImportForm();
68  $tpl->setContent($form->getHTML());
69  }
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...
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.
+ 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: