<?php
//$this->load->library('ForeignExchange');
//$fx = new ForeignExchange('BDT', 'USD');
?>
<section class="course-detail" style="padding-top: 0px;">
    <div class="row" style="width: 90%;">
        <div class="col-sm-12">
            <div class="col-sm-12">
                <?php
                echo view_message('error');
                ?>
            </div>
            <div>
                <div class="col-sm-12 form-group"></div>
                <center>
                    <input type="hidden" id="baseUrl" value="<?php echo base_url(); ?>">
                    <div class="col-sm-12 gray ">
                        <div class="col-sm-12 text-center">
                            <span style="padding-right: 10px;">
                                <img src="<?php echo base_url() ?>image/no_image_course.png" style="width: 50px">
                            </span>

                            <span class="h3" style="padding-right: 10px;" id="courseNameView">
                                <?php
                                if (strlen($course_info->course_name) > 50) {
                                    echo mb_substr($course_info->course_name, 0, 50, 'utf-8');
                                } else {
                                    echo $course_info->course_name;
                                }
                                ?>
                            </span>
                            <?php
                            if (strlen($course_info->course_name) > 50) {
                                echo '<a id="moreCourseNameView" style="cursor:pointer;padding-right: 10px;">>>></a>';
                            }
                            ?>
                            <input type="hidden" id="hiddenCourseName" value="<?php echo $course_info->course_name ?>">

                            <span>
                                <?php
                                if ($status == 2) {
                                    echo '<a href="' . base_url() . 'course/' . $course_info->url . '/registration">'
                                    . '<img src="' . base_url() . 'image/registration-icon.png" title="Get Enrollment in this Course">'
                                    . '</a>';
                                }
                                ?>
                            </span>
                        </div>

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



                <div class="row tab-bg col-sm-12  form-group padding-top-zero">
                    <div class="col-sm-12" style="padding-left:0;">
                        <div class="course-detail-tab margin-zero">
                            <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="#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="form-group"></div>
                                    <div class="tab-content panel-body">
                                        <div class="col-sm-7 text-left col-sm-offset-1">
                                            <span ><strong>Course Price :</strong>
                                                <?php
                                                if ($course_info->course_type == 1) {
                                                    if ($price_info->price_currency == 1) {
                                                        //echo 'BDT ' . $price_info->price . ' / USD ' . round($fx->toForeign($price_info->price));
                                                        echo 'BDT ' . $price_info->price;
                                                    }
                                                    if ($price_info->price_currency == 2) {
                                                        //echo 'BDT ' . round($fx->toBase($price_info->price)) . ' / USD ' . $price_info->price;
                                                        echo  ' USD ' . $price_info->price;
                                                    }
                                                } else {
                                                    echo 'Call +8801712742217 for Price';
                                                }
                                                ?>
                                            </span> <br> <br>

                                           <!-- <span><strong> Class Hour: </strong>
                                                &nbsp;<level id="courseHoue"></level>
                                            </span>  <br><br>-->


                                          <!--  <span><strong> Days: </strong><?php
                                                //if ($course_info->course_days) {
                                                    //echo $course_info->course_days;
                                               // }
                                                ?></span>  <br>-->

                                        </div>
                                        <div class="col-sm-4 text-left" >
                                            <span><strong> Class Hour: </strong>
                                                &nbsp;<level id="courseHoue"></level>
                                            </span>  <br><br>
                                           <!--   <span ><strong>Number of Classes :</strong> <?php //echo $course_info->number_of_classes; ?> </span> <br><br>-->
                                         <!--     <span ><strong> Start Date : </strong><?php
                                               // if (strtotime($course_info->course_start_date) != 0) {
                                                  //  echo date('d F, Y', strtotime($course_info->course_start_date));
                                              //  }
                                                ?></span> <br> <br> -->
                                             <!-- <span ><strong>Time : </strong><?php
                                               // if ($course_info->class_time != '00:00:00') {
                                                   // echo date('H:i:s A', strtotime($course_info->class_time));
                                             //   }
                                                ?></span>  <br>
                                            <br> -->
                                        </div>
                                        <div class="col-sm-10 col-sm-offset-1 text-center" >
                                            <br>
                                            <!--  <p class="text-center text-red">Last Date of Registration: <?php
                                               // if (strtotime($course_info->last_date_of_registration)) {
                                                  //  echo date('d F, Y', strtotime($course_info->last_date_of_registration));
                                               // }
                                                ?></p><br> -->
                                        </div>
                                        <!--<h1>Course Objectives</h1>-->
                                        <div class="col-sm-12 text-left" >
                                            <p class="text-justify"><?php
                                                echo $this->tinymce_model->view_tinyMce_information($course_info->course_creator_id, $course_info->url, $course_info->course_training_outline);
                                                ?></p>
                                        </div>

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


                                <!-- work-files tab-->
                                <div class="tab-pane" id="work-files">
                                    <div class="tab-content panel-body">
                                        <div class="col-sm-7 text-left col-sm-offset-1">
                                            <h2>Work Files</h2>
                                            <?php
                                            if ($work_files) {
                                                foreach ($work_files as $value) {
                                                    if ($value->work_file_access_level == 1) {
                                                        ?>
                                                        <a href="javascript:void(0);" id="download_work_file<?php echo $file_random_id[$value->work_file_id] ?>">
                                                            <i class="fa fa-download">&nbsp; <?php echo $value->work_file_name ?></i>   
                                                        </a><br>
                                                        <?php
                                                    } else {
                                                        ?>
                                                        <a href="javascript:void(0);">
                                                            <i class="fa fa-lock">&nbsp; <?php echo $value->work_file_name ?></i>   
                                                        </a><br>
                                                        <?php
                                                    }
                                                }
                                            } else {
                                                echo 'There is no work file';
                                            }
                                            ?>
                                        </div>
                                    </div>
                                </div>
                                <!-- /.work-files tab -->


                                <!-- objectives tab -->
                                <div class="tab-pane" id="objectives">
                                    <div class="tab-content panel-body text-left">
                                        <div class="col-sm-10 col-sm-offset-1">
                                            <h2>Objectives</h2>
                                            <p class="text-justify"><?php
                                                echo $this->tinymce_model->view_tinyMce_information($course_info->course_creator_id, $course_info->url, $course_info->course_training_objectives);
                                                ?></p>
                                        </div>
                                    </div>
                                </div>


                                <!-- quiz tab -->
                                <div class="tab-pane" id="quiz">
                                    <?php if ($course_quiz_file) { ?>
                                        <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 (count($quiz_questions) >= $quiz_info->total_number_of_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">
                                            <h3> Quiz not assigned for this Course </h3>
                                        </div>
                                    <?php } ?>
                                </div>
                                <!-- /.quiz tab -->
                            </div>
                        </div><!-- /.course-detail-tab -->
                    </div><!-- /.col-md-8 .col-sm-12 -->
                    <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>
                </div>
            </div><!-- /.gray -->
        </div><!-- /.col-md-12 -->
    </div><!-- /.row -->
</section><!-- /.course-detail -->
<script src="<?php echo base_url() ?>front_end_resource/course/course_view.js" type="text/javascript"></script>
<script>
                                                                    $('#courseHoue').text(convertDecemaltoTime('<?php echo $course_info->number_of_classes; ?>', '<?php echo $course_info->class_hour_per_day; ?>'));
</script>