<?php
//$this->load->library('ForeignExchange');
//$fx = new ForeignExchange('BDT', 'USD');
if ($video_course_type == 'draft') {
    if ($draft_video_courses) {
        ?>
        <div class="col-sm-12 padding-zero">
            <?php
            foreach ($draft_video_courses as $course_value) {
                ?>
                <div class="col-sm-12 gray text-center">
                    <div class="col-sm-6" style="padding-top: 10px ">
                        <a href="<?php echo base_url() . $course_value->url; ?>" target="_blank">
                            <?php echo $course_value->video_course_title; ?></a>
                    </div>
                    <div class="col-sm-3" style="padding-top: 10px">
                        <?php
                        if ($course_value->video_course_type == 1) {
                            if ($course_value->video_course_price_currency == 1) {
                                
                                //echo 'BDT ' . $course_value->video_course_price . ' / USD ' . $this->tt_currency->set($course_value->video_course_price, 'BDT', 'USD')->convert_currency()->get();
                                echo 'BDT ' . $course_value->video_course_price;
                            } else if ($currency == 2) {
                                
                                //echo 'BDT ' . $this->tt_currency->set($course_value->video_course_price, 'USD', 'BDT')->convert_currency()->get() . ' / USD ' . $course_value->video_course_price;
                                echo ' USD ' . $course_value->video_course_price;
                            }
                        } else {
                            echo 'Free';
                        }
                        ?>
                    </div>
                    <div class="col-sm-3" style="padding-top: 10px">
                        <a href="<?php echo base_url() . 'edit-course-information/' . $course_value->url; ?>"><i class="fa fa-edit" title="Edit"></i></a>&nbsp;
                        <span>&nbsp;</span>
                        <a href="<?php echo base_url() . 'invite-learners/' . $course_value->url; ?>"><i class="fa fa-envelope-o" title="Invite to Learners"></i></a>&nbsp;
                        <span>&nbsp;</span>
                        <a href="javascript:void(0)" onclick="checkForLinkAction('<?php echo base_url() . 'delete-course/' . $course_value->url; ?>', 'Delete', 'Do you want to delete this course')">
                            <i class="fa fa-trash-o" title="Delete"></i></a>&nbsp;
                        <span>&nbsp;</span>
                    </div>
                </div>
                <div class="col-sm-12"><br></div>
                <?php
            }
            ?>
        </div>
        <?php
    } else {
        echo '<p>There is no Draft Video Courses</p>';
    }
    ?>

    <?php
    $total_page = ceil($total_draft_video_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="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'draft', '<?php echo '1' ?>')"
                               aria-label="Previous">
                                <span aria-hidden="true" title="First Page">&laquo;&laquo;</span>
                            </a>
                        </li>
                        <li>
                            <a href="javascript:void(0)" 
                               onclick="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'draft', '<?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="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'draft', '<?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="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'draft', '<?php echo ($i + 1) ?>')" ><?php echo $i + 1 ?></a></li>
                            <?php
                        }
                        if ($total_page != $page) {
                            ?>
                        <li>
                            <a href="javascript:void(0)" 
                               onclick="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'draft', '<?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="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'draft', '<?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 == 'submit') {
    if ($submit_video_courses) {
        ?>
        <div class="col-sm-12 padding-zero">
            <?php
            foreach ($submit_video_courses as $course_value) {
                ?>
                <div class="col-sm-12 gray text-center">
                    <div class="col-sm-6" style="padding-top: 10px ">
                        <a href="<?php echo base_url() . $course_value->url; ?>" target="_blank">
                            <?php echo $course_value->video_course_title; ?></a>
                    </div>
                    <div class="col-sm-3" style="padding-top: 10px">
                        <?php
                        if ($course_value->video_course_type == 1) {
                            if ($course_value->video_course_price_currency == 1) {
                                
                                //echo 'BDT ' . $course_value->video_course_price . ' / USD ' . $this->tt_currency->set($course_value->video_course_price, 'BDT', 'USD')->convert_currency()->get();
                                echo 'BDT ' . $course_value->video_course_price;
                            } else if ($currency == 2) {
                                
                                //echo 'BDT ' . $this->tt_currency->set($course_value->video_course_price, 'USD', 'BDT')->convert_currency()->get() . ' / USD ' . $course_value->video_course_price;
                                echo ' USD ' . $course_value->video_course_price;
                            }
                        } else {
                            echo 'Free';
                        }
                        ?>
                    </div>
                    <div class="col-sm-3" style="padding-top: 10px">
                        <a href="<?php echo base_url() . 'edit-course-information/' . $course_value->url; ?>"><i class="fa fa-edit" title="Edit"></i></a>&nbsp;
                        <span>&nbsp;</span>
                        <a href="<?php echo base_url() . 'invite-learners/' . $course_value->url; ?>"><i class="fa fa-envelope-o" title="Invite to Learners"></i></a>&nbsp;
                        <span>&nbsp;</span>
                        <a href="javascript:void(0)" onclick="checkForLinkAction('<?php echo base_url() . 'delete-course/' . $course_value->url; ?>', 'Delete', 'Do you want to delete this course')">
                            <i class="fa fa-trash-o" title="Delete"></i></a>&nbsp;
                        <span>&nbsp;</span>
                    </div>
                </div>
                <div class="col-sm-12"><br></div>
                <?php
            }
            ?>
        </div>
        <?php
    } else {
        echo '<p>There is no Submission Video Courses</p>';
    }
    ?>

    <?php
    $total_submit = ceil($total_submit_video_courses->total / 10);
    if ($total_submit > 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="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'submit', '<?php echo '1' ?>')"
                               aria-label="Previous">
                                <span aria-hidden="true" title="First Page">&laquo;&laquo;</span>
                            </a>
                        </li>
                        <li>
                            <a href="javascript:void(0)" 
                               onclick="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'submit', '<?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="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'submit', '<?php echo ($page - 1) ?>')"
                               aria-label="Previous">
                                <span aria-hidden="true" title="Previous Page">&laquo;</span>
                            </a>
                        </li>
                        <?php
                    }
                    for ($i = 0; $total_submit > $i; $i++) {
                        ?>
                        <li><a href="javascript:void(0)"
                               onclick="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'submit', '<?php echo ($i + 1) ?>')" ><?php echo $i + 1 ?></a></li>
                            <?php
                        }
                        if ($total_submit != $page) {
                            ?>
                        <li>
                            <a href="javascript:void(0)" 
                               onclick="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'submit', '<?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="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'submit', '<?php echo $total_submit ?>')"
                               aria-label="Next">
                                <span aria-hidden="true" title="Last Page">&raquo;&raquo;</span>
                            </a>
                        </li>
                    <?php } ?>
                </ul>
            </nav>
        </div>
        <?php
    }
}
if ($video_course_type == 'active') {
    if ($active_video_courses) {
        ?>
        <div class="col-sm-12 padding-zero">
            <?php
            foreach ($active_video_courses as $course_value) {
                ?>
                <div class="col-sm-12 gray text-center">
                    <div class="col-sm-6" style="padding-top: 10px ">
                        <a href="<?php echo base_url() . $course_value->url; ?>" target="_blank">
                            <?php echo $course_value->video_course_title; ?></a>
                    </div>
                    <div class="col-sm-3" style="padding-top: 10px">
                        <?php
                        if ($course_value->video_course_type == 1) {
                            if ($course_value->video_course_price_currency == 1) {
                                
                                //echo 'BDT ' . $course_value->video_course_price . ' / USD ' . $this->tt_currency->set($course_value->video_course_price, 'BDT', 'USD')->convert_currency()->get();
                                echo 'BDT ' . $course_value->video_course_price;
                            } else if ($currency == 2) {
                                
                                //echo 'BDT ' . $this->tt_currency->set($course_value->video_course_price, 'USD', 'BDT')->convert_currency()->get() . ' / USD ' . $course_value->video_course_price;
                                echo ' USD ' . $course_value->video_course_price;
                            }
                        } else {
                            echo 'Free';
                        }
                        ?>
                    </div>
                    <div class="col-sm-3" style="padding-top: 10px">
                        <a href="<?php echo base_url() . 'edit-course-information/' . $course_value->url; ?>"><i class="fa fa-edit" title="Edit"></i></a>&nbsp;
                        <span>&nbsp;</span>
                        <a href="<?php echo base_url() . 'invite-learners/' . $course_value->url; ?>"><i class="fa fa-envelope-o" title="Invite to Learners"></i></a>&nbsp;
                        <span>&nbsp;</span>
                        <a href="javascript:void(0)" onclick="checkForLinkAction('<?php echo base_url() . 'delete-course/' . $course_value->url; ?>', 'Delete', 'Do you want to delete this course')">
                            <i class="fa fa-trash-o" title="Delete"></i></a>&nbsp;
                        <span>&nbsp;</span>
                    </div>
                </div>
                <div class="col-sm-12"><br></div>
                <?php
            }
            ?>
        </div>
        <?php
    } else {
        echo '<p>There is no Active Video Courses</p>';
    }
    ?>

    <?php
    $total_active_course = ceil($total_active_video_courses->total / 10);
    if ($total_active_course > 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="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'active', '<?php echo '1' ?>')"
                               aria-label="Previous">
                                <span aria-hidden="true" title="First Page">&laquo;&laquo;</span>
                            </a>
                        </li>
                        <li>
                            <a href="javascript:void(0)" 
                               onclick="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'active', '<?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="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'active', '<?php echo ($page - 1) ?>')"
                               aria-label="Previous">
                                <span aria-hidden="true" title="Previous Page">&laquo;</span>
                            </a>
                        </li>
                        <?php
                    }
                    for ($i = 0; $total_active_course > $i; $i++) {
                        ?>
                        <li><a href="javascript:void(0)"
                               onclick="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'active', '<?php echo ($i + 1) ?>')" ><?php echo $i + 1 ?></a></li>
                            <?php
                        }
                        if ($total_active_course != $page) {
                            ?>
                        <li>
                            <a href="javascript:void(0)" 
                               onclick="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'active', '<?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="videoCoursePagination('<?php echo base_url() . 'user/video-course-pagination'; ?>', 'active', '<?php echo $total_active_course ?>')"
                               aria-label="Next">
                                <span aria-hidden="true" title="Last Page">&raquo;&raquo;</span>
                            </a>
                        </li>
                    <?php } ?>
                </ul>
            </nav>
        </div>
        <?php
    }
}