diff --git a/lib.php b/lib.php index 07cd786..5a9a205 100644 --- a/lib.php +++ b/lib.php @@ -198,26 +198,7 @@ function attforblock_user_complete($course, $user, $mod, $attforblock) { require_once($CFG->libdir.'/gradelib.php'); if (has_capability('mod/attforblock:canbelisted', $mod->context, $user->id)) { - $gradeable = $attforblock->grade > 0; - $statuses = get_statuses($attforblock->id); - $userstatusesstat = get_user_statuses_stat($attforblock->id, $course->startdate, $user->id); - $stat['completed'] = get_user_taken_sessions_count($attforblock->id, $course->startdate, $user->id); - $stat['statuses'] = $userstatusesstat; - if ($gradeable) { - $grade = get_user_grade($userstatusesstat, $statuses); - $maxgrade = get_user_max_grade(get_user_taken_sessions_count($attforblock->id, $course->startdate, $user->id), $statuses); - if (!$decimalpoints = grade_get_setting($course->id, 'decimalpoints')) { - $decimalpoints = $CFG->grade_decimalpoints; - } - } - else { - $grade = 0; - $maxgrade = 0; - $decimalpoints = 0; - } - - echo construct_user_data_stat($stat, $statuses, - $gradeable, $grade, $maxgrade, $decimalpoints); + echo construct_full_user_stat_html_table($attforblock, $course, $user); } //return true; diff --git a/locallib.php b/locallib.php index ff8f76f..08f907a 100644 --- a/locallib.php +++ b/locallib.php @@ -657,8 +657,8 @@ class attforblock { /** * @return moodle_url of manage.php for attendance instance */ - public function url_manage() { - $params = array('id' => $this->cm->id); + public function url_manage($params=array()) { + $params = array_merge(array('id' => $this->cm->id), $params); return new moodle_url('/mod/attforblock/manage.php', $params); } diff --git a/renderhelpers.php b/renderhelpers.php index 7ac1226..3213971 100644 --- a/renderhelpers.php +++ b/renderhelpers.php @@ -170,7 +170,7 @@ function construct_session_full_date_time($datetime, $duration) { function construct_user_data_stat($stat, $statuses, $gradable, $grade, $maxgrade, $decimalpoints) { $stattable = new html_table(); - $stattable->attributes['class'] = 'list'; + $stattable->attributes['class'] = 'attlist'; $row = new html_table_row(); $row->cells[] = get_string('sessionscompleted','attforblock').':'; $row->cells[] = $stat['completed']; @@ -204,5 +204,30 @@ function construct_user_data_stat($stat, $statuses, $gradable, $grade, $maxgrade return html_writer::table($stattable); } +function construct_full_user_stat_html_table($attforblock, $course, $user) { + global $CFG; + + $gradeable = $attforblock->grade > 0; + $statuses = get_statuses($attforblock->id); + $userstatusesstat = get_user_statuses_stat($attforblock->id, $course->startdate, $user->id); + $stat['completed'] = get_user_taken_sessions_count($attforblock->id, $course->startdate, $user->id); + $stat['statuses'] = $userstatusesstat; + if ($gradeable) { + $grade = get_user_grade($userstatusesstat, $statuses); + $maxgrade = get_user_max_grade(get_user_taken_sessions_count($attforblock->id, $course->startdate, $user->id), $statuses); + if (!$decimalpoints = grade_get_setting($course->id, 'decimalpoints')) { + $decimalpoints = $CFG->grade_decimalpoints; + } + } + else { + $grade = 0; + $maxgrade = 0; + $decimalpoints = 0; + } + + return construct_user_data_stat($stat, $statuses, + $gradeable, $grade, $maxgrade, $decimalpoints); +} + ?> diff --git a/styles.css b/styles.css index bf8b89a..022ef3f 100644 --- a/styles.css +++ b/styles.css @@ -112,7 +112,7 @@ background-color: #EEEEEE; padding: 30px 10px; } -.path-mod-attforblock table.list td.c0 { +.path-mod-attforblock table.attlist td.c0 { text-align: right; }