<?php defined('BASEPATH')or exit("NO DIRECT ACCESS iS ALLOWED");?>


<?php  $last = $this->uri->total_segments();
$courseget_id = $this->uri->segment($last);?>
<div class="col-md-12  padding_sidebar">
<div class="row" style="margin-right:0px ;margin-left:0px;">
		    		    <div class="pull-left"><?php echo  $link;?></div>

		<div class="card-head profile-categories_bread"><header>Class Detail [ <?=strtoupper($courseget_id);?> ]</header>

		<a href="<?=site_url("Teacher/course/class-list/{$courseget_id}")?>">Refresh</a>
    		 <ol class="breadcrumb page-breadcrumb pull-right">
                    <!-- <li><i class="fa fa-home"></i>&nbsp;<a class="parent-item" href="<?=site_url("Teacher")?>"><?=ucfirst($list[0]->category_id);?></a>&nbsp;<i class="fa fa-angle-right"></i>
                    </li> -->
										<li><i class="fa fa-home"></i>&nbsp;<?=ucfirst($list[0]->category_id);?>&nbsp;<i class="fa fa-angle-right"></i>
										</li>
                    <li>&nbsp;<?=ucfirst($list[0]->class_id);?>&nbsp;<i class="fa fa-angle-right"></i>
                    </li>
										<li>&nbsp;<?=ucfirst($list[0]->subject_id);?>&nbsp;<i class="fa fa-angle-right"></i>
                    </li>
                    <li class="active"><?=strtoupper($list[0]->course_id_tag);?></li>
             </ol>

    	</div>
    <div class="card card-topline-purple">
    	<div class="card-head">
    	</div>
	   <div class="table-responsive">
	   <div id="tableContainer2" class="container-tb">
	     <table class="table" style="font-family: sans-serif;font-size: 12px;">
			<thead>
				<tr>
					 <th>#</th>
                    <th>Class status</th>
                    <th>Recording</th>
                    <th>Subject Code</th>
					 					<th>Class Id</th>
                    <th>Class Date</th>
                    <!-- <th>Day</th> -->
                    <th>Start</th>
                    <th>End</th>
                    <!-- <th>Duration</th> -->
                    <!-- <th>Extended</th> -->
                    <th>Faculty</th>
                    <!-- <th>Category</th>
                    <th>Class</th>
                    <th>Subject</th> -->
                    <!-- <th>Course Id</th>
                    <th>Course start</th>
                    <th>Course End</th>
                    <th>Timezone</th> -->
				</tr>
			</thead>
		   <tbody>
		   <?php if( count($list) ):$sn=1;
                $count = $this->uri->segment(4);
                foreach($list as $lists ): ?>
				<tr>
					<td><?php echo  $sn; ?></td>
					<td>
					<?php
					 $todays_date       =   date("Y-m-d H:i");
                     $today             =   strtotime($todays_date);
                     $starts            =   strtotime($lists->class_date.' '.$lists->class_start_time);
                     $ends              =   strtotime($lists->class_date.' '.$lists->class_end_time);
                     $time1             =   $starts - (10 * 60);
                     $less_10_min_start_time = date("Y-m-d H:i", $time1);
                     //echo $less_10_min_start_time;
                     $stars             =    strtotime($less_10_min_start_time);
                    ?>
                   <?php if(($today>=$stars)&&($today<$ends)){?>
                    <a target="blank" href="<?php echo  ($lists->presenter_url);?>" class="label label-mini"
                    style="background: linear-gradient(45deg,#FFB64D,#ffcb80);cursor:pointer;">Join Session</a>
                    <?php }else if(($today<$stars)&&($today<$ends)){?>
                        <a href='#' class="label label-info label-mini" style="cursor:default;">Upcoming</a>
                    <?php }else if ($today>=$ends){?>
                        <a href='#' class="label label-mini" style="background: linear-gradient(45deg,#FF5370,#ff869a);cursor:default;"> Over</a>
                	<?php }else{?>
                        <a href='#' class="label label-mini" style="background: linear-gradient(45deg,#FF5370,#ff869a);cursor:default;">Status not Found </a>
                	<?php }?>

                </td>
                <td>
                    <?php
                    $todays_date       =   date("Y-m-d H:i");
                    $today             =   strtotime($todays_date);
                    $ends              =   strtotime($lists->class_date.' '.$lists->class_end_time);
                    ?>
                <?php if($today>$ends){?>
                    <a target="blank" href="<?php echo  ($lists->recording_url);?>" class="label label-mini"
                    style="background: linear-gradient(45deg,#FFB64D,#ffcb80);cursor:pointer;">Recording Available</a>
                    <?php }else{?>
                        <a href='#' class="label label-mini" style="background: linear-gradient(45deg,#FF5370,#ff869a);cursor:default;">Not Available</a>
                    <?php }?>

                </td>
                <td><?php echo  strtoupper($lists->subject_code);?></td>
                <td><?php echo  strtoupper($lists->class_tag_id);?></td>
          <td><?php echo date("d-M-Y", strtotime($lists->class_date));?></td>
                <!-- <td><?php //echo  date('l',strtotime($lists->class_date));?></td> -->
                <td><?php echo  strtoupper(date('g:i a',strtotime($lists->class_start_time)));?></td>
                <td><?php echo  strtoupper(date('g:i a',strtotime($lists->class_end_time)));?></td>
                <!-- <td><?php //echo  $lists->class_duration_min." Mins";?></td> -->
                <!-- <td><?php if($lists->class_extend_time_min!="") {echo  strtoupper($lists->class_extend_time_min)." Mins";}?></td> -->
                <td><?php echo  ucwords($lists->faculty);?></td>
                <!-- <td><?php //echo  strtoupper(str_replace('-'," ",$lists->category_id));?></td>
                <td><?php //echo  strtoupper(str_replace('-'," ",$lists->class_id));?></td>
                <td><?php //echo  strtoupper(str_replace('-'," ",$lists->subject_id));?></td> -->
                <!-- <td><?php //echo  strtoupper($lists->course_id_tag);?></td>
                <td><?php //echo strtoupper(date("d-M-Y", strtotime($lists->course_start_date)));?></td>
                <td><?php //echo  strtoupper(date("d-M-Y", strtotime($lists->course_end_date)));?></td>
                <td><?php //echo  strtoupper($lists->time_zone);?></td> -->

				</tr>
		<?php $sn++;unset($json2);unset($user_id);unset($user_url);unset($stars);unset($ends);unset($today);?>
        <?php endforeach; ?>
        <?php else : ?>
        <tr><td><a href="#">No Record Found</a></td></tr>
         <?php endif; ?>
		  </tbody><?php $count++; ?>

	</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
