ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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

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

20  {
21  $this->mep = $a_mep;
22  }

Member Function Documentation

◆ executeCommand()

ilMediaPoolImportGUI::executeCommand ( )

Execute command.

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

References $cmd, $ilCtrl, and array.

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  }
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18
Create styles array
The data for the language used.

◆ importTranslation()

ilMediaPoolImportGUI::importTranslation ( )

Import translation.

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

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

98  {
99  global $ilCtrl, $lng;
100 
101  include_once("./Services/Export/classes/class.ilImport.php");
102  $imp = new ilImport();
103  $conf = $imp->getConfig("Modules/MediaPool");
104 
105  $target_lang = ilUtil::stripSlashes($_POST["import_lang"]);
106  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
107  $ot = ilObjectTranslation::getInstance($this->mep->getId());
108  if ($target_lang == $ot->getMasterLanguage())
109  {
110  ilUtil::sendFailure($lng->txt("mep_transl_master_language_not_allowed"), true);
111  $ilCtrl->redirect($this, "showTranslationImportForm");
112  }
113 
114  $conf->setTranslationImportMode($this->mep, $target_lang);
115  $imp->importObject(null, $_FILES["importfile"]["tmp_name"],
116  $_FILES["importfile"]["name"], "mep", "Modules/MediaPool");
117 //echo "h"; exit;
118  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
119  $ilCtrl->redirect($this, "showTranslationImportForm");
120  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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.
global $lng
Definition: privfeed.php:17
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 57 of file class.ilMediaPoolImportGUI.php.

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

Referenced by showTranslationImportForm().

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->mep->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("mep_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("mep_import_trans"));
89  $form->setFormAction($ilCtrl->getFormAction($this));
90 
91  return $form;
92  }
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(!is_array($argv)) $options
Create styles array
The data for the language used.
global $l
Definition: afr.php:30
global $lng
Definition: privfeed.php:17
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 45 of file class.ilMediaPoolImportGUI.php.

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

46  {
47  global $lng, $tpl;
48 
49  ilUtil::sendInfo($lng->txt("mep_trans_import_info"));
50  $form = $this->initTranslationImportForm();
51  $tpl->setContent($form->getHTML());
52  }
global $tpl
Definition: ilias.php:8
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
initTranslationImportForm()
Init translation input form.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

Field Documentation

◆ $lm

ilMediaPoolImportGUI::$lm
protected

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


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