function updateVillage_plant($sessionkey, $appcode, $Village_plantdata) { $main_result = "<VPROFILERESULT>"; $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>"; $userId = ValidateSession($sessionkey, $appcode); if ($userId > -1) { $main_result = "<AUTHSTATUS>1</AUTHSTATUS>"; $obj_Village_plant = new Village_plant(); foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) { switch ($key) { case "PLANTID": $obj_Village_plant->PlantId = $child; break; case "VILLAGEID": $obj_Village_plant->VillageId = $child; break; } } $obj_retResult_Village_plant = DAL_manageVillage_plant::updateVillage_plant($obj_Village_plant); if ($obj_retResult_Village_plant->type == 1) { $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>"; $main_result .= getVillage_plantXml($obj_retResult_Village_plant->data); } else { $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>"; } } $main_result .= "</VPROFILERESULT>"; return $main_result; }
public static function addVillage_plant($obj_Village_plant) { $db = config::dbconfig(); $obj_retresult = new returnResult(); $obj_Village_plant->VillageId = DAL_manageVillage_plant::getLastVillage_plantId() + 1; $sql = "INSERT INTO tbl_village_plant (PlantId,VillageId) \n\t\tVALUES (" . common::noSqlInject($obj_Village_plant->PlantId) . "," . common::noSqlInject($obj_Village_plant->VillageId) . ");"; $rs = mysql_query($sql); if (mysql_affected_rows() > 0) { $obj_retresult->type = 1; $obj_retresult->msg = "success"; $obj_retresult->data = $obj_Village_plant; } else { $obj_retresult->type = 0; $obj_retresult->msg = "failed"; } return $obj_retresult; }
public static function isChildVillage_plant($VillageId, $ChildVillageId) { $ischild = false; $obj_retResult = DAL_manageVillage_plant::getVillage_plantListByVillageId($ChildVillageId); //get child node if ($obj_retResult->type == 1) { $arr_Village_plantList = $obj_retResult->data; $obj_Village_plant = $arr_Village_plantList[0]; $arrParentIds = explode(",", $obj_Village_plant->Url); foreach ($arrParentIds as $Village_plantParentId) { if ($Village_plantParentId == $VillageId) { $ischild = true; } } } return $ischild; }