<?php include 'inc_classes.php'; 
//include "admin_authentication.php";?>
<?php
if(isset($_GET['record_id']))
$record_id = $_GET['record_id'];
?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Batch TImetable</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.7 -->
  <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="bower_components/Ionicons/css/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">

  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->

  <!-- Google Font -->
  <style>
  .table > tbody > tr > td, .table > tbody > tr > th, .table > tfoot > tr > td, .table > tfoot > tr > th, .table > thead > tr > td, .table > thead > tr > th
  {
	  vertical-align:center !important;
  }
  </style>
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">

  <header class="main-header">
    <!-- Logo -->
    <a href="index.php" class="logo">
      <!-- mini logo for sidebar mini 50x50 pixels -->
      <!--<span class="logo-mini"><b>A</b>LT</span>-->
      <!-- logo for regular state and mobile devices -->
      <span class="logo-lg"><b>ISAS</b> Beauty School</span>
    </a>
    <!-- Header Navbar: style can be found in header.less -->
    <nav class="navbar navbar-static-top">
      <!-- Sidebar toggle button-->
      <!--<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </a>-->

      <div class="navbar-custom-menu">
        <ul class="nav navbar-nav">
          <!-- Messages: style can be found in dropdown.less-->
          <li class="dropdown messages-menu">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              <i class="fa fa-envelope-o"></i>
              <span class="label label-success">4</span>
            </a>
            <ul class="dropdown-menu">
              <li class="header">You have 4 messages</li>
              <li>
                <!-- inner menu: contains the actual data -->
                <ul class="menu">
                  <li><!-- start message -->
                    <a href="#">
                      <div class="pull-left">
                        <img src="dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
                      </div>
                      <h4>
                        Support Team
                        <small><i class="fa fa-clock-o"></i> 5 mins</small>
                      </h4>
                      <p>Why not buy a new awesome theme?</p>
                    </a>
                  </li>
                  <!-- end message -->
                  <li>
                    <a href="#">
                      <div class="pull-left">
                        <img src="dist/img/user3-128x128.jpg" class="img-circle" alt="User Image">
                      </div>
                      <h4>
                        AdminLTE Design Team
                        <small><i class="fa fa-clock-o"></i> 2 hours</small>
                      </h4>
                      <p>Why not buy a new awesome theme?</p>
                    </a>
                  </li>
                  <li>
                    <a href="#">
                      <div class="pull-left">
                        <img src="dist/img/user4-128x128.jpg" class="img-circle" alt="User Image">
                      </div>
                      <h4>
                        Developers
                        <small><i class="fa fa-clock-o"></i> Today</small>
                      </h4>
                      <p>Why not buy a new awesome theme?</p>
                    </a>
                  </li>
                  <li>
                    <a href="#">
                      <div class="pull-left">
                        <img src="dist/img/user3-128x128.jpg" class="img-circle" alt="User Image">
                      </div>
                      <h4>
                        Sales Department
                        <small><i class="fa fa-clock-o"></i> Yesterday</small>
                      </h4>
                      <p>Why not buy a new awesome theme?</p>
                    </a>
                  </li>
                  <li>
                    <a href="#">
                      <div class="pull-left">
                        <img src="dist/img/user4-128x128.jpg" class="img-circle" alt="User Image">
                      </div>
                      <h4>
                        Reviewers
                        <small><i class="fa fa-clock-o"></i> 2 days</small>
                      </h4>
                      <p>Why not buy a new awesome theme?</p>
                    </a>
                  </li>
                </ul>
              </li>
              <li class="footer"><a href="#">See All Messages</a></li>
            </ul>
          </li>
          <!-- Notifications: style can be found in dropdown.less -->
          <li class="dropdown notifications-menu">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              <i class="fa fa-bell-o"></i>
              <span class="label label-warning">10</span>
            </a>
            <ul class="dropdown-menu">
              <li class="header">You have 10 notifications</li>
              <li>
                <!-- inner menu: contains the actual data -->
                <ul class="menu">
                  <li>
                    <a href="#">
                      <i class="fa fa-users text-aqua"></i> 5 new members joined today
                    </a>
                  </li>
                  <li>
                    <a href="#">
                      <i class="fa fa-warning text-yellow"></i> Very long description here that may not fit into the
                      page and may cause design problems
                    </a>
                  </li>
                  <li>
                    <a href="#">
                      <i class="fa fa-users text-red"></i> 5 new members joined
                    </a>
                  </li>
                  <li>
                    <a href="#">
                      <i class="fa fa-shopping-cart text-green"></i> 25 sales made
                    </a>
                  </li>
                  <li>
                    <a href="#">
                      <i class="fa fa-user text-red"></i> You changed your username
                    </a>
                  </li>
                </ul>
              </li>
              <li class="footer"><a href="#">View all</a></li>
            </ul>
          </li>
          <!-- Tasks: style can be found in dropdown.less -->
          
          <!-- User Account: style can be found in dropdown.less -->
          
          <!-- Control Sidebar Toggle Button -->
          <li>
            <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
          </li>
        </ul>
      </div>
    </nav>
  </header>
  <!-- Left side column. contains the logo and sidebar -->
<?php 
$sel="select batch_name,staff_id,course_id from course_batch_mapping where c_b_id='".$record_id."'";
$ptr_batch=mysql_query($sel);
$data_batch=mysql_fetch_array($ptr_batch);

$sel_course="select course_name from courses where course_id='".$data_batch['course_id']."'";
$ptr_course=mysql_query($sel_course);
$data_course=mysql_fetch_array($ptr_course);

$sel_name="select name from site_setting where admin_id='".$data_batch['staff_id']."'";
$ptr_name=mysql_query($sel_name);
$data_name=mysql_fetch_array($ptr_name);
?>  

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper" style="margin-left:0 !important">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        Batch Timetable
        <small><strong>Batch name:</strong> <?php echo $data_batch['batch_name']; ?> &nbsp;&nbsp;&nbsp;&nbsp; <strong>Staff name:</strong> <?php echo $data_name['name']; ?></small>
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
        <li><a href="#">Tables</a></li>
        <li class="active">Simple</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
      
      <div class="row">
        <div class="col-xs-12">
          <div class="box">
            <div class="box-header">
              <h3 class="box-title">Courase Name: <?php echo $data_course['course_name']; ?></h3>

              <div class="box-tools">
                <div class="input-group input-group-sm" style="width: 150px;">
                  <input type="text" name="table_search" class="form-control pull-right" placeholder="Search">

                  <div class="input-group-btn">
                    <button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
                  </div>
                </div>
              </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding">
              <table class="table table-hover">
                <tr>
                  <th rowspan="2" align="center" style="width:10%; text-align:center !important">Sr. No.</th>
                  <th rowspan="2" align="center" style="width:10%; text-align:center !important">Days</th>
                  <th rowspan="2" align="center" style="width:15%; text-align:center !important">Date</th>
                  <th colspan="3" align="center" style="width:45%; text-align:center !important">Topic Details</th>
                  <th rowspan="2" align="center" style="width:15%; text-align:center !important">Status</th>
                </tr>
                <tr>
                  <th align="center" style="width:20%; text-align:center !important">Topic Name</th>
                  <th align="center" style="width:15%; text-align:center !important">Topic Content</th>
                  <th align="center" style="width:10%; text-align:center !important">Model Required</th>
                </tr>
                <?php
				$sql_query= "SELECT * FROM batch_timetable where 1 and c_b_id='".$record_id."' group by day order by date asc"; 
				$ptr_sql=mysql_query($sql_query);
				$no_of_records=mysql_num_rows($ptr_sql);
				if($no_of_records)
				{
					$i=1;
					while($val_query=mysql_fetch_array($ptr_sql))
					{
						echo '<td align="center" style="text-align:center !important">'.$i.'</td>';
						echo '<td align="center" style="text-align:center !important">'.$val_query['day'].'</td>';
						$exp=explode('-',$val_query['date']);
						$new_date=$exp[2]."/".$exp[1]."/".$exp[0];
						echo '<td align="center" style="text-align:center !important">'.$new_date.'</td>';
						echo '<td align="center" colspan="3" style="text-align:center !important">';
						
						$sele_batch="select * from batch_timetable where day='".$val_query['day']."' and c_b_id='".$record_id."' ";
						$ptr_batch=mysql_query($sele_batch);
						echo'<table width="100%;" >';
						$t=1;
						while($data_batch=mysql_fetch_array($ptr_batch))
						{
							echo '<tr>';
							$listed_record_id=$data_batch['batch_timetable_map_id'];
						
							$select_topic = "select topic_name from topic where topic_id ='".$data_batch['topic_id']."' ";  
							$ptr_top=mysql_query($select_topic);        
							$val_topic= mysql_fetch_array($ptr_top);
							
							echo '<td align="center" style="width:20%;text-align:center !important">'.$val_topic['topic_name'].'</td>';
							echo '<td align="center" style="width:20%;text-align:center !important">'.stripslashes($data_batch['topic_content']).' &nbsp;&nbsp;</td>';
							
							echo '<td align="center" style="width:15%;text-align:center !important">'.$data_batch['model_required'].'</td>';
							
							echo '<tr>';
						}
						echo '</table>';
						echo '</td>';
						
						if($val_query['status']=='Completed')
						{
							$class='<span class="label label-success">Completed</span>';
						}
						else if($val_query['date'] < date('Y-m-d') && $val_query['status']=='')
						{
							$class='<span class="label label-danger">Not Completed</span>';
						}
						else
							$class='<span class="label label-warning">Pending</span>';
								
							echo '<td align="center" style="text-align:center !important">'.$class.'</td>';
						//}
						echo '</td>';
						echo '</tr>'; 
						$i++;
					}
				}
				?>
                <!--<tr>
                  <td>183</td>
                  <td>John Doe</td>
                  <td>11-7-2014</td>
                  <td><span class="label label-success">Approved</span></td>
                  <td>Bacon ipsum dolor sit amet salami venison chicken flank fatback doner.</td>
                  <td>183</td>
                  <td>John Doe</td>
                </tr>
                <tr>
                  <td>219</td>
                  <td>Alexander Pierce</td>
                  <td>11-7-2014</td>
                  <td><span class="label label-warning">Pending</span></td>
                  <td>Bacon ipsum dolor sit amet salami venison chicken flank fatback doner.</td>
                </tr>
                <tr>
                  <td>657</td>
                  <td>Bob Doe</td>
                  <td>11-7-2014</td>
                  <td><span class="label label-primary">Approved</span></td>
                  <td>Bacon ipsum dolor sit amet salami venison chicken flank fatback doner.</td>
                </tr>
                <tr>
                  <td>175</td>
                  <td>Mike Doe</td>
                  <td>11-7-2014</td>
                  <td><span class="label label-danger">Denied</span></td>
                  <td>Bacon ipsum dolor sit amet salami venison chicken flank fatback doner.</td>
                </tr>-->
              </table>
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
      </div>
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  <footer class="main-footer">
    <div class="pull-right hidden-xs">
    </div>
    <strong>Copyright &copy; 2014-2016 <a href="https://isasbeautyschool.com">ISAS BEAUTY SCHOOL </a>.</strong> All rights
    reserved.
  </footer>

</div>
<!-- ./wrapper -->

<!-- jQuery 3 -->
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- Slimscroll -->
<script src="bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="bower_components/fastclick/lib/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="dist/js/demo.js"></script>
</body>
</html>
