<?php
$person_id = $this->session->userdata('user_id');
?>

<section class="course-detail" style="<?php if ($person_id) { ?>padding-top: 0px;<?php } ?>">
    <div class="row" style="<?php if ($person_id) { ?>width: 90%;<?php } ?>">
        <div class="col-sm-12">
            <div class="gray col-sm-12">
                <div class="col-sm-12 ">
                    <div class="col-sm-12 form-group">
                        <center>
                            <span class="h3" >
                                <?php echo $video_course_info->video_course_title; ?>
                            </span>
                            <span>
                                <?php
                                if ($all_registered_student->registered_student_id != '') {
                                    $registered_student = explode(',', $all_registered_student->registered_student_id);
                                    if (!in_array($person_id, $registered_student)) {
                                        ?>                                                        
                                        <?php
                                    }
                                } else {
                                    ?>                                            
                                    <?php
                                }
                                ?>
                            </span>
                        </center>
                        <br>
                        <span>
                            <?php
                            if ($this->session->userdata('error_message') != '') {
                                echo $this->session->userdata('error_message');
                                $this->session->unset_userdata('error_message');
                            }
                            ?>
                        </span>

                    </div>



                    <?php
                    if ($free_video_info) {
                        ?>
                    <div class="col-sm-10 col-sm-offset-1 text-center form-group" id="video-container">
                            <div class="row">
                                <video poster="<?php echo base_url('image/tt_single_video_view.png'); ?>" controls>
                                    <source src="<?php echo base_url() . 'content-library/' . $course_creator_url . $free_video_info->upload_video_location; ?>" type="video/mp4">                                                              
                                </video>
                            </div>

                            <div class="col-sm-12 text-center form-group">
                                <?php
                                echo '<strong>' . $free_video_info->upload_video_section_name . '</strong> : ' . $free_video_info->upload_video_name;
                                ?>
                            </div>
                        </div>


                        <?php
                        $share_video_url = base_url() . $video_course_info->url;
//                        $share_video_url = 'http://talhatraining.com/bangla-video-training-object-oriented-programming-with-php-and-mysql';
                        ?>
                        <div class="col-sm-8 col-sm-offset-2 form-group" style="text-align: center">
                            <a class="btn btn-facebook-custom" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo urlencode($share_video_url); ?>">
                                <i class="fa fa-facebook"></i>
                            </a>
                            <a class="btn btn-google-custom" target="_blank" href="https://plus.google.com/share?url=<?php echo urlencode($share_video_url); ?>">
                                <i class="fa fa-google-plus"></i>
                            </a> 
                            <a class="btn btn-twitter-custom" target="_blank" href="https://twitter.com/intent/tweet?text='<?php echo $share_video_url; ?>'">
                                <i class="fa fa-twitter"></i>
                            </a> 

                                                    <!--                            <a class="btn btn-linkedin-custom" target="_blank" href="https://www.linkedin.com/shareArticle?mini=true&url='<?php echo $share_video_url; ?>'&title=LinkedIn%20Developer%20Network&summary=My%20favorite%20developer%20program&source=LinkedIn">
                                                        <i class="fa fa-linkedin"></i>
                                                    </a> -->
                        </div>



                    </div>
                <?php } else {
                    ?>
                    <center>
                        <?php echo 'There are no free video in this course'; ?>
                    </center>
                <?php }
                ?>

            </div>


            <div class="row tab-bg">
                <div class="col-sm-4" style="padding-top:35px;">
                    <div class="col-sm-12" style="border: 2px solid #eee;">
                        <br>
                        <div class="input-group">
                            <input type="text" 
                                   class="form-control" 
                                   placeholder="Search Video.."
                                   id="search_video_course"
                                   name="search_video_course"
                                   oninput="searchVideo('<?php echo base_url() . 'get-searched-video' ?>','<?php echo $video_course_info->video_management_id; ?>',this.value)">
                            <span class="input-group-addon" style="background-color:#80c12c">
                                <i style="color:#fff" class="fa fa-search"></i>
                            </span>
                        </div>
                        <br>


                        <div id="view_video_menu">
                            <?php
                            if ($all_section) {
                                foreach ($all_section as $section_value) {
                                    ?>
                                    <div class="col-sm-12 panel-group" 
                                         id="accordion" role="tablist" 
                                         aria-multiselectable="true">
                                        <div class="panel panel-default">
                                            <div class="panel-heading" role="tab" id="heading">
                                                <i class="indicator fa fa-caret-down"></i>
                                                <a class="accordion-toggle" data-toggle="collapse" 
                                                   href="#collapse<?php echo $section_value->upload_video_id; ?>" aria-expanded="true">
                                                       <?php echo $section_value->upload_video_section_name; ?>
                                                </a>
                                            </div>

                                            <div id="collapse<?php echo $section_value->upload_video_id; ?>" class="panel-collapse collapse in" 
                                                 role="tabpanel" aria-labelledby="headingOne">

                                                <div class="panel-body">
                                                    <?php
                                                    foreach ($upload_video_info[$section_value->upload_video_section_name] as $upload_video_value) {
                                                        if ($upload_video_value->upload_video_access_level == 1) {
                                                            ?>
                                                            <a href="javascript:void(0)" class="col-sm-12" id="video_name<?php echo $upload_video_value->upload_video_id ?>"
                                                               onclick="videoLoad('<?php echo base_url() . 'get-single-video' ?>', '<?php echo $upload_video_value->upload_video_id ?>')" >
                                                                <i class="fa fa-play-circle"></i>
                                                                <?php echo $upload_video_value->upload_video_name ?>
                                                                <span class="pull-right"></span>
                                                            </a>
                                                            <?php
                                                        } else if ($upload_video_value->upload_video_access_level == 2) {
                                                            ?>
                                                            <a href="javascript:void(0);" class="col-sm-12">
                                                                <i class="fa fa-lock"></i><?php echo '  ' . $upload_video_value->upload_video_name ?>
                                                                <span class="pull-right"></span>
                                                            </a>
                                                            <?php
                                                        }
                                                        ?>
                                                        <br>

                                                        <?php
                                                    }
                                                    ?>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <?php
                                }
                            } else {
                                echo 'No Video in this course';
                            }
                            ?>
                        </div>


                        <!--// for google adsense-->
                        <?php
                        if ($video_course_info->video_course_type == 2) {
                            ?>
                            <div class="col-sm-12" ><br>
                                <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                                <!--  TT three -->
                                <ins class="adsbygoogle"
                                     style="display:block"
                                     data-ad-client="ca-pub-3140114751019908"
                                     data-ad-slot="2044561420"
                                     data-ad-format="auto"></ins>
                                <script>
                                                                   (adsbygoogle = window.adsbygoogle || []).push({});
                                </script>
                                <br>
                            </div>
                            <?php
                        }
                        ?>
                        <!--// for google adsense-->


                    </div>

                </div>

                <div class="col-sm-8" style="padding-left:0;">
                    <div class="course-detail-tab">
                        <ul id="tabs" class="nav nav-tabs" data-tabs="tabs">
                            <li class="active"><a href="#course-detail" data-toggle="tab">Course detail</a></li>
                            <li><a href="#work-files" data-toggle="tab">Work files</a></li>
                            <li><a href="#objectives" data-toggle="tab">Objectives</a></li>
                            <!--                                        <li><a href="#transcripts" data-toggle="tab">Transcripts</a></li>-->
                            <li><a href="#quiz" data-toggle="tab">Quiz</a></li>



                        </ul>
                        <div id="my-tab-content" class="tab-content">
                            <!-- course-detail tab -->
                            <div class="tab-pane active" id="course-detail">
                                <div class="tab-content panel-body"><br>
                                    <div class="col-sm-12"><br></div>
                                    <div class="col-sm-6 text-left">
                                        <span>
                                            <strong>Course Price :</strong>
                                            <?php
//                                $course_price = $video_course_info->video_course_price;
//                                $currency = $video_course_info->video_course_price_currency;
//                                if ($video_course_info->video_course_type == 1) {
//                                    $this->load->library('ForeignExchange');
//                                    $fx = new ForeignExchange('BDT', 'USD');
//                                    if ($currency == 1) {
//                                        echo 'BDT ' . $course_price . ' / USD ' . $fx->toForeign($course_price);
//                                    } else if ($currency == 2) {
//                                        echo 'BDT ' . $fx->toForeign($course_price) . ' / USD ' . $course_price;
//                                    }
//                                } else {
//                                    echo 'Free';
//                                }
                                            ?>
                                        </span> <br> <br>
                                        <span><strong> Hour : </strong>
                                            <?php
                                            if ($total_video_duration->duration != '') {
                                                echo $total_video_duration->duration;
                                            } else {
                                                echo '00:00:00';
                                            }
                                            ?>
                                        </span>  <br><br>
                                    </div>
                                    <div class="col-sm-6 text-left" >
                                        <span ><strong>Number of Classes :</strong> <?php
                                            echo $total_uploaded_video->total;
                                            ?> </span> <br> <br>
                                        <br>
                                    </div>

                                    <!--<h1>Course Objectives</h1>-->
                                    <div class="col-sm-12 text-left" >
                                        <p class="text-justify"><?php echo $video_course_info->video_training_outline ?></p>
                                    </div>



                                    <!--// for google adsense-->
                                    <?php
                                    if ($video_course_info->video_course_type == 2) {
                                        ?>
                                        <div class="col-sm-12"><br>
                                            <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                                            <!--     TT two -->
                                            <ins class="adsbygoogle"
                                                 style="display:block"
                                                 data-ad-client="ca-pub-3140114751019908"
                                                 data-ad-slot="9567828225"
                                                 data-ad-format="auto"></ins>
                                            <script>
                                                                   (adsbygoogle = window.adsbygoogle || []).push({});
                                            </script>
                                        </div>
                                    <?php } ?>
                                    <!--// for google adsense-->

                                </div>
                            </div><!-- /.course-detail tab -->





                            <!-- work-files tab-->
                            <div class="tab-pane" id="work-files">
                                <div class="tab-content panel-body text-left">
                                    <br>
                                    <h3>Work Files</h3>
                                    <p class="text-justify">
                                        <br>
                                        <?php
                                        if ($all_work_file) {
                                            foreach ($all_work_file as $work_file_value) {
                                                $work_file_name = explode('/', $work_file_value->work_files_url);
                                                if ($work_file_value->work_files_management_access_level == 1) {
                                                    ?>
                                                    <a href="javascript:void(0)" target="_blank" onclick="downloadWorkFile('<?php echo base_url() . 'download-video-course-work-file/' ?>', '<?php echo $work_file_value->work_files_management_id ?>')">
                                                        <i class="fa fa-download"></i><?php echo $work_file_name[4]; ?>
                                                    </a><br>
                                                    <?php
                                                } else if ($work_file_value->work_files_management_access_level == 2) {
                                                    ?>
                                                    <a href="javascript:void(0)" 
                                                       class="gray-font"><i class="fa fa-lock"></i><?php echo $work_file_name[4]; ?></a><br>
                                                       <?php
                                                   }
                                               }
                                           } else {
                                               echo 'No work file are available in this video course';
                                           }
                                           ?>
                                    </p>




                                    <!--// for google adsense-->
                                    <?php
                                    if ($video_course_info->video_course_type == 2) {
                                        ?>
                                        <div class="col-sm-12"><br>
                                            <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                                            <!--  TT two -->
                                            <ins class="adsbygoogle"
                                                 style="display:block"
                                                 data-ad-client="ca-pub-3140114751019908"
                                                 data-ad-slot="9567828225"
                                                 data-ad-format="auto"></ins>
                                            <script>
                                                        (adsbygoogle = window.adsbygoogle || []).push({});
                                            </script>
                                        </div>
                                    <?php } ?>
                                    <!--// for google adsense-->


                                </div>
                            </div>
                            <!-- /.work-files tab -->



                            <!-- objectives tab -->
                            <div class="tab-pane" id="objectives">
                                <div class="tab-content panel-body text-left">
                                    <br>
                                    <h3>Objectives</h3>
                                    <p class="text-justify"><?php echo $video_course_info->video_training_objectives; ?></p>



                                    <!--// for google adsense-->
                                    <?php
                                    if ($video_course_info->video_course_type == 2) {
                                        ?>
                                        <div class="col-sm-12"><br>
                                            <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                                            <!--  TT two >-->
                                            <ins class="adsbygoogle"
                                                 style="display:block"
                                                 data-ad-client="ca-pub-3140114751019908"
                                                 data-ad-slot="9567828225"
                                                 data-ad-format="auto"></ins>
                                            <script>
                                                        (adsbygoogle = window.adsbygoogle || []).push({});
                                            </script>
                                        </div
                                    <?php } ?>
                                    <!--// for google adsense-->

                                </div>
                            </div>


                            <!-- quiz tab -->
                            <div class="tab-pane <?php
                            if ($tab == 'quiz') {
                                echo 'active';
                            }
                            ?>" id="quiz">

                                <?php if (isset($quiz_info)) { ?>
                                    <div class="tab-content panel-body">
                                        <div id="quiz_detail" style="display:block;">
                                            <div class="col-sm-10 col-sm-offset-1">

                                                <div class="col-sm-12 " style="padding: 0">

                                                    <div class="col-sm-12 text-left" style="padding: 0 0 5px 20px;">
                                                        <h3><?php echo $quiz_info->quiz_name; ?></h3>
                                                    </div>

                                                    <div class="col-sm-12 text-justify" style="padding:0 0 0 20px;">
                                                        <p><?php echo $quiz_info->quiz_description; ?></p>
                                                        <hr>
                                                    </div>

                                                    <?php if ($first_question) { ?>
                                                        <div class="col-sm-6 text-left" style="padding:10px 0 10px 20px;">
                                                            <a href="<?php echo base_url() . 'all-quiz'; ?>">  Browse All Quiz</a>
                                                        </div>
                                                        <div class="col-sm-6 text-right" style="padding:10px 0 10px 20px;">
                                                            <a href="javascript:void(0)" onclick="load_quiz_question();" > <span class="btn btn-success" >Start Quiz</span></a>
                                                        </div>
                                                    <?php } else { ?>
                                                        <div class="col-sm-12 text-left" style="padding:10px 0 10px 20px;">
                                                            <span>This quiz have no Question added yet!! <a href="<?php echo base_url() . 'all-quiz'; ?>">Try Another</a></span>
                                                        </div>
                                                    <?php } ?>

                                                </div>

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

                                            </div>
                                        </div>

                                        <div id="quiz_container"></div>

                                        <div id="quiz_container2"></div>

                                    </div>
                                <?php } else { ?>
                                    <div class="tab-content panel-body"><br>
                                        <h3> Quiz not assigned for this Course </h3>
                                    </div>
                                <?php } ?>



                                <!--// for google adsense-->
                                <?php
                                if ($video_course_info->video_course_type == 2) {
                                    ?>
                                    <div class="col-sm-12"><br>
                                        <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                                        <!-- TT four -->
                                        <ins class="adsbygoogle"
                                             style="display:block"
                                             data-ad-client="ca-pub-3140114751019908"
                                             data-ad-slot="8060742220"></ins>
                                        <script>
                                                                (adsbygoogle = window.adsbygoogle || []).push({});
                                        </script>
                                    </div>
                                <?php } ?>
                                <!--// for google adsense-->

                            </div>
                            <!-- /.quiz tab -->

                            <!-- /. Share tab-pane -->
                            <div class="tab-pane" id="share">
                                <h1>Share</h1>
                                <p>Share Share Share Share</p>
                            </div>
                        </div>
                    </div><!-- /.course-detail-tab -->
                </div><!-- /.col-md-8 .col-sm-12 -->


                <!--// for google adsense-->
                <?php
                if ($video_course_info->video_course_type == 2) {
                    ?>
                    <div class="col-sm-12"><br>
                        <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                        <!-- TT three -->
                        <ins class="adsbygoogle"
                             style="display:block"
                             data-ad-client="ca-pub-3140114751019908"
                             data-ad-slot="2044561420"
                             data-ad-format="auto"></ins>
                        <script>
                                                                (adsbygoogle = window.adsbygoogle || []).push({});
                        </script>
                        <br>
                    </div>
                <?php } ?>
                <!--// for google adsense-->


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

    </div>
</div>  
</section> 
<script src="<?php echo base_url() ?>resource_library/js-video-player/plyr.js" type="text/javascript"></script>
<script src="<?php echo base_url() ?>front_end_resource/video_course/video_course.js" type="text/javascript" ></script>
<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US;</script>
<script src="<?php echo base_url(); ?>resource_library/jquery/jquery.countdown360.js" type="text/javascript"></script>
