Current File : /home/inlingua/public_html/noida/icentex/level_1.main.php |
<?php
session_start();
ob_start();
// Copyright, Panalink Infotech Limited. Created on: 30-06-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 = "level_1";
$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();
function checkstudent($conn,$id)
{
$sqlQuery = "SELECT recNo FROM level_1 where student_recNo='".$id."' ";
//echo $sqlQuery;
$result=mysqli_query($conn,$sqlQuery);
if(mysqli_num_rows($result)) $return =false;
else $return =true;
return $return;
}
$currentMode = "";
$formPrompt = "";
$succFailMesg = "";
$showResult = "N";
$action = $_REQUEST['aC'];
if (($action == "") || ($action == "sA"))
{ // Set 'Add' mode in dataform
$currentMode = "Save All"; $succFailMesg = "<b>Add details</b> <br>";
$level=$_REQUEST['level'];
$cerification="This is to certify that {STUDENT_NAME} completed the GPP".$level." course on the above dates and can communicate effectively in English at this level. General comments are shown below.";
//$dbObject->setDbField("cerification_comment",$cerification);
/*$listening="{STUDENT_NAME} is able to understand the spoken word and can respond in an appropriate manner.
He can use the structures of this level correctly and can make good sentences.
";
$dbObject->setDbField("listening_skill",$listening);*/
/*$generalcomment="{STUDENT_NAME} is quite interactive and takes part in all class room activities enthusiastically. But he needs to work hard to improve his pronunciation skills .He should try reading simple books and watch English programmes to increase his vocabulary base.
His easy going and good-natured attitude made it a pleasure teaching him. I wish him all the best for his future efforts!
";
$dbObject->setDbField("general_comment",$generalcomment);*/
}
else if ($action == "Save All")
{ $currentMode = "Save All";
// 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
{
//print_r($_REQUEST);
//$today = date("Y-m-d");
$i=0;
$k=0;
$t=gettype($_REQUEST['language']);
if($t=="array")
{
foreach($_REQUEST['language'] as $val)
{
$level=$_REQUEST['level'];
$recNo=$_REQUEST['recNo'];
$language=$val;
$courseId=$_REQUEST['courseId'][$i];
$student_recNo=$_REQUEST['student_ids'][$i];
$level=$_REQUEST['level'][$i];
$startDate=$_REQUEST['startDate'][$i];
$endDate=$_REQUEST['endDate'][$i];
$name_student=$_REQUEST['name_student'][$i];
$cerification_comment="This is to certify that {STUDENT_NAME} completed the GPP".$level." course on the above dates and can communicate effectively in English at this level. General comments are shown below.";
$cerification_comment=str_replace('{STUDENT_NAME}',"<strong>".ucfirst($name_student)."</strong>",$cerification_comment);
$listening_skill=$_REQUEST['listening_skill'][$i];
//$listening_skill=str_replace('{STUDENT_NAME}',strtoupper($name_student),$listening_skill);
$general_comment=$_REQUEST['general_comment'][$i];
//$general_comment=str_replace('{STUDENT_NAME}',strtoupper($name_student),$general_comment);
$overall_grade=$_REQUEST['overall_grade'][$i];
$eligibility=$_REQUEST['eligibility_'.$i];
$othereligibility=$_REQUEST['othereligibility'][$i];
$createdBy=$_REQUEST['createdBy'];
$createDate=$_REQUEST['createDate'];
$dbObject->setDbField("recNo",$recNo);
$dbObject->setDbField("language",$language);
$dbObject->setDbField("courseId",$courseId);
$dbObject->setDbField("level",$level);
$dbObject->setDbField("startDate",$startDate);
$dbObject->setDbField("endDate",$endDate);
$dbObject->setDbField("name_student",$name_student);
$dbObject->setDbField("cerification_comment",$cerification_comment);
$dbObject->setDbField("listening_skill",$listening_skill);
$dbObject->setDbField("general_comment",$general_comment);
$dbObject->setDbField("overall_grade",$overall_grade);
$dbObject->setDbField("eligibility",$eligibility);
$dbObject->setDbField("othereligibility",$othereligibility);
$dbObject->setDbField("createdBy",$createdBy);
$dbObject->setDbField("createDate",$createDate);
$dbObject->setDbField("student_recNo",$student_recNo);
$i++;
if($name_student!="")
{
$dbObject->Save();
$k++;
}
}
$_SESSION['courseId']=$courseId;
if($k==0)
{
$_REQUEST['student_no']=$i;
$level=$_REQUEST['level'][0];
//$cerification="This is to certify that {STUDENT_NAME} successfully completed the GPP".$level." course on the above dates and can communicate effectively in English at this level. General comments are shown below.";
//$dbObject->setDbField("cerification_comment",$cerification);
//$listening="{STUDENT_NAME} is able to understand the spoken word and can respond in an appropriate manner.He can use the structures of this level correctly and can make good sentences.";
//$dbObject->setDbField("listening_skill",$listening);
//$generalcomment="{STUDENT_NAME} is quite interactive and takes part in all class room activities enthusiastically. But he needs to work hard to improve his pronunciation skills .He should try reading simple books and watch English programmes to increase his vocabulary base.His easy going and good-natured attitude made it a pleasure teaching him. I wish him all the best for his future efforts!";
//$dbObject->setDbField("general_comment",$generalcomment);
$succFailMesg = "<b><font color='pink'><blink>Please Enter At Least One Record.</b></blink></font><br>";
$showResult = "N"; // Show dataentry form again
}
}
else
{
$_SESSION[courseId]=$_REQUEST['cId'];
$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
$Query = "SELECT a.*,s.studentName FROM ".$tableName." a left join ingl_student
s on s.recNo =a.student_recNo where a.recNo='".$_REQUEST[kV]."'";
if ($dbObject->Retrieve_join($Query))
{
//$_REQUEST['student_no']=1;
; }
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
$_SESSION['courseId']=$_REQUEST['courseId'];
$listening_skill=$_REQUEST['listening_skill'];
$dbObject->setDbField("listening_skill",$listening_skill);
$general_comment=$_REQUEST['general_comment'];
$dbObject->setDbField("general_comment",$general_comment);
$overall_grade=addslashes($_REQUEST['overall_grade']);
$dbObject->setDbField("overall_grade",$overall_grade);
$eligibility=addslashes($_REQUEST['eligibility_1']);
$dbObject->setDbField("eligibility",$eligibility);
$othereligibility=$_REQUEST['othereligibility'];
$dbObject->setDbField("othereligibility",$othereligibility);
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
$Query = "SELECT a.*,s.studentName FROM ".$tableName." a left join ingl_student
s on s.recNo =a.student_recNo where a.recNo='".$_REQUEST[kV]."'";
if ($dbObject->Retrieve_join($Query))
{ ; }
else { $succFailMesg = "<b>Could not retrieve details. Contact system administrator</b><br>"; }
}
else if ($action == "Delete")
{ $showResult = "D"; // 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> [<a href='javascript:history.back()'>Back</a>]<br>";
$dataForm = $viewForm;
// Retrieve record first
$Query = "SELECT a.*,s.studentName FROM ".$tableName." a left join ingl_student
s on s.recNo =a.student_recNo where a.recNo='".$_REQUEST['kV']."'";
if ($dbObject->Retrieve_join($Query))
{ ; }
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;
?>