public static function addGroup($obj_Group) { $db = config::dbconfig(); $obj_retresult = new returnResult(); $obj_Group->GroupId = DAL_manageGroup::getLastGroupId() + 1; $sql = "INSERT INTO tbl_group (GroupId,GroupName,GroupPrimaryType,GroupMissionTypeId,GroupAddress) \n\t\tVALUES (" . common::noSqlInject($obj_Group->GroupId) . "," . "'" . common::noSqlInject($obj_Group->GroupName) . "'" . "," . common::noSqlInject($obj_Group->GroupPrimaryType) . "," . common::noSqlInject($obj_Group->GroupMissionTypeId) . "," . "'" . common::noSqlInject($obj_Group->GroupAddress) . "'" . ");"; $rs = mysql_query($sql); if (mysql_affected_rows() > 0) { $obj_retresult->type = 1; $obj_retresult->msg = "success"; $obj_retresult->data = $obj_Group; } else { $obj_retresult->type = 0; $obj_retresult->msg = "failed"; } return $obj_retresult; }
function updateGroup($sessionkey, $appcode, $Groupdata) { $main_result = "<VPROFILERESULT>"; $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>"; $userId = ValidateSession($sessionkey, $appcode); if ($userId > -1) { $main_result = "<AUTHSTATUS>1</AUTHSTATUS>"; $obj_Group = new Group(); foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) { switch ($key) { case "GROUPID": $obj_Group->GroupId = $child; break; case "GROUPNAME": $obj_Group->GroupName = $child; break; case "GROUPPRIMARYTYPE": $obj_Group->GroupPrimaryType = $child; break; case "GROUPMISSIONTYPEID": $obj_Group->GroupMissionTypeId = $child; break; case "GROUPADDRESS": $obj_Group->GroupAddress = $child; break; } } $obj_retResult_Group = DAL_manageGroup::updateGroup($obj_Group); if ($obj_retResult_Group->type == 1) { $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>"; $main_result .= getGroupXml($obj_retResult_Group->data); } else { $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>"; } } $main_result .= "</VPROFILERESULT>"; return $main_result; }
public static function isChildGroup($GroupId, $ChildGroupId) { $ischild = false; $obj_retResult = DAL_manageGroup::getGroupListByGroupId($ChildGroupId); //get child node if ($obj_retResult->type == 1) { $arr_GroupList = $obj_retResult->data; $obj_Group = $arr_GroupList[0]; $arrParentIds = explode(",", $obj_Group->Url); foreach ($arrParentIds as $GroupParentId) { if ($GroupParentId == $GroupId) { $ischild = true; } } } return $ischild; }