HEX
Server: Apache/2.4.25
System: Linux ion14 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19) x86_64
User: (10087)
PHP: 7.4.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,system, exec, shell_exec, passthru, popen, proc_open
Upload Files
File: /home/www/web115/wordpress/wp-content/plugins/digimember/application/view/user/exam_questions.php
<?php
    $use_checkbox = ncore_isTrue( $exam->is_multiple_answer );
?>

<script>
ncoreJQ(document).ready( function(){

    ncoreJQ( '.dm_exam_answer_radio' ).change(function() {
        var val = ncoreJQ(this).val();

        ncoreJQ(this).closest('.dm_exam_question').find('.dm_exam_answer_radio').each(function(index,obj) {
            ncoreJQ(obj).parent('label').removeClass('dm_exam_selected');
        });

        ncoreJQ(this).parent('label').addClass('dm_exam_selected');
    });

    ncoreJQ( '.dm_exam_answer_checkbox' ).change(function() {

        var is_checked = ncoreJQ(this).is( ':checked' );

        if (is_checked) {
            ncoreJQ(this).parent('label').addClass('dm_exam_selected');
        }
        else
        {
            ncoreJQ(this).parent('label').removeClass('dm_exam_selected');
        }
    });
    ncoreJQ( '#dm_exam_<?=$exam->id?>_submit' ).click(function() {
        return confirm( "<?=_digi( 'Your answers will now be submitted.\n\nContinue?' ) ?>" );
    });
} );
</script>

<style>
.dm_exam_question {
    margin: 0 0 40px 0;
    box-sizing: border-box;
}

.dm_exam_question h3 {
    margin: 0;
    padding: 0;
}

.dm_exam_question > label {
    width: 100%;
    display: block;
    margin: 3px 0;
    padding: 3px 0;
    cursor: pointer;
    box-sizing: border-box;
}
.dm_exam_selected {
    background-color: rgb(217, 237, 247);
    border: 1px solid rgb(188, 232, 241);
}

/*
.dm_exam_result_correct {
    background-color: rgb(223, 240, 216);
    border: 1px solid rgb(214, 233, 198);
}

.dm_exam_result_error {
    background-color: rgb(242, 222, 222);
    border: 1px solid rgb(235, 204, 209);
}

.dm_exam_result_would_be_correct {
    background-color: rgb(217, 237, 247);
    border: 1px solid rgb(188, 232, 241);
}
*/
</style>

<?php if ($text): ?>
    <div class='digimember_exam_intro'><?=$text?></div>
<?php endif; ?>

<form method='post'>
<div class='dm_exam_container'>

<?php
    $postname = 'exam_'.$exam->id;

    foreach ($exam->questions as $question):
        if (empty($question['answer_count'])) {
            continue;
        }
?>
    <div class='dm_exam_question'>
        <h3><?=$question['hl']?></h3>
        <?php if ($question['descr']): ?>
            <div class='dm_exam_question_descr'><?=$question['descr']?></div>
        <?php endif; ?>
        <?php
            foreach ($question['answers'] as $i => $answer):

                if (empty($answer['text'])) {
                    continue;
                }

                $is_selected = !empty( $answer['is_selected'] );
                $css         = $is_selected
                             ? 'dm_exam_selected'
                             : '';
                $selected = $is_selected
                          ? 'checked="checked"'
                          : '';

                $type = $use_checkbox
                      ? 'checkbox'
                      : 'radio';
         ?>
            <label class='<?=$css?>'>
                <input <?=$selected?> class='dm_exam_answer_<?=$type?>' type='<?=$type?>' name="<?=$postname.'['.$question['id'].']'.($use_checkbox?'['.$i.']':'')?>" value="<?=$answer['id']?>" />
                <?=$answer['text'] ?>
            </label>
        <?php endforeach; ?>
    </div>
<?php endforeach; ?>

<button class='digimember_exam_button dm_exam_submit_button' id="dm_<?=$postname?>_submit" style="<?=$button_style?>"><?=_digi('Submit your answers')?></button>

</div>
</form>