<div class="container bg-white mt-3 mb-3 pt-3 pb-3">
    <div class="row">
        <div class="col-sm-12">
            
            <div class="table-responsive">
                <table class="table table-bordered table-striped">
                    <thead>
                        <tr>
                            <th>Course</th>
                            <th>Subject Stream</th>
                            <th>Old</th>
                            <th>New</th>
                            <th>Deleted</th>
                            <th>Promote_old</th>
                            <th>Total</th>
                        </tr>
                    </thead>
                    <tbody>
                        
                        <?php 
                        $table='courses';
                        
                        $all_courses=$this->DeveloperModel->get_data($table);
                        if($all_courses){
                            foreach($all_courses as $courses){
                                $count_s=0;
                                $new_s=0;
                                $courses_id=$courses['id'];
                                $get_course_students_old=$this->DeveloperModel->get_course_students_old($courses_id);
                                if($get_course_students_old){
                                    foreach($get_course_students_old as $old_s){
                                        if($old_s['impor_ref_id']==0){
                                            $count_s = $count_s + 1;
                                        }else{
                                            $new_s=$new_s + 1;
                                        }
                                    }
                                }
                                ?>
                        <tr>
                            <td><?php echo $courses['course']; ?></td>
                            <td><?php echo $courses['subject_stream'];?></td>
                            <td><a href="<?php echo base_url();?>Developer/old_course_students/<?php echo $courses['id'];?>" class="btn btn-info">View ( <?php echo $count_s;?> )</a></td>
                            <td><a href="<?php echo base_url();?>Developer/view_new_admission/<?php echo $courses['id'];?>" class="btn btn-info">View ( <?php echo $new_s;?> )</a></td>
                            <!--<td><?php echo $new_s;?></td>-->
                            <td>
                                <a href="<?php echo base_url(); ?>Developer/view_deleted_course_students/<?php echo $courses['course'];?>" class="btn btn-warning text-white">View( 
                                <?php
                                $del_count=0;
                                $all_deleted_students=$this->DeveloperModel->get_deleted_students_for_course($courses['course']);
                                if($all_deleted_students){
                                    foreach($all_deleted_students as $del_student){
                                        $del_count=$del_count + 1;       
                                    }
                                }
                                echo $del_count;
                                ?> )
                                
                                </a>                        
                            </td>
                            <td><a href=""></a></td>
                            <td><?php echo $count_s + $new_s;?></td>
                        </tr>                                
                                <?php
                            }
                        }
                        ?>

                    </tbody>
                </table>
            </div>
            
        </div>
    </div>
</div>