<?php
$status = $this->session->userdata('status');
$type_id = $this->session->userdata('type_id');
?>

<script>
    studentList = '';
</script>

<!--Add / Change / Assign / Short-->
<div id="change">
    <div class="col-sm-10 col-sm-offset-3 main col-md-10 col-md-offset-2 main">
        <div class="col-sm-6 col-md-6">
            <a href="<?php echo base_url(); ?>super_admin_student/create/<?php echo $student_type ?>" class="btn btn-sm btn-success">Add Student</a>
            <input type="submit" value="Set Role" id="change_role_button" class="btn btn-sm btn-success"  data-toggle="modal" data-target="#setRole">
            <!--<input type="submit" value="Assign Course" id="assign_course" class="btn btn-sm btn-success"  data-toggle="modal" data-target="#assignCourse" disabled="true">-->
            <input type="submit" value="Change Status" id="change_status_button" class="btn btn-sm btn-success"  data-toggle="modal" data-target="#changeStatus">
            <?php
            $short = $this->session->userdata('short');
            if ($short === 'ASC') {
                ?>
                <a href="<?php echo base_url(); ?>super_admin/shorted_users_list/<?php // echo $user_role . '/' . $this->session->userdata('role_id') . '/' . 'DESC';   ?>" class="btn btn-sm btn-success" >Short user by name</a>
            <?php } else { ?>
                <a href="<?php echo base_url(); ?>super_admin/shorted_users_list/<?php // echo $user_role . '/' . $this->session->userdata('role_id') . '/' . 'ASC';   ?>" class="btn btn-sm btn-success" >Short user by name</a>
            <?php } ?>
        </div>

        <!--Select Student -->
        <div class="col-sm-6 col-md-6">
            <form name="control_form">
                <div class="col-sm-6">
                    <select class="form-control" for="user_role_id2" 
                            name="user_role_id2" id="user_role_id2" 
                            onchange="selectUser(this.value, user_status.value, 'change');">
                        <option value='0'> All</option>
                        <option value='1'> Super Admin </option>
                        <option value='2'> Account Officer</option>
                        <option value='4'> Organization</option>
                        <option value='3'> Resource Person</option>
                        <option value='5'> Student</option>
                    </select>
                </div>
                <div class="col-sm-6">
                    <select class="form-control" for="user_status" 
                            name="user_status" id="user_status" 
                            onchange="selectStudent('<?php echo $student_type; ?>', type_id2.value, this.value, 'student_list');">
                        <!--<option value=''> Select Status</option>-->
                        <option value='all'> All</option>
                        <option value='0'> Inactive</option>
                        <option value='1'> Active</option>
                        <option value='2'> Archive</option>
                    </select>
                </div>
            </form>
        </div>
        <!-- Student List with Some Action  -->    
        <div class="container col-sm-8 col-sm-offset-2 col-md-offset-0 col-md-12" id="res">
            <br>
            <div class="">
                <a href="<?php echo base_url(); ?>super_admin">Dashboard</a>->>
                <a href="<?php echo base_url(); ?>super_admin_student/student_list/All/0">Student Management</a>->>
                <span><?php echo $student_type; ?> Student</span>
                <div>
                    <?php
                    $message = $this->session->userdata('message');
                    if ($message) {
                        echo $message;
                    }
                    ?>
                </div>
            </div>
            <br>
            <div class="span11 right">
                <div class="col-lg-6 col-md-4" >
                    <h4><?php echo $student_type; ?> Student Information</h4> </div>
                <div class="col-lg-2 col-md-2">
                </div>
                <div class="col-lg-4 col-md-4">
                </div>
            </div>
            <!--    
            Only List with Pagination 
            Change Status / Edit / Delete
            -->
            <div class="table-responsive col-lg-11 col-md-10 col-sm-7" id="student_list">
                <div class="row">
                    <form name="myform" action=""  method="post">
                        <table class="table table-striped">
                            <thead>
                                <tr>
                                    <th><input type="checkbox" name="all_student" id="all_student" onchange="toggleAllStudentSelection(document.myform.student_id);"/></th>
                                    <!--<th>Person ID</th>-->
                                    <th>Profile Picture</th>
                                    <th>Student Name</th>
                                    <th>Student Email</th>
                                    <th>Contact Number</th>
                                    <th>Type</th>
                                    <th>Status</th>
                                    <th>Actions</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $i = 1;
                                foreach ($students as $v_student) {
                                    ?>
                                    <tr>
                                        <td><input name="student_id" id="student_id<?php echo $v_student->person_id; ?>" type="checkbox"  value="<?php echo $v_student->person_id; ?>" onchange="setStudentIdList(this.value);"/></td>
                                        <!--<td><?php // echo $v_student->person_id    ?></td>-->
                                        <td><img src="<?php echo base_url() . $v_student->person_image_thumb; ?>" width="50" height="50"> </td>
                                        <td style="width:250px;"><?php echo $v_student->person_first_name . ' ' . $v_student->person_last_name; ?></td>
                                        <td style="width:200px;"><?php echo $v_student->person_email ?></td>
                                        <td style="width:150px;"><?php echo $v_student->person_contact_number ?></td>
                                        <td style="width:70px;">
                                            <?php
                                            if ($v_student->student_type == '1') {
                                                echo 'Classroom';
                                            }
                                            if ($v_student->student_type == '2') {
                                                echo 'Video Training';
                                            }
                                            if ($v_student->student_type == '3') {
                                                echo 'Online';
                                            }
                                            ?>
                                            <br>
                                            <!--<a href="#" class="" data-toggle="modal" data-target="#changeRole">Change Role</a>-->
                                        </td>

                                        <!-- Actions -->

                                        <td style="width:50px;"><?php
                                            if ($v_student->person_status == '1') {
                                                echo '<p style="color:green;">Active</p>';
                                                ?>
                                                <a href="<?php echo base_url(); ?>super_admin_student/make_student_inactive/<?php echo $v_student->person_id; ?>"><i class="fa fa-user-times" title="Inactive"></i></a>
                                                <?php
                                            } else if ($v_student->person_status == '0') {
                                                echo '<p style="color:red;">Inactive</p>';
                                                ?>

                                                <a href="<?php echo base_url(); ?>super_admin_student/make_student_active/<?php echo $v_student->person_id; ?>">
                                                    <i class="fa fa-user-plus" title="Active"></i></a>
                                                <?php
                                            } else if ($v_student->person_status == '2') {
                                                echo '<p style="color:blue;">Archived</p>';
                                                ?>
                                                <a href="<?php echo base_url(); ?>super_admin_student/make_student_active/<?php echo $v_student->person_id; ?>"><i class="fa fa-user-plus" title="Active"></i> </a>
                                            <?php } ?>
                                        </td>

                                        <td style="width:200px;">
                                            <a href="<?php echo base_url() ?>super_admin_student/student_detail/<?php
                                            echo $v_student->person_id . '/' . $type_id;
                                            ;
                                            ?>">View Detail</a> <br>

                                            <a href="<?php echo base_url() ?>super_admin_student/edit_student_information/<?php
                                            echo $v_student->person_id;
                                            ;
                                            ?>">Edit</a><br>

                                            <a href="<?php echo base_url() ?>super_admin_student/assign_course/<?php echo $v_student->person_id; ?>">Assign Course</a><br>
                                            <a href="<?php echo base_url() ?>super_admin_student/student_payment_information/<?php echo $v_student->person_id; ?>">All Payment</a><br>
    <!--                                            <a href="<?php // echo base_url()    ?>super_admin_student/student_all_invoice/<?php // echo $v_student->person_id.'/'.$this->uri->segment(4);    ?>">View Invoices</a><br>-->
                                            <?php if ($v_student->person_status != 3) { ?><a href="<?php echo base_url(); ?>super_admin_student/make_student_archived/<?php echo $v_student->person_id; ?>" onclick="return checkAction('Archive');"><i class="fa fa-remove">Archive</i></a><?php } ?>
                                        </td>
                                        <td>
                                        </td>
                                    </tr>
                                <?php } ?>
                            </tbody>
                        </table>
                        <br>
                    </form>
                </div>

                <!-- Start Pagination -->

                <div class="col-lg-12 col-md-12 col-sm-12" >
                    <hr>
                    <form name="pagination">
                        <div class="col-lg-2 col-md-2 col-sm-2">
                            <label for="per_page_user">Per Page: </label>
                            <select name="per_page" onchange="setPerPage(this.value);">
                                <option value=''>page</option>
                                <option value='10'>10</option>
                                <option value='25'>25</option>
                                <option value='50'>50</option>
                                <option value='100'>100</option>
                                <option value='200'>200</option>
                                <option value='250'>250</option>
                                <option value='500'>500</option>
                                <option value=''>All</option>
                            </select>
                            <p>This Page :<?php echo $this_page . '/' . $total_student; ?></p>
                        </div>

                        <?php
                        $limit = $this->session->userdata('per_page');
                        if ($limit == NULL) {
                            $limit = 2;
                        }
                        $number_of_pages = ceil($total_student / $limit);
                        ?>
                        <div class="col-lg-2 col-md-2 col-sm-2">
                            <?php if (($start - $limit) >= 0) { ?>
                                <a href="<?php echo base_url(); ?>super_admin_student/<?php echo $this->uri->segment(2) . '/' . $this->uri->segment(3) . '/' . $this->uri->segment(4) . '/0'; ?>" class='btn btn-sm btn-success'>First</a>
                                <a href="<?php echo base_url(); ?>super_admin_student/<?php echo $this->uri->segment(2) . '/' . $this->uri->segment(3) . '/' . $this->uri->segment(4) . '/' . ($start - $limit); ?>" class='btn btn-sm btn-success'>Prev</a>
                            <?php } ?>
                        </div>

                        <div class='col-lg-5 col-md-5 col-sm-5'>
                            <?php for ($i = 0; $i < $number_of_pages; $i++) { ?>
                                <a href="<?php echo base_url(); ?>super_admin_student/<?php echo $this->uri->segment(2) . '/' . $this->uri->segment(3) . '/' . $this->uri->segment(4) . '/' . ($i * $limit); ?>" class='btn btn-sm btn-default'><?php echo $i; ?></a>
                            <?php } ?>
                        </div>

                        <div class="col-lg-2 col-md-2 col-sm-2">
                            <?php if ($start + $limit < $total_student) { ?>
                                <a href="<?php echo base_url(); ?>super_admin_student/<?php echo $this->uri->segment(2) . '/' . $this->uri->segment(3) . '/' . $this->uri->segment(4) . '/' . ($start + $limit); ?>" class='btn btn-sm btn-default'>Next</a>
                                <a href="<?php echo base_url(); ?>super_admin_student/<?php echo $this->uri->segment(2) . '/' . $this->uri->segment(3) . '/' . $this->uri->segment(4) . '/' . (($number_of_pages - 1) * $limit); ?>" class='btn btn-sm btn-success'>Last</a>
                            <?php } ?>
                        </div>
                        <script type="text/javascript">
                            document.forms['pagination'].elements['per_page'].value = '<?php echo $limit ?>';
                        </script>
                    </form>
                    <br>
                    <hr>
                </div>

                <!-- End Pagination -->

            </div>

        </div>  
    </div> 


    <script type="text/javascript">
        document.forms['pagination'].elements['per_page'].value = '<?php echo $limit ?>';
        document.forms['control_form'].elements['student_status'].value = '<?php echo $status; ?>';
        document.forms['control_form'].elements['student_role_id2'].value = '<?php echo $type_id; ?>';
    </script>



    <!-- Modal Start For Change Role and Status-->

    <!--
    
    Modal:
    Change Role
    
    -->

    <div class="modal fade" id="setRole" tabindex="-1" role="dialog" aria-labelledby="setRole" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">Change Role</h4>
                </div>
                <form name="setRole">
                    <div class="modal-body">

                        <label for="student_role_id_modal">Set To Role:</label><span>*</span>
                        <select class="form-control" name="student_role_id_modal" id="student_role_id_modal">
                            <option value="">--Select User Type--</option>
                            <option value="1">Admin</option>
                            <option value="2">Account</option>
                            <option value="3">Resource</option>
                            <option value="4">Organization</option>
                        </select>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        <button type="submit" class="btn btn-primary" onclick="setStudentRole();">Save changes</button>
                    </div>
                </form>
            </div>
        </div>

        <script>
            /*
             * Change Student Role Using JavaScript studentList variable (From Modal)
             */
            function setStudentRole()
            {
//                alert(studentList);
                studentRoleId = document.getElementById("student_role_id_modal").value;
                serverPage = '<?php echo base_url(); ?>super_admin_student/set_students_role/' + studentList + '/' + studentRoleId;
                xmlhttp.open("GET", serverPage);
                xmlhttp.onreadystatechange = function ()
                {
//                    alert(xmlhttp.responseText);
                    if (xmlhttp.readyState === 4 && xmlhttp.status === 200)
                    {
                        document.getElementById('res').innerHTML = xmlhttp.responseText;
//                        localtion.reload();
                    }
                };
                xmlhttp.send(null);
            }
        </script>


    </div>


    <!--
    
    Modal:: 
    Change Status
    
    -->

    <div class="modal fade" id="changeStatus" tabindex="-1" role="dialog" aria-labelledby="changeStatus" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">Change Student Status</h4>
                </div>
                <form name="changeStatus">
                    <div class="modal-body">
                        <h3>Select Status</h3>
                        <select class="form-control" name="student_status_modal" id="student_status_modal" required>
                            <option value="">--Select User Status--</option>
                            <option value="1">Active</option>
                            <option value="0">Inactive</option>
                            <option value="2">Archive</option>
                        </select>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        <button type="button" class="btn btn-primary" onclick="changeStudentStatus();">Save changes</button>
                    </div>
                </form>
            </div>
        </div>

        <script>

            function changeStudentStatus()
            {
                studentStatus = document.getElementById("student_status_modal").value;
                serverPage = '<?php echo base_url(); ?>super_admin_student/change_students_status/' + studentList + '/' + studentStatus;
                xmlhttp.open("GET", serverPage);
                xmlhttp.onreadystatechange = function ()
                {
                    if (xmlhttp.readyState === 4 && xmlhttp.status === 200)
                    {
                        document.getElementById('res').innerHTML = xmlhttp.responseText;
                        location.reload();
                    }
                };
                xmlhttp.send(null);
            }
        </script>
    </div>
    <!-- Modal END For Change Role and Status-->


    <!-- Assign Course To Student List -->

    <div class="modal fade" id="assignCourse" tabindex="-1" role="dialog" aria-labelledby="assignCourse" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">Assign Course </h4>
                </div>
                <form>
                    <div class="modal-body">
                        <div id="category" class="col-sm-9 col-md-10 col-md-offset-1">
                            <label>Select Category</label>
                            <select class="form-control span5" name="category_id" id="category_id" required onchange="selectCategoryCourse(this.value, 'course_list');">
                                <option value="">--Select Course Category--</option>
                                <?php foreach ($course_categories as $v_category) { ?>                                                    
                                    <option value="<?php echo $v_category->category_id; ?>"> <?php echo $v_category->category_name; ?></option>
                                <?php } ?>
                            </select>
                        </div>
                        <div id="course_list" class="col-sm-9 col-md-10 col-md-offset-1"></div>

                    </div>
                    <br>
                    <hr>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        <button type="button" class="btn btn-primary" onclick="assignCourse();">Assign</button>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <!--
    Print Preview and then Print option
    -->

    <div class="modal fade" id="print" tabindex="-1" role="dialog" aria-labelledby="print" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">Change Role</h4>
                </div>
                <form name="print">
                    <div class="modal-body">

                        <label for="student_role_id">Student role:</label><span>*</span>
                        <select class="form-control" name="student_role_id" id="student_role_id" required>
                            <option value="">--Select Student Role--</option>
                            <?php foreach ($student_types as $v_student_role) { ?>
                                <option value="<?php echo $v_student_role->student_role_id; ?>" <?php
                                if ($v_student_role->role_name == $student_type) {
                                    echo 'selected';
                                }
                                ?>> <?php echo $v_student_role->role_name ?></option>
                                    <?php } ?>
                        </select>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" onclick="printDiv('student_list');">print</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    </div>
                </form>
            </div>
        </div>
    </div>



    <!--
    
    Modal:: 
    IMPORT FILE FORM
    
    -->

    <div class="modal fade" id="importFile" tabindex="-1" role="dialog" aria-labelledby="importFile" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">Add Student</h4>
                </div>
                <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
                    <p>
                        <?php
                        $message = $this->session->userdata('message');
                        $this->session->unset_userdata('message');
                        if ($message) {
                            echo $message;
                        }
                        ?>
                    </p>
                    <div class="table-responsive col-sm-12">
                        <?php // echo validation_errors();               ?>
                        <form action="<?php echo base_url(); ?>super_admin/import_student_csv_file" method="post" name="import_csv" enctype="multipart/form-data" >
                            <div class="form-group col-sm-8" >
                                <label for="student_info_file" style="float:left;">Select CSV File</label><span class="required"> * <?php // echo form_error('student_image');                                                        ?></span><br><br>
                                <input style="float:left;" type='file' onchange="readURL(this, 'file_0');" name="student_info_file" value="<?php // echo set_value('student_image');                                                        ?>"/>
                                <div id="file" style="float:left;width: 50px; height: 50px;" ></div>
                            </div>
                            <div class="form-group col-sm-8" >
                                <label for="student_person_info_file" style="float:left;">Select CSV File</label><span class="required"> * <?php // echo form_error('student_image');                                                        ?></span><br><br>
                                <input style="float:left;" type='file' onchange="readURL(this, 'file_0');" name="student_person_info_file" value="<?php // echo set_value('student_image');                                                        ?>"/>
                                <div id="file" style="float:left;width: 50px; height: 50px;" ></div>
                            </div>
                            <div class="checkbox col-sm-8" >
                                <button type="submit" class="btn btn-default">Submit</button>
                                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="modal-footer">
                    <!--<button type="button" class="btn btn-primary">Save changes</button>-->
                </div>
            </div>
        </div>
    </div>



    <SCRIPT LANGUAGE="JavaScript">

        /*
         * Set All Student ID to Javascript studentList variable 
         */
        function toggleAllStudentSelection(field) {
            allStudent = document.getElementById("all_student").checked;
            if (allStudent) {
                for (i = 0; i < field.length; i++) {
                    field[i].checked = true;
                    studentList += field[i].value + '.';
                }
//                document.getElementById('change_role_button').disabled = false;
//                document.getElementById('assign_course').disabled = false;
//                document.getElementById('change_status_button').disabled = false;
            } else {
                for (i = 0; i < field.length; i++)
                    field[i].checked = false;
                studentList = '';
//                document.getElementById('change_role_button').disabled = true;
//                document.getElementById('assign_course').disabled = true;
//                document.getElementById('change_status_button').disabled = true;
            }
        }

        /*
         * Set single Student ID to Javascript studentList variable 
         */
        function setStudentIdList(studentID) {
            if ($("#student_id" + studentID).is(":checked")) {
                studentList += studentID + '.';
            } else {
                studentList = studentList.replace(studentID + ".", "");
            }
            if (studentList) {
//                document.getElementById('change_role_button').disabled = false;
//                document.getElementById('assign_course').disabled = false;
//                document.getElementById('change_status_button').disabled = false;
            } else {
//                document.getElementById('change_role_button').disabled = true;
//                document.getElementById('assign_course').disabled = true;
//                document.getElementById('change_status_button').disabled = true;
            }
        }

        /*
         * Delete Action Confirmation
         */
        function checkAction(action) {
            message = 'do you want to ' + action + '!!';
            chk = confirm(message);
            if (chk) {
                return true;
            } else {
                return false;
            }
        }

        /*
         * Change Student Status Using JavaScript studentList variable (From Modal)
         */
        function changeStudentsStatus()
        {
            studentStatus = document.getElementById("change_status").value;
            serverPage = '<?php echo base_url(); ?>super_admin/change_students_status/' + studentList + '/' + studentStatus;
            xmlhttp.open("GET", serverPage);
            xmlhttp.onreadystatechange = function ()
            {
                if (xmlhttp.readyState === 4 && xmlhttp.status === 200)
                {
                    document.getElementById(objID).innerHTML = xmlhttp.responseText;
                    localtion.reload();
                }
            };
            xmlhttp.send(null);
        }

        /*
         * Select Course By category Id
         */

        function selectCategoryCourse(categoryID, objID) {
            serverPage = '<?php echo base_url(); ?>cmis/select_all_available_course_by_cateogy_id/' + categoryID;
            xmlhttp.open("GET", serverPage);
            xmlhttp.onreadystatechange = function ()
            {
                if (xmlhttp.readyState === 4 && xmlhttp.status === 200)
                {
                    document.getElementById(objID).innerHTML = xmlhttp.responseText;
                    localtion.reload();
                }
            };
            xmlhttp.send(null);
        }

        /*
         * Assign Course to Student Using JavaScript studentList variable (From Modal)
         */
        function assignCourse()
        {
            courseID = document.getElementById("course_id").value;
            serverPage = '<?php echo base_url(); ?>smis/assign_course_to_student/' + studentList + '/' + courseID;
            xmlhttp.open("GET", serverPage);
            xmlhttp.onreadystatechange = function ()
            {
                alert(xmlhttp.readyState + xmlhttp.status);
                if (xmlhttp.readyState === 4 && xmlhttp.status === 200)
                {
                    alert(xmlhttp.responseText);
                    location.reload();
                }
            };
            xmlhttp.send(null);
        }



        /*
         * Select Student By Student Type and Status 
         */
        function selectStudent(roleID, studentStatus, objID) {
            if (roleID === '') {
                serverPage = '<?php echo base_url(); ?>super_admin/select_student_list/' + null + '/' + studentStatus + '/' + 0;
            } else {
                serverPage = '<?php echo base_url(); ?>super_admin/select_student_list/' + roleID + '/' + studentStatus + '/' + 0;
            }

            xmlhttp.open("GET", serverPage);
            xmlhttp.onreadystatechange = function ()
            {
                if (xmlhttp.readyState === 4 && xmlhttp.status === 200)
                {
                    document.getElementById(objID).innerHTML = xmlhttp.responseText;
                }
            };
            xmlhttp.send(null);
        }


        /*
         * Set Per Page List Value
         */
        function setPerPage(perPage) {

            serverPage = '<?php echo base_url(); ?>super_admin_student/set_per_page/' + perPage;
            xmlhttp.open("GET", serverPage);
            xmlhttp.onreadystatechange = function ()
            {
                if (xmlhttp.readyState === 4 && xmlhttp.status === 200)
                {
                    location.reload();
                }
            };
            xmlhttp.send(null);
        }


        /*
         * Send Mail To Selected Student using studentList
         */
        function sendMailToStudent() {
            if (studentList === '') {
                studentList = '';
                window.location = '<?php echo base_url(); ?>smis/send_mail_to_student/' + studentList;
            } else {
                window.location = '<?php echo base_url(); ?>smis/send_mail_to_student/' + studentList;
            }
        }


        /*
         * Print Student List
         */
        function printPreview(divName) {
            serverPage = '<?php echo base_url(); ?>super_admin/make_print_data/' + studentList;
            xmlhttp.open("GET", serverPage);
            xmlhttp.onreadystatechange = function ()
            {
                if (xmlhttp.readyState === 4 && xmlhttp.status === 200)
                {
                    window = document.getElementById('print_preview').innerHTML = xmlhttp.responseText;
                }
            };
            xmlhttp.send(null);
        }

    </script>
</div>
