plugin/exo/Manager/Attempt/PaperManager.php
public function isSolutionAvailable(Exercise $exercise, Paper $paper)
    {
        $correctionMode = $exercise->getCorrectionMode();
        switch ($correctionMode) {
            case ShowCorrectionAt::AFTER_END:
                $available = !empty($paper->getEnd());
                break;

            case ShowCorrectionAt::AFTER_LAST_ATTEMPT:
                $available = 0 === $exercise->getMaxAttempts() || $paper->getNumber() === $exercise->getMaxAttempts();
                break;

            case ShowCorrectionAt::AFTER_DATE:
                $now = new \DateTime();
                $available = empty($exercise->getDateCorrection()) || $now >= $exercise->getDateCorrection();
                break;

            case ShowCorrectionAt::NEVER:
            default:
                $available = false;
                break;
        }

        return $available;
    }
public function isSolutionAvailable(Exercise $exercise, Paper $paper)
    {
        $correctionMode = $exercise->getCorrectionMode();
        switch ($correctionMode) {
            case ShowCorrectionAt::AFTER_END:
                $available = !empty($paper->getEnd());
                break;

            case ShowCorrectionAt::AFTER_LAST_ATTEMPT:
                $available = 0 === $exercise->getMaxAttempts() || $paper->getNumber() === $exercise->getMaxAttempts();
                break;

            case ShowCorrectionAt::AFTER_DATE:
                $now = new \DateTime();
                $available = empty($exercise->getDateCorrection()) || $now >= $exercise->getDateCorrection();
                break;

            case ShowCorrectionAt::NEVER:
            default:
                $available = false;
                break;
        }

        return $available;
    }
public function isSolutionAvailable ( Exercise $ exercise , Paper $ paper ) { $ correctionMode = $ exercise -> getCorrectionMode ( ) ; switch ( $ correctionMode ) { case ShowCorrectionAt :: AFTER_END : $ available = ! empty ( $ paper -> getEnd ( ) ) ; break ; case ShowCorrectionAt :: AFTER_LAST_ATTEMPT : $ available = 0 === $ exercise -> getMaxAttempts ( ) || $ paper -> getNumber ( ) === $ exercise -> getMaxAttempts ( ) ; break ; case ShowCorrectionAt :: AFTER_DATE : $ now = new \ DateTime ( ) ; $ available = empty ( $ exercise -> getDateCorrection ( ) ) || $ now >= $ exercise -> getDateCorrection ( ) ; break ; case ShowCorrectionAt :: NEVER : default : $ available = false ; break ; } return $ available ; }
Check if the solution of the Paper is available to User.

@param Exercise $exercise
@param Paper    $paper

@return bool
Check if the solution of the Paper is available to User .