public function check_time($timer) {
        if ($this->properties->timelimit) {
            $timeleft = $timer->starttime + $this->properties->timelimit - time();
            if ($timeleft <= 0) {
                // Out of time.
                $this->add_message(get_string('eolstudentoutoftime', 'lesson'));
                return false;
            } else if ($timeleft < 60) {
                // One minute warning.
                $this->add_message(get_string('studentoneminwarning', 'lesson'));
            }
        }
        return true;
    }
public function check_time($timer) {
        if ($this->properties->timelimit) {
            $timeleft = $timer->starttime + $this->properties->timelimit - time();
            if ($timeleft <= 0) {
                // Out of time.
                $this->add_message(get_string('eolstudentoutoftime', 'lesson'));
                return false;
            } else if ($timeleft < 60) {
                // One minute warning.
                $this->add_message(get_string('studentoneminwarning', 'lesson'));
            }
        }
        return true;
    }
public function check_time ( $ timer ) { if ( $ this -> properties -> timelimit ) { $ timeleft = $ timer -> starttime + $ this -> properties -> timelimit - time ( ) ; if ( $ timeleft <= 0 ) { // Out of time. $ this -> add_message ( get_string ( 'eolstudentoutoftime' , 'lesson' ) ) ; return false ; } else if ( $ timeleft < 60 ) { // One minute warning. $ this -> add_message ( get_string ( 'studentoneminwarning' , 'lesson' ) ) ; } } return true ; }
Check if the user is out of time in a timed lesson.

@param  stdClass $timer timer object
@return bool True if the user is on time, false is the user ran out of time
@since  Moodle 3.3
Check if the user is out of time in a timed lesson .