mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
ROLES AND PERMISSIONS - FIRST CHECK-IN
======================================= WARNING: DEV IS CURRENTLY VERY UNSTABLE. This is a mega-checkin of the new Roles system. A lot of changes have been made in core and modules. Currently there are a lot of rough edges and known problems. We are working hard on these .. .the reason for getting this into HEAD at this stage is enable us to move faster (our branch was diverging from HEAD too much). Please keep an eye on http://docs.moodle.org/en/Roles for current status and information for developers on how to use the new Roles system.
This commit is contained in:
parent
394577c3e4
commit
bbbf2d4015
139 changed files with 40452 additions and 2001 deletions
|
@ -17,10 +17,14 @@
|
|||
}
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
has_capability('mod/choice:readresponses', $context->id, true);
|
||||
|
||||
//if (!isteacher($course->id)) {
|
||||
// error("Only teachers can look at this page");
|
||||
//}
|
||||
|
||||
if (!$choice = choice_get_choice($cm->instance)) {
|
||||
error("Course module is incorrect");
|
||||
|
@ -32,7 +36,8 @@
|
|||
|
||||
add_to_log($course->id, "choice", "report", "report.php?id=$cm->id", "$choice->id",$cm->id);
|
||||
|
||||
if ($action == 'delete') { //some responses need to be deleted
|
||||
if ($action == 'delete' && has_capability('mod/choice:deleteresponses',$context->id, true)) {
|
||||
//if ($action == 'delete') { //some responses need to be deleted
|
||||
$attemptids = isset($_POST['attemptid']) ? $_POST['attemptid'] : array(); //get array of repsonses to delete.
|
||||
choice_delete_responses($attemptids); //delete responses.
|
||||
redirect("report.php?id=$cm->id");
|
||||
|
@ -81,7 +86,8 @@
|
|||
ksort($useranswer);
|
||||
|
||||
//print spreadsheet if one is asked for:
|
||||
if ($download == "xls") {
|
||||
//if ($download == "xls") {
|
||||
if ($download == "xls" && has_capability('mod/choice:downloadresponses', $context->id, true)) {
|
||||
require_once("$CFG->libdir/excellib.class.php");
|
||||
|
||||
/// Calculate file name
|
||||
|
@ -137,8 +143,9 @@
|
|||
|
||||
exit;
|
||||
}
|
||||
// print text file
|
||||
if ($download == "txt") {
|
||||
// print text file
|
||||
//if ($download == "txt") {
|
||||
if ($download == "txt" && has_capability('mod/choice:downloadresponses', $context->id, true)) {
|
||||
$filename = clean_filename("$course->shortname ".strip_tags(format_string($choice->name,true))).'.txt';
|
||||
|
||||
header("Content-Type: application/download\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue