Browse Source

Adding function get_user_taken_sessions_percentages to summary class

MOODLE_31_STABLE
Antonio Carlos Mariani 9 years ago
parent
commit
08e15a94dd
  1. 17
      classes/summary.php

17
classes/summary.php

@ -22,6 +22,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
include_once($CFG->dirroot . '/mod/attendance/locallib.php');
class mod_attendance_summary { class mod_attendance_summary {
/** @var int attendance instance identifier */ /** @var int attendance instance identifier */
@ -82,6 +84,21 @@ class mod_attendance_summary {
return $this->groupmode; return $this->groupmode;
} }
/**
* Returns the percentages of each user related to the taken sessions
*
* @return array
*/
public function get_user_taken_sessions_percentages() {
$percentages = array();
foreach ($this->userspoints as $userid => $userpoints) {
$percentages[$userid] = attendance_calc_fraction($userpoints->points, $userpoints->maxpoints);
}
return $percentages;
}
/** /**
* Returns a summary of the points assigned to the user related to the taken sessions * Returns a summary of the points assigned to the user related to the taken sessions
* *

Loading…
Cancel
Save