Added proper page comments and inform user when attempts have been deleted

This commit is contained in:
mark-nielsen 2006-09-10 01:40:38 +00:00
parent d2d7f39064
commit 8d1b4ee7b5

View file

@ -1,8 +1,11 @@
<?PHP
/**************************************************************************
this file displays the lesson statistics.
**************************************************************************/
<?php // $Id$
/**
* Displays the lesson statistics.
*
* @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package lesson
**/
require_once('../../config.php');
require_once('locallib.php');
@ -29,10 +32,11 @@
require_capability('mod/lesson:manage', $context);
/// Process any form data before fetching attempts, grades and times
if (has_capability('mod/lesson:edit', $context) and $form = data_submitted()) {
confirm_sesskey();
if (confirm_sesskey() and
has_capability('mod/lesson:edit', $context) and
$form = data_submitted($CFG->wwwroot.'/mod/lesson/report.php')) {
/// Cycle through array of userids with nested arrays of tries
if (!empty($form->attempts)) {
foreach ($form->attempts as $userid => $tries) {
// Modifier IS VERY IMPORTANT! What does it do?
// Well, it is for when you delete multiple attempts for the same user.
@ -71,6 +75,8 @@
$modifier++;
}
}
lesson_set_message(get_string('attemptsdeleted', 'lesson'), 'notifysuccess');
}
}
if (! $attempts = get_records('lesson_attempts', 'lessonid', $lesson->id, 'timeseen')) {