public function get_due_date() {
        $deadlines = array();
        if ($this->quizobj->get_quiz()->timelimit) {
            $deadlines[] = $this->attempt->timestart + $this->quizobj->get_quiz()->timelimit;
        }
        if ($this->quizobj->get_quiz()->timeclose) {
            $deadlines[] = $this->quizobj->get_quiz()->timeclose;
        }
        if ($deadlines) {
            $duedate = min($deadlines);
        } else {
            return false;
        }

        switch ($this->attempt->state) {
            case self::IN_PROGRESS:
                return $duedate;

            case self::OVERDUE:
                return $duedate + $this->quizobj->get_quiz()->graceperiod;

            default:
                throw new coding_exception('Unexpected state: ' . $this->attempt->state);
        }
    }
public function get_due_date() {
        $deadlines = array();
        if ($this->quizobj->get_quiz()->timelimit) {
            $deadlines[] = $this->attempt->timestart + $this->quizobj->get_quiz()->timelimit;
        }
        if ($this->quizobj->get_quiz()->timeclose) {
            $deadlines[] = $this->quizobj->get_quiz()->timeclose;
        }
        if ($deadlines) {
            $duedate = min($deadlines);
        } else {
            return false;
        }

        switch ($this->attempt->state) {
            case self::IN_PROGRESS:
                return $duedate;

            case self::OVERDUE:
                return $duedate + $this->quizobj->get_quiz()->graceperiod;

            default:
                throw new coding_exception('Unexpected state: ' . $this->attempt->state);
        }
    }
public function get_due_date ( ) { $ deadlines = array ( ) ; if ( $ this -> quizobj -> get_quiz ( ) -> timelimit ) { $ deadlines [ ] = $ this -> attempt -> timestart + $ this -> quizobj -> get_quiz ( ) -> timelimit ; } if ( $ this -> quizobj -> get_quiz ( ) -> timeclose ) { $ deadlines [ ] = $ this -> quizobj -> get_quiz ( ) -> timeclose ; } if ( $ deadlines ) { $ duedate = min ( $ deadlines ) ; } else { return false ; } switch ( $ this -> attempt -> state ) { case self :: IN_PROGRESS : return $ duedate ; case self :: OVERDUE : return $ duedate + $ this -> quizobj -> get_quiz ( ) -> graceperiod ; default : throw new coding_exception ( 'Unexpected state: ' . $ this -> attempt -> state ) ; } }
If the attempt is in an applicable state, work out the time by which the
student should next do something.
@return int timestamp by which the student needs to do something.
If the attempt is in an applicable state work out the time by which the student should next do something .