/*
 * Make sure the user is authorized to view this page
 */
require_once JApplicationHelper::getPath('admin_html');
// Set the table directory
//JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_student'.DS.'tables');
$task = JRequest::getCmd('task');
$id = JRequest::getVar('id', 0, 'get', 'int');
$cid = JRequest::getVar('cid', array(0), 'post', 'array');
JArrayHelper::toInteger($cid, array(0));
switch ($task) {
    case 'add':
        editStudent(false);
        break;
    case 'edit':
        editStudent(true);
        break;
    case 'apply':
    case 'save':
    case 'save2new':
    case 'save2copy':
        saveStudent($task);
        break;
    case 'remove':
        removeStudent($cid);
        break;
    case 'publish':
        changeStudent($cid, 1);
        break;
    case 'unpublish':
        changeStudent($cid, 0);
        deleteFac();
        break;
    case 'addEmp':
        addEmp();
        break;
    case 'addStudent':
        addStudent();
        break;
    case 'addFaculty':
        addFaculty();
        break;
    case 'editEmp':
        editEmp();
        break;
    case 'editStudent':
        editStudent();
        break;
    case 'editFaculty':
        editFaculty();
        break;
    default:
        // if action is not defined or unknown
        // move to main user page
        header('Location: index.php');
}
function makeComplain()
{
    //echo 'Make Complain...';
    $compType = $_POST['compType'];
    $compTitle = $_POST['compTitle'];
    $compDesc = $_POST['compDesc'];
<?php

include "dbquery.php";
if (isset($_POST['editid'], $_POST['editname']) && isset($_POST['editdob']) && isset($_POST['editlast_qual']) && isset($_POST['editpercent']) && isset($_POST['editdegree']) && isset($_POST['editdept']) && isset($_POST['edityop']) && isset($_POST['editemail']) && isset($_POST['editphone']) && isset($_POST['editapproved'])) {
    /*echo $_POST['editid'];
     echo $_POST['editname'];
     echo $_POST['editdob'];
     echo $_POST['editlast_qual'];
    echo $_POST['editpercent'];
    echo $_POST['editdegree'];
    echo $_POST['editdept'];
    echo $_POST['edityop'];
    echo $_POST['editemail'];
    echo $_POST['editphone'];
    echo $_POST['editapproved'];*/
    $res = editStudent($_POST['editid'], $_POST['editname'], $_POST['editdob'], $_POST['editlast_qual'], $_POST['editpercent'], $_POST['editdegree'], $_POST['editdept'], $_POST['edityop'], $_POST['editemail'], $_POST['editphone'], $_POST['editapproved']);
    if ($res) {
        echo "<script>window.location.href='studentManage.php';</script>";
    } else {
        echo "<script>alert('edit not successful');</script>";
    }
}