function updateVillage_organization($sessionkey, $appcode, $Village_organizationdata) { $main_result = "<VPROFILERESULT>"; $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>"; $userId = ValidateSession($sessionkey, $appcode); if ($userId > -1) { $main_result = "<AUTHSTATUS>1</AUTHSTATUS>"; $obj_Village_organization = new Village_organization(); foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) { switch ($key) { case "ORGANIZATIONID": $obj_Village_organization->OrganizationId = $child; break; case "VILLAGEID": $obj_Village_organization->VillageId = $child; break; } } $obj_retResult_Village_organization = DAL_manageVillage_organization::updateVillage_organization($obj_Village_organization); if ($obj_retResult_Village_organization->type == 1) { $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>"; $main_result .= getVillage_organizationXml($obj_retResult_Village_organization->data); } else { $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>"; } } $main_result .= "</VPROFILERESULT>"; return $main_result; }
public static function addVillage_organization($obj_Village_organization) { $db = config::dbconfig(); $obj_retresult = new returnResult(); $obj_Village_organization->VillageId = DAL_manageVillage_organization::getLastVillage_organizationId() + 1; $sql = "INSERT INTO tbl_village_organization (OrganizationId,VillageId) \n\t\tVALUES (" . common::noSqlInject($obj_Village_organization->OrganizationId) . "," . common::noSqlInject($obj_Village_organization->VillageId) . ");"; $rs = mysql_query($sql); if (mysql_affected_rows() > 0) { $obj_retresult->type = 1; $obj_retresult->msg = "success"; $obj_retresult->data = $obj_Village_organization; } else { $obj_retresult->type = 0; $obj_retresult->msg = "failed"; } return $obj_retresult; }
public static function isChildVillage_organization($VillageId, $ChildVillageId) { $ischild = false; $obj_retResult = DAL_manageVillage_organization::getVillage_organizationListByVillageId($ChildVillageId); //get child node if ($obj_retResult->type == 1) { $arr_Village_organizationList = $obj_retResult->data; $obj_Village_organization = $arr_Village_organizationList[0]; $arrParentIds = explode(",", $obj_Village_organization->Url); foreach ($arrParentIds as $Village_organizationParentId) { if ($Village_organizationParentId == $VillageId) { $ischild = true; } } } return $ischild; }