function updateForesttype($sessionkey, $appcode, $Foresttypedata) { $main_result = "<VPROFILERESULT>"; $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>"; $userId = ValidateSession($sessionkey, $appcode); if ($userId > -1) { $main_result = "<AUTHSTATUS>1</AUTHSTATUS>"; $obj_Foresttype = new Foresttype(); foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) { switch ($key) { case "FORESTTYPEID": $obj_Foresttype->ForestTypeId = $child; break; case "NAME": $obj_Foresttype->Name = $child; break; case "DESCRIPTION": $obj_Foresttype->Description = $child; break; } } $obj_retResult_Foresttype = DAL_manageForesttype::updateForesttype($obj_Foresttype); if ($obj_retResult_Foresttype->type == 1) { $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>"; $main_result .= getForesttypeXml($obj_retResult_Foresttype->data); } else { $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>"; } } $main_result .= "</VPROFILERESULT>"; return $main_result; }
public static function addForesttype($obj_Foresttype) { $db = config::dbconfig(); $obj_retresult = new returnResult(); $obj_Foresttype->ForestTypeId = DAL_manageForesttype::getLastForesttypeId() + 1; $sql = "INSERT INTO tbl_foresttype (ForestTypeId,Name,Description) \n\t\tVALUES (" . common::noSqlInject($obj_Foresttype->ForestTypeId) . "," . "'" . common::noSqlInject($obj_Foresttype->Name) . "'" . "," . "'" . common::noSqlInject($obj_Foresttype->Description) . "'" . ");"; $rs = mysql_query($sql); if (mysql_affected_rows() > 0) { $obj_retresult->type = 1; $obj_retresult->msg = "success"; $obj_retresult->data = $obj_Foresttype; } else { $obj_retresult->type = 0; $obj_retresult->msg = "failed"; } return $obj_retresult; }
public static function isChildForesttype($ForestTypeId, $ChildForestTypeId) { $ischild = false; $obj_retResult = DAL_manageForesttype::getForesttypeListByForestTypeId($ChildForestTypeId); //get child node if ($obj_retResult->type == 1) { $arr_ForesttypeList = $obj_retResult->data; $obj_Foresttype = $arr_ForesttypeList[0]; $arrParentIds = explode(",", $obj_Foresttype->Url); foreach ($arrParentIds as $ForesttypeParentId) { if ($ForesttypeParentId == $ForestTypeId) { $ischild = true; } } } return $ischild; }