function updateVillage_image($sessionkey, $appcode, $Village_imagedata)
{
    $main_result = "<VPROFILERESULT>";
    $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>";
    $userId = ValidateSession($sessionkey, $appcode);
    if ($userId > -1) {
        $main_result = "<AUTHSTATUS>1</AUTHSTATUS>";
        $obj_Village_image = new Village_image();
        foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) {
            switch ($key) {
                case "PICTUREID":
                    $obj_Village_image->PictureId = $child;
                    break;
                case "VILLAGEID":
                    $obj_Village_image->VillageId = $child;
                    break;
                case "PICTUREPATH":
                    $obj_Village_image->PicturePath = $child;
                    break;
                case "DESCRIPTION":
                    $obj_Village_image->Description = $child;
                    break;
            }
        }
        $obj_retResult_Village_image = DAL_manageVillage_image::updateVillage_image($obj_Village_image);
        if ($obj_retResult_Village_image->type == 1) {
            $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>";
            $main_result .= getVillage_imageXml($obj_retResult_Village_image->data);
        } else {
            $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>";
        }
    }
    $main_result .= "</VPROFILERESULT>";
    return $main_result;
}
 public static function addVillage_image($obj_Village_image)
 {
     $db = config::dbconfig();
     $obj_retresult = new returnResult();
     $obj_Village_image->PictureId = DAL_manageVillage_image::getLastVillage_imageId() + 1;
     $sql = "INSERT INTO tbl_village_image (PictureId,VillageId,PicturePath,Description) \n\t\tVALUES (" . common::noSqlInject($obj_Village_image->PictureId) . "," . common::noSqlInject($obj_Village_image->VillageId) . "," . "'" . common::noSqlInject($obj_Village_image->PicturePath) . "'" . "," . "'" . common::noSqlInject($obj_Village_image->Description) . "'" . ");";
     $rs = mysql_query($sql);
     if (mysql_affected_rows() > 0) {
         $obj_retresult->type = 1;
         $obj_retresult->msg = "success";
         $obj_retresult->data = $obj_Village_image;
     } else {
         $obj_retresult->type = 0;
         $obj_retresult->msg = "failed";
     }
     return $obj_retresult;
 }
 public static function isChildVillage_image($PictureId, $ChildPictureId)
 {
     $ischild = false;
     $obj_retResult = DAL_manageVillage_image::getVillage_imageListByPictureId($ChildPictureId);
     //get child node
     if ($obj_retResult->type == 1) {
         $arr_Village_imageList = $obj_retResult->data;
         $obj_Village_image = $arr_Village_imageList[0];
         $arrParentIds = explode(",", $obj_Village_image->Url);
         foreach ($arrParentIds as $Village_imageParentId) {
             if ($Village_imageParentId == $PictureId) {
                 $ischild = true;
             }
         }
     }
     return $ischild;
 }