Current File : /home/inlingua/public_html/noida/icentex/admin_fdingl_course.main.php |
<?php
// Copyright, Panalink Infotech Limited. Created on: 27-11-2010
// Include the database connection details
require('dbConnection.php');
// Include common functions
require('commonFunc.php');
// Include common functions
require('globalVars.php');
// Setup table name, configuration and data entry form
$tableName = "ingl_course";
$tableConf = $tableName . ".conf.php";
$dataForm = $tableName . ".form.php";
$viewForm = $tableName . ".view.php";
// Include table configuration details
require($tableConf);
// Include the table handler class
require('dbHandler.class.php');
$dbObject = new dbHandler();
$dbObject->setTableName($tableName);
$dbObject->setDbFieldList($dbFieldList);
$dbObject->setKeyFieldName("recNo");
$dbObject->connect();
// Retrieve parameters from request
$dbObject->getDbFieldsFromRequest();
$currentMode = "";
$formPrompt = "";
$succFailMesg = "";
$showResult = "N";
$action = $_REQUEST['aC'];
if (($action == "") || ($action == "sA"))
{ // Set 'Add' mode in dataform
$currentMode = "Add"; $succFailMesg = "<b>Add details</b> [<a href='javascript:history.back()'>Back</a>]<br>";
}
else if ($action == "Add")
{ $currentMode = "Add";
// Perform check for duplicate entry
if($dbObject->Exists("recNo", $_REQUEST["recNo"]))
{ $succFailMesg = "<b>Could not add details, record with this key exists.</b><br>";
$showResult = "N"; // Show dataentry form again
}
else
{ //$today = date("Y-m-d");
$dbObject->Save();
$succFailMesg = "<b>Details added successfully</b><br>";
$showResult = "Y"; // Goto result part in dataform
}
}
else if ($action == "sM")
{ // Set 'Update' mode in dataform
$currentMode = "Update"; $succFailMesg = "<b>Modify details</b> [<a href='javascript:history.back()'>Back</a>]<br>";
// Retrieve record first
if ($dbObject->Retrieve("recNo",$_REQUEST["kV"]))
{ ; }
else { $succFailMesg = "<b>Could not retrieve details. Contact system administrator</b><br>"; }
}
else if ($action == "Update")
{ $currentMode = "Update";
$showResult = "Y"; // Goto result part in dataform
if ($dbObject->Update("recNo",$_REQUEST["kV"]))
{ $succFailMesg = "<b>Details modified successfully</b><br>"; }
else
{ $succFailMesg = "<b>Could not modify details. Contact system administrator</b><br>" ; }
}
else if ($action == "sD")
{ $currentMode = "Delete"; $succFailMesg = "<b>Delete details</b> [<a href='javascript:history.back()'>Back</a>]<br>";
// Retrieve record first
if ($dbObject->Retrieve("recNo",$_REQUEST["kV"]))
{ ; }
else { $succFailMesg = "<b>Could not retrieve details. Contact system administrator</b><br>"; }
}
else if ($action == "Delete")
{ $showResult = "Y"; // Goto result part in dataform
if ($dbObject->Delete("recNo",$_REQUEST["kV"]))
{ $succFailMesg = "<b>Details deleted successfully</b><br>"; }
else
{ $succFailMesg = "<b>Could not delete details. Contact System administrator</b><br>" ; }
}
else if ($action == "sV")
{ // Set 'View' mode
$currentMode = "View"; $succFailMesg = "<b>View details</b><br>";
$dataForm = $viewForm;
// Retrieve record first
if ($dbObject->Retrieve("recNo",$_REQUEST["kV"]))
{ ; }
else { $succFailMesg = "<b>Could not retrieve details. Contact system administrator</b><br>"; }
}
else
{ echo "Nothing to do !";
return;
}
// Load the data entry or view entry form
require($dataForm);
$dbObject->CloseConnection();
return;
?>