<div class="col-sm-8">
    <div class="row ">
        <div class="col-sm-12 " style="padding: 0">
            <div class="col-sm-12" >
                <h3>
                    All Certificate Information
                    <!--<a href=""> <span class="pull-right" style="font-size: 18px">Create Quiz</span></a>-->
                </h3>
                <hr>
            </div>

            <div class="col-sm-12" >

                <div class="col-sm-12 gray_ttc text-center" style="border-bottom: 2px solid #8CC73F;padding-top: 10px;padding-bottom: 10px;font-weight: bold">
                    <div class="col-sm-4" style="padding:10px 0">Certificate Image</div>
                    <div class="col-sm-4" style="padding:10px 0">Certificate Name</div>
                    <div class="col-sm-4" style="padding:10px 0">Action</div>
                </div>

                <div class="col-sm-12"><br></div> 

                <?php
//                if ($all_certificate) {
//                    foreach ($all_certificate as $v_certificate) {
                        ?>

                        <div class="col-sm-12 gray_ttc text-center padding-zero margin-zero" id="message<?php// echo $v_certificate->certificate_id; ?>" >

                        </div>

                        <div class="col-sm-12 gray text-center">

                            <div class="col-sm-4" style="padding:10px 0">
                                <?php //if ($v_certificate->certificate_image) { ?>
                                    <img src="<?php //echo base_url() . $v_certificate->certificate_image; ?>" style="width: 40px;">
                                <?php //}
                                ?>
                            </div>

                            <div class="col-sm-4" style="padding:10px 0">
                                <a href="<?php //echo base_url() . 'quiz/' . $v_certificate->certificate_public_id . '/certificate' ?>" target="blank"></a>
                            </div>

                            <div class="col-sm-4" style="padding:10px 0">

                                <div id="actions<?php //echo $v_certificate->certificate_id; ?>">

                                    <a href="<?php //echo base_url() . 'quiz/' . $v_certificate->certificate_public_id . '/edit-certificate'; ?>"><i class="fa fa-edit" title="Edit"></i></a>
                                    <span>&nbsp;&nbsp;</span>

                                    <a href="<?php //echo base_url() . 'quiz/' . $v_certificate->certificate_public_id . '/certificate-holders'; ?>"><i class="fa fa-graduation-cap" title="Certificate Holders"></i></a>
                                    <span>&nbsp;&nbsp;</span>

                                    <a href="<?php //echo base_url() . 'assign-certificate/' . $v_certificate->certificate_public_id; ?>"><i class="fa  fa-certificate" title="Assign Certificate"></i></a>
                                    <span>&nbsp;&nbsp;</span>

                                    <?php
                                    //if ($v_certificate->certificate_status == 0) {
                                        ?>
                                        <a href="#" onclick="return checkForAction('<?php //echo base_url() . 'activate-certificate/' . $v_certificate->certificate_public_id ?>', 'Active', '<?php //echo $v_certificate->certificate_id; ?>')">
                                            <i class="fa  fa-user-plus" title="Publish"></i>
                                        </a>&nbsp;&nbsp;
                                    
                                        <a href="#" onclick="return checkForAction('<?php //echo base_url() . 'inactivate-certificate/' . $v_certificate->certificate_public_id; ?>', 'Inactive', '<?php //echo $v_certificate->certificate_id; ?>')">
                                            <i class="fa  fa-user-times" title="Unpublish"></i>
                                        </a>&nbsp;&nbsp;
                                    <?php //} else if ($v_certificate->certificate_status == 2) { ?>
                                        <a href="#" onclick="return checkForAction('<?php //echo base_url() . 'activate-certificate/' . $v_certificate->certificate_public_id; ?>', 'Active', '<?php //echo $v_certificate->certificate_id; ?>')">
                                            <i class="fa  fa-user-plus" title="Publish"></i>
                                        </a>&nbsp;&nbsp;
                                    <?php //} ?>

                                    <?php //if ($v_certificate->certificate_status != 2) { ?>
                                        <a  href="#" onclick="return checkForAction('<?php //echo base_url() . 'archive-certificate/' . $v_certificate->certificate_public_id; ?>', 'Delete', '<?php //echo $v_certificate->certificate_id; ?>')">
                                            <i class="fa fa-trash-o" title="Delete"></i>
                                        </a>&nbsp;&nbsp;
                                    <?php// } ?>

                                </div>

                            </div>
                        </div>
                        <div class="col-sm-12"><br></div>
                            <?php
//                        }
//                    } else {
//                        echo 'You do not have any Certificate';
//                    }
                    ?>



                <!--                <nav class="course-pagination">
                                    <ul class="pagination">
                                        <li>
                                            <a href="#" aria-label="Previous">
                                                <span aria-hidden="true" title="First Page">&laquo;&laquo;</span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="#" aria-label="Previous">
                                                <span aria-hidden="true" title="Previous Page">&laquo;</span>
                                            </a>
                                        </li>
                                        <li><a href="#">1</a></li>
                                        <li><a href="#">2</a></li>
                                        <li><a href="#">3</a></li>
                                        <li><a href="#">4</a></li>
                                        <li><a href="#">5</a></li>
                                        <li>
                                            <a href="#" aria-label="Next">
                                                <span aria-hidden="true" title="Next Page">&raquo;</span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="#" aria-label="Next">
                                                <span aria-hidden="true" title="Last Page">&raquo;&raquo;</span>
                                            </a>
                                        </li>
                                    </ul>
                                </nav>-->

            </div>

        </div><!-- /.row gray -->

    </div>

</div>

<script>

    function checkForAction(url, action, quizID) { // check for Active Inactives
//        alert(url);
        swal({
            title: "",
            text: "Are you sure you want to " + action + " this Certificate?",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: '#DD6B55',
            confirmButtonText: 'Yes',
            cancelButtonText: "No",
            closeOnConfirm: true,
            closeOnCancel: true
        },
        function (isConfirm) {
            if (isConfirm) {
//                document.location.href = url;
//                ac_inac_del_action
                serverPage = url;
                xmlhttp.open("GET", serverPage);
//                alert(serverPage);
                xmlhttp.onreadystatechange = function ()
                {
//                    alert(xmlhttp.readyState);
//                    alert(xmlhttp.status);
                    if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                    {
//                        alert(xmlhttp.responseText);
                        document.getElementById("actions" + quizID).innerHTML = xmlhttp.responseText;
                        document.getElementById("message" + quizID).innerHTML = "<div class='alert alert-info' style='height:20px; padding:0px;margine:0px;' ><a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a>Certificate Successfully " + action + "</div>";

                    }
                }
                xmlhttp.send(null);
            } else {
                return;
            }

        });
    }

</script>