33 public function __construct($a_parent_gui, $a_main_obj = null)
36 $ilPluginAdmin = $DIC[
'ilPluginAdmin'];
40 #$this->addFormat('xml', $a_parent_gui->lng->txt('ass_create_export_file'), $this, 'createTestExport'); 41 $this->
addFormat(
'xml', $a_parent_gui->lng->txt(
'ass_create_export_file'));
42 $this->
addFormat(
'xmlres', $a_parent_gui->lng->txt(
'ass_create_export_file_with_results'), $this,
'createTestExportWithResults');
43 $this->
addFormat(
'csv', $a_parent_gui->lng->txt(
'ass_create_export_test_results'), $this,
'createTestResultsExport');
44 $this->
addFormat(
'arc', $a_parent_gui->lng->txt(
'ass_create_export_test_archive'), $this,
'createTestArchiveExport');
45 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
'Test',
'texp');
46 foreach ($pl_names as $pl) {
63 require_once
'Modules/Test/classes/tables/class.ilTestExportTableGUI.php';
71 public function createTestExportWithResults()
79 $ilCtrl = $DIC[
'ilCtrl'];
81 require_once
'Modules/Test/classes/class.ilTestExportFactory.php';
83 $test_exp = $expFactory->getExporter(
'xml');
84 $test_exp->setResultExportingEnabledForTestExport(
true);
85 $test_exp->buildExportFile();
86 ilUtil::sendSuccess(
$lng->txt(
'exp_file_created'),
true);
87 $ilCtrl->redirectByClass(
'iltestexportgui');
93 public function createTestResultsExport()
101 $ilCtrl = $DIC[
'ilCtrl'];
103 require_once
'Modules/Test/classes/class.ilTestExportFactory.php';
105 $test_exp = $expFactory->getExporter(
'results');
106 $test_exp->buildExportFile();
107 ilUtil::sendSuccess(
$lng->txt(
'exp_file_created'),
true);
108 $ilCtrl->redirectByClass(
'iltestexportgui');
114 $ilAccess = $DIC[
'ilAccess'];
115 $ilCtrl = $DIC[
'ilCtrl'];
116 $ilDB = $DIC[
'ilDB'];
119 if ($ilAccess->checkAccess(
"write",
"", $this->obj->ref_id)) {
123 require_once
'Modules/Test/classes/class.ilTestEvaluation.php';
128 $participantData->setActiveIdsFilter(array_keys($allActivesPasses));
129 $participantData->load($this->obj->getTestId());
131 require_once
'Modules/Test/classes/class.ilTestArchiveService.php';
133 $archiveService->setParticipantData($participantData);
134 $archiveService->archivePassesByActives($allActivesPasses);
136 include_once(
"./Modules/Test/classes/class.ilTestArchiver.php");
137 $test_id = $this->obj->getId();
140 require_once
'./Modules/Test/classes/class.ilTestScoring.php';
142 $best_solution = $scoring->calculateBestSolutionForTest();
145 if (!is_dir($tmpFileName)) {
149 $directory_name = realpath($tmpFileName);
150 $file_name = $directory_name . DIRECTORY_SEPARATOR .
'Best_Solution.pdf';
152 require_once
'./Modules/Test/classes/class.ilTestPDFGenerator.php';
155 $archive_exp->handInTestBestSolution($best_solution, $file_name);
158 $archive_exp->updateTestArchive();
159 $archive_exp->compressTestArchive();
163 $ilCtrl->redirectByClass(
'iltestexportgui');
170 $ilToolbar = $DIC[
'ilToolbar'];
171 $ilCtrl = $DIC[
'ilCtrl'];
174 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
178 $options[
$f[
"key"]] = $f[
"txt"];
180 include_once
'Services/Form/classes/class.ilSelectInputGUI.php';
182 $si->setOptions($options);
183 $ilToolbar->addInputItem(
$si,
true);
184 $ilToolbar->addFormButton(
$lng->txt(
"exp_create_file"),
"createExportFile");
188 $ilToolbar->addFormButton(
$lng->txt(
"exp_create_file") .
" (" .
$format[
"txt"] .
")",
"create_" .
$format[
"key"]);
191 require_once
'class.ilTestArchiver.php';
194 $archive_files = array();
196 if (file_exists($archive_dir) && is_dir($archive_dir)) {
197 $archive_files = scandir($archive_dir);
200 $export_dir = $this->obj->getExportDirectory();
201 $export_files = $this->obj->getExportFiles($export_dir);
203 if (count($export_files) > 0) {
204 foreach ($export_files as $exp_file) {
205 $file_arr = explode(
"__", $exp_file);
206 if ($file_arr[0] == $exp_file) {
210 array_push(
$data, array(
212 'size' => filesize($export_dir .
"/" . $exp_file),
213 'timestamp' => $file_arr[0]
218 if (count($archive_files) > 0) {
219 foreach ($archive_files as $exp_file) {
220 if ($exp_file ==
'.' || $exp_file ==
'..') {
223 $file_arr = explode(
"_", $exp_file);
227 'size' => filesize($archive_dir .
"/" . $exp_file),
228 'timestamp' => $file_arr[4],
234 $table->setSelectAllCheckbox(
"file");
236 $table->addCustomColumn($c[
"txt"], $c[
"obj"], $c[
"func"]);
240 $table->addCustomMultiCommand($c[
"txt"],
"multi_" . $c[
"func"]);
243 $table->resetFormats();
244 foreach ($this->formats as
$format) {
245 $table->addFormat($format[
'key']);
248 $table->setData(
$data);
249 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
'no_manual_feedback_export_info'),
true);
250 $tpl->setContent($table->getHTML());
261 $ilCtrl = $DIC[
'ilCtrl'];
267 if (!isset(
$_POST[
'file'])) {
269 $ilCtrl->redirect($this,
'listExportFiles');
272 if (count(
$_POST[
'file']) > 1) {
274 $ilCtrl->redirect($this,
'listExportFiles');
277 require_once
'class.ilTestArchiver.php';
281 $exportFile = $this->obj->getExportDirectory() .
'/' .
$filename;
282 $archiveFile = $archiver->getZipExportDirectory() .
'/' .
$filename;
284 if (file_exists($exportFile)) {
288 if (file_exists($archiveFile)) {
292 $ilCtrl->redirect($this,
'listExportFiles');
298 public function delete()
306 $ilCtrl = $DIC[
'ilCtrl'];
308 require_once
'class.ilTestArchiver.php';
312 $export_dir = $this->obj->getExportDirectory();
313 foreach (
$_POST[
'file'] as $file) {
314 $file = basename($file);
315 $dir = substr($file, 0, strlen($file) - 4);
317 if (!strlen($file) || !strlen($dir)) {
321 $exp_file = $export_dir .
'/' . $file;
322 $arc_file = $archiveDir .
'/' . $file;
323 $exp_dir = $export_dir .
'/' . $dir;
324 if (@is_file($exp_file)) {
327 if (@is_file($arc_file)) {
330 if (@is_dir($exp_dir)) {
334 ilUtil::sendSuccess(
$lng->txt(
'msg_deleted_export_files'),
true);
335 $ilCtrl->redirect($this,
'listExportFiles');
static makeDirParents($a_dir)
Create a new directory and all parent directories.
createTestArchiveExport()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const PDF_USER_RESULT
PDF Purposes.
addFormat($a_key, $a_txt="", $a_call_obj=null, $a_call_func="")
Add formats.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getCustomColumns()
Get custom columns.
Export User Interface Class.
getZipExportDirectory()
Return the export directory, where zips are placed.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
getCustomMultiCommands()
Get custom multi commands.
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
__construct(Container $dic, ilPlugin $plugin)
__construct($a_parent_gui, $a_main_obj=null)
Constuctor.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static prepareGenerationRequest($service, $purpose)
Prepare the content processing for a PDF generation request This function should be called as in a re...
getParentGUI()
get parent gui
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.