function updateVillage_group($sessionkey, $appcode, $Village_groupdata) { $main_result = "<VPROFILERESULT>"; $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>"; $userId = ValidateSession($sessionkey, $appcode); if ($userId > -1) { $main_result = "<AUTHSTATUS>1</AUTHSTATUS>"; $obj_Village_group = new Village_group(); foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) { switch ($key) { case "GROUPID": $obj_Village_group->GroupId = $child; break; case "VILLAGEID": $obj_Village_group->VillageId = $child; break; } } $obj_retResult_Village_group = DAL_manageVillage_group::updateVillage_group($obj_Village_group); if ($obj_retResult_Village_group->type == 1) { $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>"; $main_result .= getVillage_groupXml($obj_retResult_Village_group->data); } else { $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>"; } } $main_result .= "</VPROFILERESULT>"; return $main_result; }
public static function addVillage_group($obj_Village_group) { $db = config::dbconfig(); $obj_retresult = new returnResult(); $obj_Village_group->VillageId = DAL_manageVillage_group::getLastVillage_groupId() + 1; $sql = "INSERT INTO tbl_village_group (GroupId,VillageId) \n\t\tVALUES (" . common::noSqlInject($obj_Village_group->GroupId) . "," . "'" . common::noSqlInject($obj_Village_group->VillageId) . "'" . ");"; $rs = mysql_query($sql); if (mysql_affected_rows() > 0) { $obj_retresult->type = 1; $obj_retresult->msg = "success"; $obj_retresult->data = $obj_Village_group; } else { $obj_retresult->type = 0; $obj_retresult->msg = "failed"; } return $obj_retresult; }
public static function isChildVillage_group($VillageId, $ChildVillageId) { $ischild = false; $obj_retResult = DAL_manageVillage_group::getVillage_groupListByVillageId($ChildVillageId); //get child node if ($obj_retResult->type == 1) { $arr_Village_groupList = $obj_retResult->data; $obj_Village_group = $arr_Village_groupList[0]; $arrParentIds = explode(",", $obj_Village_group->Url); foreach ($arrParentIds as $Village_groupParentId) { if ($Village_groupParentId == $VillageId) { $ischild = true; } } } return $ischild; }