50 $ilTabs = $DIC[
'ilTabs'];
51 $ilToolbar = $DIC[
'ilToolbar'];
57 $this->parent_gui = $parent_gui;
58 $this->parent_object = $parent_gui->object;
59 $this->tabs_gui = $this->parent_gui->tabs_gui;
60 $this->toolbar = $ilToolbar;
63 $this->lng->loadLanguageModule(
'user');
65 if (!$this->
ilAccess->checkaccess(
"write",
"", $this->parent_gui->object->getRefId())) {
75 $cmd = $this->ctrl->getCmd();
82 $this->tabs_gui->clearTargets();
83 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTarget($this,
'chooseImport'));
87 $this->tabs_gui->clearTargets();
88 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTarget($this,
'chooseImport'));
99 $this->ctrl->redirectByClass(
'ilinfoscreengui',
'');
102 $this->tabs_gui->setTabActive(
'view_content');
103 $this->tabs_gui->removeSubTab(
"page_editor");
104 $this->tabs_gui->removeSubTab(
"ordering");
107 $this->toolbar->addButton($this->lng->txt(
"simple_import"), $this->ctrl->getLinkTargetByClass(
"ilOrgUnitSimpleImportGUI",
"importScreen"));
108 $this->toolbar->addButton($this->lng->txt(
"simple_user_import"), $this->ctrl->getLinkTargetByClass(
"ilOrgUnitSimpleUserImportGUI",
"userImportScreen"));
115 $this->tpl->setContent(
$form->getHTML());
122 $input =
new ilFileInputGUI($this->lng->txt(
"import_xml_file"),
"import_file");
124 $input->setSuffixes(
array(
'zip',
'xml'));
125 $form->addItem($input);
126 $form->setFormAction($this->ctrl->getFormAction($this));
127 $form->addCommandButton($submit_action, $this->lng->txt(
"import"));
136 if (!
$form->checkInput()) {
137 $this->tpl->setContent(
$form->getHTML());
142 $file_path =
$file[
"tmp_name"];
143 $file_type = pathinfo(
$file[
"name"], PATHINFO_EXTENSION);
144 $file_name = pathinfo(
$file[
"name"], PATHINFO_FILENAME);
146 if ($file_type ==
"zip") {
147 $extract_path = $file_path .
'_extracted/';
148 $extracted_file = $extract_path . $file_name .
'/manifest.xml';
150 $zip =
new ZipArchive();
151 $res = $zip->open($file_path);
153 $zip->extractTo($extract_path);
156 if (file_exists($extracted_file)) {
157 $file_path = $extracted_file;
162 $importer->simpleImport($file_path);
164 $this->
ilLog->
write($e->getMessage() .
" - " . $e->getTraceAsString());
166 $this->ctrl->redirect($this,
"render");
177 if (!$importer->hasErrors() && !$importer->hasWarnings()) {
178 $stats = $importer->getStats();
181 if ($importer->hasWarnings()) {
182 $msg = $this->lng->txt(
"import_terminated_with_warnings") .
" <br/>";
183 foreach ($importer->getWarnings() as
$warning) {
184 $msg .=
"-" . $this->lng->txt(
$warning[
"lang_var"]) .
" (Import ID: " .
$warning[
"import_id"] .
")<br />";
188 if ($importer->hasErrors()) {
189 $msg = $this->lng->txt(
"import_terminated_with_errors") .
"<br/>";
190 foreach ($importer->getErrors() as
$warning) {
191 $msg .=
"- " . $this->lng->txt(
$warning[
"lang_var"]) .
" (Import ID: " .
$warning[
"import_id"] .
")<br />";
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Class ilOrgUnitSimpleImportGUI.
write($a_msg, $a_log_level=null)
logging
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
foreach($_POST as $key=> $value) $res
checkAccess($a_permission, $a_cmd, $a_ref_id, $a_type="", $a_obj_id="", $a_tree_id="")
check access for an object (provide $a_type and $a_obj_id if available for better performance)(option...
if(isset($_POST['submit'])) $form
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilOrgUnitSimpleImport.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
displayImportResults($importer)