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(
'csv', $a_parent_gui->lng->txt(
'ass_create_export_test_results'), $this,
'createTestResultsExport');
28 if($a_parent_gui->object->getEnableArchiving() ==
true)
31 $a_parent_gui->lng->txt(
'ass_create_export_test_archive' ),
33 'createTestArchiveExport' 36 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
'Test',
'texp');
37 foreach($pl_names as $pl)
43 $plugin->setTest($this->obj);
46 $plugin->getFormatLabel(),
56 public function createTestExport()
64 require_once
'Modules/Test/classes/class.ilTestExport.php';
66 $test_exp->buildExportFile();
68 $ilCtrl->redirectByClass(
'iltestexportgui');
74 public function createTestResultsExport()
82 require_once
'Modules/Test/classes/class.ilTestExport.php';
84 $test_exp->buildExportFile();
86 $ilCtrl->redirectByClass(
'iltestexportgui');
93 if ($ilAccess->checkAccess(
"write",
"", $this->obj->ref_id))
95 include_once(
"./Modules/Test/classes/class.ilTestArchiver.php");
96 $test_id = $this->obj->getId();
99 require_once
'./Modules/Test/classes/class.ilTestScoring.php';
101 $best_solution = $scoring->calculateBestSolutionForTest();
103 require_once
'./Modules/Test/classes/class.ilTestPDFGenerator.php';
106 $archive_exp->handInTestBestSolution($best_solution,
'Best_Solution.pdf');
107 unlink(
'Best_Solution.pdf');
109 $archive_exp->updateTestArchive();
110 $archive_exp->compressTestArchive();
116 $ilCtrl->redirectByClass(
'iltestexportgui');
123 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
131 include_once
'Services/Form/classes/class.ilSelectInputGUI.php';
134 $ilToolbar->addInputItem(
$si,
true);
135 $ilToolbar->addFormButton($lng->txt(
"exp_create_file"),
"createExportFile");
140 $format = $format[0];
141 $ilToolbar->addFormButton($lng->txt(
"exp_create_file") .
" (" . $format[
"txt"] .
")",
"create_" . $format[
"key"]);
144 require_once
'class.ilTestArchiver.php';
147 $archive_files = array();
148 if( file_exists($archive_dir) && is_dir($archive_dir) )
150 $archive_files = scandir($archive_dir);
153 $export_dir = $this->obj->getExportDirectory();
154 $export_files = $this->obj->getExportFiles($export_dir);
156 if(count($export_files) > 0)
158 foreach($export_files as $exp_file)
160 $file_arr = explode(
"__", $exp_file);
161 array_push(
$data, array(
163 'size' => filesize($export_dir .
"/" . $exp_file),
164 'timestamp' => $file_arr[0]
169 if(count($archive_files) > 0)
171 foreach($archive_files as $exp_file)
173 if ($exp_file ==
'.' || $exp_file ==
'..')
177 $file_arr = explode(
"_", $exp_file);
178 array_push(
$data, array(
180 'size' => filesize($archive_dir.
"/".$exp_file),
181 'timestamp' => $file_arr[4]
186 require_once
'Modules/Test/classes/tables/class.ilTestExportTableGUI.php';
188 $table->setSelectAllCheckbox(
"file");
191 $table->addCustomColumn($c[
"txt"], $c[
"obj"], $c[
"func"]);
196 $table->addCustomMultiCommand($c[
"txt"],
"multi_".$c[
"func"]);
199 $table->setData(
$data);
200 $tpl->setContent($table->getHTML());
211 if(!isset(
$_POST[
'file']))
214 $ilCtrl->redirect($this,
'listExportFiles');
217 if(count(
$_POST[
'file']) > 1)
220 $ilCtrl->redirect($this,
'listExportFiles');
223 require_once
'class.ilTestArchiver.php';
227 $exportFile = $this->obj->getExportDirectory().
'/'.
$filename;
228 $archiveFile = $archiver->getZipExportDirectory().
'/'.
$filename;
230 if( file_exists($exportFile) )
235 if( file_exists($archiveFile) )
240 $ilCtrl->redirect($this,
'listExportFiles');
246 public function delete()
254 require_once
'class.ilTestArchiver.php';
258 $export_dir = $this->obj->getExportDirectory();
261 $file = basename($file);
262 $dir = substr($file, 0, strlen($file) - 4);
264 if( !strlen($file) || !strlen($dir) )
269 $exp_file = $export_dir.
'/'.
$file;
270 $arc_file = $archiveDir.
'/'.
$file;
271 $exp_dir = $export_dir.
'/'.$dir;
272 if(@is_file($exp_file))
276 if(@is_file($arc_file))
280 if(@is_dir($exp_dir))
286 $ilCtrl->redirect($this,
'listExportFiles');
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
getCustomMultiCommands()
Get custom multi commands.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
__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