23 protected function run(array $params) : void
26 $DIC->language()->loadLanguageModule(
'orgu');
30 $xml = simplexml_load_string($params[
'OrgUnitTree']);
33 foreach (
$xml->children() as $ou_id => $node) {
34 $importer->simpleImportElement(simplexml_load_string($node->asXML()));
37 throw new \ilSoapPluginException(
"Could not Read the XML File");
40 if (count($importer->getErrors()) || count($importer->getWarnings())) {
42 if ($importer->hasWarnings()) {
43 $arr_msg[] =
$DIC->language()->txt(
"import_terminated_with_warnings");
44 foreach ($importer->getWarnings() as $warning) {
45 $arr_msg[$warning[
"import_id"]] =
$DIC->language()->txt($warning[
"lang_var"]) .
" (Import ID: " . $warning[
"import_id"] .
")";
48 if ($importer->hasErrors()) {
49 $arr_msg[] =
$DIC->language()->txt(
"import_terminated_with_errors");
50 foreach ($importer->getErrors() as $error) {
51 $arr_msg[$error[
"import_id"]] =
$DIC->language()->txt($error[
"lang_var"]) .
" (Import ID: " . $error[
"import_id"] .
")";
55 throw new \ilSoapPluginException(implode(
" / ", $arr_msg));
65 return "importOrgUnitsSimpleXML";
92 return "Imports ILIAS Organisational Units (SimpleXML)";
An exception for terminatinating execution or to throw for unit testing.
getAdditionalInputParams()
getOutputParams()
Get the output parameters in the same format as the input parameters.array
getDocumentation()
Get the documentation of this method.string
Class ilOrgUnitSimpleImport.