$tt = "{$udutu->section}"; } } else { $tt = userdate($udutu->timemodified); } $report = ' '; if (has_capability('mod/udutu:viewreport', $context)) { $trackedusers = get_record('udutu_scoes_track', 'udutuid', $udutu->id, '', '', '', '', 'count(distinct(userid)) as c'); if ($trackedusers->c > 0) { $reportshow = '<a href="report.php?id=' . $udutu->coursemodule . '">' . get_string('viewallreports', 'udutu', $trackedusers->c) . '</a></div>'; } else { $reportshow = get_string('noreports', 'udutu'); } } else { if (has_capability('mod/udutu:viewscores', $context)) { require_once 'locallib.php'; $report = udutu_grade_user($udutu, $USER->id); $reportshow = get_string('score', 'udutu') . ": " . $report; } } if (!$udutu->visible) { //Show dimmed if the mod is hidden $table->data[] = array($tt, "<a class=\"dimmed\" href=\"view.php?id={$udutu->coursemodule}\">" . format_string($udutu->name, true) . "</a>", format_text($udutu->summary), $reportshow); } else { //Show normal if the mod is visible $table->data[] = array($tt, "<a href=\"view.php?id={$udutu->coursemodule}\">" . format_string($udutu->name, true) . "</a>", format_text($udutu->summary), $reportshow); } } echo "<br />"; print_table($table); print_footer($course);
/** * Given a udutu id return all the grades of that activity * * @param int $udutuid udutu instance id * @return mixed */ function udutu_grades($udutuid) { global $CFG; if (!($udutu = get_record('udutu', 'id', $udutuid))) { return NULL; } if ($udutu->grademethod % 10 == 0) { // GRADESCOES if (!($return->maxgrade = count_records_select('udutu_scoes', "udutu='{$udutuid}' AND launch<>''"))) { return NULL; } } else { $return->maxgrade = $udutu->maxgrade; } $return->grades = NULL; if ($scousers = get_records_select('udutu_scoes_track', "udutuid='{$udutuid}' GROUP BY userid", "", "userid,null")) { require_once 'locallib.php'; foreach ($scousers as $scouser) { $return->grades[$scouser->userid] = udutu_grade_user($udutu, $scouser->userid); } } return $return; }