107 : ?StandardForm {
108 $qtiParser = new \ilQTIParser(
109 $importdir,
110 $qtifile,
112 0,
113 []
114 );
115 $qtiParser->startParsing();
116 $founditems = &$qtiParser->getFoundItems();
117 if ($path_to_uploaded_file_in_temp_dir !== null && $founditems === []) {
119 $this->deleteUploadedImportFile($path_to_uploaded_file_in_temp_dir);
120 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'qpl_import_no_items'),
true);
121 return null;
122 }
123
124 $complete = 0;
125 $incomplete = 0;
126 foreach ($founditems as $item) {
127 if ($item['type'] !== '') {
128 $complete++;
129 } else {
130 $incomplete++;
131 }
132 }
133
134 if ($complete == 0) {
136 $this->deleteUploadedImportFile($path_to_uploaded_file_in_temp_dir);
137 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'qpl_import_non_ilias_files'),
true);
138 return null;
139 }
140
141 $options = [];
142 $values = [];
143 foreach ($founditems as $item) {
144 $options[$item['ident']] = "{$item['title']} ({$this->getLabelForQuestionType($item['type'])})";
145 $values[] = $item['ident'];
146 }
147 $select_questions = $this->ui_factory->input()->field()->multiSelect(
148 $this->
lng->txt(
'questions'),
149 $options
150 )->withValue($values);
151
152 return $this->ui_factory->input()->container()->form()->standard(
153 $this->
ctrl->getFormActionByClass(self::class, $form_cmd),
154 ['selected_questions' => $select_questions]
155 )->withSubmitLabel($this->
lng->txt(
'import'));
156 }
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively