4 require_once
'Services/Export/classes/class.ilExportGUI.php';
20 public function __construct($a_parent_gui, $a_main_obj = null)
23 $ilPluginAdmin = $DIC[
'ilPluginAdmin'];
25 parent::__construct($a_parent_gui, $a_main_obj);
27 #$this->addFormat('xml', $a_parent_gui->lng->txt('ass_create_export_file'), $this, 'createTestExport'); 28 $this->
addFormat(
'xml', $a_parent_gui->lng->txt(
'ass_create_export_file'));
29 $this->
addFormat(
'xmlres', $a_parent_gui->lng->txt(
'ass_create_export_file_with_results'), $this,
'createTestExportWithResults');
30 $this->
addFormat(
'csv', $a_parent_gui->lng->txt(
'ass_create_export_test_results'), $this,
'createTestResultsExport');
31 $this->
addFormat(
'arc', $a_parent_gui->lng->txt(
'ass_create_export_test_archive'), $this,
'createTestArchiveExport');
32 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
'Test',
'texp');
33 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()
71 require_once
'Modules/Test/classes/class.ilTestExportFactory.php';
73 $test_exp = $expFactory->getExporter(
'xml');
74 $test_exp->setResultExportingEnabledForTestExport(
true);
75 $test_exp->buildExportFile();
76 ilUtil::sendSuccess(
$lng->txt(
'exp_file_created'),
true);
77 $ilCtrl->redirectByClass(
'iltestexportgui');
83 public function createTestResultsExport()
93 require_once
'Modules/Test/classes/class.ilTestExportFactory.php';
95 $test_exp = $expFactory->getExporter(
'results');
96 $test_exp->buildExportFile();
97 ilUtil::sendSuccess(
$lng->txt(
'exp_file_created'),
true);
98 $ilCtrl->redirectByClass(
'iltestexportgui');
104 $ilAccess = $DIC[
'ilAccess'];
106 $ilDB = $DIC[
'ilDB'];
109 if ($ilAccess->checkAccess(
"write",
"", $this->obj->ref_id)) {
113 require_once
'Modules/Test/classes/class.ilTestEvaluation.php';
117 require_once
'Modules/Test/classes/class.ilTestParticipantData.php';
119 $participantData->setActiveIdsFilter(array_keys($allActivesPasses));
120 $participantData->load($this->obj->getTestId());
122 require_once
'Modules/Test/classes/class.ilTestArchiveService.php';
124 $archiveService->setParticipantData($participantData);
125 $archiveService->archivePassesByActives($allActivesPasses);
127 include_once(
"./Modules/Test/classes/class.ilTestArchiver.php");
128 $test_id = $this->obj->getId();
131 require_once
'./Modules/Test/classes/class.ilTestScoring.php';
133 $best_solution = $scoring->calculateBestSolutionForTest();
136 if (!is_dir($tmpFileName)) {
140 $directory_name = realpath($tmpFileName);
141 $file_name = $directory_name . DIRECTORY_SEPARATOR .
'Best_Solution.pdf';
143 require_once
'./Modules/Test/classes/class.ilTestPDFGenerator.php';
146 $archive_exp->handInTestBestSolution($best_solution, $file_name);
149 $archive_exp->updateTestArchive();
150 $archive_exp->compressTestArchive();
154 $ilCtrl->redirectByClass(
'iltestexportgui');
161 $ilToolbar = $DIC[
'ilToolbar'];
165 $ilToolbar->setFormAction(
$ilCtrl->getFormAction($this));
171 include_once
'Services/Form/classes/class.ilSelectInputGUI.php';
174 $ilToolbar->addInputItem(
$si,
true);
175 $ilToolbar->addFormButton(
$lng->txt(
"exp_create_file"),
"createExportFile");
179 $ilToolbar->addFormButton(
$lng->txt(
"exp_create_file") .
" (" .
$format[
"txt"] .
")",
"create_" .
$format[
"key"]);
182 require_once
'class.ilTestArchiver.php';
185 $archive_files = array();
186 if (file_exists($archive_dir) && is_dir($archive_dir)) {
187 $archive_files = scandir($archive_dir);
190 $export_dir = $this->obj->getExportDirectory();
191 $export_files = $this->obj->getExportFiles($export_dir);
193 if (count($export_files) > 0) {
194 foreach ($export_files as $exp_file) {
195 $file_arr = explode(
"__", $exp_file);
196 if($file_arr[0] == $exp_file)
continue;
198 array_push(
$data, array(
200 'size' => filesize($export_dir .
"/" . $exp_file),
201 'timestamp' => $file_arr[0]
206 if (count($archive_files) > 0) {
207 foreach ($archive_files as $exp_file) {
208 if ($exp_file ==
'.' || $exp_file ==
'..') {
211 $file_arr = explode(
"_", $exp_file);
212 array_push(
$data, array(
214 'size' => filesize($archive_dir .
"/" . $exp_file),
215 'timestamp' => $file_arr[4]
221 $table->setSelectAllCheckbox(
"file");
223 $table->addCustomColumn($c[
"txt"], $c[
"obj"], $c[
"func"]);
227 $table->addCustomMultiCommand($c[
"txt"],
"multi_" . $c[
"func"]);
248 if (!isset(
$_POST[
'file'])) {
250 $ilCtrl->redirect($this,
'listExportFiles');
253 if (count(
$_POST[
'file']) > 1) {
255 $ilCtrl->redirect($this,
'listExportFiles');
258 require_once
'class.ilTestArchiver.php';
262 $exportFile = $this->obj->getExportDirectory() .
'/' .
$filename;
263 $archiveFile = $archiver->getZipExportDirectory() .
'/' .
$filename;
265 if (file_exists($exportFile)) {
269 if (file_exists($archiveFile)) {
273 $ilCtrl->redirect($this,
'listExportFiles');
279 public function delete()
289 require_once
'class.ilTestArchiver.php';
293 $export_dir = $this->obj->getExportDirectory();
294 foreach (
$_POST[
'file'] as $file) {
295 $file = basename($file);
296 $dir = substr($file, 0, strlen($file) - 4);
298 if (!strlen($file) || !strlen($dir)) {
302 $exp_file = $export_dir .
'/' . $file;
303 $arc_file = $archiveDir .
'/' . $file;
304 $exp_dir = $export_dir .
'/' . $dir;
305 if (@is_file($exp_file)) {
308 if (@is_file($arc_file)) {
311 if (@is_dir($exp_dir)) {
315 ilUtil::sendSuccess(
$lng->txt(
'msg_deleted_export_files'),
true);
316 $ilCtrl->redirect($this,
'listExportFiles');
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.
getCustomMultiCommands()
Get custom multi commands.
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
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
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.