function updateVillage_history($sessionkey, $appcode, $Village_historydata)
{
    $main_result = "<VPROFILERESULT>";
    $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>";
    $userId = ValidateSession($sessionkey, $appcode);
    if ($userId > -1) {
        $main_result = "<AUTHSTATUS>1</AUTHSTATUS>";
        $obj_Village_history = new Village_history();
        foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) {
            switch ($key) {
                case "TBLID":
                    $obj_Village_history->TblId = $child;
                    break;
                case "VILLAGEID":
                    $obj_Village_history->VillageId = $child;
                    break;
                case "DESCRIPTIONTYPE":
                    $obj_Village_history->DescriptionType = $child;
                    break;
                case "DESCRIPTION":
                    $obj_Village_history->Description = $child;
                    break;
            }
        }
        $obj_retResult_Village_history = DAL_manageVillage_history::updateVillage_history($obj_Village_history);
        if ($obj_retResult_Village_history->type == 1) {
            $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>";
            $main_result .= getVillage_historyXml($obj_retResult_Village_history->data);
        } else {
            $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>";
        }
    }
    $main_result .= "</VPROFILERESULT>";
    return $main_result;
}
 public static function addVillage_history($obj_Village_history)
 {
     $db = config::dbconfig();
     $obj_retresult = new returnResult();
     $obj_Village_history->TblId = DAL_manageVillage_history::getLastVillage_historyId() + 1;
     $sql = "INSERT INTO tbl_village_history (TblId,VillageId,DescriptionType,Description) \n\t\tVALUES (" . common::noSqlInject($obj_Village_history->TblId) . "," . common::noSqlInject($obj_Village_history->VillageId) . "," . "'" . common::noSqlInject($obj_Village_history->DescriptionType) . "'" . "," . "'" . common::noSqlInject($obj_Village_history->Description) . "'" . ");";
     $rs = mysql_query($sql);
     if (mysql_affected_rows() > 0) {
         $obj_retresult->type = 1;
         $obj_retresult->msg = "success";
         $obj_retresult->data = $obj_Village_history;
     } else {
         $obj_retresult->type = 0;
         $obj_retresult->msg = "failed";
     }
     return $obj_retresult;
 }
 public static function isChildVillage_history($TblId, $ChildTblId)
 {
     $ischild = false;
     $obj_retResult = DAL_manageVillage_history::getVillage_historyListByTblId($ChildTblId);
     //get child node
     if ($obj_retResult->type == 1) {
         $arr_Village_historyList = $obj_retResult->data;
         $obj_Village_history = $arr_Village_historyList[0];
         $arrParentIds = explode(",", $obj_Village_history->Url);
         foreach ($arrParentIds as $Village_historyParentId) {
             if ($Village_historyParentId == $TblId) {
                 $ischild = true;
             }
         }
     }
     return $ischild;
 }