Current File : /home/inlingua/www/dwarka/icentex/level_language.main.php
<?php
session_start();
ob_start();
// Copyright, Panalink Infotech Limited. Created on: 09-07-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_2";
$tableConf = $tableName . ".conf.php";
$dataForm = "level_language.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_2 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>&nbsp;&nbsp;&nbsp;&nbsp;<br>";
	
	$level=$_REQUEST[level];
	
	/*$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 grades are shown below.";

//$dbObject->setDbField("cerification_comment",$cerification);

$generalcomment="{STUDENT_NAME} has become quite confident in interacting in the target language since the beginning of the course.He is able to use the structures of this level and likes to experiment with them.

Singing the lyrics of songs would help to add a musical quality to his articulations while thinking in English would help him to become more at ease in his communications as it would encourage a continuous flow of words.
 
{STUDENT_NAME} wholehearted participation in the learning process and persevering attitude made it a pleasure to teach him and I wish him all the best for his future endeavors!

";
	$dbObject->setDbField("general_comment",$generalcomment);*/
}
else if ($action == "Save All")
{	$currentMode = "Save All"; 
    $SinglecurrentMode="Save";

	// 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");
		$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 grades are shown below.";
	$cerification_comment=str_replace('{STUDENT_NAME}',"<strong>".ucfirst($name_student)."</strong>",$cerification_comment);
	$clarityandquality=$_REQUEST[clarityandquality][$i];
	$fluency=$_REQUEST[fluency][$i];
	$accuracyenglish=$_REQUEST[accuracyenglish][$i];
	$knowledge=$_REQUEST[knowledge][$i];
	$abilityunder=$_REQUEST[abilityunder][$i];
	$listening=$_REQUEST[listening][$i];
	$general_comment=$_REQUEST[general_comment][$i];
	$general_comment=str_replace('{STUDENT_NAME}',"<strong>".ucfirst($name_student)."</strong>",$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("clarityandquality",$clarityandquality);
	$dbObject->setDbField("fluency",$fluency);
	$dbObject->setDbField("accuracyenglish",$accuracyenglish);
	$dbObject->setDbField("knowledge",$knowledge);
	$dbObject->setDbField("abilityunder",$abilityunder);
	$dbObject->setDbField("listening",$listening);
	$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 grades are shown below.";

$dbObject->setDbField("cerification_comment",$cerification);

$generalcomment="{STUDENT_NAME} has become quite confident in interacting in the target language since the beginning of the course.He is able to use the structures of this level and likes to experiment with them.

Singing the lyrics of songs would help to add a musical quality to his articulations while thinking in English would help him to become more at ease in his communications as it would encourage a continuous flow of words.
 
{STUDENT_NAME} wholehearted participation in the learning process and persevering attitude made it a pleasure to teach him and I wish him all the best for his future endeavors!

";
	$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>&nbsp;&nbsp;&nbsp;&nbsp;[<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 == "Update")
{	$currentMode = "Update"; 
	$showResult = "Y"; // Goto result part in dataform
	$_SESSION[courseId]=$_REQUEST[courseId];
	$name_student=$_REQUEST[name_student];
	$dbObject->setDbField("name_student",$name_student);
	
	//$general_comment=addslashes($_REQUEST[general_comment]);
	$general_comment=$_REQUEST[general_comment];
	$dbObject->setDbField("general_comment",$general_comment);
	
	$eligibility=$_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>&nbsp;&nbsp;&nbsp;&nbsp;[<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>&nbsp;&nbsp;&nbsp;&nbsp;[<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;


?>