function updateLocation($sessionkey, $appcode, $Locationdata) { $main_result = "<VPROFILERESULT>"; $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>"; $userId = ValidateSession($sessionkey, $appcode); if ($userId > -1) { $main_result = "<AUTHSTATUS>1</AUTHSTATUS>"; $obj_Location = new Location(); foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) { switch ($key) { case "LOCATIONID": $obj_Location->LocationId = $child; break; case "NAME": $obj_Location->Name = $child; break; case "LOCATIONTYPE": $obj_Location->LocationType = $child; break; case "DESCRIPTION": $obj_Location->Description = $child; break; } } $obj_retResult_Location = DAL_manageLocation::updateLocation($obj_Location); if ($obj_retResult_Location->type == 1) { $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>"; $main_result .= getLocationXml($obj_retResult_Location->data); } else { $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>"; } } $main_result .= "</VPROFILERESULT>"; return $main_result; }
public static function addLocation($obj_Location) { $db = config::dbconfig(); $obj_retresult = new returnResult(); $obj_Location->LocationId = DAL_manageLocation::getLastLocationId() + 1; $sql = "INSERT INTO tbl_location (LocationId,Name,LocationType,Description) \n\t\tVALUES (" . common::noSqlInject($obj_Location->LocationId) . "," . "'" . common::noSqlInject($obj_Location->Name) . "'" . "," . "'" . common::noSqlInject($obj_Location->LocationType) . "'" . "," . "'" . common::noSqlInject($obj_Location->Description) . "'" . ");"; $rs = mysql_query($sql); if (mysql_affected_rows() > 0) { $obj_retresult->type = 1; $obj_retresult->msg = "success"; $obj_retresult->data = $obj_Location; } else { $obj_retresult->type = 0; $obj_retresult->msg = "failed"; } return $obj_retresult; }
public static function isChildLocation($LocationId, $ChildLocationId) { $ischild = false; $obj_retResult = DAL_manageLocation::getLocationListByLocationId($ChildLocationId); //get child node if ($obj_retResult->type == 1) { $arr_LocationList = $obj_retResult->data; $obj_Location = $arr_LocationList[0]; $arrParentIds = explode(",", $obj_Location->Url); foreach ($arrParentIds as $LocationParentId) { if ($LocationParentId == $LocationId) { $ischild = true; } } } return $ischild; }