public function attempt_state($attemptobj) {
        switch ($attemptobj->get_state()) {
            case quiz_attempt::IN_PROGRESS:
                return get_string('stateinprogress', 'quiz');

            case quiz_attempt::OVERDUE:
                return get_string('stateoverdue', 'quiz') . html_writer::tag('span',
                        get_string('stateoverduedetails', 'quiz',
                                userdate($attemptobj->get_due_date())),
                        array('class' => 'statedetails'));

            case quiz_attempt::FINISHED:
                return get_string('statefinished', 'quiz') . html_writer::tag('span',
                        get_string('statefinisheddetails', 'quiz',
                                userdate($attemptobj->get_submitted_date())),
                        array('class' => 'statedetails'));

            case quiz_attempt::ABANDONED:
                return get_string('stateabandoned', 'quiz');
        }
    }
public function attempt_state($attemptobj) {
        switch ($attemptobj->get_state()) {
            case quiz_attempt::IN_PROGRESS:
                return get_string('stateinprogress', 'quiz');

            case quiz_attempt::OVERDUE:
                return get_string('stateoverdue', 'quiz') . html_writer::tag('span',
                        get_string('stateoverduedetails', 'quiz',
                                userdate($attemptobj->get_due_date())),
                        array('class' => 'statedetails'));

            case quiz_attempt::FINISHED:
                return get_string('statefinished', 'quiz') . html_writer::tag('span',
                        get_string('statefinisheddetails', 'quiz',
                                userdate($attemptobj->get_submitted_date())),
                        array('class' => 'statedetails'));

            case quiz_attempt::ABANDONED:
                return get_string('stateabandoned', 'quiz');
        }
    }
public function attempt_state ( $ attemptobj ) { switch ( $ attemptobj -> get_state ( ) ) { case quiz_attempt :: IN_PROGRESS : return get_string ( 'stateinprogress' , 'quiz' ) ; case quiz_attempt :: OVERDUE : return get_string ( 'stateoverdue' , 'quiz' ) . html_writer :: tag ( 'span' , get_string ( 'stateoverduedetails' , 'quiz' , userdate ( $ attemptobj -> get_due_date ( ) ) ) , array ( 'class' => 'statedetails' ) ) ; case quiz_attempt :: FINISHED : return get_string ( 'statefinished' , 'quiz' ) . html_writer :: tag ( 'span' , get_string ( 'statefinisheddetails' , 'quiz' , userdate ( $ attemptobj -> get_submitted_date ( ) ) ) , array ( 'class' => 'statedetails' ) ) ; case quiz_attempt :: ABANDONED : return get_string ( 'stateabandoned' , 'quiz' ) ; } }
Generate a brief textual desciption of the current state of an attempt.
@param quiz_attempt $attemptobj the attempt
@param int $timenow the time to use as 'now'.
@return string the appropriate lang string to describe the state.
Generate a brief textual desciption of the current state of an attempt .