mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-10579 capabilities for grade import plugins
This commit is contained in:
parent
c71fea5986
commit
e77bcaa30d
@ -1,2 +1,17 @@
|
||||
<?php // $Id$
|
||||
|
||||
$gradeimport_csv_capabilities = array(
|
||||
|
||||
'gradeimport/csv:view' => array(
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_COURSE,
|
||||
'legacy' => array(
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
'admin' => CAP_ALLOW
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
@ -1,17 +1,20 @@
|
||||
<?php
|
||||
require_once('../../../config.php');
|
||||
include_once($CFG->libdir.'/gradelib.php');
|
||||
<?php //$Id$
|
||||
require_once '../../../config.php';
|
||||
require_once $CFG->dirroot.'/grade/lib.php';
|
||||
require_once '../grade_import_form.php';
|
||||
require_once '../lib.php';
|
||||
|
||||
$id = required_param('id', PARAM_INT); // course id
|
||||
$course = get_record('course', 'id', $id); // actual course
|
||||
|
||||
// capability check
|
||||
require_login($id);
|
||||
require_capability('moodle/grade:import', get_context_instance(CONTEXT_COURSE, $course->id));
|
||||
if (!$course = get_record('course', 'id', $id)) {
|
||||
print_error('nocourseid');
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $id);
|
||||
require_capability('moodle/grade:import', $context);
|
||||
require_capability('gradeimport/csv:view', $context);
|
||||
|
||||
require_once('../grade_import_form.php');
|
||||
require_once($CFG->dirroot.'/grade/lib.php');
|
||||
require_once('../lib.php');
|
||||
|
||||
// sort out delimiter
|
||||
$csv_encode = '/\&\#44/';
|
||||
|
6
grade/import/csv/version.php
Normal file
6
grade/import/csv/version.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
$plugin->version = 2007072401;
|
||||
$plugin->requires = 2007072402;
|
||||
|
||||
?>
|
17
grade/import/xml/db/access.php
Normal file
17
grade/import/xml/db/access.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php // $Id$
|
||||
|
||||
$gradeimport_xml_capabilities = array(
|
||||
|
||||
'gradeimport/xml:view' => array(
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_COURSE,
|
||||
'legacy' => array(
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
'admin' => CAP_ALLOW
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
|
@ -1,21 +1,26 @@
|
||||
<?php
|
||||
<?php //$Id$
|
||||
|
||||
/**
|
||||
* code in development
|
||||
* does xml plugin need some flexibility/mapping of columns?
|
||||
*/
|
||||
require_once('../../../config.php');
|
||||
|
||||
require_once '../../../config.php';
|
||||
require_once $CFG->dirroot.'/grade/lib.php';
|
||||
require_once '../grade_import_form.php';
|
||||
require_once '../lib.php';
|
||||
|
||||
$id = required_param('id', PARAM_INT); // course id
|
||||
$course = get_record('course', 'id', $id); // actual course
|
||||
|
||||
// capability check
|
||||
require_login($id);
|
||||
require_capability('moodle/grade:import', get_context_instance(CONTEXT_COURSE, $course->id));
|
||||
if (!$course = get_record('course', 'id', $id)) {
|
||||
print_error('nocourseid');
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $id);
|
||||
require_capability('moodle/grade:import', $context);
|
||||
require_capability('gradeimport/xml:view', $context);
|
||||
|
||||
require_once('../lib.php');
|
||||
require_once('../grade_import_form.php');
|
||||
require_once($CFG->dirroot.'/grade/lib.php');
|
||||
|
||||
// print header
|
||||
$strgrades = get_string('grades', 'grades');
|
||||
|
6
grade/import/xml/version.php
Normal file
6
grade/import/xml/version.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
$plugin->version = 2007072401;
|
||||
$plugin->requires = 2007072402;
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user