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


					<div class="col-md-12 padding_sidebar">
            <div class="row" style="margin-right:0px ;margin-left:0px;">
            		<div class="card-head profile-categories_bread"><header>Session Completed</header>
            		<div class="pull-left"><?php echo  $link;?></div>
                		 <ol class="breadcrumb page-breadcrumb pull-right">
                        <li><i class="fa fa-home"></i>&nbsp;<a class="parent-item" href="<?=site_url("Teacher")?>">Home</a>&nbsp;<i class="fa fa-angle-right"></i>
                        </li>
                        <li class="active">Completed Classes</li>
                     </ol>
            			<div class="pull-left">
            			  <a href="#" class="btn btn-sm btn-social btn-github pull-right button_collapse">
        						<i class="fa fa-fw fa-search  text-green"></i>Search</a>
            			</div>
                </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 table_containers">
                      <thead>
                        <tr>
													<th>#</th>
													<th>Class Id</th>
													<th>Date</th>
													<th>Start At</th>
													<th>End At</th>
													<th>Class</th>
													<th>Subject</th>
													<th>Faculty</th>
													<th>Recording</th>
													<th>Class Topic Remarks</th>
                        </tr>
                      </thead>
                       <tbody>
                       <?php if( count($list) ):$sn=1;
                          $count = $this->uri->segment(4);
                          foreach($list as $lists ): ?>
                          <?php
														$asia_calcutta_date_start = DateTime::createFromFormat('Y-m-d H:i',date("Y-m-d H:i",strtotime($lists->class_date." ".$lists->class_start_time)),new DateTimeZone('Asia/Calcutta'));
														$user_timezone_start = clone $asia_calcutta_date_start;
														$user_timezone_start->setTimeZone(new DateTimeZone($this->session->userdata('user_timezone')));
														$asia_calcutta_date_end = DateTime::createFromFormat('Y-m-d H:i',date("Y-m-d H:i",strtotime($lists->class_date." ".$lists->class_end_time)),new DateTimeZone('Asia/Calcutta'));
														$user_timezone_end = clone $asia_calcutta_date_end;
														$user_timezone_end->setTimeZone(new DateTimeZone($this->session->userdata('user_timezone')));
														//echo 'UTC:  ' . $asia_calcutta_date->format('Y-m-d g:i A');  // UTC:  2011-04-27 2:45 AM
														//echo 'ACST: ' . $acst_date->format('Y-m-d g:i A'); // ACST: 2011-04-27 12:15 PM
														$todays_date       =   date("Y-m-d H:i");
														$today             =   strtotime($todays_date);
														$starts            =   strtotime($user_timezone_start->format('Y-m-d H:i'));
														$ends              =   strtotime($user_timezone_end->format('Y-m-d H:i'));
														$time1             =   $starts - (10 * 60);
														$less_10_min_start_time = date("Y-m-d H:i", $time1);
														$stars             =    strtotime($less_10_min_start_time);
                          ?>
                        <tr <?php if(($today>=$stars)&&($today<$ends)){ ?>style="background-color:#bfcadacf;"<?php }?>>
													<td><?php echo  ucfirst($sn);?></td>
													<td><?php echo  $lists->class_tag_id;?></td>
													<td><?php echo  $user_timezone_start->format('d-M-Y');?></td>
													<td><?php echo  $user_timezone_start->format('g:i A');?></td>
													<td><?php echo  $user_timezone_end->format('g:i A');?></td>
													<td><?php echo  strtoupper($lists->class);?></td>
													<td><?php echo  strtoupper($lists->subject);?></td>
													<td><?php echo  strtoupper($lists->presenter);?></td>
													<td>
												  <?php if($today>$ends){?>
													<a href='<?=$lists->recording_url;?>' target="blank" class="label label-mini" style="background: linear-gradient(45deg,#FFB64D,#ffcb80);cursor:pointer;" >Recording</a>
													<?php }else{?>
															<a href='#' class="label label-mini" style="background: linear-gradient(45deg,#FF5370,#ff869a);cursor:default;">Not Available</a>
													<?php } ?>
													</td>
													<td><?=anchor("#",'Class topic remarks',["data-target"=>"#remarksModal-$lists->class_tag_id","data-class"=>$lists->class_tag_id,"data-st_cls_id"=>$lists->id,"data-st_cls_clid"=>$lists->class_id, "data-toggle"=>"modal","id"=>$sn,"class"=>"remarks12"]);?></td>

<?php $a=json_decode($lists->remarks_student,true); ?>
													<!-- class Remarks   -->
													<div id="remarksModal-<?=$lists->class_tag_id?>" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
													  <div class="modal-dialog">
													  <div class="modal-content">
													      <div class="modal-header modal_headers">
													          <button type="button" class="close-change close" data-dismiss="modal" aria-hidden="true">
																			<img src="<?=base_url('assets/web/images/close-pop.png');?>" alt="close-pop.png"></button>
													          <h1 class="text-center text_change">Class Remarks <?=$lists->class_tag_id?></h1>
													      </div>
													      <div class="modal-body">
																	<div class="content py-5 bg-light  ">
																		<div class="container">
																		  <div class="row">

													    					<div class="col-md-12">
													                    <span class="anchor" id="formChangePassword"></span>

																						 <div id='response1' style="color:red;text-align:center;"></div>
													                    <div class="card card-outline-secondary">
													                        <div class="card-body">
																											<form class="form" action="<?=site_url('Student/update_class_remarks')?>" role="form" id="remarksForm<?=$sn?>" method="post"  autocomplete="off">
																												<?php echo  form_hidden("class_id",$lists->class_tag_id);?>
																												<?php echo  form_hidden("st_cls_id",$lists->id);?>
																												<?php echo  form_hidden("st_cls_clid",$lists->class_id);?>
																												<div class="form-group">
																														<label for="inputPasswordOld">Class Topic</label>
																														<input type="text" class="form-control" name="class_topic" value="<?=$a['remarks']['topic'];?>"  required>
																												</div>
																												<div class="form-group">
																														<label for="inputPasswordNew">Class Description</label>
																														<textarea name="class_description" class="form-control"  required><?=$a['remarks']['description'];?></textarea>
																														<span class="form-text small text-muted">
																																		The Description must be 8-20 characters.
																																</span>
																												</div>
																												<div class="form-group">
																														<button type="submit" class="btn btn-success btn-lg float-right btn-block save_change">Save</button>
																												</div>
																										</form>
													                        </div>
													                    </div>
													                </div>
																			</div>
																		</div>
																	</div>
																</div>
													  </div>
													  </div>
													</div>
													<!---class Remarks -->
                        </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++; unset($a)?>
                  </table>
                  </div>
                  </div>
            </div>
            </div>
				</div>
      </div>
		</div>

	<div class='wrap_search'>
	<div class='content content_pop'>
		<div class="col-md-12">
			  <?=form_open('Teacher/recent_classes_15_days_search');?>
				<div class="col-md-10">
					<div class="col-md-2  padding_20 emp_style">
			<select id='sel_category' class="form-control input-sm" name="category">
					<option value="" >Select Category</option>
					<?php
					foreach($category as $category1){
						echo "<option value='".$category1['id']."'>".strtoupper($category1['category_code'])." | ".strtoupper($category1['category'])."</option>";
					}
					?>
			</select>
					</div>
					<div class="col-md-2  padding_20 emp_style">
						<select id='sel_class' class="form-control input-sm" name="class" >
							<option value="" >Select class</option>
						</select>
					</div>
					<div class="col-md-2  padding_20 emp_style">
						<select id='sel_subject' class="form-control input-sm" name="subject" >
							<option value="" >Select subject</option>
						</select>
					</div>
					<div class="col-md-2  padding_20 emp_style">
					<select id='sel_course_list' class="form-control input-sm" name="course" >
						<option value="" >Select course</option>
					</select>
		          </div>
				<div class="col-md-2  btn_mrgin1 emp_style">
							 <?=form_submit('search','search',['class'=>'btn btn-primary btn_mrgin btn-sm']);?>
				</div>
				</div>
			<?php echo form_close();?>
			</div>
	<?=form_open('Teacher/recent_classes_15_days_search2');?>
	<div class="col-md-2">
		<div class="col-md-12  padding_20 emp_style">
			<?=form_dropdown('subject_code',$subject_code ,set_value('subject_code',$data_taskpo['subject_code']),['class'=>'form-control input-sm select2 select2-hidden-accessible',
			"tabindex"=>"-1","aria-hidden"=>"true","style"=>"width: 100%;",'onchange'=>"this.form.submit()"]);?>
		</div>
  </div>
	<?php echo form_close();?>

	</div>

</div>
