ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ($a_lm)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 showTranslationImportForm ()
 Translation import. More...
 
 initTranslationImportForm ()
 Init translation input form. More...
 
 importTranslation ()
 Import translation. More...
 

Protected Attributes

 $ctrl
 
 $lng
 
 $tpl
 
 $lm
 

Detailed Description

Import related features for learning modules.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilLMImportGUI::__construct (   $a_lm)

Constructor.

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

References $DIC.

35  {
36  global $DIC;
37 
38  $this->ctrl = $DIC->ctrl();
39  $this->lng = $DIC->language();
40  $this->tpl = $DIC["tpl"];
41  $this->lm = $a_lm;
42  }
global $DIC
Definition: goto.php:24

Member Function Documentation

◆ executeCommand()

ilLMImportGUI::executeCommand ( )

Execute command.

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

References $ctrl.

48  {
49  $ilCtrl = $this->ctrl;
50 
51  $cmd = $ilCtrl->getCmd("showTranslationImportForm");
52 
53  if (in_array($cmd, array("showTranslationImportForm", "importTranslation"))) {
54  $this->$cmd();
55  }
56  }

◆ importTranslation()

ilLMImportGUI::importTranslation ( )

Import translation.

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

References $_POST, $ctrl, $lng, ilObjectTranslation\getInstance(), ilUtil\sendFailure(), and ilUtil\stripSlashes().

114  {
115  $ilCtrl = $this->ctrl;
116  $lng = $this->lng;
117 
118  $imp = new ilImport();
119  $conf = $imp->getConfig("Modules/LearningModule");
120 
121  $target_lang = ilUtil::stripSlashes($_POST["import_lang"]);
122  $ot = ilObjectTranslation::getInstance($this->lm->getId());
123  if ($target_lang == $ot->getMasterLanguage() || $target_lang == "") {
124  ilUtil::sendFailure($lng->txt("cont_transl_master_language_not_allowed"), true);
125  $ilCtrl->redirect($this, "showTranslationImportForm");
126  }
127 
128  $conf->setTranslationImportMode($this->lm, $target_lang);
129  $imp->importObject(
130  null,
131  $_FILES["importfile"]["tmp_name"],
132  $_FILES["importfile"]["name"],
133  "lm",
134  "Modules/LearningModule"
135  );
136  //echo "h"; exit;
137  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
138  $ilCtrl->redirect($this, "showTranslationImportForm");
139  }
Import class.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getInstance($a_obj_id)
Get instance.
$_POST["username"]
+ Here is the call graph for this function:

◆ initTranslationImportForm()

ilLMImportGUI::initTranslationImportForm ( )

Init translation input form.

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

References $ctrl, $lng, $si, ilObjectTranslation\getInstance(), and ilFileInputGUI\setSuffixes().

Referenced by showTranslationImportForm().

78  {
79  $lng = $this->lng;
80  $ilCtrl = $this->ctrl;
81 
82  $lng->loadLanguageModule("meta");
83 
84  $form = new ilPropertyFormGUI();
85 
86  // import file
87  $fi = new ilFileInputGUI($lng->txt("file"), "importfile");
88  $fi->setSuffixes(array("zip"));
89  $fi->setRequired(true);
90  $fi->setSize(30);
91  $form->addItem($fi);
92 
93  $ot = ilObjectTranslation::getInstance($this->lm->getId());
94  foreach ($ot->getLanguages() as $l) {
95  if ($l["lang_code"] != $ot->getMasterLanguage()) {
96  $options[$l["lang_code"]] = $lng->txt("meta_l_" . $l["lang_code"]);
97  }
98  }
99  $si = new ilSelectInputGUI($lng->txt("cont_import_lang"), "import_lang");
100  $si->setOptions($options);
101  $form->addItem($si);
102 
103  $form->addCommandButton("importTranslation", $lng->txt("import"));
104  $form->setTitle($lng->txt("cont_import_trans"));
105  $form->setFormAction($ilCtrl->getFormAction($this));
106 
107  return $form;
108  }
This class represents a property form user interface.
This class represents a file property in a property form.
static getInstance($a_obj_id)
Get instance.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showTranslationImportForm()

ilLMImportGUI::showTranslationImportForm ( )

Translation import.

Parameters

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

References $lng, $tpl, initTranslationImportForm(), and ilUtil\sendInfo().

65  {
66  $lng = $this->lng;
67  $tpl = $this->tpl;
68 
69  ilUtil::sendInfo($lng->txt("cont_trans_import_info"));
70  $form = $this->initTranslationImportForm();
71  $tpl->setContent($form->getHTML());
72  }
initTranslationImportForm()
Init translation input form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilLMImportGUI::$ctrl
protected

◆ $lm

ilLMImportGUI::$lm
protected

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

◆ $lng

ilLMImportGUI::$lng
protected

◆ $tpl

ilLMImportGUI::$tpl
protected

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

Referenced by showTranslationImportForm().


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