Beispiel #1
0
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
require_once '../../../config.php';
require_once $CFG->dirroot . '/grade/export/lib.php';
require_once 'grade_export_ods.php';
$id = required_param('id', PARAM_INT);
// course id
if (!($course = $DB->get_record('course', array('id' => $id)))) {
    print_error('nocourseid');
}
require_login($course);
$context = context_course::instance($id);
$groupid = groups_get_course_group($course, true);
require_capability('moodle/grade:export', $context);
require_capability('gradeexport/ods:view', $context);
if (groups_get_course_groupmode($COURSE) == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) {
    if (!groups_is_member($groupid, $USER->id)) {
        print_error('cannotaccessgroup', 'grades');
    }
}
$mform = new grade_export_form(null, array('publishing' => true, 'simpleui' => true));
$data = $mform->get_data();
// print all the exported data here
$export = new grade_export_ods($course, $groupid, $data);
$export->print_grades();