From 5fe324d8dbe7cc60b6030b3d779271f9c7aa4f5d Mon Sep 17 00:00:00 2001 From: Artem Andreev Date: Sat, 23 Apr 2011 17:25:43 +0400 Subject: [PATCH] First (unfinished) implementation view.php - redirect to manage.php --- view.php | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 view.php diff --git a/view.php b/view.php new file mode 100644 index 0000000..e6fbd79 --- /dev/null +++ b/view.php @@ -0,0 +1,56 @@ +get_record('course', array('id' => $cm->course), '*', MUST_EXIST); + $attforblock = $DB->get_record('attforblock', array('id' => $cm->instance), '*', MUST_EXIST); +} else { + $attforblock = $DB->get_record('attforblock', array('id' => $a), '*', MUST_EXIST); + $course = $DB->get_record('course', array('id' => $workshop->course), '*', MUST_EXIST); + $cm = get_coursemodule_from_instance('attforblock', $attforblock->id, $course->id, false, MUST_EXIST); +} + +require_login($course, true, $cm); + +// Not specified studentid for displaying attendance? +// Redirect to appropriate page if can +if (!$studentid) { + if (has_capability('mod/attforblock:manageattendances', $PAGE->context) || + has_capability('mod/attforblock:takeattendances', $PAGE->context) || + has_capability('mod/attforblock:changeattendances', $PAGE->context)) { + redirect("manage.php?id=$cm->id"); + } + elseif (has_capability('mod/attforblock:viewreports', $PAGE->context)) { + redirect("report.php?id=$cm->id"); + } +} + +if ($view) + set_current_view($course->id, $_GET['view']); +else + $view = get_current_view($course->id, 'months'); + +require_capability('mod/attforblock:view', $PAGE->context); + + +?>