
<?php
$quiz_total_time = 0;
foreach ($quiz_questions as $value) {
    $quiz_total_time += $value->time_limit;
}
$quiz_total_time = $quiz_total_time / 60;
$taken_time = $taken_time / 60;
?>

<div class="col-sm-8 ">

    <div class="col-sm-12 padding-zero text-left"><h3>Quiz Result</h3></div>

    <div class="col-sm-12 padding-zero"><br></div>
    <div class="col-sm-8 gray">
        <form action="quiz_test_multiple_choice_question.html" method="post">
            <div class="col-sm-8  padding-zero text-left">

                <div class="col-sm-12 text-left" style="padding: 0 0 5px 20px;">
                    <h3>Status On Questions</h3>  
                    <p>Total question : <?php echo $total_question; ?></p>
                    <p>Total correct answer : <?php echo $correct_ans; ?></p>
                    <p>Total  wrong answer : <?php echo $wrong_ans; ?></p>
                    <p>Total unanswer question: <?php echo $unanswered; ?></p>
                    <p>Taken Time: 
                        <?php
//                                    echo $taken_time . '/' . ($quiz_total_time * 60);
                        echo $this->cf->sec2view($taken_time) . ' / ' . $this->cf->sec2view($quiz_total_time * 60);
                        ?>
                    </p>
                    <p>Correct answer percentage: <span id="skillP"><?php echo round($correct_percentage, 2); ?>%</span></p>
                </div>
                <div class="col-sm-12"><hr><br></div>

                <?php if ($grade) { ?>

                    <div class="col-sm-12 text-left" style="padding: 0 0 5px 20px;">
                        <h3>Status On Marks</h3>  
                        <p>Total Marks : <?php echo $total_marks; ?></p>
                        <p>Receive Marks : <?php echo $receive_marks; ?></p>
                        <p>Grade : <?php echo $grade->grade_name; ?></p>
                        <p><a href="demo3.html">View Certificate</a></p>
                        <p>Receive Marks percentage: <?php echo round($correct_percentage, 2) . '' . '%'; ?></p>
                    </div>

                <?php } ?>

                <div class="col-sm-12"><br></div>

                <div class="col-sm-12">
                    <a href="<?php echo base_url() . 'quiz/' . $quiz_info->quiz_public_id . '/publish-result'; ?>" 
                       class="btn btn-success"> Publish Result </a>
                </div>

            </div>
        </form>    
        <div class="col-sm-4 padding-zero">

            <div class="row">
                <div class="col-sm-12"><br><br><br></div>
                <div class="col-sm-12" style="padding: 0">

                                <!--<div style="width: 200px;" id="testPercentage" class="circlestat  circliful" data-dimension="200" data-text="80%" data-width="30" data-fontsize="38" data-fgcolor="#32cd32" data-percent="80" data-bgcolor="#eee" data-fill="#ddd"><span style="line-height: 200px; font-size: 38px;" class="circle-text">80%</span><canvas height="200" width="200"></canvas></div>-->
                    <div id="testPercentage" class="circlestat " data-dimension="200" data-text="" data-width="30" data-fontsize="38" data-fgcolor="" data-percent=""  data-bgcolor="#eee" data-fill="#ddd"></div>
                    <script type="text/javascript">
                        $(function () {

                            var Skillpercentage = document.getElementById('skillP').innerHTML;
                            var SkiilValue = Skillpercentage.replace("%", "");

                            if (SkiilValue <= 50) {

                                var testPercentage = document.getElementById('testPercentage');
                                testPercentage.setAttribute("data-fgcolor", "#fc0a0a");
                            }
                            else if (SkiilValue <= 70) {

                                var testPercentage = document.getElementById('testPercentage');
                                testPercentage.setAttribute("data-fgcolor", "#f7ea5b");
                            }
                            else if (SkiilValue <= 85) {

                                var testPercentage = document.getElementById('testPercentage');
                                testPercentage.setAttribute("data-fgcolor", "#32cd32");
                            }
                            else if (SkiilValue <= 100) {

                                var testPercentage = document.getElementById('testPercentage');
                                testPercentage.setAttribute("data-fgcolor", "#8CC73F");
                            }

                            var testPercentage = document.getElementById('testPercentage');
                            testPercentage.setAttribute("data-percent", SkiilValue);
                            testPercentage.setAttribute("data-text", Skillpercentage);

                            //                   


                            $('.circlestat').circliful();
                        });</script>

                </div>
            </div>
        </div>
    </div>
</div>
