<?php 
include_once('header.php'); 
$view_course=get_courses($_GET['course_id'],'','','','');
$same_courses=get_same_courses($_GET['course_id'],$view_course[0]['course_id'],'','',3);
$curriculum=get_curriculum('',$view_course[0]['id'],$view_course[0]['course_title'],1,'');

if(!empty($_GET['sid']))
$upd=add_to_cart($_GET['sid'],$_GET['child_id'],$_GET['action']);

$sela=executework("SELECT * FROM  lms_cart_list,lms_cart_course where lms_cart_course.cart_id=lms_cart_list.cart_id and lms_cart_list.child_id ='".$_SESSION['login_id']."' and lms_cart_list.purchage_course_id='".$view_course[0]['id']."'  and lms_cart_course.user_type='Student'");
$cnta=@mysqli_num_rows($sela);
$rowa=@mysqli_fetch_array($sela); 
?>
<!-- START SECTION TOP -->
	<section class="section-top">
		<div class="container">
			<div class="col-lg-10 offset-lg-1 text-center">
				<div class="section-top-title wow fadeInRight" data-wow-duration="1s" data-wow-delay="0.3s" data-wow-offset="0">
					<h1>Course Details</h1>
					<ul>
						<li><a href="dashboard.php">Dashboard</a></li>
						<li> / Course Details</li>
					</ul>
				</div><!-- //.HERO-TEXT -->
			</div><!--- END COL -->
		</div><!--- END CONTAINER -->
	</section>	
	<!-- END SECTION TOP -->

		<!-- START EVENT -->
		<section class="our_event section-padding">
			<div class="container">
				<div class="row">	
					<div class="col-lg-8 col-sm-8 col-xs-12">
						<div class="single_event_single">
                        
                        <?php if(!empty($view_course[0]['course_img'])){ ?>
								<img alt="" class="img-fluid" src="../instructor/courses_upload/<?php echo $view_course[0]['course_img']; ?>"/>
							<?php } else{ ?>
                           		 <img class="img-fluid" src="assets/images/banner/course-bg-p2.png" alt="">
                            <?php } ?>
                        
							
							<div class="single_event_text_single">
								 <h4><?php echo $view_course[0]['course_title']; ?></h4>
								<!--<span><i class="fa fa-calendar"></i>10 Oct 2023</span>
								<span><i class="fa fa-clock-o"></i>7 days</span>
								<span><i class="fa fa-table"></i><strong>30 Seats Available</strong></span>-->
								 <p><?php echo $view_course[0]['details']; ?></p>
							</div>
						</div><!--- END SINGLE EVENT -->
                            <div class="course-details-content section-bg">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item">
                                        <a href="#overview" class="nav-link active" data-bs-toggle="tab">Overview</a>
                                    </li>
                                    <li>
                                        <a href="#Additional_Info" class="nav-link" data-bs-toggle="tab">Additional Info</a>
                                    </li>
                                     <li>
                                        <a href="#curriculum" class="nav-link" data-bs-toggle="tab">Curriculum </a>
                                    </li>
                                </ul>
                                <div class="tab-content" id="myTabContent">
                                    <div class="tab-pane show fade active" id="overview">
                                        <div class="overview">
                                            <p><?php echo $view_course[0]['course_overview']; ?></p>
                                            <div class="details-buttons-area">
                                              
                                              <?php if($cnta==0 && empty($rowa['order_status'])){ 
											  			if(empty($_SESSION['login_id']))
                                                    	{
											  ?>
                                              		
                                                    	<a href="login.php" class="custom-button theme-one" >Enroll Now <i class="fa fa-angle-right"></i></a>
                                                       <?php } 
													      else {
													   ?>
                                                 <a class="custom-button theme-one" onClick="purchage_status('<?php echo $view_course[0]['id']; ?>','<?php echo $_SESSION['login_id']; ?>','view_course.php','add');" >Enroll Now <i class="fa fa-angle-right"></i></a>
                                            <?php } } if($cnta!=0 && empty($rowa['order_status'])){ ?>
                                            
                                             <a href="#0" class="custom-button theme-one" onClick="purchage_status('<?php echo $view_course[0]['id']; ?>','<?php echo $_SESSION['login_id']; ?>','view_course.php','remove');" >Remove <i class="fa fa-angle-right"></i></a>
                                            
                                            <?php } if($cnta!=0 && $rowa['order_status']=='completed'){ ?>
                                                <button class="btn btn-course btn-success">  View Course </button>
                                                <?php } ?>
                                            
                                              
                                                <ul class="social-icons">
                                                    <li>
                                                        <a href="#0" class="active"><i class="fa fa-facebook"></i></a>
                                                    </li>
                                                    <li>
                                                        <a href="#0"><i class="fa fa-twitter"></i></a>
                                                    </li>
                                                    <li>
                                                        <a href="#0"><i class="fa fa-instagram"></i></a>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" id="Additional_Info">
                                        <div class="overview">
                                          <?php if(!empty($view_course[0]['additional_info'])) { ?>
                                            <p><?php echo $view_course[0]['additional_info']; ?></p>
                                          <?php } else { ?>
                                          	<p> <center> <strong> No Data Found </strong> </center> </p>
                                           <?php } ?>
                                            <div class="details-buttons-area">
                                                  <?php if($cnta==0 && empty($rowa['order_status'])){ ?>
                                                 <a class="custom-button theme-one" onClick="purchage_status('<?php echo $view_course[0]['id']; ?>','<?php echo $_SESSION['login_id']; ?>','view_course.php','add');" >Enroll Now <i class="fa fa-angle-right"></i></a>
                                            <?php } if($cnta!=0 && empty($rowa['order_status'])){ ?>
                                            
                                             <a href="#0" class="custom-button theme-one" onClick="purchage_status('<?php echo $view_course[0]['id']; ?>','<?php echo $_SESSION['login_id']; ?>','view_course.php','remove');" >Remove <i class="fa fa-angle-right"></i></a>
                                            
                                            <?php } if($cnta!=0 && $rowa['order_status']=='completed'){ ?>
                                                <button class="btn btn-course btn-success">  View Course </button>
                                                <?php } ?>
                                                <ul class="social-icons">
                                                    <li>
                                                        <a href="#0"><i class="fa fa-facebook"></i></a>
                                                    </li>
                                                    <li>
                                                        <a href="#0"><i class="fa fa-twitter"></i></a>
                                                    </li>
                                                    <li>
                                                        <a href="#0"><i class="fa fa-instagram"></i></a>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                   
                                   <div class="tab-pane fade" role="tabpanel" id="curriculum">
                                        <div class="overview">
                                            <table class="table">
                                            	<?php
													 for($i=0;$i<count($curriculum);$i++)
													 {
												?>
                                            	<tr>
                                                	
                                                	<th><?php echo $curriculum[$i]['module_title']; ?></th>
                                                    <?php } ?>
                                                </tr>
                                                <?php if(count($curriculum)==0){?>
                                                	<tr>
                                                    	<th style="color:red"> No Data Found </th>
                                                    </tr>
                                                 <?php } ?>
                                            </table>
                                            <div class="details-buttons-area">
                                            
                                            
                                              <?php if($cnta==0 && empty($rowa['order_status'])){ ?>
                                                 <a class="custom-button theme-one" onClick="purchage_status('<?php echo $view_course[0]['id']; ?>','<?php echo $_SESSION['login_id']; ?>','view_course.php','add');" >Enroll Now <i class="fa fa-angle-right"></i></a>
                                            <?php } if($cnta!=0 && empty($rowa['order_status'])){ ?>
                                            
                                             <a href="#0" class="custom-button theme-one" onClick="purchage_status('<?php echo $view_course[0]['id']; ?>','<?php echo $_SESSION['login_id']; ?>','view_course.php','remove');" >Remove <i class="fa fa-angle-right"></i></a>
                                            
                                            <?php } if($cnta!=0 && $rowa['order_status']=='completed'){ ?>
                                                <button class="btn btn-course btn-success">  View Course </button>
                                                <?php } ?>
                                            
                                               
                                                <ul class="social-icons">
                                                    <li>
                                                        <a href="#0"><i class="fa fa-facebook"></i></a>
                                                    </li>
                                                    <li>
                                                        <a href="#0"><i class="fa fa-twitter"></i></a>
                                                    </li>
                                                    <li>
                                                        <a href="#0"><i class="fa fa-instagram"></i></a>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                    
                                </div>
                            </div>						
					</div><!--- END COL -->
					<div class="col-lg-4 col-sm-4 col-xs-12">
						<div class="course_features">
							<h3>Course features</h3>
							<ul>
								<li><i class="fa fa-calendar"></i> Course duration <b><?php echo $view_course[0]['duration']; ?></b></li>
								<li><i class="fa fa-calendar"></i> Classes <b> <?php echo $view_course[0]['no_of_class']; ?> </b></li>
							</ul>
						</div>
						<div class="event_info_price">
							<h4>Price - <?php echo $view_course[0]['course_price']; ?>$</h4>
						</div>
						
						<div class="related_course">
							<h3>Related Course</h3>
							
                            <?php
								  for($i=0;$i<count($same_courses);$i++)
								  {
							 ?>
                            
                            <div class="single_rc">
								<div class="rc_img">
									<?php if(!empty($same_courses[$i]['course_img'])){ ?>
                                        <img src="../instructor/courses_upload/<?php echo $same_courses[$i]['course_img']; ?>" width="50px" alt="">
                                    <?php } else{ ?>
                                         <img src="assets/images/banner/course-bg-p2.png" width="50px" alt="">
                                    <?php } ?>
								</div>
							
								<h4><a href="view_course.php?course_id=<?php echo $same_courses[$i]['id']; ?>">
                                	<?php 
                                        $text = $same_courses[$i]['course_title'];
                                        $words = explode(" ", $text);
                            
                                        echo $words[0];
                                        if (isset($words[1])) {
                                            echo " " . $words[1];
                                        }
                                    ?>
                                </a></h4>
								<span>$<?php echo $same_courses[$i]['course_price']; ?></span>
							</div><!--- END SINGLE RELATED COURSE -->
                            
							<?php } ?>
                            
						</div><!--- END RELATED COURSE -->
												
																		
					</div><!--- END COL -->
				</div><!-- END ROW -->
			</div><!-- END CONTAINER -->
		</section>
		<!-- END EVENT -->
<?php include_once('footer.php'); ?>