public static function addPerson($obj_Person)
 {
     $db = config::dbconfig();
     $obj_retresult = new returnResult();
     $obj_Person->PersonId = DAL_managePerson::getLastPersonId() + 1;
     $sql = "INSERT INTO tbl_person (PersonId,FullName,NickName,OtherNames,DrivingLicenceNo,PassportNo,PermanentAddress,Email,Website,Description,Gender,DOB,Height,Weight,HairColor,EyeColor,BloodType,Occupation,MonthlyIncome,FutureTargets,FutureNeeds,DOD,NIC,Status) \n\t\tVALUES (" . common::noSqlInject($obj_Person->PersonId) . "," . "'" . common::noSqlInject($obj_Person->FullName) . "'" . "," . "'" . common::noSqlInject($obj_Person->NickName) . "'" . "," . "'" . common::noSqlInject($obj_Person->OtherNames) . "'" . "," . "'" . common::noSqlInject($obj_Person->DrivingLicenceNo) . "'" . "," . "'" . common::noSqlInject($obj_Person->PassportNo) . "'" . "," . "'" . common::noSqlInject($obj_Person->PermanentAddress) . "'" . "," . "'" . common::noSqlInject($obj_Person->Email) . "'" . "," . "'" . common::noSqlInject($obj_Person->Website) . "'" . "," . "'" . common::noSqlInject($obj_Person->Description) . "'" . "," . common::noSqlInject($obj_Person->Gender) . "," . "'" . common::noSqlInject($obj_Person->DOB) . "'" . "," . common::noSqlInject($obj_Person->Height) . "," . common::noSqlInject($obj_Person->Weight) . "," . "'" . common::noSqlInject($obj_Person->HairColor) . "'" . "," . "'" . common::noSqlInject($obj_Person->EyeColor) . "'" . "," . "'" . common::noSqlInject($obj_Person->BloodType) . "'" . "," . "'" . common::noSqlInject($obj_Person->Occupation) . "'" . "," . common::noSqlInject($obj_Person->MonthlyIncome) . "," . "'" . common::noSqlInject($obj_Person->FutureTargets) . "'" . "," . "'" . common::noSqlInject($obj_Person->FutureNeeds) . "'" . "," . "'" . common::noSqlInject($obj_Person->DOD) . "'" . "," . "'" . common::noSqlInject($obj_Person->NIC) . "'" . "," . common::noSqlInject($obj_Person->Status) . ");";
     $rs = mysql_query($sql);
     if (mysql_affected_rows() > 0) {
         $obj_retresult->type = 1;
         $obj_retresult->msg = "success";
         $obj_retresult->data = $obj_Person;
     } else {
         $obj_retresult->type = 0;
         $obj_retresult->msg = "failed";
     }
     return $obj_retresult;
 }
Beispiel #2
0
function updatePerson($sessionkey, $appcode, $Persondata)
{
    $main_result = "<VPROFILERESULT>";
    $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>";
    $userId = ValidateSession($sessionkey, $appcode);
    if ($userId > -1) {
        $main_result = "<AUTHSTATUS>1</AUTHSTATUS>";
        $obj_Person = new Person();
        foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) {
            switch ($key) {
                case "PERSONID":
                    $obj_Person->PersonId = $child;
                    break;
                case "FULLNAME":
                    $obj_Person->FullName = $child;
                    break;
                case "NICKNAME":
                    $obj_Person->NickName = $child;
                    break;
                case "OTHERNAMES":
                    $obj_Person->OtherNames = $child;
                    break;
                case "DRIVINGLICENCENO":
                    $obj_Person->DrivingLicenceNo = $child;
                    break;
                case "PASSPORTNO":
                    $obj_Person->PassportNo = $child;
                    break;
                case "PERMANENTADDRESS":
                    $obj_Person->PermanentAddress = $child;
                    break;
                case "EMAIL":
                    $obj_Person->Email = $child;
                    break;
                case "WEBSITE":
                    $obj_Person->Website = $child;
                    break;
                case "DESCRIPTION":
                    $obj_Person->Description = $child;
                    break;
                case "GENDER":
                    $obj_Person->Gender = $child;
                    break;
                case "DOB":
                    $obj_Person->DOB = $child;
                    break;
                case "HEIGHT":
                    $obj_Person->Height = $child;
                    break;
                case "WEIGHT":
                    $obj_Person->Weight = $child;
                    break;
                case "HAIRCOLOR":
                    $obj_Person->HairColor = $child;
                    break;
                case "EYECOLOR":
                    $obj_Person->EyeColor = $child;
                    break;
                case "BLOODTYPE":
                    $obj_Person->BloodType = $child;
                    break;
                case "OCCUPATION":
                    $obj_Person->Occupation = $child;
                    break;
                case "MONTHLYINCOME":
                    $obj_Person->MonthlyIncome = $child;
                    break;
                case "FUTURETARGETS":
                    $obj_Person->FutureTargets = $child;
                    break;
                case "FUTURENEEDS":
                    $obj_Person->FutureNeeds = $child;
                    break;
                case "DOD":
                    $obj_Person->DOD = $child;
                    break;
                case "PICTURE":
                    $obj_Person->Picture = $child;
                    break;
                case "NIC":
                    $obj_Person->NIC = $child;
                    break;
                case "STATUS":
                    $obj_Person->Status = $child;
                    break;
            }
        }
        $obj_retResult_Person = DAL_managePerson::updatePerson($obj_Person);
        if ($obj_retResult_Person->type == 1) {
            $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>";
            $main_result .= getPersonXml($obj_retResult_Person->data);
        } else {
            $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>";
        }
    }
    $main_result .= "</VPROFILERESULT>";
    return $main_result;
}
 public static function isChildPerson($PersonId, $ChildPersonId)
 {
     $ischild = false;
     $obj_retResult = DAL_managePerson::getPersonListByPersonId($ChildPersonId);
     //get child node
     if ($obj_retResult->type == 1) {
         $arr_PersonList = $obj_retResult->data;
         $obj_Person = $arr_PersonList[0];
         $arrParentIds = explode(",", $obj_Person->Url);
         foreach ($arrParentIds as $PersonParentId) {
             if ($PersonParentId == $PersonId) {
                 $ischild = true;
             }
         }
     }
     return $ischild;
 }