for more details about $lang_arr, click here. */ $cls = $lang_arr[$_SESSION['ltag']]; //!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(); ?> "; print""; //!The Current Record Date. $rec_date=date("Y-m-d H:i:s"); //!The Tab key field with a suffix of the language tag. /*!E.g kan_ for Kannada, hin_ for Hindi etc.*/ $nid = $_SESSION['ltag']."tab_key"; //!The Recipe Id field with a suffix of the language tag. /*!E.g kan_ for Kannada, hin_ for Hindi etc.*/ $recid = $_SESSION['ltag']."rec_id"; /*if($_POST['submit']=='Add') { $nid=generate_valid_id(get_next_id($nid),6); $insqry="INSERT INTO ".$_SESSION['ltag']."tab_key.rec_plant (".$_SESSION['ltag']."tab_key,".$_SESSION['ltag']."rec_id, plant_id, plant_part) VALUES('$nid','".$_POST[$recid]."','".addslashes($_POST['plant_id'])."','".addslashes($_POST['plant_part'])."')"; print $insqry; exit; }*/ if($_POST['submit']=='Add') { if($_SESSION['ltag']=="") { //refresh_ids('tab_key', 'rec_plant'); $nid=generate_valid_id(get_next_id($nid, 'rec_plant'),6); $insqry="INSERT INTO rec_plant (tab_key, rec_id, plant_id, ".$_SESSION['ltag']."plant_part) VALUES('$nid','".$_POST['rec_id']."','".addslashes($_POST['plant_id'])."', '".addslashes($_POST['plant_part'])."')"; }else //For Other Languages { $qFindOut="SELECT * FROM rec_plant WHERE rec_id='".$_POST['rec_id']."' AND plant_id='".$_POST['plant_id']."'"; if(mysql_num_rows(mysql_query($qFindOut))==0) { }else { if($_SESSION['ltag']=='kan_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='tam_' || $_SESSION['ltag']=='mal_') { $SubPlantPart=$_POST[$_SESSION['ltag'].'plant_part']; if($_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tam_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='mal_') { foreach($SubstitutionArray[$_SESSION['ltag']] as $Skey=>$Sval) { $SubPlantPart=str_replace($Sval, $Skey, $SubPlantPart); } } $insqry="UPDATE rec_plant SET ".$_SESSION['ltag']."plant_part='".utf8_decode($SubPlantPart)."' WHERE rec_id='".$_POST['rec_id']."' AND plant_id='".$_POST['plant_id']."'"; print "Part 1"; exit(); } else { $PlantPart=$_POST['plant_part']; $insqry="UPDATE rec_plant SET ".$_SESSION['ltag']."plant_part='".$PlantPart."' WHERE rec_id='".$_POST['rec_id']."' AND plant_id='".$_POST['plant_id']."'"; print "Part 2"; exit(); } } } } if($_POST['submit']=='Update') { if($_SESSION['ltag']) { if($_SESSION['ltag']=='kan_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='tam_' || $_SESSION['ltag']=='mal_') { $SubPlantPart=$_POST[$_SESSION['ltag'].'plant_part']; if($_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tam_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='mal_') { foreach($SubstitutionArray[$_SESSION['ltag']] as $Skey=>$Sval) { $SubPlantPart=str_replace($Sval, $Skey, $SubPlantPart); } } $insqry = "UPDATE rec_plant SET rec_id='".$_POST['rec_id']."', plant_id='".addslashes($_POST['plant_id'])."', ".$_SESSION['ltag']."plant_part='".utf8_decode(addslashes($SubPlantPart))."' WHERE tab_key = '".$_POST['id']."'"; } else { $PlantPart=addslashes($_POST[$_SESSION['ltag'].'plant_part']); $insqry = "UPDATE rec_plant SET rec_id='".$_POST['rec_id']."', plant_id='".addslashes($_POST['plant_id'])."', ".$_SESSION['ltag']."plant_part='".$PlantPart."' WHERE tab_key = '".$_POST['id']."'"; print "Part 4"; exit(); } }else { $PlantPart=addslashes($_POST['plant_part']); $insqry = "UPDATE rec_plant SET rec_id='".$_POST['rec_id']."', plant_id='".addslashes($_POST['plant_id'])."', ".$_SESSION['ltag']."plant_part='".$PlantPart."' WHERE tab_key = '".$_POST['id']."'"; print "Part 5"; exit(); } //print $insqry; } if($insqry!='') { $result=mysql_query($insqry) or die(mysql_error()); header('location:show_rec_plant.php'); } //!Initialization of Form Prototype. /*! for more details about Html_form method, click here. */ $curform=new Html_form('Addedit_'.'rec_plant'.'.php','post','form1','','','chk_all',''); $curform->start(); if($_GET['id']!="") { $result=mysql_query("SELECT * FROM rec_plant WHERE tab_key='".$_GET['id']."'"); $row=mysql_fetch_array($result); $curform->displayhidden("id",$_GET['id']); } //RECIPE DROP DOWN //!Specifies the particular Recipe for a Language. $rtab = $_SESSION['ltag']."recipe"; //!Specifies the particular Recipe ID for a Language. $rtabid = $_SESSION['ltag']."recipe_id"; //!Specifies the particular Ailment for a language. $ailtab= $_SESSION['ltag']."ailments"; //!Specifies the particular Ailment Id for a language. $ailtabid = $_SESSION['ltag']."ail_id"; //!Specifies the English Recipe ID. $rid = "rec_id"; //print $_GET['sh']; if($_GET['sh'] !="") { $sh = fetch_me($rtab,"recipe_name",$rtabid,$_GET['sh']); if($_SESSION['ltag']=='kan_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='tam_') { $sh=utf8_encode($sh); } else { if(strpos($sh, "a:2:{i:0;s:")!==false) { $Arrsh=unserialize($sh); $sh=$Arrsh[1]; } } $curform->displaytextrow('rec_name','Recipe',$sh,35,100,1,'readonly','',$cls); $curform->displayhidden('rec_id',$_GET['sh']); } else { $recipes=get_list_data($rtab,$rtabid,array('recipe_name','ail_name'),'',"SELECT * FROM $rtab INNER JOIN $ailtab ON $rtab.$ailtabid = $ailtab.$ailtabid ORDER BY $ailtab.ail_name,recipe_name"); if($_SESSION['ltag']=='kan_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='tam_') { foreach($recipes as $key=>$Val) { $RevSubVal=utf8_encode($Val); if($_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tam_') { foreach($SubstitutionArray[$_SESSION['ltag']] as $rskey=>$rsval) { $RevSubVal=str_replace($rskey, $rsval, $RevSubVal); } } $recipes[$key]=$RevSubVal; } } else { foreach($recipes as $key=>$Val) { if(strpos($Val, "a:2:{i:0;s:")!==false) { $ArrVal=unserialize($Val); $recipes[$key]=$ArrVal[1]; } } } $curform->displayselectrow('rec_id','Recipe',$recipes,$row[$rid],'','','--- SELECT ---','','',$cls); } //PLANTS DROP DOWN //$plants=get_list_data("'".$_SESSION['ltag']."ver_names'",'plant_id',array('NAME'),'',"SELECT * FROM ".$_SESSION['ltag']."ver_names WHERE lang_name='".$cls."' " ); //query till 12 dec 06 //$plants=get_list_data("'".$_SESSION['ltag']."botmast'",'plant_id',array('genus','species'),'',"SELECT * FROM ".$_SESSION['ltag']."botmast WHERE stand='Y' ORDER BY genus"); $plants=get_list_data("'".$_SESSION['ltag']."botmast'",'plant_id',array('genus','species'),'',"SELECT * FROM ".$_SESSION['ltag']."botmast ORDER BY genus"); if($_SESSION['ltag']=='kan_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='tam_') { foreach($plants as $key=>$Val) { $RevSubVal=utf8_encode($Val); if($_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tam_') { foreach($SubstitutionArray[$_SESSION['ltag']] as $rskey=>$rsval) { $RevSubVal=str_replace($rskey, $rsval, $RevSubVal); } } $plants[$key]=$RevSubVal; } } else { foreach($plants as $key=>$Val) { if(strpos($Val, "a:2:{i:0;s:")!==false) { $ArrVal=unserialize($Val); $plants[$key]=$ArrVal[1]; } } } $curform->displayselectrow('plant_id','Plant',$plants,$row['plant_id'],'','','--- SELECT ---','','',$cls); if($_SESSION['ltag']=='kan_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tel_' || $_SESSION['ltag']=='tam_') { $RevSubPlantPart=utf8_encode($row[$_SESSION['ltag'].'plant_part']); if($_SESSION['ltag']=='mar_' || $_SESSION['ltag']=='hin_' || $_SESSION['ltag']=='ben_' || $_SESSION['ltag']=='tam_') { foreach($SubstitutionArray[$_SESSION['ltag']] as $Skey=>$Sval) { $RevSubPlantPart=str_replace($Skey, $Sval, $RevSubPlantPart); } } $curform->displaytextrow($_SESSION['ltag'].'plant_part','Plant Part',$RevSubPlantPart,35,100,1,'','',$cls); } else { if(strpos($row[$_SESSION['ltag'].'plant_part'], "a:2:{i:0;s:")===false) { $PlantPart=$row[$_SESSION['ltag'].'plant_part']; } else { $ArrPlantPart=unserialize($row[$_SESSION['ltag'].'plant_part']); $PlantPart=$ArrPlantPart[1]; } $curform->displaytextrow($_SESSION['ltag'].'plant_part','Plant Part',$PlantPart,35,100,1,'','',$cls); } if($_GET['id']=="") { $curform->displayhidden("submit","Add"); $curform->displaysubmitrow("submit1","Add"); } else { $curform->displayhidden("submit","Update"); $curform->displaysubmitrow("submit1","Update"); } $curform->end(); print"
Add / Edit recipe plant
"; } else { echo "You are not Authorised to view this page ! ! !"; } ?>