Permalink
Browse files

MDL-33547: Fix for mod_assign portfolio export for a list of files.

This will fix any submission or feedback plugin using render_area_files
to show a list of files.
  • Loading branch information...
1 parent 4db0616 commit 509e59ca38a6d17d49a2dd7920f9af7fcc87ff11 Damyon Wiese committed Jun 6, 2012
Showing with 3 additions and 13 deletions.
  1. +0 −10 mod/assign/locallib.php
  2. +2 −2 mod/assign/portfolio_callback.php
  3. +1 −1 mod/assign/renderable.php
View
@@ -39,12 +39,6 @@
define('ASSIGN_FILTER_SINGLE_USER', 'singleuser');
define('ASSIGN_FILTER_REQUIRE_GRADING', 'require_grading');
-/**
- * File areas for assignment portfolio if enabled
- */
-define('ASSIGN_FILEAREA_PORTFOLIO_FILES', 'portfolio_files');
-
-
/** Include accesslib.php */
require_once($CFG->libdir.'/accesslib.php');
/** Include formslib.php */
@@ -53,8 +47,6 @@
require_once($CFG->dirroot . '/repository/lib.php');
/** Include local mod_form.php */
require_once($CFG->dirroot.'/mod/assign/mod_form.php');
-/** Include portfoliolib.php */
-require_once($CFG->libdir . '/portfoliolib.php');
/** gradelib.php */
require_once($CFG->libdir.'/gradelib.php');
/** grading lib.php */
@@ -2275,8 +2267,6 @@ public function render_area_files($component, $area, $submissionid) {
$submissionid = $submission->id;
}
-
-
$fs = get_file_storage();
$browser = get_file_browser();
$files = $fs->get_area_files($this->get_context()->id, $component, $area , $submissionid , "timemodified", false);
@@ -69,6 +69,7 @@ public static function expected_callbackargs() {
'cmid' => true,
'sid' => false,
'area' => false,
+ 'component' => false,
'fileid' => false,
'plugin' => false,
'editor' => false,
@@ -105,11 +106,10 @@ public function load_data() {
}
-
// export either an area of files or a single file (see function for more detail)
// the first arg is an id or null. If it is an id, the rest of the args are ignored
// if it is null, the rest of the args are used to load a list of files from get_areafiles
- $this->set_file_and_format_data($this->fileid, $context->id, 'mod_assign', $this->area, $this->sid, 'timemodified', false);
+ $this->set_file_and_format_data($this->fileid, $context->id, $this->component, $this->area, $this->sid, 'timemodified', false);
}
@@ -473,7 +473,7 @@ public function __construct(context $context, $sid, $filearea, $component) {
require_once($CFG->libdir . '/portfoliolib.php');
if (count($files) >= 1 && has_capability('mod/assign:exportownsubmission', $this->context)) {
$button = new portfolio_add_button();
- $button->set_callback_options('assign_portfolio_caller', array('cmid' => $this->cm->id, 'sid'=>$sid, 'area'=>$filearea), '/mod/assign/portfolio_callback.php');
+ $button->set_callback_options('assign_portfolio_caller', array('cmid' => $this->cm->id, 'sid'=>$sid, 'area'=>$filearea, 'component'=>$component), '/mod/assign/portfolio_callback.php');
$button->reset_formats();
$this->portfolioform = $button->to_html(PORTFOLIO_ADD_TEXT_LINK);
}

0 comments on commit 509e59c

Please sign in to comment.