<?php defined('BASEPATH') or exit('No direct Access is Allowed'); ?>

<?php
  $last     = $this->uri->total_segments();
  $classid = $this->uri->segment($last);
?>
<div class="content-wrapper">
  <section class="content">
  <div class="row">
    <div class="col-xs-12">
      <div class="box">
        <div class="box-body table-responsive no-padding">
                           <div class="border_full">
                           <h3 class="full_h3"><?=$list[0]->userid;?> - <?=strtoupper($list[0]->student_name);?>
                             <a href="<?=site_url('admin/course/Course/studentschedulelist');?>" class="btn btn-default pull-right" style="background-color: #ffffff;">
                               <i class="fa fa-fw fa-list"></i> Student Schedule List</a>       </h3>
                           <div class="table-responsive">
                               <table class="table table-bordered" id="">
                                 <thead>
                                 <tr>
                                   <th>Student Name</th>
                                   <th>Course Name</th>
                                   <th>Faculty</th>
                                   <th>Total Course Enrolled</th>
                                   <th>Total Class Enrolled</th>
                                </tr>
                              </thead>
                                 <tbody>
                                 <tr>
                                   <td><?php echo strtoupper($list[0]->student_name);?></td>
                                   <td><?php echo strtoupper($list[0]->course_name);?></td>
                                   <td><?php echo ucwords($list[0]->faculty); ?></td>
                                   <td><?php $a= explode(',',$course_count);echo count(array_unique($a)); ?></td>
                                   <td><?php echo ucwords($class_count); ?></td>
                                </tr>
                              </tbody>
                         </table>
                         </div>
                 </div>
               </div>
        </div>
        <div class="box">
          <div class="box-body table-responsive no-padding">
               <div class="border_full">
            <h3 class="full_h3">Classes Info
              <a href="<?=site_url('admin/course/Course/studentschedulelist');?>" class="btn btn-default pull-right" style="background-color: #ffffff;">
                <i class="fa fa-fw fa-list"></i> Student Schedule List</a>
                                  </h3>
        <div  id="reportsummary">
        <!-- <table id="example2" class="table table-bordered table-hover  table-responsive" style="font-size: 10px;">-->

  <div id="tableContainer2" class="container-tb">
        <table class="table-hover">
          <thead >
            <tr>
                <th>Sr.</th>
                <th>Classid </th>
                <th>Date </th>
                <th>Start Time</th>
                <th>Close Time</th>
                <th>Class Duration (MIN)</th>
                <th>Faculty</th>
                <th>Class Amount</th>
                <th>Total Class</th>
                <th>Total course</th>
                <th>Status</th>
                <th>class link</th>
                <th>Course Name</th>
            </tr>
          </thead>
          <tbody  style="font-size: 12px;" >
			<?php if( count($list) ):$sn=1;
			$count = $this->uri->segment(6);
			foreach($list as $lists ): ?>
      <?php
        $todays_date       =   date("Y-m-d H:i");

        // $asia_calcutta_date = DateTime::createFromFormat('Y-m-d H:i',$todays_date,new DateTimeZone('Asia/Calcutta'));
        // $acst_date = clone $asia_calcutta_date; // we don't want PHP's default pass object by reference here
        // $acst_date->setTimeZone(new DateTimeZone('Asia/Hong_Kong'));

        //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
        //echo $todays_date;die;
        $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);
        //$stars             =    strtotime($less_10_min_start_time);

        ?>
            <tr <?php if(($today>=$starts)||($lists->method=="cancel")||($lists->class_status=="cancel")){?> style="color:red;"<?php }?>>
                <td><?php echo  $sn; ?></td>
                <td><?php echo strtoupper($lists->class_name);?></td>
                <td><?php echo date("d-M-Y",strtotime($lists->class_date)); ?></td>
                <td><?php echo date("h:i A",strtotime($lists->class_start_time)); ?></td>
                <td><?php echo date("h:i A",strtotime($lists->class_end_time)); ?></td>
                <td><?php if($lists->class_extended_min!=""){
                  $extend =$lists->class_extended_min;
                }
                else{
                  $extend =0;
                } echo ($lists->class_duration_min+$extend)."'"; ?></td>
                <td><?php echo ucwords($lists->faculty); ?></td>
                <td>  <i class="fa fa-fw fa-rupee"></i> <?php echo ucwords($lists->class_amount); ?></td>
                <td><?php echo ucwords($class_count); ?></td>
                <td><?php $a= explode(',',$course_count);echo count(array_unique($a)); ?></td>
                <td><?php echo ucwords($lists->class_status.",".$lists->method); ?></td>
                <td><?php echo anchor($lists->st_url,"class url",['title'=>'Class List','class'=>'btn btn-sm btn-success']); ?></td>
                <td><?php echo strtoupper($lists->course_name);?></td>
            </tr>
            <?php $sn++;?>
			<?php unset($a); endforeach; ?>
            <?php else : ?>
            <tr>
              <td><strong>No record found</strong></td>
            </tr>
            <?php endif; ?>
          </tbody>
        </table>
        </div>
        </div>    </div>
        <?php $count++; //echo  $link; ?>
        </div>
    </div>
  </div>
</div>
</section>
</div>

			<div class='wrap'>
	<div class='content content_pop'>
		<div class="col-md-12">
		   <?=form_open('admin/Adminlte/course_list_search');?>
				<div class="">

				   	<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 padding_20">
						<?=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%;"]);?>
                   </div>

					<div class="col-md-2  padding_20 emp_style">
						<?php $options=array(''=>'Search Type','and'=>'And','or'=>'OR');?>
						<?=form_dropdown('seach_term',$options,set_value('seach_term','and'),['class'=>'form-control input-sm','style'=>'']);?>
					</div>
					<div class="col-md-2  padding_20 emp_style">
						<?php $options=array(''=>'Order By','ASC'=>'Ascending','DESC'=>'Descending','RANDOM'=>'Random');?>
						<?=form_dropdown('order_by',$options,set_value('order_by','ASC'),['class'=>'form-control input-sm']);?>
					</div>

				</div>
				<div class="btn_mrgin1">

				 <?=form_submit('search','search',['class'=>'btn btn-primary btn_mrgin btn-sm']);?>
				</div>
			<?php echo form_close();?>
			</div>
	</div>
</div>
