4 require_once
'Services/Export/classes/class.ilExportGUI.php';
20 public function __construct($a_parent_gui, $a_main_obj = null)
22 global $ilPluginAdmin;
24 parent::__construct($a_parent_gui, $a_main_obj);
26 #$this->addFormat('xml', $a_parent_gui->lng->txt('ass_create_export_file'), $this, 'createTestExport'); 27 $this->
addFormat(
'xml', $a_parent_gui->lng->txt(
'ass_create_export_file'));
28 $this->
addFormat(
'xmlres', $a_parent_gui->lng->txt(
'ass_create_export_file_with_results'), $this,
'createTestExportWithResults');
29 $this->
addFormat(
'csv', $a_parent_gui->lng->txt(
'ass_create_export_test_results'), $this,
'createTestResultsExport');
30 $this->
addFormat(
'arc', $a_parent_gui->lng->txt(
'ass_create_export_test_archive' ), $this,
'createTestArchiveExport');
31 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
'Test',
'texp');
32 foreach($pl_names as $pl)
38 $plugin->setTest($this->obj);
41 $plugin->getFormatLabel(),
53 require_once
'Modules/Test/classes/tables/class.ilTestExportTableGUI.php';
61 public function createTestExportWithResults()
69 require_once
'Modules/Test/classes/class.ilTestExportFactory.php';
71 $test_exp = $expFactory->getExporter(
'xml');
72 $test_exp->setResultExportingEnabledForTestExport(
true);
73 $test_exp->buildExportFile();
75 $ilCtrl->redirectByClass(
'iltestexportgui');
81 public function createTestResultsExport()
89 require_once
'Modules/Test/classes/class.ilTestExportFactory.php';
91 $test_exp = $expFactory->getExporter(
'results');
92 $test_exp->buildExportFile();
94 $ilCtrl->redirectByClass(
'iltestexportgui');
101 if ($ilAccess->checkAccess(
"write",
"", $this->obj->ref_id))
104 require_once
'Services/PDFGeneration/classes/class.ilPDFGeneration.php';
107 require_once
'Modules/Test/classes/class.ilTestEvaluation.php';
111 require_once
'Modules/Test/classes/class.ilTestParticipantData.php';
113 $participantData->setActiveIds(array_keys($allActivesPasses));
114 $participantData->load($this->obj->getTestId());
116 require_once
'Modules/Test/classes/class.ilTestArchiveService.php';
118 $archiveService->setParticipantData($participantData);
119 $archiveService->archivePassesByActives($allActivesPasses);
121 include_once(
"./Modules/Test/classes/class.ilTestArchiver.php");
122 $test_id = $this->obj->getId();
125 require_once
'./Modules/Test/classes/class.ilTestScoring.php';
127 $best_solution = $scoring->calculateBestSolutionForTest();
130 if(!is_dir($tmpFileName))
135 $directory_name = realpath($tmpFileName);
136 $file_name = $directory_name . DIRECTORY_SEPARATOR .
'Best_Solution.pdf';
138 require_once
'./Modules/Test/classes/class.ilTestPDFGenerator.php';
141 $archive_exp->handInTestBestSolution($best_solution, $file_name);
144 $archive_exp->updateTestArchive();
145 $archive_exp->compressTestArchive();
151 $ilCtrl->redirectByClass(
'iltestexportgui');
158 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
166 include_once
'Services/Form/classes/class.ilSelectInputGUI.php';
169 $ilToolbar->addInputItem(
$si,
true);
170 $ilToolbar->addFormButton($lng->txt(
"exp_create_file"),
"createExportFile");
175 $format = $format[0];
176 $ilToolbar->addFormButton($lng->txt(
"exp_create_file") .
" (" . $format[
"txt"] .
")",
"create_" . $format[
"key"]);
179 require_once
'class.ilTestArchiver.php';
182 $archive_files =
array();
183 if( file_exists($archive_dir) && is_dir($archive_dir) )
185 $archive_files = scandir($archive_dir);
188 $export_dir = $this->obj->getExportDirectory();
189 $export_files = $this->obj->getExportFiles($export_dir);
191 if(count($export_files) > 0)
193 foreach($export_files as $exp_file)
195 $file_arr = explode(
"__", $exp_file);
198 'size' => filesize($export_dir .
"/" . $exp_file),
199 'timestamp' => $file_arr[0]
204 if(count($archive_files) > 0)
206 foreach($archive_files as $exp_file)
208 if ($exp_file ==
'.' || $exp_file ==
'..')
212 $file_arr = explode(
"_", $exp_file);
215 'size' => filesize($archive_dir.
"/".$exp_file),
216 'timestamp' => $file_arr[4]
222 $table->setSelectAllCheckbox(
"file");
225 $table->addCustomColumn($c[
"txt"], $c[
"obj"], $c[
"func"]);
230 $table->addCustomMultiCommand($c[
"txt"],
"multi_".$c[
"func"]);
233 $table->setData(
$data);
234 $tpl->setContent($table->getHTML());
250 if(!isset(
$_POST[
'file']))
253 $ilCtrl->redirect($this,
'listExportFiles');
256 if(count(
$_POST[
'file']) > 1)
259 $ilCtrl->redirect($this,
'listExportFiles');
262 require_once
'class.ilTestArchiver.php';
266 $exportFile = $this->obj->getExportDirectory().
'/'.
$filename;
267 $archiveFile = $archiver->getZipExportDirectory().
'/'.
$filename;
269 if( file_exists($exportFile) )
274 if( file_exists($archiveFile) )
279 $ilCtrl->redirect($this,
'listExportFiles');
285 public function delete()
293 require_once
'class.ilTestArchiver.php';
297 $export_dir = $this->obj->getExportDirectory();
300 $file = basename($file);
301 $dir = substr($file, 0, strlen($file) - 4);
303 if( !strlen($file) || !strlen($dir) )
308 $exp_file = $export_dir.
'/'.
$file;
309 $arc_file = $archiveDir.
'/'.
$file;
310 $exp_dir = $export_dir.
'/'.$dir;
311 if(@is_file($exp_file))
315 if(@is_file($arc_file))
319 if(@is_dir($exp_dir))
325 $ilCtrl->redirect($this,
'listExportFiles');
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
createTestArchiveExport()
Export User Interface Class.
Class ilTestPDFGenerator.
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.
if(!is_array($argv)) $options
getZipExportDirectory()
Return the export directory, where zips are placed.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
Create styles array
The data for the language used.
getCustomMultiCommands()
Get custom multi commands.
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
static prepareGeneration()
Prepare the PDF generation This initializes the purpose for MathJax rendering It has to be called bef...
Create new PHPExcel object
obj_idprivate
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
__construct($a_parent_gui, $a_main_obj=null)
Constuctor.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
getParentGUI()
get parent gui