if ((isset($_COOKIE["user"])) or (isset($_COOKIE["bengali"])) or (isset($_COOKIE["malayalam"])) )
{
@ob_start();
@session_start();
include '../include/connect.php';
include '../include/Form.php';
include '../include/display.php';
include '../include/common.php';
display_top();
display_cms_menu();
//!This was a Language Tag. This is no longer used now. It is Blank.
$LangTag="";
//$LangTag=$_SESSION['ltag'];
//!This is the different class representation for different languages.
/*!
for more details about $lang_arr, click here.
*/
$cls = $lang_arr[$_SESSION['ltag']];
//!Used for Database storage of some of the Kannada Baraha Codes.
/*!
Description
:
In some cases, the Baraha Codes when entered into a database, is not stored properly, and hence, not retrieved properly as well. Hence, they are substituted by English phrases and stored in the database, and likewise also retrieved. This is used for that purpose.
Author
:
Vijay Srinivas
Email
:
vijay.srini@frlht.org
*/
$SubstitutionArray['kan_']=array();
//!Used for Database storage of some of the Bengali Baraha Codes.
/*!
Description
:
In some cases, the Baraha Codes when entered into a database, is not stored properly, and hence, not retrieved properly as well. Hence, they are substituted by English phrases and stored in the database, and likewise also retrieved. This is used for that purpose.
Author
:
Vijay Srinivas
Email
:
vijay.srini@frlht.org
*/
$SubstitutionArray['ben_']=array("[tr]"=>"Œ", "[tt]"=>"Š", "[~jj]"=>"…²", "[nD]"=>"—", "[pt]"=>"›", "[ddh]"=>"Ž", "[ndh]"=>"™", "[Thy]"=>"œ", "[~jc]"=>"ƒ");
//!Used for Database storage of some of the Marathi Baraha Codes.
/*!
Description
:
In some cases, the Baraha Codes when entered into a database, is not stored properly, and hence, not retrieved properly as well. Hence, they are substituted by English phrases and stored in the database, and likewise also retrieved. This is used for that purpose.
Author
:
Vijay Srinivas
Email
:
vijay.srini@frlht.org
*/
$SubstitutionArray['mar_']=array("[Dya]"=>"Ž");
//!Used for Database storage of some of the Hindi Baraha Codes.
/*!
Description
:
In some cases, the Baraha Codes when entered into a database, is not stored properly, and hence, not retrieved properly as well. Hence, they are substituted by English phrases and stored in the database, and likewise also retrieved. This is used for that purpose.
Author
:
Vijay Srinivas
Email
:
vijay.srini@frlht.org
*/
$SubstitutionArray['hin_']=array("[kk]"=>"‚ü", "[~gG]"=>"†¡û", "[~g~g]"=>"ˆû", "[cc]"=>"Š", "[~gm]"=>"‰", "[~gk]"=>"ƒ¡û", "[~gK]"=>"„¡û", "[~gg]"=>"…¡û", "[Ty]"=>"š", "[ThTh]"=>"›û", "[Thy]"=>"œ", "[DG]"=>"†û", "[Dk]"=>"ƒû", "[DK]"=>"„û", "[Dg]"=>"…û", "[DD]"=>"Œû", "[Dy]"=>"Ž", "[Dhy]"=>"ž");
//!Used for Database storage of some of the Tamil Baraha Codes.
/*!
Description
:
In some cases, the Baraha Codes when entered into a database, is not stored properly, and hence, not retrieved properly as well. Hence, they are substituted by English phrases and stored in the database, and likewise also retrieved. This is used for that purpose.
Author
:
Vijay Srinivas
Email
:
vijay.srini@frlht.org
*/
$SubstitutionArray['tam_']=array("[j]"=>"ˆ", "[ja]"=>"ƒ", "[~ju]"=>"š", "[~jU]"=>"œ", "[Sh]"=>"‰", "[Sha]"=>"„", "[S]"=>"Š", "[Sa]"=>"…", "[h]"=>"‹", "[ha]"=>"†", "[kSh]"=>"Œ", "[kSha]"=>"‡");
$SubstitutionArray['tel_']=array();
$SubstitutionArray['mal_']=array();
//!It is the Vernacular ID String.
/*!
Later on, this could be used to generate a valid 6-digit ID
*/
$nid=$LangTag."ver_id";
//print_r($_GET);
?>
print"
";
print"
Add / Edit ver_names
";
//!The Current Record Date
$rec_date=date("Y-m-d H:i:s");
if($_POST['submit']=='Add')
{ /*array_search -- Searches the array for a given value and returns the corresponding key if successful
Description -- mixed array_search ( mixed needle, array haystack [, bool strict])
Searches haystack for needle and returns the key if it is found in the array, FALSE otherwise.
*/
// GET LANGUAGE TAG FROM THE ARRAY 'lang_tag'
//$l_tag = array_search($_POST['lang_name'],$lang_tag);
$LL=$LangTag."lang_tag";
$l_tag = array_search($_POST['lang_name'],$$LL);
$nid=generate_valid_id(get_next_id('ver_id', 'ver_names'),6);
if($_SESSION['ltag']=='kan_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='tam_' || $_SESSION['ltag']=='mal_')
{
$SubVernName=$_POST['Vern_name'];
foreach($SubstitutionArray[$_SESSION['ltag']] as $skey=>$sval)
{
$SubVernName=str_replace($sval, $skey, $SubVernName);
}
$insqry="INSERT INTO ".$LangTag."ver_names (".$LangTag."ver_id,plant_id, lang_name, Lang_tag, NAME, VERN_NAME, BOOK_ID,EntryTime) VALUES('$nid', '".$_POST['plant_id']."', '".addslashes($_POST['lang_name'])."', '$l_tag', '".addslashes($_POST['NAME'])."', '".utf8_decode($SubVernName)."', '".addslashes($_POST['BOOK_ID'])."', '".format_date_db($rec_date)."')";
}
else
{
$XName=addslashes($_POST['NAME']);
$XVName=$_POST['Vern_name'];
$insqry="INSERT INTO ".$LangTag."ver_names (".$LangTag."ver_id,plant_id, lang_name, Lang_tag, NAME, VERN_NAME, BOOK_ID,EntryTime) VALUES('$nid', '".$_POST['plant_id']."', '".addslashes($_POST['lang_name'])."', '$l_tag', '".$XName."', '".$XVName."', '".addslashes($_POST['BOOK_ID'])."', '".format_date_db($rec_date)."')";
}
}
if($_POST['submit']=='Update')
{ /*array_search -- Searches the array for a given value and returns the corresponding key if successful
Description -- mixed array_search ( mixed needle, array haystack [, bool strict])
Searches haystack for needle and returns the key if it is found in the array, FALSE otherwise.
*/
// GET LANGUAGE TAG FROM THE ARRAY 'lang_tag'
$LL=$LangTag."lang_tag";
$l_tag = array_search($_POST['lang_name'],$$LL);
//$l_tag = array_search($_POST['lang_name'],$lang_tag);
if($_SESSION['ltag']=='kan_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='tam_' || $_SESSION['ltag']=='mal_')
{
$SubVernName=$_POST['Vern_name'];
foreach($SubstitutionArray[$_SESSION['ltag']] as $skey=>$sval)
{
$SubVernName=str_replace($sval, $skey, $SubVernName);
}
$insqry="UPDATE ".$LangTag."ver_names SET lang_name='".addslashes($_POST['lang_name'])."',Lang_tag='$l_tag',NAME='".addslashes($_POST['NAME'])."',VERN_NAME='".utf8_decode($SubVernName)."', BOOK_ID='".addslashes($_POST['BOOK_ID'])."',EntryTime='".format_date_db($rec_date)."' WHERE ".$LangTag."ver_id='".$_POST['id']."'";
}
else
{
$XName=addslashes($_POST['NAME']);
$XVName=$_POST['Vern_name'];
$insqry="UPDATE ".$LangTag."ver_names SET lang_name='".addslashes($_POST['lang_name'])."',Lang_tag='$l_tag',NAME='".$XName."',VERN_NAME='".$XVName."', BOOK_ID='".addslashes($_POST['BOOK_ID'])."',EntryTime='".format_date_db($rec_date)."' WHERE ".$LangTag."ver_id='".$_POST['id']."'";
}
}
if($insqry!='')
{
//print_r($_POST);
//print " ".$insqry;
//exit;
$result=mysql_query($insqry) or die(mysql_error());
header('location:show_ver_names.php');
}
//!Initialization of Form Prototype.
/*!
for more details about Html_form method, click here.
*/
$curform=new Html_form('Addedit_'.'ver_names'.'.php','post','form1','','','chk_all','');
$curform->start();
if($_GET['id']!="")
{
$result=mysql_query("select * from ".$LangTag."ver_names where ".$LangTag."ver_id='".$_GET['id']."'");
$row=mysql_fetch_array($result);
$curform->displayhidden("id",$_GET['id']);
}
//PLANTS DROP DOWN
//changed on 12 dec 06 to remove stand='Y'
//$plants=get_list_data("'".$LangTag."botmast'",'plant_id',array('genus','species'),'',"SELECT * FROM ".$LangTag."botmast WHERE stand='Y' ORDER BY genus");
//!A List of plants
/*!
in genus species format for more details about get_list_data, click here.
*/
$plants=get_list_data("'".$_SESSION['ltag']."botmast'",'plant_id',array('genus','species'),'',"SELECT * FROM ".$_SESSION['ltag']."botmast ORDER BY genus");
if(!$_SESSION['ltag']) {
$curform->displayselectrow('plant_id','Plant',$plants,$row[plant_id],'','','--- SELECT ---','','',$cls);
// LANGUAGE DROPDOWN
$l = $LangTag."langs";
$curform->displayselectrow('lang_name','Language',$langs,$row[lang_name],'','','--- SELECT ---','','','');
$curform->displaytextrow('NAME','Vern Name',$row[NAME],35,100,1,'','',$cls);
}
else{
if($_SESSION['ltag']=='kan_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='tam_' || $_SESSION['ltag']=='mal_')
{
$SubPlant=utf8_encode($plants[$row[plant_id]]);
foreach($SubstitutionArray[$_SESSION['ltag']] as $skey=>$sval)
{
$SubPlant=str_replace($skey, $sval, $SubPlant);
}
$curform->displaytextrow('plant_id','Plant',$SubPlant,35,100,1,'','',"$cls");
}
else
{
$Plant=$plants[$row[plant_id]];
$curform->displaytextrow('plant_id','Plant',$Plant,35,100,1,'','',"$cls");
}
$l=$LangTag."langs";
$curform->displaytextrow('lang_name','Language',$row[lang_name],35,100,1,'','',"");
$curform->displaytextrow('NAME','Transliterated Vernacular Name',$row[NAME],35,100,1,'','',"");
if($_SESSION['ltag']=='kan_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='tam_' || $_SESSION['ltag']=='mal_')
{
$SubVernName=utf8_encode($row[VERN_NAME]);
foreach($SubstitutionArray[$_SESSION['ltag']] as $skey=>$sval)
{
$SubVernName=str_replace($skey, $sval, $SubVernName);
}
$curform->displaytextrow('Vern_name','Vernacular Name',$SubVernName,35,100,1,'','',"$cls");
}
else
{
$VernName=$row[VERN_NAME];
$curform->displaytextrow('Vern_name','Vernacular Name',$VernName,35,100,1,'','',"$cls");
}
}
//$curform->displaytextrow('BOOK_ID','BOOK_ID',$row->BOOK_ID,35,100,1);
//$curform->displaytextrow('EntryTime','EntryTime',$row->EntryTime,35,100,1);
if($_GET['id']=="")
{
$curform->displayhidden("submit","Add");
$curform->displaysubmitrow("submit1","Add");
}
else
{
$curform->displayhidden("submit","Update");
$curform->displaysubmitrow("submit1","Update");
}
$curform->end();
print"