<?php

include_once $CFG->dirroot . "/lib/classes/" . "application/Directory.Class.php5";
$directoryObj = new Directory1();
$dCreated = date('Y-m-d H:i:s');
$GeneralObj->getRequestVars();
$directoryObj->setAllVar();
if ($_SESSION["sess_eType"] == "3") {
    $iCompanyId = $_SESSION['sess_iCompanyId'];
    $qs = '&iSGroupId=' . $iSGroupId;
} else {
    if ($_SESSION['sess_eType'] == 'Group Admin') {
        $iCompanyId = $_SESSION['sess_iCompanyId'];
        $iSGroupId = $_SESSION['sess_iSGroupId'];
        $qs = '';
    } else {
        $qs = '&iCompanyId=' . $iCompanyId . '&iSGroupId=' . $iSGroupId;
    }
}
$redirect_file = "index.php?file=m-directoryadd" . $qs;
$GeneralObj->checkDuplicate('iDirectoryId', 'Directory', array('iSGroupId', 'vEmpId'), $redirect_file, "Employee Id Already Exists", $iDirectoryId, " AND");
$GeneralObj->checkDuplicate('iDirectoryId', 'Directory', array('vEmail'), $redirect_file, "Email Already Exists", $iDirectoryId);
if ($mode == "Add") {
    # echo "<pre>";  print_r($_FILES) ; exit;
    //$redirect_file="index.php?file=m-directoryadd&mode=$mode&iDirectoryId=$iDirectoryId";
    //   $GeneralObj->checkDuplicate('iUserId', 'User', Array('vUsername'),$redirect_file, "Username is Already Exists ", $vUsername);
    // $userObj->setdCreated($dCreated);
    $directoryObj->setiSGroupId($iSGroupId);
    $directoryObj->insert();
    $msg = MSG_ADD;
    $url = 'index.php?file=Directory&AX=Yes' . $qs . '&var_msg=' . $msg;
<?php

include_once $CFG->dirroot . "/lib/classes/" . "application/Directory.Class.php5";
$directoryObj = new Directory1();
$GeneralObj->getRequestVars();
$section = 'Directory';
$mode = $_REQUEST['mode'];
if ($mode == "Update") {
    $directoryObj->select($iDirectoryId);
    $directoryObj->getAllVar();
} else {
    $mode = "Add";
}
if ($file != '') {
    $link = "index.php?file=" . $file . "&mode=" . $mode . "&listfile=" . $listfile;
}
$TOP_HEADER = $mode . ' ' . $section;
if ($mode == 'Update') {
    $TOP_HEADER .= ' [' . $vFirstname . ' ' . $vLastname . ']';
}
?>
<form name="frmadd" method="post" enctype="multipart/form-data" action="index.php?file=m-directoryadd_a">
	<input type="hidden" id="mode" name="mode" value="<?php 
echo $mode;
?>
">
	<input type="hidden" id="SAMPM" name="SAMPM" value="<?php 
echo $SAMPM;
?>
">
	<input type="hidden" id="EAMPM" name="EAMPM" value="<?php