protected function output_caching_info($lastcachetime, $quizid, $groupstudentsjoins, $whichattempts, $reporturl) {
        global $DB, $OUTPUT;

        if (empty($lastcachetime)) {
            return '';
        }

        // Find the number of attempts since the cached statistics were computed.
        list($fromqa, $whereqa, $qaparams) = quiz_statistics_attempts_sql($quizid, $groupstudentsjoins, $whichattempts, true);
        $count = $DB->count_records_sql("
                SELECT COUNT(1)
                FROM $fromqa
                WHERE $whereqa
                AND quiza.timefinish > {$lastcachetime}", $qaparams);

        if (!$count) {
            $count = 0;
        }

        // Generate the output.
        $a = new stdClass();
        $a->lastcalculated = format_time(time() - $lastcachetime);
        $a->count = $count;

        $recalcualteurl = new moodle_url($reporturl,
                array('recalculate' => 1, 'sesskey' => sesskey()));
        $output = '';
        $output .= $OUTPUT->box_start(
                'boxaligncenter generalbox boxwidthnormal mdl-align', 'cachingnotice');
        $output .= get_string('lastcalculated', 'quiz_statistics', $a);
        $output .= $OUTPUT->single_button($recalcualteurl,
                get_string('recalculatenow', 'quiz_statistics'));
        $output .= $OUTPUT->box_end(true);

        return $output;
    }
protected function output_caching_info($lastcachetime, $quizid, $groupstudentsjoins, $whichattempts, $reporturl) {
        global $DB, $OUTPUT;

        if (empty($lastcachetime)) {
            return '';
        }

        // Find the number of attempts since the cached statistics were computed.
        list($fromqa, $whereqa, $qaparams) = quiz_statistics_attempts_sql($quizid, $groupstudentsjoins, $whichattempts, true);
        $count = $DB->count_records_sql("
                SELECT COUNT(1)
                FROM $fromqa
                WHERE $whereqa
                AND quiza.timefinish > {$lastcachetime}", $qaparams);

        if (!$count) {
            $count = 0;
        }

        // Generate the output.
        $a = new stdClass();
        $a->lastcalculated = format_time(time() - $lastcachetime);
        $a->count = $count;

        $recalcualteurl = new moodle_url($reporturl,
                array('recalculate' => 1, 'sesskey' => sesskey()));
        $output = '';
        $output .= $OUTPUT->box_start(
                'boxaligncenter generalbox boxwidthnormal mdl-align', 'cachingnotice');
        $output .= get_string('lastcalculated', 'quiz_statistics', $a);
        $output .= $OUTPUT->single_button($recalcualteurl,
                get_string('recalculatenow', 'quiz_statistics'));
        $output .= $OUTPUT->box_end(true);

        return $output;
    }
protected function output_caching_info ( $ lastcachetime , $ quizid , $ groupstudentsjoins , $ whichattempts , $ reporturl ) { global $ DB , $ OUTPUT ; if ( empty ( $ lastcachetime ) ) { return '' ; } // Find the number of attempts since the cached statistics were computed. list ( $ fromqa , $ whereqa , $ qaparams ) = quiz_statistics_attempts_sql ( $ quizid , $ groupstudentsjoins , $ whichattempts , true ) ; $ count = $ DB -> count_records_sql ( "
                SELECT COUNT(1)
                FROM $fromqa
                WHERE $whereqa
                AND quiza.timefinish > {$lastcachetime}" , $ qaparams ) ; if ( ! $ count ) { $ count = 0 ; } // Generate the output. $ a = new stdClass ( ) ; $ a -> lastcalculated = format_time ( time ( ) - $ lastcachetime ) ; $ a -> count = $ count ; $ recalcualteurl = new moodle_url ( $ reporturl , array ( 'recalculate' => 1 , 'sesskey' => sesskey ( ) ) ) ; $ output = '' ; $ output .= $ OUTPUT -> box_start ( 'boxaligncenter generalbox boxwidthnormal mdl-align' , 'cachingnotice' ) ; $ output .= get_string ( 'lastcalculated' , 'quiz_statistics' , $ a ) ; $ output .= $ OUTPUT -> single_button ( $ recalcualteurl , get_string ( 'recalculatenow' , 'quiz_statistics' ) ) ; $ output .= $ OUTPUT -> box_end ( true ) ; return $ output ; }
Return HTML for a message that says when the stats were last calculated and a 'recalculate now' button.

@param int    $lastcachetime  the time the stats were last cached.
@param int    $quizid         the quiz id.
@param array  $groupstudentsjoins (joins, wheres, params) for students in the group or empty array if groups not used.
@param string $whichattempts which attempts to use, represented internally as one of the constants as used in
$quiz->grademethod ie.
QUIZ_GRADEAVERAGE, QUIZ_GRADEHIGHEST, QUIZ_ATTEMPTLAST or QUIZ_ATTEMPTFIRST
we calculate stats based on which attempts would affect the grade for each student.
@param moodle_url $reporturl url for this report
@return string HTML.
Return HTML for a message that says when the stats were last calculated and a recalculate now button .