Skip to content

Commit

Permalink
MDL-72054 assign: pass course/coursemodule to assign_files
Browse files Browse the repository at this point in the history
  • Loading branch information
danmarsden committed Jul 1, 2021
1 parent a747fd3 commit ceb2da3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion mod/assign/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -6125,7 +6125,8 @@ public function submissions_open($userid = 0,
public function render_area_files($component, $area, $submissionid) {
global $USER;

return $this->get_renderer()->assign_files($this->context, $submissionid, $area, $component);
return $this->get_renderer()->assign_files($this->context, $submissionid, $area, $component,
$this->course, $this->coursemodule);

}

Expand Down
9 changes: 7 additions & 2 deletions mod/assign/renderable.php
Original file line number Diff line number Diff line change
Expand Up @@ -891,11 +891,16 @@ class assign_files implements renderable {
* @param int $sid
* @param string $filearea
* @param string $component
* @param stdClass $course
* @param stdClass $cm
*/
public function __construct(context $context, $sid, $filearea, $component) {
public function __construct(context $context, $sid, $filearea, $component, $course = null, $cm = null) {
global $CFG;
if (empty($course) || empty($cm)) {
list($context, $course, $cm) = get_context_info_array($context->id);
}

$this->context = $context;
list($context, $course, $cm) = get_context_info_array($context->id);
$this->cm = $cm;
$this->course = $course;
$fs = get_file_storage();
Expand Down
6 changes: 4 additions & 2 deletions mod/assign/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ class mod_assign_renderer extends plugin_renderer_base {
* @param int $userid
* @param string $filearea
* @param string $component
* @param stdClass $course
* @param stdClass $coursemodule
* @return string
*/
public function assign_files(context $context, $userid, $filearea, $component) {
return $this->render(new assign_files($context, $userid, $filearea, $component));
public function assign_files(context $context, $userid, $filearea, $component, $course = null, $coursemodule = null) {
return $this->render(new assign_files($context, $userid, $filearea, $component, $course, $coursemodule));
}

/**
Expand Down

0 comments on commit ceb2da3

Please sign in to comment.