$string['allownotes'] = 'Allow notes';
$string['allowresubmit'] = 'Allow resubmitting';
$string['alreadygraded'] = 'Your assignment has already been graded and resubmission is not allowed.';
+$string['assignment:exportownsubmission'] = 'Export own submission';
$string['assignment:grade'] = 'Grade assignment';
$string['assignment:submit'] = 'Submit assignment';
$string['assignment:view'] = 'View assignment';
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
- )
+ ),
+
+ 'mod/assignment:exportownsubmission' => array(
+
+ 'captype' => 'read',
+ 'contextlevel' => CONTEXT_MODULE,
+ 'legacy' => array(
+ 'teacher' => CAP_ALLOW,
+ 'editingteacher' => CAP_ALLOW,
+ 'admin' => CAP_ALLOW,
+ 'student' => CAP_ALLOW,
+ )
+ ),
);
?>
$icon = mimeinfo_from_type('icon', $mimetype);
$path = $browser->encodepath($CFG->wwwroot.'/pluginfile.php', '/'.$this->context->id.'/assignment_submission/'.$userid.'/'.$filename);
$output .= '<a href="'.$path.'" ><img src="'.$CFG->pixpath.'/f/'.$icon.'" class="icon" alt="'.$icon.'" />'.s($filename).'</a>';
- if ($this->portfolio_exportable() && true) { // @todo replace with capability check
+ if ($this->portfolio_exportable() && has_capability('mod/assignment:exportownsubmission', $this->context)) {
$p['file'] = $file->get_id();
$output .= portfolio_add_button('assignment_portfolio_caller', $p, null, false, true);
}
$output .= '<br />';
}
- if ($this->portfolio_exportable() && true) { //@todo replace with check capability
+ if ($this->portfolio_exportable() && has_capability('mod/assignment:exportownsubmission', $this->context)) {
unset($p['file']);// for all files
$output .= '<br />' . portfolio_add_button('assignment_portfolio_caller', $p, null, true, true);
}
}
public function check_permissions() {
- return has_capability('mod/assignment:export-upload-files', get_context_instance(CONTEXT_MODULE, $this->assignment->cm->id));
+ $context = get_context_instance(CONTEXT_MODULE, $this->assignment->cm->id);
+ return has_capability('mod/assignment:exportownsubmission', $context);
}
public function __wakeup() {
$mform->display();
} else {
print_box_start('generalbox boxwidthwide boxaligncenter', 'online');
- if ($submission && true) { // @todo penny replace with capability check later
+ if ($submission && has_capability('mod/assignment:exportownsubmission', $this->context)) {
echo format_text($submission->data1, $submission->data2);
$p = array(
'userid' => $USER->id,
.'<img title="'.$strdelete.'" src="'.$CFG->pixpath.'/t/delete.gif" class="iconsmall" alt="" /></a> ';
}
- if (true) { // @todo penny replace with capability check
+ if (has_capability('mod/assignment:exportownsubmission', $this->context)) {
$p['file'] = $filename;
$output .= portfolio_add_button('assignment_portfolio_caller', $p, '/mod/assignment/lib.php', false, true);
}
$output .= '<br />';
}
- if (true) { //@todo penny replace with check capability
+ if (has_capability('mod/assignment:exportownsubmission', $this->context)) {
unset($p['file']);// for all files
$output .= '<br />' . portfolio_add_button('assignment_portfolio_caller', $p, '/mod/assignment/lib.php', true, true);
}
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2008073000;
-$module->requires = 2008072401; // Requires this Moodle version
+$module->version = 2008081100;
+$module->requires = 2008080701; // Requires this Moodle version
$module->cron = 60;
?>