SC#277
This commit is contained in:
@@ -130,7 +130,7 @@ $string['description'] = 'Description';
|
||||
$string['discrimination'] = 'Discrim. Index';
|
||||
$string['displayoptions'] = 'Display options';
|
||||
$string['download'] = 'Click to download the exported category file';
|
||||
$string['downloadextra'] = '(file is also stored in the course files in the /quiz folder)';
|
||||
$string['downloadextra'] = '(file is also stored in the course files in the /backupdata/quiz folder)';
|
||||
$string['duplicateresponse'] = 'This submission has been ignored because you gave an equivalent answer earlier.';
|
||||
$string['eachattemptbuildsonthelast'] = 'Each attempt builds on the last';
|
||||
$string['editcategories'] = 'Edit categories';
|
||||
|
||||
+2
-3
@@ -112,13 +112,12 @@
|
||||
// link to download the finished file
|
||||
$file_ext = $qformat->export_file_extension();
|
||||
$download_str = get_string( 'download', 'quiz' );
|
||||
$quizexportdir = get_string( 'exportfilename', 'quiz' );
|
||||
$downloadextra_str = get_string( 'downloadextra','quiz' );
|
||||
if ($CFG->slasharguments) {
|
||||
$efile = "{$CFG->wwwroot}/file.php/$course->id/$quizexportdir/$exportfilename".$file_ext."?forcedownload=1";
|
||||
$efile = "{$CFG->wwwroot}/file.php/".$qformat->question_get_export_dir()."/$exportfilename".$file_ext."?forcedownload=1";
|
||||
}
|
||||
else {
|
||||
$efile = "{$CFG->wwwroot}/file.php?file=/$course->id/$quizexportdir/$exportfilename".$file_ext."&forcedownload=1";
|
||||
$efile = "{$CFG->wwwroot}/file.php?file=/".$qformat->question_get_export_dir()."/$exportfilename".$file_ext."&forcedownload=1";
|
||||
}
|
||||
echo "</p><center><a href=\"$efile\">$download_str</a></center></p>";
|
||||
echo "</p><center><font size=\"-1\">$downloadextra_str</font></center></p>";
|
||||
|
||||
+9
-7
@@ -272,14 +272,10 @@ class qformat_default {
|
||||
global $CFG;
|
||||
|
||||
// create a directory for the exports (if not already existing)
|
||||
$dirname = get_string("exportfilename","quiz");
|
||||
$courseid = $this->course->id;
|
||||
$path = $CFG->dataroot.'/'.$courseid.'/'.$dirname;
|
||||
if (!is_dir($path)) {
|
||||
if (!mkdir($path, $CFG->directorypermissions)) {
|
||||
error( get_string('cannotcreatepath','quiz',$path) );
|
||||
}
|
||||
if (! $export_dir = make_upload_directory($this->question_get_export_dir())) {
|
||||
error( get_string('cannotcreatepath','quiz',$export_dir) );
|
||||
}
|
||||
$path = $CFG->dataroot.'/'.$this->question_get_export_dir();
|
||||
|
||||
// get the questions (from database) in this category
|
||||
// only get q's with no parents (no cloze subquestions specifically)
|
||||
@@ -347,6 +343,12 @@ class qformat_default {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
function question_get_export_dir() {
|
||||
$dirname = get_string("exportfilename","quiz");
|
||||
$path = $this->course->id.'/backupdata/'.$dirname; // backupdata is protected directory
|
||||
return $path;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -235,24 +235,14 @@ function handle_questions_media(&$questions, $path, $courseid) {
|
||||
function exportprocess($filename) {
|
||||
|
||||
global $CFG;
|
||||
$courseid = $this->course->id;
|
||||
|
||||
// create a directory for the exports (if not already existing)
|
||||
$dirname = get_string("exportfilename","quiz");
|
||||
$courseid = $this->course->id;
|
||||
$path = $CFG->dataroot.'/'.$courseid.'/'.$dirname;
|
||||
if (!is_dir($path)) {
|
||||
if (!mkdir($path, $CFG->directorypermissions)) {
|
||||
error("Cannot create path: $path");
|
||||
}
|
||||
if (!$export_dir = make_upload_directory($this->question_get_export_dir().'/'.$filename)) {
|
||||
error( get_string('cannotcreatepath','quiz',$export_dir) );
|
||||
}
|
||||
// create directory for this particular IMS export, if not already existing
|
||||
$path = $path."/".$filename;
|
||||
if (!is_dir($path)) {
|
||||
if (!mkdir($path, $CFG->directorypermissions)) {
|
||||
error("Cannot create path: $path");
|
||||
}
|
||||
}
|
||||
|
||||
$path = $CFG->dataroot.'/'.$this->question_get_export_dir().'/'.$filename;
|
||||
|
||||
// get the questions (from database) in this category
|
||||
// $questions = get_records("question","category",$this->category->id);
|
||||
$questions = get_questions_category( $this->category );
|
||||
@@ -281,6 +271,9 @@ function handle_questions_media(&$questions, $path, $courseid) {
|
||||
$smarty->error_reporting = 99;
|
||||
$expout = $smarty->fetch('imsmanifest.tpl');
|
||||
$filepath = $path.'/imsmanifest.xml';
|
||||
if (empty($expout)) {
|
||||
error("Unkown error - empty imsmanifest.xml");
|
||||
}
|
||||
if (!$fh=fopen($filepath,"w")) {
|
||||
error("Cannot open for writing: $filepath");
|
||||
}
|
||||
@@ -313,7 +306,7 @@ function handle_questions_media(&$questions, $path, $courseid) {
|
||||
zip_files( array($path), "$path.zip" );
|
||||
|
||||
// remove the temporary directory
|
||||
delDirContents( $path );
|
||||
remove_dir( $path );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -688,7 +681,7 @@ function xml_entitize(&$collection) {
|
||||
}
|
||||
}
|
||||
$smarty = new Smarty;
|
||||
$smarty->template_dir = "{$CFG->dirroot}/mod/quiz/format/qti2/templates";
|
||||
$smarty->template_dir = "{$CFG->dirroot}/question/format/qti2/templates";
|
||||
$smarty->compile_dir = "$path";
|
||||
return $smarty;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user