<?php
foreach ($all_video_courses as $video_course_value) {
    ?>
    <div class="col-sm-12 gray text-left" >
        <div class="col-sm-4" style="padding-top: 5px ">
            <a href="<?php echo base_url(); ?>" target="_blank">
                <?php echo $video_course_value->video_course_title; ?>
            </a>
        </div>
        <div class="col-sm-2" style="padding-top: 5px">
            <?php
            if ($video_course_value->person_role == 6 || $video_course_value->person_role == 1) {
                echo 'Talha Trainging';
            }
            ?>
        </div>
        <div class="col-sm-3" style="padding-top: 5px">
            <?php
            echo $video_course_value->course_category_name;
            ?>
        </div>
        <div class="col-sm-3" id="video_course_status<?php echo $video_course_value->video_management_id; ?>">
            <?php
            switch ($video_course_value->video_management_status) {
                case 1:
                    ?>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'inactive')" >
                        <i class="fa fa-user-times" title="Inactive"></i>
                    </a>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'archive')" >
                        <i class="fa fa-archive" title="Archive"></i>
                    </a>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'pending')" >
                        <i class="fa fa-refresh fa-spin" title="Pending"></i>
                    </a>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'draft')" >
                        <i class="fa fa-dropbox" title="Draft"></i>
                    </a>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'delete')" >
                        <i class="fa fa-trash-o" title="Delete"></i>
                    </a>
                    <?php
                    break;
                case 6:
                    ?>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'active')" >
                        <i class="fa fa-user-plus" title="Acitve"></i>
                    </a>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'archive')" >
                        <i class="fa fa-archive" title="Archive"></i>
                    </a>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'pending')" >
                        <i class="fa fa-refresh fa-spin" title="Pending"></i>
                    </a>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'draft')" >
                        <i class="fa fa-dropbox" title="Draft"></i>
                    </a>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'delete')" >
                        <i class="fa fa-trash-o" title="Delete"></i>
                    </a> 
                    <?php
                    break;
                case 2:
                    ?>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'active')" >
                        <i class="fa fa-user-plus" title="Acitve"></i>
                    </a>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'delete')" >
                        <i class="fa fa-trash-o" title="Delete"></i>
                    </a>
                    <?php
                    break;
                case 3:
                    ?>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'approved')" >
                        <i class="glyphicon glyphicon-ok" title="Approved"></i>
                    </a>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'draft')" >
                        <i class="fa fa-dropbox" title="Draft"></i>
                    </a>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'delete')" >
                        <i class="fa fa-trash-o" title="Delete"></i>
                    </a>
                    <?php
                    break;
                case 4:
                    ?>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'active')" >
                        <i class="fa fa-user-plus" title="Acitve"></i>
                    </a>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'archive')" >
                        <i class="fa fa-archive" title="Archive"></i>
                    </a>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'pending')" >
                        <i class="fa fa-refresh fa-spin" title="Pending"></i>
                    </a>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'draft')" >
                        <i class="fa fa-dropbox" title="Draft"></i>
                    </a>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'delete')" >
                        <i class="fa fa-trash-o" title="Delete"></i>
                    </a> 
                    <?php
                    break;
                case 5:
                    ?>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'active')" >
                        <i class="fa fa-user-plus" title="Acitve"></i>
                    </a>
                    <a href="javascript:void(0)"
                       onclick="changeVideoCourseStatus('<?php echo base_url() . 'change-video-course-status'; ?>', '<?php echo $video_course_value->video_management_id; ?>', 'delete')" >
                        <i class="fa fa-trash-o" title="Delete"></i>
                    </a>
                    <?php
                    break;
            }
            ?>

            <a href="<?php echo base_url() ?>edit-video-course/<?php echo $video_course_value->url; ?>">
                <i class="fa fa-edit" title="Edit"></i>
            </a>

            <a target="_blank" href="<?php echo base_url() . $video_course_value->url ?>">
                <i class="fa fa-th" title="Course Details"></i>
            </a>
        </div>
    </div>
    <div class="col-sm-12"><br></div> 
    <?php
}
?>

<?php
$total_page = ceil($total_video_courses->total / 10);
if ($total_page > 1) {
    ?>
    <nav class="course-pagination">
        <ul class="pagination">
            <?php
            if ($page > 2) {
                ?>
                <li>
                    <a href="<?php echo base_url() . 'manage-video-course'; ?>" aria-label="Previous">
                        <span aria-hidden="true" title="First Page">&laquo;&laquo;</span>
                    </a>
                </li>
                <li>
                    <a href="<?php echo base_url() . 'manage-video-course/' . ($page - 1); ?>" aria-label="Previous">
                        <span aria-hidden="true" title="Previous Page">&laquo;</span>
                    </a>
                </li>
            <?php } elseif ($page > 1) { ?>
                <li>
                    <a href="<?php echo base_url() . 'manage-video-course/' . ($page - 1); ?>" aria-label="Previous">
                        <span aria-hidden="true" title="Previous Page">&laquo;</span>
                    </a>
                </li>
                <?php
            }
            for ($i = 0; $total_page > $i; $i++) {
                echo '<li><a href="' . base_url() . 'manage-video-course/' . ($i + 1) . '">' . ($i + 1) . '</a></li>';
            }
            if ($total_page != $page) {
                ?>
                <li>
                    <a href="<?php echo base_url() . 'manage-video-course/' . ($page + 1); ?>" aria-label="Next">
                        <span aria-hidden="true" title="Next Page">&raquo;</span>
                    </a>
                </li>
                <li>
                    <a href="<?php echo base_url() . 'manage-video-course/' . $total_page; ?>" aria-label="Next">
                        <span aria-hidden="true" title="Last Page">&raquo;&raquo;</span>
                    </a>
                </li>
            <?php } ?>
        </ul>
    </nav>
<?php } 

