MDL-33791 Portfolio: Fixed security issue with passing file paths.
[moodle.git] / mod / assign / renderable.php
CommitLineData
bbd0e548
DW
1<?php
2// This file is part of Moodle - http://moodle.org/
3//
4// Moodle is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// Moodle is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
17/**
18 * This file contains the definition for the renderable classes for the assignment
19 *
20 * @package mod_assign
21 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
25defined('MOODLE_INTERNAL') || die();
26
27/**
28 * This class wraps the submit for grading confirmation page
29 * @package mod_assign
30 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
31 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
32 */
33class assign_submit_for_grading_page implements renderable {
34 /** @var array $notifications is a list of notification messages returned from the plugins*/
35 var $notifications = array();
36 /** @var int $coursemoduleid */
37 var $coursemoduleid = 0;
94f26900
DW
38 /** @var moodleform $confirmform */
39 var $confirmform = null;
bbd0e548
DW
40
41 /**
42 * Constructor
43 * @param string $notifications - Any mesages to display
9682626e 44 * @param int $coursemoduleid
bbd0e548 45 */
94f26900 46 public function __construct($notifications, $coursemoduleid, $confirmform) {
bbd0e548
DW
47 $this->notifications = $notifications;
48 $this->coursemoduleid = $coursemoduleid;
94f26900 49 $this->confirmform = $confirmform;
bbd0e548
DW
50 }
51
52}
53
bf78ebd6
DW
54/**
55 * Implements a renderable grading error notification
56 * @package mod_assign
57 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
58 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
59 */
60class assign_quickgrading_result implements renderable {
61 /** @var string $message is the message to display to the user */
62 var $message = '';
63 /** @var int $coursemoduleid */
64 var $coursemoduleid = 0;
65
66 /**
67 * Constructor
68 * @param string $message This is the message to display
69 */
70 public function __construct($message, $coursemoduleid) {
71 $this->message = $message;
72 $this->coursemoduleid = $coursemoduleid;
73 }
74
75}
76
bbd0e548
DW
77/**
78 * Implements a renderable grading options form
79 * @package mod_assign
80 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
81 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
82 */
83class assign_form implements renderable {
84 /** @var moodleform $form is the edit submission form */
85 var $form = null;
86 /** @var string $classname is the name of the class to assign to the container */
87 var $classname = '';
bf78ebd6
DW
88 /** @var string $jsinitfunction is an optional js function to add to the page requires */
89 var $jsinitfunction = '';
bbd0e548
DW
90
91 /**
92 * Constructor
bf78ebd6
DW
93 * @param string $classname This is the class name for the container div
94 * @param moodleform $form This is the moodleform
95 * @param string $jsinitfunction This is an optional js function to add to the page requires
bbd0e548 96 */
bf78ebd6 97 public function __construct($classname, moodleform $form, $jsinitfunction = '') {
bbd0e548
DW
98 $this->classname = $classname;
99 $this->form = $form;
bf78ebd6 100 $this->jsinitfunction = $jsinitfunction;
bbd0e548
DW
101 }
102
103}
104
bf78ebd6 105
bbd0e548
DW
106/**
107 * Implements a renderable user summary
108 * @package mod_assign
109 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
110 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
111 */
112class assign_user_summary implements renderable {
113 /** @var stdClass $user suitable for rendering with user_picture and fullname(). Must contain firstname, lastname, id and picture fields */
114 public $user = null;
115 /** @var int $courseid */
116 public $courseid;
117 /** @var bool $viewfullnames */
118 public $viewfullnames = false;
b473171a
DW
119 /** @var bool $blindmarking */
120 public $blindmarking = false;
121 /** @var int $uniqueidforuser */
122 public $uniqueidforuser;
bbd0e548
DW
123
124 /**
125 * Constructor
126 * @param stdClass $user
127 * @param int $courseid
128 * @param bool $viewfullnames
129 */
b473171a 130 public function __construct(stdClass $user, $courseid, $viewfullnames, $blindmarking, $uniqueidforuser) {
bbd0e548
DW
131 $this->user = $user;
132 $this->courseid = $courseid;
133 $this->viewfullnames = $viewfullnames;
b473171a
DW
134 $this->blindmarking = $blindmarking;
135 $this->uniqueidforuser = $uniqueidforuser;
bbd0e548
DW
136 }
137}
138
139/**
140 * Implements a renderable feedback plugin feedback
141 * @package mod_assign
142 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
143 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
144 */
145class assign_feedback_plugin_feedback implements renderable {
146 /** @var int SUMMARY */
147 const SUMMARY = 10;
148 /** @var int FULL */
149 const FULL = 20;
150
151 /** @var assign_submission_plugin $plugin */
152 var $plugin = null;
153 /** @var stdClass $grade */
154 var $grade = null;
155 /** @var string $view */
156 var $view = self::SUMMARY;
157 /** @var int $coursemoduleid */
158 var $coursemoduleid = 0;
159 /** @var string returnaction The action to take you back to the current page */
160 var $returnaction = '';
161 /** @var array returnparams The params to take you back to the current page */
162 var $returnparams = array();
163
164 /**
165 * feedback for a single plugin
166 *
167 * @param assign_feedback_plugin $plugin
168 * @param stdClass $grade
169 * @param string $view one of feedback_plugin::SUMMARY or feedback_plugin::FULL
170 * @param int $coursemoduleid
171 * @param string $returnaction The action required to return to this page
172 * @param array $returnparams The params required to return to this page
173 */
174 public function __construct(assign_feedback_plugin $plugin, stdClass $grade, $view, $coursemoduleid, $returnaction, $returnparams) {
175 $this->plugin = $plugin;
176 $this->grade = $grade;
177 $this->view = $view;
178 $this->coursemoduleid = $coursemoduleid;
179 $this->returnaction = $returnaction;
180 $this->returnparams = $returnparams;
181 }
182
183}
184
185/**
186 * Implements a renderable submission plugin submission
187 * @package mod_assign
188 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
189 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
190 */
191class assign_submission_plugin_submission implements renderable {
192 /** @var int SUMMARY */
193 const SUMMARY = 10;
194 /** @var int FULL */
195 const FULL = 20;
196
197 /** @var assign_submission_plugin $plugin */
198 var $plugin = null;
199 /** @var stdClass $submission */
200 var $submission = null;
201 /** @var string $view */
202 var $view = self::SUMMARY;
203 /** @var int $coursemoduleid */
204 var $coursemoduleid = 0;
205 /** @var string returnaction The action to take you back to the current page */
206 var $returnaction = '';
207 /** @var array returnparams The params to take you back to the current page */
208 var $returnparams = array();
209
210
211
212 /**
213 * Constructor
214 * @param assign_submission_plugin $plugin
215 * @param stdClass $submission
216 * @param string $view one of submission_plugin::SUMMARY, submission_plugin::FULL
217 * @param int $coursemoduleid - the course module id
218 * @param string $returnaction The action to return to the current page
219 * @param array $returnparams The params to return to the current page
220 */
221 public function __construct(assign_submission_plugin $plugin, stdClass $submission, $view, $coursemoduleid, $returnaction, $returnparams) {
222 $this->plugin = $plugin;
223 $this->submission = $submission;
224 $this->view = $view;
225 $this->coursemoduleid = $coursemoduleid;
226 $this->returnaction = $returnaction;
227 $this->returnparams = $returnparams;
228 }
229}
230
231/**
232 * Renderable feedback status
233 * @package mod_assign
234 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
235 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
236 */
237class assign_feedback_status implements renderable {
238
239 /** @var stding $gradefordisplay the student grade rendered into a format suitable for display */
240 var $gradefordisplay = '';
241 /** @var mixed the graded date (may be null) */
242 var $gradeddate = 0;
243 /** @var mixed the grader (may be null) */
244 var $grader = null;
245 /** @var array feedbackplugins - array of feedback plugins */
246 var $feedbackplugins = array();
247 /** @var stdClass assign_grade record */
248 var $grade = null;
249 /** @var int coursemoduleid */
250 var $coursemoduleid = 0;
251 /** @var string returnaction */
252 var $returnaction = '';
253 /** @var array returnparams */
254 var $returnparams = array();
255
256 /**
257 * Constructor
258 * @param string $gradefordisplay
259 * @param mixed $gradeddate
260 * @param mixed $grader
261 * @param array $feedbackplugins
262 * @param mixed $grade
263 * @param int $coursemoduleid
264 * @param string $returnaction The action required to return to this page
265 * @param array $returnparams The list of params required to return to this page
266 */
267 public function __construct($gradefordisplay, $gradeddate, $grader, $feedbackplugins, $grade, $coursemoduleid, $returnaction, $returnparams) {
268 $this->gradefordisplay = $gradefordisplay;
269 $this->gradeddate = $gradeddate;
270 $this->grader = $grader;
271 $this->feedbackplugins = $feedbackplugins;
272 $this->grade = $grade;
273 $this->coursemoduleid = $coursemoduleid;
274 $this->returnaction = $returnaction;
275 $this->returnparams = $returnparams;
276 }
277
278}
279
280/**
281 * Renderable submission status
282 * @package mod_assign
283 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
284 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
285 */
286class assign_submission_status implements renderable {
287 /** @var int STUDENT_VIEW */
288 const STUDENT_VIEW = 10;
289 /** @var int GRADER_VIEW */
290 const GRADER_VIEW = 20;
291
292 /** @var int allowsubmissionsfromdate */
293 var $allowsubmissionsfromdate = 0;
294 /** @var bool alwaysshowdescription */
295 var $alwaysshowdescription = false;
296 /** @var stdClass the submission info (may be null) */
297 var $submission = null;
12a1a0da
DW
298 /** @var boolean teamsubmissionenabled - true or false */
299 public $teamsubmissionenabled = false;
300 /** @var stdClass teamsubmission the team submission info (may be null) */
301 public $teamsubmission = null;
302 /** @var stdClass submissiongroup the submission group info (may be null) */
303 public $submissiongroup = null;
304 /** @var array submissiongroupmemberswhoneedtosubmit list of users who still need to submit */
305 public $submissiongroupmemberswhoneedtosubmit = array();
bbd0e548
DW
306 /** @var bool submissionsenabled */
307 var $submissionsenabled = false;
308 /** @var bool locked */
309 var $locked = false;
310 /** @var bool graded */
311 var $graded = false;
312 /** @var int duedate */
313 var $duedate = 0;
9e795179
DW
314 /** @var int cutoffdate */
315 public $cutoffdate = 0;
bbd0e548
DW
316 /** @var array submissionplugins - the list of submission plugins */
317 var $submissionplugins = array();
318 /** @var string returnaction */
319 var $returnaction = '';
320 /** @var string returnparams */
321 var $returnparams = array();
12a1a0da
DW
322 /** @var int courseid */
323 public $courseid = 0;
bbd0e548
DW
324 /** @var int coursemoduleid */
325 var $coursemoduleid = 0;
326 /** @var int the view (assign_submission_status::STUDENT_VIEW OR assign_submission_status::GRADER_VIEW) */
327 var $view = self::STUDENT_VIEW;
12a1a0da
DW
328 /** @var bool canviewfullnames */
329 public $canviewfullnames = false;
bbd0e548
DW
330 /** @var bool canedit */
331 var $canedit = false;
332 /** @var bool cansubmit */
333 var $cansubmit = false;
9e795179
DW
334 /** @var int extensionduedate */
335 public $extensionduedate = 0;
12a1a0da
DW
336 /** @var context context */
337 public $context = 0;
88cfe469
DW
338 /** @var bool blindmarking - Should we hide student identities from graders? */
339 public $blindmarking = false;
bbd0e548 340
ec32d068
RW
341 /** @var string gradingcontrollerpreview */
342 public $gradingcontrollerpreview = '';
343
bbd0e548
DW
344 /**
345 * constructor
346 *
347 * @param int $allowsubmissionsfromdate
348 * @param bool $alwaysshowdescription
349 * @param stdClass $submission
12a1a0da
DW
350 * @param bool $teamsubmissionenabled
351 * @param stdClass $teamsubmission
352 * @param int $submissiongroup
353 * @param array $submissiongroupmemberswhoneedtosubmit
bbd0e548
DW
354 * @param bool $submissionsenabled
355 * @param bool $locked
356 * @param bool $graded
357 * @param int $duedate
9e795179 358 * @param int $cutoffdate
bbd0e548
DW
359 * @param array $submissionplugins
360 * @param string $returnaction
361 * @param array $returnparams
362 * @param int $coursemoduleid
12a1a0da 363 * @param int $courseid
bbd0e548
DW
364 * @param string $view
365 * @param bool $canedit
366 * @param bool $cansubmit
12a1a0da 367 * @param bool $canviewfullnames
9e795179 368 * @param int $extensionduedate - Any extension to the due date granted for this user
12a1a0da 369 * @param context $context - Any extension to the due date granted for this user
88cfe469 370 * @param blindmarking $blindmarking - Should we hide student identities from graders?
bbd0e548 371 */
12a1a0da
DW
372 public function __construct($allowsubmissionsfromdate, $alwaysshowdescription, $submission,
373 $teamsubmissionenabled, $teamsubmission, $submissiongroup,
374 $submissiongroupmemberswhoneedtosubmit, $submissionsenabled,
9e795179 375 $locked, $graded, $duedate, $cutoffdate, $submissionplugins, $returnaction, $returnparams,
12a1a0da 376 $coursemoduleid, $courseid, $view, $canedit, $cansubmit, $canviewfullnames, $extensionduedate,
ec32d068 377 $context, $blindmarking, $gradingcontrollerpreview) {
bbd0e548
DW
378 $this->allowsubmissionsfromdate = $allowsubmissionsfromdate;
379 $this->alwaysshowdescription = $alwaysshowdescription;
380 $this->submission = $submission;
12a1a0da
DW
381 $this->teamsubmissionenabled = $teamsubmissionenabled;
382 $this->teamsubmission = $teamsubmission;
383 $this->submissiongroup = $submissiongroup;
384 $this->submissiongroupmemberswhoneedtosubmit = $submissiongroupmemberswhoneedtosubmit;
bbd0e548
DW
385 $this->submissionsenabled = $submissionsenabled;
386 $this->locked = $locked;
387 $this->graded = $graded;
388 $this->duedate = $duedate;
9e795179 389 $this->cutoffdate = $cutoffdate;
bbd0e548
DW
390 $this->submissionplugins = $submissionplugins;
391 $this->returnaction = $returnaction;
392 $this->returnparams = $returnparams;
393 $this->coursemoduleid = $coursemoduleid;
12a1a0da 394 $this->courseid = $courseid;
bbd0e548
DW
395 $this->view = $view;
396 $this->canedit = $canedit;
397 $this->cansubmit = $cansubmit;
12a1a0da 398 $this->canviewfullnames = $canviewfullnames;
9e795179 399 $this->extensionduedate = $extensionduedate;
12a1a0da 400 $this->context = $context;
88cfe469 401 $this->blindmarking = $blindmarking;
ec32d068 402 $this->gradingcontrollerpreview = $gradingcontrollerpreview;
bbd0e548
DW
403 }
404
405}
406
407/**
408 * Renderable header
409 * @package mod_assign
410 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
411 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
412 */
413class assign_header implements renderable {
414 /** @var stdClass the assign record */
415 var $assign = null;
416 /** @var mixed context|null the context record */
417 var $context = null;
418 /** @var bool $showintro - show or hide the intro */
419 var $showintro = false;
420 /** @var int coursemoduleid - The course module id */
421 var $coursemoduleid = 0;
422 /** @var string $subpage optional subpage (extra level in the breadcrumbs) */
423 var $subpage = '';
a1e54f4d
DW
424 /** @var string $preface optional preface (text to show before the heading) */
425 var $preface = '';
bbd0e548
DW
426
427 /**
428 * Constructor
429 *
430 * @param stdClass $assign - the assign database record
431 * @param mixed $context context|null the course module context (or the course context if the coursemodule has not been created yet)
432 * @param bool $showintro - show or hide the intro
433 * @param int $coursemoduleid - the course module id
434 * @param string $subpage - an optional sub page in the navigation
a1e54f4d 435 * @param string $preface - an optional preface to show before the heading
bbd0e548 436 */
a1e54f4d 437 public function __construct(stdClass $assign, $context, $showintro, $coursemoduleid, $subpage='', $preface='') {
bbd0e548
DW
438 $this->assign = $assign;
439 $this->context = $context;
440 $this->showintro = $showintro;
441 $this->coursemoduleid = $coursemoduleid;
442 $this->subpage = $subpage;
a1e54f4d 443 $this->preface = $preface;
bbd0e548
DW
444 }
445}
446
447/**
448 * Renderable grading summary
449 * @package mod_assign
450 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
451 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
452 */
453class assign_grading_summary implements renderable {
454 /** @var int participantcount - The number of users who can submit to this assignment */
455 var $participantcount = 0;
456 /** @var bool submissiondraftsenabled - Allow submission drafts */
457 var $submissiondraftsenabled = false;
458 /** @var int submissiondraftscount - The number of submissions in draft status */
459 var $submissiondraftscount = 0;
460 /** @var bool submissionsenabled - Allow submissions */
461 var $submissionsenabled = false;
462 /** @var int submissionssubmittedcount - The number of submissions in submitted status */
463 var $submissionssubmittedcount = 0;
f70079b9
DW
464 /** @var int submissionsneedgradingcount - The number of submissions that need grading */
465 var $submissionsneedgradingcount = 0;
bbd0e548
DW
466 /** @var int duedate - The assignment due date (if one is set) */
467 var $duedate = 0;
9e795179
DW
468 /** @var int cutoffdate - The assignment cut off date (if one is set) */
469 var $cutoffdate = 0;
bbd0e548
DW
470 /** @var int coursemoduleid - The assignment course module id */
471 var $coursemoduleid = 0;
12a1a0da
DW
472 /** @var boolean teamsubmission - Are team submissions enabled for this assignment */
473 public $teamsubmission = false;
bbd0e548
DW
474
475 /**
476 * constructor
477 *
478 * @param int $participantcount
479 * @param bool $submissiondraftsenabled
480 * @param int $submissiondraftscount
481 * @param bool $submissionsenabled
482 * @param int $submissionssubmittedcount
9e795179 483 * @param int $cutoffdate
bbd0e548
DW
484 * @param int $duedate
485 * @param int $coursemoduleid
9e795179 486 * @param int $submissionsneedgradingcount
12a1a0da 487 * @param bool $teamsubmission
bbd0e548 488 */
12a1a0da
DW
489 public function __construct($participantcount, $submissiondraftsenabled,
490 $submissiondraftscount, $submissionsenabled,
491 $submissionssubmittedcount, $cutoffdate, $duedate,
492 $coursemoduleid, $submissionsneedgradingcount, $teamsubmission) {
bbd0e548
DW
493 $this->participantcount = $participantcount;
494 $this->submissiondraftsenabled = $submissiondraftsenabled;
495 $this->submissiondraftscount = $submissiondraftscount;
496 $this->submissionsenabled = $submissionsenabled;
497 $this->submissionssubmittedcount = $submissionssubmittedcount;
498 $this->duedate = $duedate;
9e795179 499 $this->cutoffdate = $cutoffdate;
bbd0e548 500 $this->coursemoduleid = $coursemoduleid;
f70079b9 501 $this->submissionsneedgradingcount = $submissionsneedgradingcount;
12a1a0da 502 $this->teamsubmission = $teamsubmission;
bbd0e548
DW
503 }
504
bbd0e548
DW
505}
506
507/**
508 * An assign file class that extends rendererable class and is used by the assign module.
509 *
510 * @package mod_assign
511 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
512 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
513 */
514class assign_files implements renderable {
515 /** @var context $context */
516 public $context;
517 /** @var string $context */
518 public $dir;
519 /** @var MoodleQuickForm $portfolioform */
520 public $portfolioform;
521 /** @var stdClass $cm course module */
522 public $cm;
523 /** @var stdClass $course */
524 public $course;
525
526
527 /**
528 * The constructor
529 *
530 * @param context $context
531 * @param int $sid
532 * @param string $filearea
533 * @param string $component
534 */
535 public function __construct(context $context, $sid, $filearea, $component) {
536 global $CFG;
537 $this->context = $context;
538 list($context, $course, $cm) = get_context_info_array($context->id);
539 $this->cm = $cm;
540 $this->course = $course;
541 $fs = get_file_storage();
542 $this->dir = $fs->get_area_tree($this->context->id, $component, $filearea, $sid);
543
544 $files = $fs->get_area_files($this->context->id, $component, $filearea, $sid, "timemodified", false);
545
546 if (!empty($CFG->enableportfolios)) {
547 require_once($CFG->libdir . '/portfoliolib.php');
548 if (count($files) >= 1 && has_capability('mod/assign:exportownsubmission', $this->context)) {
549 $button = new portfolio_add_button();
37743241
MN
550 $button->set_callback_options('assign_portfolio_caller',
551 array('cmid' => $this->cm->id,
552 'sid' => $sid,
553 'area' => $filearea,
554 'component' => $component),
555 'mod_assign');
bbd0e548
DW
556 $button->reset_formats();
557 $this->portfolioform = $button->to_html(PORTFOLIO_ADD_TEXT_LINK);
558 }
559
560 }
561
562 // plagiarism check if it is enabled
563 $output = '';
564 if (!empty($CFG->enableplagiarism)) {
565 require_once($CFG->libdir . '/plagiarismlib.php');
566
567 // for plagiarism_get_links
568 $assignment = new assign($this->context, null, null);
569 foreach ($files as $file) {
570
571 $output .= plagiarism_get_links(array('userid' => $sid,
572 'file' => $file,
573 'cmid' => $this->cm->id,
574 'course' => $this->course,
575 'assignment' => $assignment->get_instance()));
576
577 $output .= '<br />';
578 }
579 }
580
581 $this->preprocess($this->dir, $filearea, $component);
582 }
583
584 /**
585 * preprocessing the file list to add the portfolio links if required
586 *
587 * @param array $dir
588 * @param string $filearea
589 * @param string $component
590 * @return void
591 */
592 public function preprocess($dir, $filearea, $component) {
593 global $CFG;
594 foreach ($dir['subdirs'] as $subdir) {
595 $this->preprocess($subdir, $filearea, $component);
596 }
597 foreach ($dir['files'] as $file) {
598 $file->portfoliobutton = '';
599 if (!empty($CFG->enableportfolios)) {
600 $button = new portfolio_add_button();
601 if (has_capability('mod/assign:exportownsubmission', $this->context)) {
37743241
MN
602 $button->set_callback_options('assign_portfolio_caller',
603 array('cmid' => $this->cm->id, 'fileid' => $file->get_id()),
604 'mod_assign');
bbd0e548
DW
605 $button->set_format_by_file($file);
606 $file->portfoliobutton = $button->to_html(PORTFOLIO_ADD_ICON_LINK);
607 }
608 }
609 $url = file_encode_url("$CFG->wwwroot/pluginfile.php", '/'.$this->context->id.'/'.$component.'/'.$filearea.'/'.$file->get_itemid(). $file->get_filepath().$file->get_filename(), true);
610 $filename = $file->get_filename();
611 $file->fileurl = html_writer::link($url, $filename);
612 }
613 }
614}