<div class="container-fluid mt-3 mb-3 bg-white">
    <div class="row">
        <div class="col-sm-12 pt-3 pb-3">
            
            <ul class="breadcrumb">
                <li class="breadcrumb-item"><a href="<?php echo base_url();?>Welcome">Home</a></li>
                <li class="breadcrumb-item"><a href="<?php echo base_url();?>Certificate/dashboard">Certificate</a></li>
                <li class="breadcrumb-item">Students</li>
            </ul>
            
            
            <div class="table-responsive">
                <table class="table table-bordered table-striped" id="mytable">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>SID</th>
                            <th>Name</th>
                            <th>Father Name</th>
                            <th>Class</th>
                            <th>Doc</th>
                            <th>Status</th>
                            <th>Profile</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $count=0;
                        $acedemic_session=$this->session->userdata('acedemic_session');
                        $all_students=$this->CertificateModel->getstudents_in_alpha_order();
                        $course='';
                        $subject_stream='';
                        if($all_students){
                            foreach($all_students as $students){
                                $sid=$students['id'];
                                $count=$count + 1;
                                $check_student_courses_info=$this->CertificateModel->student_course_data($sid,$acedemic_session);
                                if($check_student_courses_info){
                                    foreach($check_student_courses_info as $student_courses_info){
                                        $course_id=$student_courses_info['course_id'];
                                        $course_table='courses';
                                        $get_course_info=$this->CertificateModel->get_item_data($course_id,$course_table);
                                        if($get_course_info){
                                            foreach($get_course_info as $course_info){
                                                $course=$course_info['course'];
                                                $subject_stream=$course_info['subject_stream'];
                                            }
                                        }
                        ?>
                        <tr>
                            <td><?php echo $count;?></td>
                            <td><?php echo $students['id']; ?></td>
                            <td style="text-transform:uppercase;"><?php echo $students['student_name'];?></td>
                            <td style="text-transform:uppercase;"><?php echo $students['father_name'];?></td>
                            <td><?php if($course_id == 0){echo $course_id;}else{ echo $course; echo " "; echo $subject_stream;}?></td>
                            
                            <td>
                                <a href="<?php echo base_url();?>Certificate/student_docs/<?php echo $sid;?>" class="btn btn-sm btn-danger" target="_blank">
                                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-files" viewBox="0 0 16 16">
                                        <path d="M13 0H6a2 2 0 0 0-2 2 2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2 2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zm0 13V4a2 2 0 0 0-2-2H5a1 1 0 0 1 1-1h7a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1zM3 4a1 1 0 0 1 1-1h7a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4z"/>
                                    </svg>
                                </a>
                            </td>
                            <td></td>
                            <td>
                                <a href="#" class="btn btn-sm btn-info">
                                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-person-circle" viewBox="0 0 16 16">
                                        <path d="M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"/>
                                        <path fill-rule="evenodd" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468 11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z"/>
                                    </svg>
                                </a>
                            </td>
                        </tr>
                        <?php
                                    }
                                }else{
                        ?>
                        <tr class="text-warning">
                            <td><?php echo $count;?></td>
                            <td><?php echo $students['id']; ?></td>
                            <td style="text-transform:uppercase;"><?php echo $students['student_name'];?></td>
                            <td style="text-transform:uppercase;"><?php echo $students['father_name'];?></td>
                            <td><?php echo $students['class'];?></td>
                            <td>
                                <a href="<?php echo base_url();?>Certificate/student_docs/<?php echo $sid;?>" class="btn btn-sm btn-danger" target="_blank">
                                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-files" viewBox="0 0 16 16">
                                        <path d="M13 0H6a2 2 0 0 0-2 2 2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2 2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zm0 13V4a2 2 0 0 0-2-2H5a1 1 0 0 1 1-1h7a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1zM3 4a1 1 0 0 1 1-1h7a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4z"/>
                                    </svg>
                                </a>
                            </td>
                            <td></td>
                            <td><a href="#" class="btn btn-sm btn-info">
                                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-person-circle" viewBox="0 0 16 16">
                                        <path d="M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"/>
                                        <path fill-rule="evenodd" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468 11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z"/>
                                    </svg>
                                </a></td>
                        </tr>
                        
                        <?php
                                }
                        ?>
                        
                        <?php
                            }
                        }
                        ?>
                        
                    </tbody>
                </table>
            </div>
            
        </div>
    </div>
</div>

