mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
Export now saves file in correct course file area (ie, the current one).
Export now works for published courses where the teacher is not a teacher on the 'remote' course. See bug #3996 and bug #3985
This commit is contained in:
parent
7443a8c43e
commit
cc93459372
2 changed files with 9 additions and 3 deletions
|
@ -505,7 +505,7 @@ function quiz_print_cat_question_list($course, $categoryid, $quizid,
|
|||
helpbutton("import", $strimportquestions, "quiz");
|
||||
echo ' | ';
|
||||
}
|
||||
echo '<a href="export.php?category='.$category->id.'">'.$strexportquestions.'</a>';
|
||||
echo "<a href=\"export.php?category={$category->id}&courseid={$course->id}\">$strexportquestions</a>";
|
||||
helpbutton("export", $strexportquestions, "quiz");
|
||||
echo '</font></td></tr>';
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
require_once("locallib.php");
|
||||
|
||||
$category = required_param('category',PARAM_INT);
|
||||
$courseid = required_param('courseid',PARAM_INT);
|
||||
$format = optional_param('format','', PARAM_CLEANFILE );
|
||||
$exportfilename = optional_param('exportfilename','',PARAM_CLEANFILE );
|
||||
|
||||
|
@ -12,10 +13,14 @@
|
|||
error("This wasn't a valid category!");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $category->course)) {
|
||||
if (! $categorycourse = get_record("course", "id", $category->course)) {
|
||||
error("This category doesn't belong to a valid course!");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $courseid)) {
|
||||
error("Course does not exist!");
|
||||
}
|
||||
|
||||
require_login($course->id, false);
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
|
@ -110,7 +115,7 @@
|
|||
echo "<tr><td align=\"right\">\n";
|
||||
print_string("category", "quiz");
|
||||
echo ":</td><td>";
|
||||
echo str_replace(' ', '', $categories[$category->id]) . " ($course->shortname)";
|
||||
echo str_replace(' ', '', $category->name) . " ($categorycourse->shortname)";
|
||||
echo "</td></tr>\n";
|
||||
|
||||
echo "<tr><td align=\"right\">";
|
||||
|
@ -128,6 +133,7 @@
|
|||
|
||||
echo "<tr><td align=\"center\" colspan=\"2\">";
|
||||
echo " <input type=\"hidden\" name=\"category\" value=\"$category->id\" />";
|
||||
echo " <input type=\"hidden\" name=\"courseid\" value=\"$course->id\" />";
|
||||
echo " <input type=\"submit\" name=\"save\" value=\"".get_string("exportquestions","quiz")."\" />";
|
||||
echo "</td></tr>\n";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue