From ba31d7ad831d4163c8211f6ee1068f6ccbaac953 Mon Sep 17 00:00:00 2001 From: Joseph Baxter Date: Wed, 21 May 2014 16:41:34 +0100 Subject: [PATCH] fix for log page link --- locallib.php | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/locallib.php b/locallib.php index ce2e3c8..a8a49b7 100644 --- a/locallib.php +++ b/locallib.php @@ -878,10 +878,23 @@ class attendance { // Update the users grade. $this->update_users_grade(array($USER->id)); - // Log the change. + /* create url for link in log screen + * need to set grouptype to 0 to allow take attendance page to be called + * from report/log page */ + $params = array( - 'sessionid' => $mformdata->sessid); - $url = $this->url_take($params); + 'sessionid' => $this->pageparams->sessionid, + 'grouptype' => 0, + 'id' => $this->cm->id); + + $url = 'take.php?'; + foreach ($params as $param => $value) { + $url = $url . $param . '=' . $value . '&'; + } + + $url = rtrim($url,'&'); + + // Log the change. add_to_log($this->course->id, 'attendance', 'taken', $url, '', $USER->id); return true; @@ -934,10 +947,19 @@ class attendance { $this->update_users_grade(array_keys($sesslog)); } + // create url for link in log screen $params = array( 'sessionid' => $this->pageparams->sessionid, - 'grouptype' => $this->pageparams->grouptype); - $url = $this->url_take($params); + 'grouptype' => $this->pageparams->grouptype, + 'id' => $this->cm->id); + + $url = 'take.php?'; + foreach ($params as $param => $value) { + $url = $url . $param . '=' . $value . '&'; + } + + $url = rtrim($url,'&'); + add_to_log($this->course->id, 'attendance', 'taken', $url, '', $this->cm->id); $group = 0;