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) {
37 $plugin->setTest($this->obj);
40 $plugin->getFormatLabel(),
52 require_once
'Modules/Test/classes/tables/class.ilTestExportTableGUI.php';
60 public function createTestExportWithResults()
68 require_once
'Modules/Test/classes/class.ilTestExportFactory.php';
70 $test_exp = $expFactory->getExporter(
'xml');
71 $test_exp->setResultExportingEnabledForTestExport(
true);
72 $test_exp->buildExportFile();
74 $ilCtrl->redirectByClass(
'iltestexportgui');
80 public function createTestResultsExport()
88 require_once
'Modules/Test/classes/class.ilTestExportFactory.php';
90 $test_exp = $expFactory->getExporter(
'results');
91 $test_exp->buildExportFile();
93 $ilCtrl->redirectByClass(
'iltestexportgui');
100 if ($ilAccess->checkAccess(
"write",
"", $this->obj->ref_id)) {
102 require_once
'Services/PDFGeneration/classes/class.ilPDFGeneration.php';
105 require_once
'Modules/Test/classes/class.ilTestEvaluation.php';
109 require_once
'Modules/Test/classes/class.ilTestParticipantData.php';
111 $participantData->setActiveIds(array_keys($allActivesPasses));
112 $participantData->load($this->obj->getTestId());
114 require_once
'Modules/Test/classes/class.ilTestArchiveService.php';
116 $archiveService->setParticipantData($participantData);
117 $archiveService->archivePassesByActives($allActivesPasses);
119 include_once(
"./Modules/Test/classes/class.ilTestArchiver.php");
120 $test_id = $this->obj->getId();
123 require_once
'./Modules/Test/classes/class.ilTestScoring.php';
125 $best_solution = $scoring->calculateBestSolutionForTest();
128 if (!is_dir($tmpFileName)) {
132 $directory_name = realpath($tmpFileName);
133 $file_name = $directory_name . DIRECTORY_SEPARATOR .
'Best_Solution.pdf';
135 require_once
'./Modules/Test/classes/class.ilTestPDFGenerator.php';
138 $archive_exp->handInTestBestSolution($best_solution, $file_name);
141 $archive_exp->updateTestArchive();
142 $archive_exp->compressTestArchive();
146 $ilCtrl->redirectByClass(
'iltestexportgui');
153 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
159 include_once
'Services/Form/classes/class.ilSelectInputGUI.php';
162 $ilToolbar->addInputItem(
$si,
true);
163 $ilToolbar->addFormButton($lng->txt(
"exp_create_file"),
"createExportFile");
167 $ilToolbar->addFormButton($lng->txt(
"exp_create_file") .
" (" .
$format[
"txt"] .
")",
"create_" .
$format[
"key"]);
170 require_once
'class.ilTestArchiver.php';
173 $archive_files =
array();
174 if (file_exists($archive_dir) && is_dir($archive_dir)) {
175 $archive_files = scandir($archive_dir);
178 $export_dir = $this->obj->getExportDirectory();
179 $export_files = $this->obj->getExportFiles($export_dir);
181 if (count($export_files) > 0) {
182 foreach ($export_files as $exp_file) {
183 $file_arr = explode(
"__", $exp_file);
186 'size' => filesize($export_dir .
"/" . $exp_file),
187 'timestamp' => $file_arr[0]
192 if (count($archive_files) > 0) {
193 foreach ($archive_files as $exp_file) {
194 if ($exp_file ==
'.' || $exp_file ==
'..') {
197 $file_arr = explode(
"_", $exp_file);
200 'size' => filesize($archive_dir .
"/" . $exp_file),
201 'timestamp' => $file_arr[4]
207 $table->setSelectAllCheckbox(
"file");
209 $table->addCustomColumn($c[
"txt"], $c[
"obj"], $c[
"func"]);
213 $table->addCustomMultiCommand($c[
"txt"],
"multi_" . $c[
"func"]);
217 $tpl->setContent(
$table->getHTML());
232 if (!isset(
$_POST[
'file'])) {
234 $ilCtrl->redirect($this,
'listExportFiles');
237 if (count(
$_POST[
'file']) > 1) {
239 $ilCtrl->redirect($this,
'listExportFiles');
242 require_once
'class.ilTestArchiver.php';
246 $exportFile = $this->obj->getExportDirectory() .
'/' .
$filename;
247 $archiveFile = $archiver->getZipExportDirectory() .
'/' .
$filename;
249 if (file_exists($exportFile)) {
253 if (file_exists($archiveFile)) {
257 $ilCtrl->redirect($this,
'listExportFiles');
263 public function delete()
271 require_once
'class.ilTestArchiver.php';
275 $export_dir = $this->obj->getExportDirectory();
277 $file = basename($file);
278 $dir = substr($file, 0, strlen($file) - 4);
280 if (!strlen($file) || !strlen($dir)) {
284 $exp_file = $export_dir .
'/' .
$file;
285 $arc_file = $archiveDir .
'/' .
$file;
286 $exp_dir = $export_dir .
'/' . $dir;
287 if (@is_file($exp_file)) {
290 if (@is_file($arc_file)) {
293 if (@is_dir($exp_dir)) {
298 $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.
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.
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
if(empty($password)) $table
__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
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options