<div class="col-sm-12 gray_ttc" style="border-bottom: 2px solid #8CC73F;padding-top: 10px;padding-bottom: 10px;font-weight: bold">
    <div class="col-sm-2">Course Name</div>
    <div class="col-sm-2 text-center">Created By</div>
    <div class="col-sm-2">Resource Person</div>
    <div class="col-sm-1">Topic</div>
    <div class="col-sm-1">Type</div>
    <div class="col-sm-1">Upcoming</div>                      
    <div class="col-sm-1">Permission</div>                      
    <div class="col-sm-2 text-center">Action</div>
</div>
<div class="col-sm-12"><br></div>

<?php
foreach ($all_course as $course_value) {
    ?>
    <div class="col-sm-12 gray_ttc " style="padding-top: 10px;padding-bottom: 10px;">
        <div class="col-sm-2">
            <a target="_blank" href="<?php echo base_url() . $course_value->url ?>">
                <?php
                if (strlen($course_value->course_name) > 10) {
                    echo mb_substr($course_value->course_name, 0, 10, 'utf-8') . ' ...';
                } else {
                    echo $course_value->course_name;
                }
                ?>
            </a>
        </div>

        <div class="col-sm-2 text-center">
            <?php
            if ($creator_info[$course_value->course_id]->person_role == 1 || $creator_info[$course_value->course_id]->person_role == 6) {
                echo 'Talha Training';
            } else if ($creator_info[$course_value->course_id]->person_role == 3) {
                ?>
                <a target="_blank" href="<?php echo base_url() . $creator_info[$course_value->course_id]->url; ?>/profile">
                    <?php echo $creator_info[$course_value->course_id]->person_first_name . ' ' . $creator_info[$course_value->course_id]->person_last_name; ?>
                </a>
                <?php
            } else if ($creator_info[$course_value->course_id]->person_role == 4) {
                ?>
                <a target="_blank" href="<?php echo base_url() . $creator_info[$course_value->course_id]->url; ?>/profile">
                    <?php echo $creator_info[$course_value->course_id]->person_first_name . ' ' . $creator_info[$course_value->course_id]->person_last_name; ?>
                </a>
                <?php
            }
            ?>
        </div>

        <div class="col-sm-2">
            <a target="_blank" href="<?php echo base_url() . $resource_person_info[$course_value->course_id]->url; ?>/profile">
                <?php echo $resource_person_info[$course_value->course_id]->person_first_name . ' ' . $resource_person_info[$course_value->course_id]->person_last_name; ?>
            </a>
        </div>
        <div class="col-sm-1">
            <?php
            if (isset($topic_info[$course_value->course_id]->topic_name)) {
                echo $topic_info[$course_value->course_id]->topic_name;
            } else {
                echo '-';
            }
            ?>
        </div>
        <div class="col-sm-1">
            <?php
            echo ($course_value->course_type == 1) ? '<strong>Paid</strong>' : '<strong>Free</strong>';
            ?>
        </div>

        <div class="col-sm-1 text-center" id="upcommingViewStatus<?php echo $course_value->course_id; ?>">
            <?php
            if ($course_value->upcoming_course == 1) {
                ?>
                <a href="javascript:void(0)" data-toggle="modal" data-target="#upcommingNotPermitted<?php echo $course_value->course_id; ?>"><i class="fa fa-times" title="NO"></i></a>
                <?php
            } else {
                ?>
                <a href="javascript:void(0)" data-toggle="modal" data-target="#upcommingPermitted<?php echo $course_value->course_id; ?>"><i class="fa fa-check-circle" title="Yes"></i></a>
                <?php
            }
            ?>
        </div>

        <div class="modal" style="" id="upcommingNotPermitted<?php echo $course_value->course_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
            <?php
            $function_name2 = 'changeCourseUpcomming(&quot;' . base_url('admin/chnage-course-upcomming-status') . '&quot;,&quot;' . $course_value->course_id . '&quot;,&quot;no&quot;)';
            $message2 = 'Are you sure you want to change Course Upcomming Status?';
            $this->cf->get_status_modal($function_name2, $message2);
            ?>
        </div>
        <div class="modal" style="" id="upcommingPermitted<?php echo $course_value->course_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
            <?php
            $function_name3 = 'changeCourseUpcomming(&quot;' . base_url('admin/chnage-course-upcomming-status') . '&quot;,&quot;' . $course_value->course_id . '&quot;,&quot;yes&quot;)';
            $message3 = 'Are you sure you want to change Course Upcomming Status?';
            $this->cf->get_status_modal($function_name3, $message3);
            ?>
        </div>

        <div class="col-sm-1 text-center" id="resourcePeronEdit<?php echo $course_value->course_id; ?>">
            <?php
            if ($course_value->course_resource_person_edit == 1) {
                ?>
                <a href="javascript:void(0)" data-toggle="modal" data-target="#rPersonEditNotPermitted<?php echo $course_value->course_id; ?>"><i class="fa fa-times" title="NO"></i></a>
                <?php
            } else {
                ?>
                <a href="javascript:void(0)" data-toggle="modal" data-target="#rPersonEditPermitted<?php echo $course_value->course_id; ?>"><i class="fa fa-check-circle" title="Yes"></i></a>
                <?php
            }
            ?>
        </div>

        <div class="modal" style="" id="rPersonEditNotPermitted<?php echo $course_value->course_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
            <?php
            $function_name = 'changeCoursePermission(&quot;' . base_url('admin/chnage-course-permission') . '&quot;,&quot;' . $course_value->course_id . '&quot;,&quot;no&quot;)';
            $message = 'Are you sure you want to change Resource Person Permission?';
            $this->cf->get_status_modal($function_name, $message);
            ?>
        </div>
        <div class="modal" style="" id="rPersonEditPermitted<?php echo $course_value->course_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
            <?php
            $function_name1 = 'changeCoursePermission(&quot;' . base_url('admin/chnage-course-permission') . '&quot;,&quot;' . $course_value->course_id . '&quot;,&quot;yes&quot;)';
            $message1 = 'Are you sure you want to change Resource Person Permission?';
            $this->cf->get_status_modal($function_name1, $message1);
            ?>
        </div>


        <div class="col-sm-2 text-center">
            <span id="courseStatus<?php echo $course_value->course_id; ?>">
                <?php
                switch ($course_value->course_status) {
                    case 1:
                        ?>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseInactive<?php echo $course_value->course_id; ?>"><i class="fa fa-user-times" title="Inactive"></i></a>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseArchive<?php echo $course_value->course_id; ?>"><i class="fa fa-archive" title="Archive"></i></a>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#coursePending<?php echo $course_value->course_id; ?>"><i class="fa fa-refresh fa-spin" title="Pending"></i></a>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseDraft<?php echo $course_value->course_id; ?>"><i class="fa fa-dropbox" title="Draft"></i></a>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseDelete<?php echo $course_value->course_id; ?>"><i class="fa fa-trash-o" title="Delete"></i></a>
                        <?php
                        break;
                    case 6:
                        ?>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseActive<?php echo $course_value->course_id; ?>"><i class="fa fa-user-plus" title="Acitve"></i></a>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseArchive<?php echo $course_value->course_id; ?>"><i class="fa fa-archive" title="Archive"></i></a>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#coursePending<?php echo $course_value->course_id; ?>"><i class="fa fa-refresh fa-spin" title="Pending"></i></a>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseDraft<?php echo $course_value->course_id; ?>"><i class="fa fa-dropbox" title="Draft"></i></a>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseDelete<?php echo $course_value->course_id; ?>"><i class="fa fa-trash-o" title="Delete"></i></a>
                        <?php
                        break;
                    case 2:
                        ?>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseActive<?php echo $course_value->course_id; ?>"><i class="fa fa-user-plus" title="Acitve"></i></a>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseDelete<?php echo $course_value->course_id; ?>"><i class="fa fa-trash-o" title="Delete"></i></a>
                        <?php
                        break;
                    case 3:
                        ?>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseApproved<?php echo $course_value->course_id; ?>"><i class="glyphicon glyphicon-ok" title="Approved"></i></a>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseDraft<?php echo $course_value->course_id; ?>"><i class="fa fa-dropbox" title="Draft"></i></a>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseDelete<?php echo $course_value->course_id; ?>"><i class="fa fa-trash-o" title="Delete"></i></a>
                        <?php
                        break;
                    case 4:
                        ?>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseActive<?php echo $course_value->course_id; ?>"><i class="fa fa-user-plus" title="Acitve"></i></a>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseArchive<?php echo $course_value->course_id; ?>"><i class="fa fa-archive" title="Archive"></i></a>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#coursePending<?php echo $course_value->course_id; ?>"><i class="fa fa-refresh fa-spin" title="Pending"></i></a>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseDraft<?php echo $course_value->course_id; ?>"><i class="fa fa-dropbox" title="Draft"></i></a>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseDelete<?php echo $course_value->course_id; ?>"><i class="fa fa-trash-o" title="Delete"></i></a>
                        <?php
                        break;
                    case 5:
                        ?>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseActive<?php echo $course_value->course_id; ?>"><i class="fa fa-user-plus" title="Active"></i></a>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#courseDelete<?php echo $course_value->course_id; ?>"><i class="fa fa-trash-o" title="Delete"></i></a>
                        <?php
                        break;
                }
                ?>
            </span>

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

            <a target="_blank" href="<?php echo base_url("admin/course-register-student/$course_value->url") ?>">
                <i class="fa fa-th" title="Course Details"></i>
            </a>
            
            <a target="_blank" href="<?php echo base_url("admin/course-create-certificate/$course_value->url") ?>">
                <i class="fa fa-certificate" title="Create Certificate"></i>
            </a>
        </div>



        <div class="modal" style="" id="courseActive<?php echo $course_value->course_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
            <?php
            $status_message1 = 'Are you sure you want to Active this Course?';
            $status_function_name1 = 'changeCourseStatus(&quot;' . base_url('admin/chnage-course-status') . '&quot;,&quot;' . $course_value->course_id . '&quot;,&quot;1&quot;)';
            $this->cf->get_status_modal($status_function_name1, $status_message1);
            ?>
        </div>
        <div class="modal" style="" id="courseInactive<?php echo $course_value->course_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
            <?php
            $status_message2 = 'Are you sure you want to Inactive this Course?';
            $status_function_name2 = 'changeCourseStatus(&quot;' . base_url('admin/chnage-course-status') . '&quot;,&quot;' . $course_value->course_id . '&quot;,&quot;6&quot;)';
            $this->cf->get_status_modal($status_function_name2, $status_message2);
            ?>
        </div>
        <div class="modal" style="" id="courseArchive<?php echo $course_value->course_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
            <?php
            $status_message3 = 'Are you sure you want to Archive this Course?';
            $status_function_name3 = 'changeCourseStatus(&quot;' . base_url('admin/chnage-course-status') . '&quot;,&quot;' . $course_value->course_id . '&quot;,&quot;2&quot;)';
            $this->cf->get_status_modal($status_function_name3, $status_message3);
            ?>
        </div>
        <div class="modal" style="" id="coursePending<?php echo $course_value->course_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
            <?php
            $status_message4 = 'Are you sure you want to Pending this Course?';
            $status_function_name4 = 'changeCourseStatus(&quot;' . base_url('admin/chnage-course-status') . '&quot;,&quot;' . $course_value->course_id . '&quot;,&quot;3&quot;)';
            $this->cf->get_status_modal($status_function_name4, $status_message4);
            ?>
        </div>
        <div class="modal" style="" id="courseApproved<?php echo $course_value->course_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
            <?php
            $status_message5 = 'Are you sure you want to Approved this Course?';
            $status_function_name5 = 'changeCourseStatus(&quot;' . base_url('admin/chnage-course-status') . '&quot;,&quot;' . $course_value->course_id . '&quot;,&quot;4&quot;)';
            $this->cf->get_status_modal($status_function_name5, $status_message5);
            ?>
        </div>
        <div class="modal" style="" id="courseDraft<?php echo $course_value->course_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
            <?php
            $status_message6 = 'Are you sure you want to Draft this Course?';
            $status_function_name6 = 'changeCourseStatus(&quot;' . base_url('admin/chnage-course-status') . '&quot;,&quot;' . $course_value->course_id . '&quot;,&quot;5&quot;)';
            $this->cf->get_status_modal($status_function_name6, $status_message6);
            ?>
        </div>
        <div class="modal" style="" id="courseDelete<?php echo $course_value->course_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
            <?php
            $status_message7 = 'Are you sure you want to Delete this Course?';
            $status_function_name7 = 'changeCourseStatus(&quot;' . base_url('admin/chnage-course-status') . '&quot;,&quot;' . $course_value->course_id . '&quot;,&quot;delete&quot;)';
            $this->cf->get_status_modal($status_function_name7, $status_message7);
            ?>
        </div>

    </div>
    <?php
}
?>
<?php
echo $pagination_link;
