<?php
//    $section_id = $this->session->userdata("section_id");
//    $video_course_id = $this->session->userdata("video_course_id");
?>
<div class="col-sm-10">
    <div class="row ">
        <div class="col-sm-12 ">
            <div class="col-sm-6 col-sm-offset-3">
                <div class="input-group">
                    <input type="text" 
                           class="form-control" 
                           id="manage_admin_video_search"
                           oninput="searchManageAdminVideo(this.value,'<?php echo base_url() . 'search-admin-video' ?>')"
                           placeholder="Search here..." 
                           aria-describedby="basic-addon1">
                    <span class="input-group-addon" id="basic-addon1"><i class="fa fa-search"></i></span>
                </div>
            </div>
            <div class="col-sm-3">
                <select class="form-control"
                        id="manage_admin_video_status"
                        onchange="searchByManageAdminVideoStatus(this.value, '<?php echo base_url("search-admin-video"); ?>')">
                    <option value=''>All</option>
                    <option value='1'>Active</option>
                    <option value='2'>Draft</option>
                </select>
            </div>
            <input type="hidden" id="baseUrl" value="<?php echo base_url(); ?>">
        </div>
        
        <div class="col-sm-12 "><br></div>
        <div class="col-sm-12 ">
            <div class="col-sm-12" ><br>  <hr></div>
            <div class="col-sm-12" id="view_course">
                <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-1">Serial</div>
                    <div class="col-sm-3">Video Name</div>
                    <div class="col-sm-4">Resolution</div>
                    <div class="col-sm-3">Workfile Name</div>          
                    <div class="col-sm-1">Action</div>
                </div>
                <div class="col-sm-12"><br></div>


                <div class="col-sm-12 padding-zero" id="view_manage_admin_video">
                <?php 
                    //$this->cf->dd($section_id.'--'.$video_course_id);
                    foreach ($manage_admin_video_info['manage_video'] as $manage_video_info){
                        $serial++;
                ?>
                    <div class="col-sm-12 gray_ttc " style="padding-top: 10px;padding-bottom: 10px;">
                        
                        <div class="col-sm-1">
                            <?php echo $serial; ?>
                        </div>
                        
                        <div class="col-sm-3">
                            <?php 
                                $encrypt_manage_video_id = $this->encryption->encrypt($manage_video_info->manage_video_id);
                                $encrypt_manage_video_id = str_replace("/", "%F2", $encrypt_manage_video_id);
                            ?>
                            <a href="<?php echo base_url() . 'view-single-video/'. $encrypt_manage_video_id ?>" target="_blank">
                                <?php echo $manage_video_info->manage_video_title;?>
                            </a>
                        </div>
                        
                        <div class="col-sm-4">
                            <?php
                            foreach($manage_admin_video_info[$manage_video_info->manage_video_id] as $manage_video_location){
                                $manage_video_location_id_data = $manage_video_location->manage_video_id.','.$manage_video_location->manage_video_location_id;
                                $encrypt_manage_video_location_id = $this->encryption->encrypt($manage_video_location_id_data);
                                $encrypt_data = str_replace("/", "%F2", $encrypt_manage_video_location_id);
                            ?>
                            <a href="<?php echo base_url() . 'view-single-video/'. $encrypt_data ?>" target="_blank">
                                <?php echo $manage_video_location->manage_video_location_resolution;?>
                            </a>
                            <a href="javascript:void(0)" onclick="deleteSingleResolutionVideo('<?php echo base_url().'delete-single-resolution-video' ?>','<?php echo $manage_video_location->manage_video_location_id ?>')">
                                <i class="fa fa-times-circle"></i>
                            </a>
                                
                            <?php echo " | "; } ?>
                        </div>
                        
                        <div class="col-sm-3">
                            <?php 
                                if(isset($manage_admin_video_info['work_files'][$manage_video_info->manage_video_id])){
                            ?>
                                <a href="javascript:void(0)" target="_blank" onclick="downloadWorkFile('<?php echo base_url() . 'download-manage-admin-video-workfile/' ?>', '<?php echo $manage_admin_video_info['work_files'][$manage_video_info->manage_video_id]->work_file_id; ?>')">
                                     <i class="fa fa-download"></i>
                                 <?php
                                         echo $manage_admin_video_info['work_files'][$manage_video_info->manage_video_id]->work_file_name;

                                 ?>
                                </a>
                                <a href="javascript:void(0)" onclick="deleteVideoWorkfile('<?php echo base_url().'delete-admin-video-workfile' ?>','<?php echo $manage_admin_video_info['work_files'][$manage_video_info->manage_video_id]->work_file_type_id ?>')">
                                    <i class="fa fa-times-circle"></i>
                                </a>
                            <?php
                                }
                            ?>
                            
                        </div>
                        <div class="col-sm-1">
                            <?php if(isset($section_id)){ ?>
                                <a href="<?php echo base_url();?>add-video-to-section/<?php echo $section_id;?>">
                                    <i class="fa fa-plus" title="Assign This video section"></i>
                                </a>
                            <?php
                            }else{ ?>
                                <a href="<?php echo base_url();?>super-admin/assign-video-to-course">
                                    <i class="fa fa-file-video-o" title="Assign This video to a course"></i>
                                </a>
                            <?php } ?>
                            <a href="<?php echo base_url() . 'edit-admin-video/'.$encrypt_manage_video_id.'/'.'manage_admin_video' ?>" target="_blank">
                                <i class="fa fa-edit" title="Edit"></i>
                            </a>
                            <a href="javascript:void(0)" onclick="deleteAdminVideo('<?php echo base_url().'delete-admin-video' ?>','<?php echo $manage_video_info->manage_video_id ?>')">
                                <i class="fa fa-trash" title="Delete"></i>
                            </a>
                        </div>
                    </div>
                <?php } ?>
                <?php
                    echo $manage_admin_video_pagination;
                ?>

                </div>

            </div>
        </div>
    </div>
    <div class="col-sm-12 "><br></div>   
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>back_end_resource/manage_admin_video/add_admin_video.js"></script>
