<?php

// if(isset($_GET['sid'],$_GET['pid']))
// {
// 	$sid = $_GET['sid'];
//   //$did = $_GET['did'];
//   $pid = $_GET['pid'];
//
//   //get department id from programme id supplied
//   //$did = get_department_using_programme_id($pid);
//
//
//   $did = get_department_comb_using_programme_id($pid);
//
// }

//  $mid = get_user_department($user_id); // the main department_id
//
//
//  //check if the programme is a sed programme
//  //checking eiither new special edu course or old
// if ($mid != 12) //12 is set for old sed structure
// {
//
//   $sed_pids = get_sed_programme_ids( '%SED%',$type_id = 2, $mode = 1,$dept_idd = '!= 12');
// }
// else
// {
//   $sed_pids = get_sed_programme_ids( '%SED%',$type_id = 2, $mode = 1,$dept_idd = '= 12');
// }

//print_r($pids);

// //$prog_id = get_user_programme_id($user_id);
// $prog_code = get_programme_code($pid);
// //$level = get_user_level($user_id);
//
// //verify programme id presence
// $sed_std = false;
// if(in_array($pid, $sed_pids)){
//   $sed_pro = true;
//   //echo  'yes';
//   //$sed_prog_id = get_user_sed_prog_id($user_id);
// }

 ?>

<div class="well">

      <ul class="tabs">
      	<li><a href="#view1">Prog. Combination Summary</a></li>
        <!--<li><a href="gateway.php?act=view_course_assessments">Assessments</a></li>-->
      </ul>
      <div class="tabcontents">
        <div id="view1">

             <div id="accordion" class="panel-group">

        <?php $q = "SELECT * FROM sessions  WHERE status = 0 ORDER BY title DESC";
			  		$r = mysqli_query($dbc, $q);

					if(mysqli_num_rows($r)>0)
					{
						$a=0; //initialise counter
						while($row = mysqli_fetch_array($r,MYSQLI_ASSOC))
						{
	    ?>
							<div class="panel panel-success">
								<div class="panel-heading">
									<p class="panel-title">
                                   		<a id="<?php echo $a + 1; ?>" data-toggle="collapse" data-parent="#accordion" href="#collapse<?php  echo $a + 1; ?>">
                                        <span class="glyphicon glyphicon-plus"></span>
											<?php echo $row['title']; ?>
                                        </a>

                                    <span class="label label-success" style="font-size:15px;float:right;">
									<?php //echo get_total_votes_per_post($row['id']); //parameter is post id?></span>


                                    </p>
								</div>
										<div id="collapse<?php echo $a + 1; ?>" class="panel-collapse collapse<?php //echo $a + 1; ?>  <?php //if($a + 1 =='1'){ echo 'in';} //hide the collapse ?>">
                                        	<div class="panel-body">
                          						<ul class="list-group">




                                                    <?php 	//collect the post id
                                														$session = $row['id'];
													                         	?>


                                                                <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">



										                                                        <!-- start level III -->

										                                                        <!-- show level III starting from 2019/2020 session -->

										                                                        <?php if ($session > 4)
										                                                        {


										                                                        ?>


										                                                                 <div class="panel panel-info">
										                                                                        <div class="panel-heading" role="tab" id="level3_heading">
										                                                                          <h4 class="panel-title">
										                                                                            <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#level3" aria-expanded="false" aria-controls="level3">Level III</a>
										                                                                          </h4>
										                                                                        </div>
										                                                                        <div id="level3" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="level3_heading">
										                                                                          <div class="panel-body">


										                                                                              <div class="col-lg-6">

										                                                                      <h4>FIRST SEMESTER</h4>
										                                                                     <?php

										                                                                                           echo '&nbsp&nbsp <div class="btn-group">
                                      										                                                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <i class="glyphicon glyphicon-print"></i>
                                      										                                                      Print <span class="caret"></span>
                                      										                                                    </button>
                                      										                                                    <ul class="dropdown-menu">';


                                        																																			echo '<li><a target="_blank" href="print_top_level_summary.php?ses='. $session.'&sem=1&sid='.$sid.'&pid='.$pid.'&lvl=III" > TOP LEVEL SUMMARY</a> </li>';




                                        										                                                   echo
                                        										                                                   '</ul>
                                        										                                                  </div>'; //end of  /.btn group


										                                                                        ?>


										                                                                                 </div>


										                                                                                 <div class="col-lg-6">

										                                                                                <h4>SECOND SEMESTER</h4>
                                                                                                    <?php

                                                                                                                          echo '&nbsp&nbsp <div class="btn-group">
                                                                                                                         <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <i class="glyphicon glyphicon-print"></i>
                                                                                                                           Print <span class="caret"></span>
                                                                                                                         </button>
                                                                                                                         <ul class="dropdown-menu">';


                                                                                                                         echo '<li><a target="_blank" href="print_top_level_summary.php?ses='. $session.'&sem=2&sid='.$sid.'&pid='.$pid.'&lvl=III" > TOP LEVEL SUMMARY</a> </li>';




                                                                                                                          echo
                                                                                                                          '</ul>
                                                                                                                         </div>'; //end of  /.btn group


                                                                                                       ?>

										                                                                                </div>



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








										                                              <?php


										                                            }// end of condition to show 2019/2020 session for level III and above

										                                              ?>

                                                        <!-- start level II -->

                                                        <!-- show level II starting from 2018/2019 session -->

                                                        <?php if ($session != 3)
                                                        {


                                                        ?>


                                                                 <div class="panel panel-danger">
                                                                        <div class="panel-heading" role="tab" id="level2_heading">
                                                                          <h4 class="panel-title">
                                                                            <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#level2" aria-expanded="false" aria-controls="level2">Level II</a>
                                                                          </h4>
                                                                        </div>
                                                                        <div id="level2" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="level2_heading">
                                                                          <div class="panel-body">


                                                                              <div class="col-lg-6">

                                                                      <h4>FIRST SEMESTER</h4>
                                                                      <?php







                                                                                 ?>


                                                                                 </div>


                                                                                 <div class="col-lg-6">

                                                                                <h4>SECOND SEMESTER</h4>
                                                                               <?php









                                                                                   ?>

                                                                                </div>



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








                                              <?php


                                            }// end of condition to show 2018/2019 session for level II and above

                                              ?>




                                                                   <!-- start level I -->
                                                                      <div class="panel panel-warning">
                                                                        <div class="panel-heading" role="tab" id="level1_heading">
                                                                          <h4 class="panel-title">
                                                                            <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#level1" aria-expanded="false" aria-controls="level1">Level I</a>
                                                                          </h4>
                                                                        </div>
                                                                        <div id="level1" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="level1_heading">
                                                                          <div class="panel-body">





                                                                          		<div class="col-lg-6">

                                                            				        	<h4>FIRST SEMESTER</h4>
																				                                      <?php









                                                                                 ?>


                                                                                 </div>


                                                                                 <div class="col-lg-6">

                                                                                <h4>SECOND SEMESTER</h4>
																				  <?php
                                                                                          //get second semester courses assigned to staff





                                                                                   ?>

                                                                                </div>



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






                                                             </div> <!-- /.panel group -->





                          					</ul>
										</div>
							</div>
							<!--First accordion panel container Ends here -->
			<?php

						$a++; //increment the loop for the control
						}
					}
			?>

							</div>



				</div>





        </div> <!-- /view1 -->


      </div>
</div>

</form>
