<?php
if ($video_course_type == 'free') {
    if ($free_courses) {
        $i = 0;
        foreach ($free_courses as $course_value) {
            ?>

            <div class="col-sm-12 gray">
                <div class="col-sm-9 text-left" style="padding-top: 10px ">
                    <a target="_blank" href="<?php echo base_url() . $course_value->url; ?>">
                        <?php echo $course_value->video_course_title; ?>
                    </a>
                </div>

                <div class="col-sm-3" style="padding-top: 10px">
                    <a href="<?php echo base_url() . 'course/' . $course_value->url . '/certificate' ?>">
                        <i class="fa  fa-graduation-cap" title="View Certificate"></i>
                        &nbsp;&nbsp;&nbsp;
                    </a>

                    <a href="<?php echo base_url() . 'course/' . $course_value->url . '/quiz' ?>">
                        <i class="fa  fa  fa-lightbulb-o fa-lg" title="View quiz"></i>
                        &nbsp;&nbsp;&nbsp;
                    </a>
                    <a href="javascript:void(0)"  data-toggle="modal" data-target="#deleteFreeVideoCourse<?php echo $course_value->video_management_id; ?>" >
                        <i class="fa  fa-remove" title="Cancel"></i>
                    </a>&nbsp;&nbsp;&nbsp;
                </div>

                <!-- Start Delete Modal View-->
                <div class="modal" style="" id="deleteFreeVideoCourse<?php echo $course_value->video_management_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content" style="top: 180px;border: 5px solid #80c12c;border-top: 20px solid #80c12c !important;margin: 0 auto;width: 450px">           
                            <div class="modal-body">
                                <h4 style="text-align: center !important">Are you sure you want to Cancel this Video Course?</h4>
                            </div>
                            <div class="modal-footer">
                                <div  class="col-sm-12">               
                                    <button onclick="cancelVideoCourseRegistration('<?php echo base_url() . 'cancel-learner-video-course-registration' ?>', '<?php echo $course_value->student_id ?>', 'free')" style="margin-left: 90px" type="button" class="btn btn-success  col-sm-2" data-dismiss="modal">Yes</button>
                                    <button type="button" style="margin-left: 20px" class="btn btn-danger col-sm-2 col-sm-offset-4" data-dismiss="modal">No</button>
                                </div>
                            </div>            
                        </div>
                    </div>
                </div> 
                <!-- END Delete Modal View-->

            </div>
            <div class="col-sm-12"><br></div> 
            <?php
            $i++;
        }
    } else {
        echo 'You do not have register any Free Video Course';
    }
    ?>


    <?php
    $total_page = ceil($total_free_courses->total / 10);
    if ($total_page > 1) {
        ?>
        <div class="col-sm-12 " style="padding: 0">
            <nav class="course-pagination">
                <ul class="pagination">
                    <?php
                    if ($page > 2) {
                        ?>
                        <li>
                            <a href="javascript:void(0)" 
                               onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'free', '<?php echo '0' ?>')"
                               aria-label="Previous">
                                <span aria-hidden="true" title="First Page">&laquo;&laquo;</span>
                            </a>
                        </li>
                        <li>
                            <a href="javascript:void(0)" 
                               onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'free', '<?php echo ($page - 1) ?>')"
                               aria-label="Previous">
                                <span aria-hidden="true" title="Previous Page">&laquo;</span>
                            </a>
                        </li>
                    <?php } elseif ($page > 1) { ?>
                        <li>
                            <a href="javascript:void(0)" 
                               onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'free', '<?php echo ($page - 1) ?>')"
                               aria-label="Previous">
                                <span aria-hidden="true" title="Previous Page">&laquo;</span>
                            </a>
                        </li>
                        <?php
                    }
                    for ($i = 0; $total_page > $i; $i++) {
                        ?>
                        <li><a href="javascript:void(0)"
                               onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'free', '<?php echo ($i + 1) ?>')" ><?php echo $i + 1 ?></a></li>
                            <?php
                        }
                        if ($total_page != $page) {
                            ?>
                        <li>
                            <a href="javascript:void(0)" 
                               onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'free', '<?php echo ($page + 1) ?>')"
                               aria-label="Next">
                                <span aria-hidden="true" title="Next Page">&raquo;</span>
                            </a>
                        </li>
                        <li>
                            <a href="javascript:void(0)" 
                               onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'free', '<?php echo $total_page ?>')"
                               aria-label="Next">
                                <span aria-hidden="true" title="Last Page">&raquo;&raquo;</span>
                            </a>
                        </li>
                    <?php } ?>
                </ul>
            </nav>
        </div>
        <?php
    }
}

if ($video_course_type == 'register') {
    if ($registered_courses) {
        $k = 0;
        foreach ($registered_courses as $course_value) {
            ?>
            <div class="col-sm-12 gray text-left">
                <div class="col-sm-5" style="padding-top: 10px ">
                    <a target="_blank" href="<?php echo base_url() . $course_value->url; ?>">
                        <?php echo $course_value->video_course_title; ?>
                    </a>
                </div>

                <div class="col-sm-3" style="padding-top: 10px">
                    <?php
//                                    if ($course_value->video_course_price_currency == 1) {
//                                        echo 'BDT ' . $course_value->video_course_price . ' / USD ' . $fx->toForeign($course_value->video_course_price);
//                                    } else if ($currency == 2) {
//                                        echo 'BDT ' . $fx->toForeign($course_value->video_course_price) . ' / USD ' . $course_value->video_course_price;
//                                    }
                    ?>
                </div>
                <div class="col-sm-2" style="padding-top: 10px">Unpaid</div>
                <div class="col-sm-2" style="padding-top: 10px">
                    <?php
//                                        $payment_id = $this->encrypt->encode($value->payment_id);
//                                        $id = str_replace("/", "%F2", $payment_id);
                    ?>
                    <a href="<?php // echo base_url() . 'view-invoice-set-id/' . $id;        ?>">
                        <i class="fa  fa  fa-money" title="View Invoice"></i>
                        &nbsp;&nbsp;&nbsp;
                    </a>
                    <a href="javascript:void(0)"  data-toggle="modal" data-target="#deleteRegisterVideoCourse<?php echo $course_value->video_management_id; ?>" >
                        <i class="fa  fa-remove" title="Cancel"></i>
                    </a>&nbsp;&nbsp;&nbsp;
                </div>

                <!-- Start Delete Modal View-->
                <div class="modal" style="" id="deleteRegisterVideoCourse<?php echo $course_value->video_management_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content" style="top: 180px;border: 5px solid #80c12c;border-top: 20px solid #80c12c !important;margin: 0 auto;width: 450px">           
                            <div class="modal-body">
                                <h4 style="text-align: center !important">Are you sure you want to Cancel this Video Course?</h4>
                            </div>
                            <div class="modal-footer">
                                <div  class="col-sm-12">               
                                    <button onclick="cancelVideoCourseRegistration('<?php echo base_url() . 'cancel-learner-video-course-registration' ?>', '<?php echo $course_value->payment_id ?>', 'registration')" 
                                            style="margin-left: 90px" type="button" class="btn btn-success  col-sm-2" data-dismiss="modal">Yes</button>
                                    <button type="button" style="margin-left: 20px" class="btn btn-danger col-sm-2 col-sm-offset-4" data-dismiss="modal">No</button>
                                </div>
                            </div>            
                        </div>
                    </div>
                </div> 
                <!-- END Delete Modal View-->

            </div>
            <div class="col-sm-12"><br></div> 
            <?php
            $k++;
        }
    } else {
        echo 'You do not have any register video course';
    }
    ?>

    <?php
    $total_register_page = ceil($total_registered_course->total / 10);
    if ($total_register_page > 1) {
        ?>
        <div class="col-sm-12 " style="padding: 0">
            <nav class="course-pagination">
                <ul class="pagination">
                    <?php
                    if ($page > 2) {
                        ?>
                        <li>
                            <a href="javascript:void(0)" 
                               onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'register', '<?php echo '0' ?>')"
                               aria-label="Previous">
                                <span aria-hidden="true" title="First Page">&laquo;&laquo;</span>
                            </a>
                        </li>
                        <li>
                            <a href="javascript:void(0)" 
                               onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'register', '<?php echo ($page - 1) ?>')"
                               aria-label="Previous">
                                <span aria-hidden="true" title="Previous Page">&laquo;</span>
                            </a>
                        </li>
                    <?php } elseif ($page > 1) { ?>
                        <li>
                            <a href="javascript:void(0)" 
                               onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'register', '<?php echo ($page - 1) ?>')"
                               aria-label="Previous">
                                <span aria-hidden="true" title="Previous Page">&laquo;</span>
                            </a>
                        </li>
                        <?php
                    }
                    for ($i = 0; $total_register_page > $i; $i++) {
                        ?>
                        <li><a href="javascript:void(0)"
                               onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'register', '<?php echo ($i + 1) ?>')" ><?php echo $i + 1 ?></a></li>
                            <?php
                        }
                        if ($total_register_page != $page) {
                            ?>
                        <li>
                            <a href="javascript:void(0)" 
                               onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'register', '<?php echo ($page + 1) ?>')"
                               aria-label="Next">
                                <span aria-hidden="true" title="Next Page">&raquo;</span>
                            </a>
                        </li>
                        <li>
                            <a href="javascript:void(0)" 
                               onclick="learnerVideoCoursePagination('<?php echo base_url() . 'user/learner-video-course-pagination'; ?>', 'register', '<?php echo $total_register_page ?>')"
                               aria-label="Next">
                                <span aria-hidden="true" title="Last Page">&raquo;&raquo;</span>
                            </a>
                        </li>
                    <?php } ?>
                </ul>
            </nav>
        </div>
    <?php
    }
}