<?php
if (isset($_GET['link2']) && (!empty($_GET['link2'])) && $_GET['link2'] != 0) {


$select = $conn->query("SELECT * FROM package WHERE id = '$vlink2'");
      $fetch = $select->fetchAll(PDO::FETCH_OBJ);
      $count = $select->rowCount();
      $serial = 1;
      if ($count > 0) {
        foreach ($fetch as $value) {
          $piden = $value->id;
          $level = $value->level;
          $semester = $value->semester;
          $course = $value->course;
          $lecturer = $value->lecturer;

     $select2 = $conn->query("SELECT * FROM course WHERE id = '$course' LIMIT 1");
            $fetch2 = $select2->fetchAll(PDO::FETCH_OBJ);
            $count2 = $select2->rowCount();
            if ($count2 > 0) {
              foreach ($fetch2 as $value2) {
                $name2 = $value2->name;
                $code2 = $value2->code;
              }
            } 
        $select2 = $conn->query("SELECT * FROM lecturers WHERE id = '$lecturer' ");
            $fetch2 = $select2->fetchAll(PDO::FETCH_OBJ);
            $count2 = $select2->rowCount();
            if ($count2 > 0) {
              foreach ($fetch2 as $value2) {
                $sname = $value2->sname;
                $oname = $value2->oname;
              }
            }
            }
            } 
?>
<!-- page content -->
        <div class="right_col" role="main">
          <div class="">
            <div class="page-title">
              <div class="title_left">
                <h3><a href="main.php">Dashboard</a>/<a href=" "><?php echo "$name2 ($code2)" ?></a></h3>
              </div>
            </div>

            <div class="clearfix"></div>

            <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <div class="row">
                      <div class="col-md-2 col-xs-6 col-sm-4">
                        <a href="?mod=hlecturer&link2=<?php echo $vlink2 ?>&action=announcements"><button class="btn btn-success btn-block <?php if(isset($_GET['action']) && $_GET['action'] == "announcements"){ echo "active";} ?>">Announcements</button></a>
                      </div>
                      <div class="col-md-2 col-xs-6 col-sm-4">
                        <a href="?mod=hlecturer&link2=<?php echo $vlink2 ?>&action=virtual"><button class="btn btn-success btn-block <?php if(isset($_GET['action']) && $_GET['action'] == "virtual"){ echo "active";} ?>">Virtual Class</button></a>
                      </div>
                      <div class="col-md-1 col-xs-6 col-sm-4">
                        <a href="?mod=hlecturer&link2=<?php echo $vlink2 ?>&action=notes"><button class="btn btn-success btn-block <?php if(isset($_GET['action']) && $_GET['action'] == "notes"){ echo "active";} ?>">Notes</button></a>
                      </div>
                      <div class="col-md-1 col-xs-6 col-sm-4">
                        <a href="?mod=hlecturer&link2=<?php echo $vlink2 ?>&action=courseslides"><button class="btn btn-success btn-block <?php if(isset($_GET['action']) && $_GET['action'] == "courseslides"){ echo "active";} ?>">Slides</button></a>
                      </div>
                      <div class="col-md-1 col-xs-6 col-sm-4">
                        <a href="?mod=hlecturer&link2=<?php echo $vlink2 ?>&action=audios"><button class="btn btn-success btn-block <?php if(isset($_GET['action']) && $_GET['action'] == "audios"){ echo "active";} ?>">Audios</button></a>
                      </div>
                      <div class="col-md-1 col-xs-6 col-sm-4">
                        <a href="?mod=hlecturer&link2=<?php echo $vlink2 ?>&action=videos"><button class="btn btn-success btn-block <?php if(isset($_GET['action']) && $_GET['action'] == "videos"){ echo "active";} ?>">Videos</button></a>
                      </div>
                      <div class="col-md-2 col-xs-6 col-sm-4">
                        <a href="?mod=hlecturer&link2=<?php echo $vlink2 ?>&action=assignments"><button class="btn btn-success btn-block <?php if(isset($_GET['action']) && $_GET['action'] == "assignments"){ echo "active";} ?>">Assignments</button></a>
                      </div>
                       <div class="col-md-2 col-xs-6 col-sm-4">
                        <a href="?mod=hlecturer&link2=<?php echo $vlink2 ?>&action=coursenames"><button class="btn btn-success btn-block <?php if(isset($_GET['action']) && $_GET['action'] == "coursenames"){ echo "active";} ?>">Students</button></a>
                      </div>
                    </div>
                    
                    <div class="clearfix"></div>
                  </div>
<?php
if(isset($_GET['action']) && $_GET['action'] == "coursemates"){
include('pages/coursestudents.php');
}elseif (isset($_GET['action']) && $_GET['action'] == "notes") {
include('pages/addnote.php');
}elseif (isset($_GET['action']) && $_GET['action'] == "courseslides") {
include('pages/addslides.php');
}elseif (isset($_GET['action']) && $_GET['action'] == "audios") {
include('pages/addaudio.php');
}elseif (isset($_GET['action']) && $_GET['action'] == "videos") {
include('pages/addvideo.php');
}elseif (isset($_GET['action']) && $_GET['action'] == "assignments") {
include('pages/addassignment.php');
}elseif (isset($_GET['action']) && $_GET['action'] == "virtual") {
include('pages/viewvirtual.php');
}elseif (isset($_GET['action']) && $_GET['action'] == "announcements") {
include('pages/addannouncement.php');
}else{
  include('pages/coursestudents.php');  
}
?>
                            
                    
                  </div>
                </div>
              </div>
            </div>
          </div>
        <!-- /page content -->

<?php
}else{
?>
<!-- page content -->
        <div class="right_col" role="main">
          <div class="">
            <div class="page-title">
              <div class="title_left">
                <h3><a href="main.php">Dashboard</a>/<a href=" ">Classes</a></h3>
              </div>
            </div>

            <div class="clearfix"></div>

            <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <div class="row">
                        <h1>Error: Page not Found... Go back home</h1>
                    </div>
                    
                    <div class="clearfix"></div>
                  </div>                           
                    
                  </div>
                </div>
              </div>
            </div>
          </div>
        <!-- /page content -->

<?php
}
?>
