예제 #1
0
}
if (isset($item_list['1']) && is_numeric($item_list['1'])) {
    $quId = (int) $item_list['1'];
} else {
    $quId = null;
}
if (isset($item_list['2']) && is_numeric($item_list['2'])) {
    $exId = (int) $item_list['2'];
} else {
    $exId = null;
}
if ($cmd == 'download') {
    // find exercise informations
    $exercise = new Exercise();
    if ($exercise->load($exId) || $is_allowedToEdit) {
        if ($exercise->getVisibility() == 'VISIBLE' || $is_allowedToEdit) {
            $question = new Question();
            if ($question->load($quId)) {
                $attachmentFile = $question->getQuestionDirSys() . $question->getAttachment();
                if (claro_send_file($attachmentFile)) {
                    die;
                } else {
                    $dialogBox->error(get_lang('Not found'));
                }
            } else {
                $dialogBox->error(get_lang('Not found'));
            }
        } else {
            $dialogBox->error(get_lang('Not allowed'));
        }
    } else {
예제 #2
0
 */
$resetQuestionList = false;
// if exercise is not in session try to load it.
// if exId has been defined in request force refresh of exercise in session
if (!isset($_SESSION['serializedExercise']) || !is_null($exId)) {
    // clean previous exercise if any
    unset($_SESSION['serializedExercise']);
    $exercise = new Exercise();
    if (is_null($exId) || !$exercise->load($exId)) {
        // exercise is required
        header("Location: " . Url::Contextualize('./exercise.php'));
        exit;
    } else {
        // load successfull
        // exercise must be visible or in learning path to be displayed to a student
        if ($exercise->getVisibility() != 'VISIBLE' && !$is_allowedToEdit && !($inOldLP || $inLP)) {
            $dialogBox->error(get_lang('The exercise is not available'));
            $content = $dialogBox->render();
            $claroline->display->body->appendContent($content);
            echo $claroline->display->render();
            //header("Location: ./exercise.php");
            exit;
        } else {
            $_SESSION['serializedExercise'] = serialize($exercise);
            $resetQuestionList = true;
        }
    }
} else {
    // get it back from session
    $exercise = unserialize($_SESSION['serializedExercise']);
    $exId = $exercise->getId();