<div class="row">
    <div class="panel-group">
    <?php foreach($subscribed_exam_standards as $standard): 
    $id = $standard->exam_standard_ID;
    ?>
    <div class="col-sm-6">
        <div class="panel panel-primary">
            <div class="panel-heading">
            <h4 class="panel-title">
                <a data-toggle="collapse" href="#exam_standard_<?= $id; ?>"><?= $standard->standard_name ?></a>
            </h4>
            </div>
            <div id="exam_standard_<?= $id; ?>" class="panel-collapse collapse">
                <ul class="list-group">
            <?php foreach($exam_orgs as $org):
                if($org->exam_standard_ID == $standard->exam_standard_ID): 
            ?>
                    <li class="list-group-item">
                        <strong><?= $org->exam_org_name ?></strong>
                        <table class="table table-striped">
                            <tbody>
                            <?php foreach($post_levels as $post): 
                                if($post->exam_org_ID == $org->exam_org_ID):
                            ?>
                                <tr>
                                    <td><span><?= $post->post_level_name ?></span></td>
                                    <td>
                                        <button class="pull-right btn btn-warning btn-sm" 
                                        onclick="open_exam_window(<?= $standard->exam_standard_ID ?>,<?= $org->exam_org_ID  ?>,<?= $post->post_level_ID ?>)">
                                            Start Exam
                                        </button>
                                    </td>
                                </tr>
                            <?php
                                endif; 
                            endforeach; ?>
                            </tbody>
                        </table>
                    </li>
            <?php
                endif; 
            endforeach; ?>
                </ul>
            </div>
        </div>
    </div>
    <?php endforeach; ?>
    </div>
</div>
<br>
<button class="btn btn-primary" onclick="open_exam_window()">
Start Exam
</button>
<script>
	 function open_exam_window(exam_standard, exam_org, post_level) {
                var width = screen.availWidth-15;
                var height = screen.availHeight-70;
                var exam_window_url = '<?= base_url('online_exam/init/'); ?>'+exam_standard+'/'+exam_org+'/'+post_level;
                var examWindow = window.open(exam_window_url,'Online Exam','width='+width+'px, height='+height+'px, top=0px, left=0px, resizable=0, location=0');

            }
</script>

