ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilMediaPoolImportGUI Class Reference

Import related features for media pools (currently used for translation imports) More...

+ Collaboration diagram for ilMediaPoolImportGUI:

Public Member Functions

 __construct ($a_mep)
 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 media pools (currently used for translation imports)

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.ilMediaPoolImportGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilMediaPoolImportGUI::__construct (   $a_mep)

Constructor.

Definition at line 34 of file class.ilMediaPoolImportGUI.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->mep = $a_mep;
42  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ executeCommand()

ilMediaPoolImportGUI::executeCommand ( )

Execute command.

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

References $ctrl, and $ilCtrl.

48  {
50 
51  $cmd = $ilCtrl->getCmd("showTranslationImportForm");
52 
53  if (in_array($cmd, array("showTranslationImportForm", "importTranslation"))) {
54  $this->$cmd();
55  }
56  }
global $ilCtrl
Definition: ilias.php:18

◆ importTranslation()

ilMediaPoolImportGUI::importTranslation ( )

Import translation.

Definition at line 116 of file class.ilMediaPoolImportGUI.php.

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

117  {
119  $lng = $this->lng;
120 
121  include_once("./Services/Export/classes/class.ilImport.php");
122  $imp = new ilImport();
123  $conf = $imp->getConfig("Modules/MediaPool");
124 
125  $target_lang = ilUtil::stripSlashes($_POST["import_lang"]);
126  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
127  $ot = ilObjectTranslation::getInstance($this->mep->getId());
128  if ($target_lang == $ot->getMasterLanguage()) {
129  ilUtil::sendFailure($lng->txt("mep_transl_master_language_not_allowed"), true);
130  $ilCtrl->redirect($this, "showTranslationImportForm");
131  }
132 
133  $conf->setTranslationImportMode($this->mep, $target_lang);
134  $imp->importObject(
135  null,
136  $_FILES["importfile"]["tmp_name"],
137  $_FILES["importfile"]["name"],
138  "mep",
139  "Modules/MediaPool"
140  );
141  //echo "h"; exit;
142  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
143  $ilCtrl->redirect($this, "showTranslationImportForm");
144  }
Import class.
global $ilCtrl
Definition: ilias.php:18
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()

ilMediaPoolImportGUI::initTranslationImportForm ( )

Init translation input form.

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

References $ctrl, $form, $ilCtrl, $l, $lng, PHPMailer\PHPMailer\$options, $si, ilObjectTranslation\getInstance(), and ilFileInputGUI\setSuffixes().

Referenced by showTranslationImportForm().

78  {
79  $lng = $this->lng;
81 
82  $lng->loadLanguageModule("meta");
83 
84  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
85  $form = new ilPropertyFormGUI();
86 
87  // import file
88  $fi = new ilFileInputGUI($lng->txt("file"), "importfile");
89  $fi->setSuffixes(array("zip"));
90  $fi->setRequired(true);
91  $fi->setSize(30);
92  $form->addItem($fi);
93 
94  include_once("./Services/MetaData/classes/class.ilMDLanguageItem.php");
95  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
96  $ot = ilObjectTranslation::getInstance($this->mep->getId());
97  foreach ($ot->getLanguages() as $l) {
98  if ($l["lang_code"] != $ot->getMasterLanguage()) {
99  $options[$l["lang_code"]] = $lng->txt("meta_l_" . $l["lang_code"]);
100  }
101  }
102  $si = new ilSelectInputGUI($lng->txt("mep_import_lang"), "import_lang");
103  $si->setOptions($options);
104  $form->addItem($si);
105 
106  $form->addCommandButton("importTranslation", $lng->txt("import"));
107  $form->setTitle($lng->txt("mep_import_trans"));
108  $form->setFormAction($ilCtrl->getFormAction($this));
109 
110  return $form;
111  }
This class represents a selection list property in a property form.
This class represents a property form user interface.
This class represents a file property in a property form.
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form
global $l
Definition: afr.php:30
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()

ilMediaPoolImportGUI::showTranslationImportForm ( )

Translation import.

Parameters

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

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

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

Field Documentation

◆ $ctrl

ilMediaPoolImportGUI::$ctrl
protected

◆ $lm

ilMediaPoolImportGUI::$lm
protected

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

◆ $lng

ilMediaPoolImportGUI::$lng
protected

◆ $tpl

ilMediaPoolImportGUI::$tpl
protected

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

Referenced by showTranslationImportForm().


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