ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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

 $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 19 of file class.ilLMImportGUI.php.

20 {
21 $this->lm = $a_lm;
22 }

Member Function Documentation

◆ executeCommand()

ilLMImportGUI::executeCommand ( )

Execute command.

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

28 {
29 global $ilCtrl;
30
31 $cmd = $ilCtrl->getCmd("showTranslationImportForm");
32
33 if (in_array($cmd, array("showTranslationImportForm", "importTranslation")))
34 {
35 $this->$cmd();
36 }
37 }
global $ilCtrl
Definition: ilias.php:18
$cmd
Definition: sahs_server.php:35

References $cmd, and $ilCtrl.

◆ importTranslation()

ilLMImportGUI::importTranslation ( )

Import translation.

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

98 {
99 global $ilCtrl, $lng;
100
101 include_once("./Services/Export/classes/class.ilImport.php");
102 $imp = new ilImport();
103 $conf = $imp->getConfig("Modules/LearningModule");
104
105 $target_lang = ilUtil::stripSlashes($_POST["import_lang"]);
106 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
107 $ot = ilObjectTranslation::getInstance($this->lm->getId());
108 if ($target_lang == $ot->getMasterLanguage())
109 {
110 ilUtil::sendFailure($lng->txt("cont_transl_master_language_not_allowed"), true);
111 $ilCtrl->redirect($this, "showTranslationImportForm");
112 }
113
114 $conf->setTranslationImportMode($this->lm, $target_lang);
115 $imp->importObject(null, $_FILES["importfile"]["tmp_name"],
116 $_FILES["importfile"]["name"], "lm", "Modules/LearningModule");
117//echo "h"; exit;
118 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
119 $ilCtrl->redirect($this, "showTranslationImportForm");
120 }
Import class.
static getInstance($a_obj_id)
Get instance.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST['username']
Definition: cron.php:12
global $lng
Definition: privfeed.php:40

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

+ Here is the call graph for this function:

◆ initTranslationImportForm()

ilLMImportGUI::initTranslationImportForm ( )

Init translation input form.

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

58 {
59 global $lng, $ilCtrl;
60
61 $lng->loadLanguageModule("meta");
62
63 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
64 $form = new ilPropertyFormGUI();
65
66 // import file
67 $fi = new ilFileInputGUI($lng->txt("file"), "importfile");
68 $fi->setSuffixes(array("zip"));
69 $fi->setRequired(true);
70 $fi->setSize(30);
71 $form->addItem($fi);
72
73 include_once("./Services/MetaData/classes/class.ilMDLanguageItem.php");
74 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
75 $ot = ilObjectTranslation::getInstance($this->lm->getId());
76 foreach ($ot->getLanguages() as $l)
77 {
78 if ($l["lang_code"] != $ot->getMasterLanguage())
79 {
80 $options[$l["lang_code"]] = $lng->txt("meta_l_".$l["lang_code"]);
81 }
82 }
83 $si = new ilSelectInputGUI($lng->txt("cont_import_lang"), "import_lang");
84 $si->setOptions($options);
85 $form->addItem($si);
86
87 $form->addCommandButton("importTranslation", $lng->txt("import"));
88 $form->setTitle($lng->txt("cont_import_trans"));
89 $form->setFormAction($ilCtrl->getFormAction($this));
90
91 return $form;
92 }
global $l
Definition: afr.php:30
This class represents a file property in a property form.
This class represents a property form user interface.
This class represents a selection list property in a property form.
if(!is_array($argv)) $options

References $ilCtrl, $l, $lng, $options, $si, and ilObjectTranslation\getInstance().

Referenced by showTranslationImportForm().

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

◆ showTranslationImportForm()

ilLMImportGUI::showTranslationImportForm ( )

Translation import.

Parameters

return

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

46 {
47 global $lng, $tpl;
48
49 ilUtil::sendInfo($lng->txt("cont_trans_import_info"));
50 $form = $this->initTranslationImportForm();
51 $tpl->setContent($form->getHTML());
52 }
global $tpl
Definition: ilias.php:8
initTranslationImportForm()
Init translation input form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

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

+ Here is the call graph for this function:

Field Documentation

◆ $lm

ilLMImportGUI::$lm
protected

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


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