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