<?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);


?>

<div class="well">

      <ul class="tabs">
      	<li><a href="#view1">Assessment</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'];


													?>




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


														 ?>


														 <!-- level 3 -->

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


																	 <div class="panel panel-warning">
																		 <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
																										 //show first semester courses assigned to staff
																										 echo view_courses_by_programme($session,$sid,$did, $pid,$semester = '1', $level = 'III'); //$user_id

																							?>

																							</div>


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

																						 <h4>SECOND SEMESTER</h4>
			 <?php
																											 //get second semester courses assigned to staff
																												echo view_courses_by_programme($session,$sid,$did, $pid,$semester = '2', $level = 'III'); //$user_id

																								?>

																						 </div>






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






													</div> <!-- /.panel group -->
													<!--end of level III -->




																 <?php }

																 ?>





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


                                                        ?>



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


                                                                      <div class="panel panel-warning">
                                                                        <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
                                                                                        //show first semester courses assigned to staff
                                                                                        echo view_courses_by_programme($session,$sid,$did, $pid,$semester = '1', $level = 'II'); //$user_id

                                                                                 ?>

                                                                                 </div>


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

                                                                                <h4>SECOND SEMESTER</h4>
                                          <?php
                                                                                          //get second semester courses assigned to staff
                                                                                           echo view_courses_by_programme($session,$sid,$did, $pid,$semester = '2', $level = 'II'); //$user_id

                                                                                   ?>

                                                                                </div>






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






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




                                                            <?php }

                                                            ?>









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


                                                                      <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
                                                                                        //show first semester courses assigned to staff
                                                                                        echo view_courses_by_programme($session,$sid,$did, $pid,$semester = '1', $level = 'I'); //$user_id

                                                                                 ?>

                                                                                 </div>


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

                                                                                <h4>SECOND SEMESTER</h4>
																				  <?php
                                                                                          //get second semester courses assigned to staff
                                                                                           echo view_courses_by_programme($session,$sid,$did, $pid,$semester = '2', $level = 'I'); //$user_id

                                                                                   ?>

                                                                                </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>
