Skip to content

Commit

Permalink
Export now saves file in correct course file area (ie, the current one).
Browse files Browse the repository at this point in the history
Export now works for published courses where the teacher is not
a teacher on the 'remote' course.
See bug #3996 and bug #3985
  • Loading branch information
thepurpleblob committed Aug 30, 2005
1 parent 7443a8c commit cc93459
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mod/quiz/editlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}&amp;courseid={$course->id}\">$strexportquestions</a>";
helpbutton("export", $strexportquestions, "quiz");
echo '</font></td></tr>';

Expand Down
10 changes: 8 additions & 2 deletions mod/quiz/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@
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 );

if (! $category = get_record("quiz_categories", "id", $category)) {
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)) {
Expand Down Expand Up @@ -110,7 +115,7 @@
echo "<tr><td align=\"right\">\n";
print_string("category", "quiz");
echo ":</td><td>";
echo str_replace('&nbsp;', '', $categories[$category->id]) . " ($course->shortname)";
echo str_replace('&nbsp;', '', $category->name) . " ($categorycourse->shortname)";
echo "</td></tr>\n";

echo "<tr><td align=\"right\">";
Expand All @@ -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";

Expand Down

0 comments on commit cc93459

Please sign in to comment.