function updateLocation_resources($sessionkey, $appcode, $Location_resourcesdata) { $main_result = "<VPROFILERESULT>"; $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>"; $userId = ValidateSession($sessionkey, $appcode); if ($userId > -1) { $main_result = "<AUTHSTATUS>1</AUTHSTATUS>"; $obj_Location_resources = new Location_resources(); foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) { switch ($key) { case "RESOURCEID": $obj_Location_resources->ResourceId = $child; break; case "LOCATIONID": $obj_Location_resources->LocationId = $child; break; case "RESOURCETYPE": $obj_Location_resources->ResourceType = $child; break; case "RESOURCEPATH": $obj_Location_resources->ResourcePath = $child; break; } } $obj_retResult_Location_resources = DAL_manageLocation_resources::updateLocation_resources($obj_Location_resources); if ($obj_retResult_Location_resources->type == 1) { $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>"; $main_result .= getLocation_resourcesXml($obj_retResult_Location_resources->data); } else { $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>"; } } $main_result .= "</VPROFILERESULT>"; return $main_result; }
public static function addLocation_resources($obj_Location_resources) { $db = config::dbconfig(); $obj_retresult = new returnResult(); $obj_Location_resources->ResourceId = DAL_manageLocation_resources::getLastLocation_resourcesId() + 1; $sql = "INSERT INTO tbl_location_resources (ResourceId,LocationId,ResourceType,ResourcePath) \n\t\tVALUES (" . common::noSqlInject($obj_Location_resources->ResourceId) . "," . common::noSqlInject($obj_Location_resources->LocationId) . "," . common::noSqlInject($obj_Location_resources->ResourceType) . "," . "'" . common::noSqlInject($obj_Location_resources->ResourcePath) . "'" . ");"; $rs = mysql_query($sql); if (mysql_affected_rows() > 0) { $obj_retresult->type = 1; $obj_retresult->msg = "success"; $obj_retresult->data = $obj_Location_resources; } else { $obj_retresult->type = 0; $obj_retresult->msg = "failed"; } return $obj_retresult; }
public static function isChildLocation_resources($ResourceId, $ChildResourceId) { $ischild = false; $obj_retResult = DAL_manageLocation_resources::getLocation_resourcesListByResourceId($ChildResourceId); //get child node if ($obj_retResult->type == 1) { $arr_Location_resourcesList = $obj_retResult->data; $obj_Location_resources = $arr_Location_resourcesList[0]; $arrParentIds = explode(",", $obj_Location_resources->Url); foreach ($arrParentIds as $Location_resourcesParentId) { if ($Location_resourcesParentId == $ResourceId) { $ischild = true; } } } return $ischild; }