<?php


//this is the page created to lst all the students that did course reg or withou t course reg

//erros and information printouts
$errors = array();
$info = array();
$info_success = array();



if($_REQUEST['act'] == 'suspend_student_prence' )
{//


  //$course_id = $_REQUEST['cid'];//course id
    $pid = $_REQUEST['pid'];//programme id
    $sid = $_REQUEST['sid'];//school id
    $ses = $_REQUEST['ses'];//session passed
    $sem = $_REQUEST['sem'];//semster passed
    $level = $_REQUEST['level'];//semster passed
    $uid = $_REQUEST['stu_id'];//student id
    $type = $_REQUEST['type'];//student id




    //get who perform the action
    $sec_id = get_security_id($user_id);

//validity status is
//1 - rustication
//2 -one semester
//3
//


    if($type == 'one_semester')
    {
       $q = "UPDATE `students_prence` SET validity_status = 2, date_suspended = NOW(), rusticated_suspended_by = '$sec_id', session_rusticated_suspended = '$ses'  WHERE  id = $uid";
    }
    else if ($type == 'both_semesters')
    {
       $q = "UPDATE `students_prence` SET validity_status = 3, date_suspended = NOW(), rusticated_suspended_by = '$sec_id', session_rusticated_suspended = '$ses'  WHERE  id = $uid";
    }
    else if ($type == 'expel')
    {
       $q = "UPDATE `students_prence` SET validity_status = 1, date_rusticated = NOW(), rusticated_suspended_by = '$sec_id', session_rusticated_suspended = '$ses'  WHERE  id = $uid";
    }
    else if ($type == 'reset')
    {
       $q = "UPDATE `students_prence` SET validity_status = 0, rusticated_suspended_by = '$sec_id'  WHERE  id = $uid";
    }
    else
    {

    }



$r = mysqli_query($dbc,$q);



if($r)
{

  header("Location: gateway.php?act=view_students_list_form_b2_prence&ses=".$ses."&sem=".$sem."&sid=".$sid."&pid=".$pid."&level=".$level."&is=Successfully Done");

}
else
{
  header("Location: gateway.php?act=view_students_list_form_b2_prence&ses=".$ses."&sem=".$sem."&sid=".$sid."&pid=".$pid."&level=".$level."$error=Not Successful");

}






}// end of clear courses is implemented



?>
