$godFather->setLastname2($_POST["lastname2GodFather"]); $godFather->setGender('M'); PersonManager::addPerson($godFather, 'true'); $godFather = PersonManager::getSinglePerson('id', PersonManager::getLastID()); } $marriage->setIdGodFather($godFather->getId()); } //Process The GodMother if ($_POST["nameGodMother"] !== '') { $godMother = PersonManager::getSinglePerson('names', $_POST["nameGodMother"], 'lastname1', $_POST["lastname1GodMother"], 'lastname2', $_POST["lastname2GodMother"]); if ($godMother === NULL) { $godMother = new Person(); $godMother->setNames($_POST["nameGodMother"]); $godMother->setLastname1($_POST["lastname1GodMother"]); $godMother->setLastname2($_POST["lastname2GodMother"]); $godMother->setGender('F'); PersonManager::addPerson($godMother, 'true'); $godMother = PersonManager::getSinglePerson('id', PersonManager::getLastID()); } $marriage->setIdGodMother($godMother->getId()); } //Process The Witness1 if ($_POST["nameWitness1"] !== '') { $witness1 = PersonManager::getSinglePerson('names', $_POST["nameWitness1"], 'lastname1', $_POST["lastname1Witness1"], 'lastname2', $_POST["lastname2Witness1"]); if ($witness1 === NULL) { $witness1 = new Person(); $witness1->setNames($_POST["nameWitness1"]); $witness1->setLastname1($_POST["lastname1Witness1"]); $witness1->setLastname2($_POST["lastname2Witness1"]); PersonManager::addPerson($witness1, 'true'); $witness1 = PersonManager::getSinglePerson('id', PersonManager::getLastID());
/** * @expectedException \InvalidArgumentException * @dataProvider invalidGenderProvider * * @param $gender */ public function testSetInvalidGender($gender) { $this->person->setGender($gender); }
public function getPeople($ids, $fields, $options, $token) { $first = $options->getStartIndex(); $max = $options->getCount(); $this->checkDb(); $ret = array(); $filterQuery = ''; $options->setFilterBy(null); //DateOfBirth $query = "\n\t\tSELECT * FROM `Profiles` WHERE `ID` IN (" . implode(',', $ids) . ") {$filterQuery} ORDER BY `ID`\n\t"; /* `ID` AS 'id', `NickName` AS 'first_name', `NickName` AS 'last_name', `DescriptionMe` AS 'about_me', 20 AS 'age', `DateOfBirth` AS 'date_of_birth', 1 AS 'children', '' AS 'ethnicity', '' AS 'fashion', '' AS 'happiest_when', '' AS 'humor', '' AS 'job_interests' */ $res = mysqli_query($this->db, $query); if ($res) { while ($row = @mysqli_fetch_array($res, MYSQLI_ASSOC)) { $person_id = $row['ID']; $sFirstName = isset($row['FirstName']) ? $row['FirstName'] : $row['NickName']; $sLastName = isset($row['LastName']) ? $row['LastName'] : ''; $name = new Name($sFirstName . ' ' . $sLastName); $name->setGivenName($sFirstName); $name->setFamilyName($sLastName); $person = new Person($person_id, $name); $person->setDisplayName($name->getFormatted()); $sAboutMe = isset($row['DescriptionMe']) ? $row['DescriptionMe'] : ''; $person->setAboutMe($sAboutMe); $sDateOfBirth = isset($row['DateOfBirth']) ? date('Y-m-d', $row['DateOfBirth']) : ''; $sAge = $sDateOfBirth != '' ? $this->bx_getAge($sDateOfBirth) : ''; $person->setAge($sAge); $sChildren = isset($row['Children']) ? $row['Children'] : ''; $person->setChildren($sChildren); $person->setBirthday($sDateOfBirth); $sEthnicity = isset($row['Ethnicity']) ? $row['Ethnicity'] : ''; $person->setEthnicity($sEthnicity); $sFashion = isset($row['Fashion']) ? $row['Fashion'] : ''; $person->setFashion($sFashion); $sHappiestWhen = isset($row['HappiestWhen']) ? $row['HappiestWhen'] : ''; $person->setHappiestWhen($sHappiestWhen); $sHumor = isset($row['Humor']) ? $row['Humor'] : ''; $person->setHumor($sHumor); $sJobInterests = isset($row['JobInterests']) ? $row['JobInterests'] : ''; $person->setJobInterests($sJobInterests); $sLivingArrangement = isset($row['LivingArrangement']) ? $row['LivingArrangement'] : ''; $person->setLivingArrangement($sLivingArrangement); $sLookingFor = isset($row['LookingFor']) ? $row['LookingFor'] : ''; $person->setLookingFor($sLookingFor); $sNickName = isset($row['NickName']) ? $row['NickName'] : ''; $person->setNickname($sNickName); $sPets = isset($row['Pets']) ? $row['Pets'] : ''; $person->setPets($sPets); $sPoliticalViews = isset($row['PoliticalViews']) ? $row['PoliticalViews'] : ''; $person->setPoliticalViews($sPoliticalViews); $sProfileSong = isset($row['ProfileSong']) ? $row['ProfileSong'] : ''; $person->setProfileSong($sProfileSong); $person->setProfileUrl($this->url_prefix . '/profile/' . $person_id); //'A' TODO $sProfileVideo = isset($row['ProfileVideo']) ? $row['ProfileVideo'] : ''; $person->setProfileVideo($sProfileVideo); $sRelationshipStatus = isset($row['RelationshipStatus']) ? $row['RelationshipStatus'] : ''; $person->setRelationshipStatus($sRelationshipStatus); $sReligion = isset($row['Religion']) ? $row['Religion'] : ''; $person->setReligion($sReligion); $sRomance = isset($row['Romance']) ? $row['Romance'] : ''; $person->setRomance($sRomance); $sScaredOf = isset($row['ScaredOf']) ? $row['ScaredOf'] : ''; $person->setScaredOf($sScaredOf); $sSexualOrientation = isset($row['SexualOrientation']) ? $row['SexualOrientation'] : ''; $person->setSexualOrientation($sSexualOrientation); $person->setStatus($row['UserStatus']); $person->setThumbnailUrl(!empty($row['thumbnail_url']) ? $this->url_prefix . $row['thumbnail_url'] : ''); //'A' TODO if (!empty($row['thumbnail_url'])) { // also report thumbnail_url in standard photos field (this is the only photo supported by partuza) $person->setPhotos(array(new Photo($this->url_prefix . $row['thumbnail_url'], 'thumbnail', true))); } $sUtcOffset = isset($row['TimeZone']) ? $row['TimeZone'] : "-00:00"; $person->setUtcOffset(sprintf('%+03d:00', $sUtcOffset)); // force "-00:00" utc-offset format if (!empty($row['Drinker'])) { $person->setDrinker($row['Drinker']); } if (!empty($row['Sex'])) { $person->setGender(strtolower($row['Sex'])); } if (!empty($row['Smoker'])) { $person->setSmoker($row['Smoker']); } /* the following fields require additional queries so are only executed if requested */ if (isset($fields['activities']) || in_array('@all', $fields)) { $activities = array(); //'A' we haven`t activities yet /*$res2 = mysqli_query($this->db, "select activity from person_activities where person_id = " . $person_id); while (list($activity) = @mysqli_fetch_row($res2)) { $activities[] = $activity; }*/ $person->setActivities($activities); } if (isset($fields['addresses']) || in_array('@all', $fields)) { $addresses = array(); $sCountry = isset($row['Country']) ? $row['Country'] : ''; $sRegion = isset($row['City']) ? $row['City'] : ''; //'A' region -> city $sZip = isset($row['zip']) ? $row['zip'] : ''; if (empty($row['unstructured_address'])) { $row['unstructured_address'] = trim($row['street_address'] . " " . $sRegion . " " . $sCountry); } $addres = new Address($row['unstructured_address']); $addres->setCountry($sCountry); if (!empty($row['latitude'])) { $addres->setLatitude($row['latitude']); } if (!empty($row['longitude'])) { $addres->setLongitude($row['longitude']); } if (!empty($row['locality'])) { $addres->setLocality($row['locality']); } $addres->setPostalCode($sZip); $addres->setRegion($sRegion); if (!empty($row['street_address'])) { $addres->setStreetAddress($row['street_address']); } if (!empty($row['street_address'])) { $addres->setType($row['street_address']); } //FIXME quick and dirty hack to demo PC $addres->setPrimary(true); $addresses[] = $addres; $person->setAddresses($addresses); } if (isset($fields['bodyType']) || in_array('@all', $fields)) { //'A' we haven`t bodyType at all /*$res2 = mysqli_query($this->db, "select * from person_body_type where person_id = " . $person_id); if (@mysqli_num_rows($res2)) { $row = @mysql_fetch_array($res2, MYSQLI_ASSOC); $bodyType = new BodyType(); $bodyType->setBuild($row['build']); $bodyType->setEyeColor($row['eye_color']); $bodyType->setHairColor($row['hair_color']); $bodyType->setHeight($row['height']); $bodyType->setWeight($row['weight']); $person->setBodyType($bodyType); }*/ } if (isset($fields['books']) || in_array('@all', $fields)) { //'A' we haven`t books at all /*$books = array(); $res2 = mysqli_query($this->db, "select book from person_books where person_id = " . $person_id); while (list($book) = @mysqli_fetch_row($res2)) { $books[] = $book; } $person->setBooks($books);*/ } if (isset($fields['cars']) || in_array('@all', $fields)) { //'A' we haven`t cars at all /*$cars = array(); $res2 = mysqli_query($this->db, "select car from person_cars where person_id = " . $person_id); while (list($car) = @mysqli_fetch_row($res2)) { $cars[] = $car; } $person->setCars($cars);*/ } if (isset($fields['currentLocation']) || in_array('@all', $fields)) { //'A' we haven`t currentLocation at all /*$addresses = array(); $res2 = mysqli_query($this->db, "select addresses.* from person_current_location, person_addresses, addresses where addresses.id = person_current_location.address_id and person_addresses.person_id = " . $person_id); if (@mysqli_num_rows($res2)) { $row = mysqli_fetch_array($res2, MYSQLI_ASSOC); if (empty($row['unstructured_address'])) { $row['unstructured_address'] = trim($row['street_address'] . " " . $row['region'] . " " . $row['country']); } $addres = new Address($row['unstructured_address']); $addres->setCountry($row['country']); $addres->setLatitude($row['latitude']); $addres->setLongitude($row['longitude']); $addres->setLocality($row['locality']); $addres->setPostalCode($row['postal_code']); $addres->setRegion($row['region']); $addres->setStreetAddress($row['street_address']); $addres->setType($row['address_type']); $person->setCurrentLocation($addres); }*/ } if (isset($fields['emails']) || in_array('@all', $fields)) { $emails = array(); //'A' we haven`t multi emails, only single /*$res2 = mysqli_query($this->db, "select address, email_type from person_emails where person_id = " . $person_id); while (list($address, $type) = @mysqli_fetch_row($res2)) { $emails[] = new Email(strtolower($address), $type); // TODO: better email canonicalization; remove dups } $person->setEmails($emails);*/ $sEmail = isset($row['Email']) ? $row['Email'] : ''; $emails[] = new Email(strtolower($sEmail), 'main'); $person->setEmails($emails); } if (isset($fields['food']) || in_array('@all', $fields)) { //'A' we haven`t food at all /*$foods = array(); $res2 = mysqli_query($this->db, "select food from person_foods where person_id = " . $person_id); while (list($food) = @mysqli_fetch_row($res2)) { $foods[] = $food; } $person->setFood($foods);*/ } if (isset($fields['heroes']) || in_array('@all', $fields)) { //'A' we haven`t heroes at all /*$strings = array(); $res2 = mysqli_query($this->db, "select hero from person_heroes where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setHeroes($strings);*/ } if (isset($fields['interests']) || in_array('@all', $fields)) { //'A' we haven`t interests at all /* $strings = array(); $res2 = mysqli_query($this->db, "select interest from person_interests where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setInterests($strings);*/ } $organizations = array(); $fetchedOrg = false; if (isset($fields['jobs']) || in_array('@all', $fields)) { //'A' we haven`t jobs at all /*$res2 = mysqli_query($this->db, "select organizations.* from person_jobs, organizations where organizations.id = person_jobs.organization_id and person_jobs.person_id = " . $person_id); while ($row = mysqli_fetch_array($res2, MYSQLI_ASSOC)) { $organization = new Organization(); $organization->setDescription($row['description']); $organization->setEndDate($row['end_date']); $organization->setField($row['field']); $organization->setName($row['name']); $organization->setSalary($row['salary']); $organization->setStartDate($row['start_date']); $organization->setSubField($row['sub_field']); $organization->setTitle($row['title']); $organization->setWebpage($row['webpage']); $organization->setType('job'); if ($row['address_id']) { $res3 = mysqli_query($this->db, "select * from addresses where id = " . $row['address_id']); if (mysqli_num_rows($res3)) { $row = mysqli_fetch_array($res3, MYSQLI_ASSOC); if (empty($row['unstructured_address'])) { $row['unstructured_address'] = trim($row['street_address'] . " " . $row['region'] . " " . $row['country']); } $addres = new Address($row['unstructured_address']); $addres->setCountry($row['country']); $addres->setLatitude($row['latitude']); $addres->setLongitude($row['longitude']); $addres->setLocality($row['locality']); $addres->setPostalCode($row['postal_code']); $addres->setRegion($row['region']); $addres->setStreetAddress($row['street_address']); $addres->setType($row['address_type']); $organization->setAddress($address); } } $organizations[] = $organization; } $fetchedOrg = true;*/ } if (isset($fields['schools']) || in_array('@all', $fields)) { //'A' we haven`t schools at all /*$res2 = mysqli_query($this->db, "select organizations.* from person_schools, organizations where organizations.id = person_schools.organization_id and person_schools.person_id = " . $person_id); while ($row = mysqli_fetch_array($res2, MYSQLI_ASSOC)) { $organization = new Organization(); $organization->setDescription($row['description']); $organization->setEndDate($row['end_date']); $organization->setField($row['field']); $organization->setName($row['name']); $organization->setSalary($row['salary']); $organization->setStartDate($row['start_date']); $organization->setSubField($row['sub_field']); $organization->setTitle($row['title']); $organization->setWebpage($row['webpage']); $organization->setType($row['school']); if ($row['address_id']) { $res3 = mysqli_query($this->db, "select * from addresses where id = " . $row['address_id']); if (mysqli_num_rows($res3)) { $row = mysqli_fetch_array($res3, MYSQLI_ASSOC); if (empty($row['unstructured_address'])) { $row['unstructured_address'] = trim($row['street_address'] . " " . $row['region'] . " " . $row['country']); } $addres = new Address($row['unstructured_address']); $addres->setCountry($row['country']); $addres->setLatitude($row['latitude']); $addres->setLongitude($row['longitude']); $addres->setLocality($row['locality']); $addres->setPostalCode($row['postal_code']); $addres->setRegion($row['region']); $addres->setStreetAddress($row['street_address']); $addres->setType($row['address_type']); $organization->setAddress($address); } } $organizations[] = $organization; } $fetchedOrg = true;*/ } if ($fetchedOrg) { $person->setOrganizations($organizations); } //TODO languagesSpoken, currently missing the languages / countries tables so can't do this yet if (isset($fields['movies']) || in_array('@all', $fields)) { //'A' possible after /*$strings = array(); $res2 = mysqli_query($this->db, "select movie from person_movies where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setMovies($strings);*/ } if (isset($fields['music']) || in_array('@all', $fields)) { //'A' possible after /*$strings = array(); $res2 = mysqli_query($this->db, "select music from person_music where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setMusic($strings);*/ } if (isset($fields['phoneNumbers']) || in_array('@all', $fields)) { //'A' we haven`t phoneNumbers at all /*$numbers = array(); $res2 = mysqli_query($this->db, "select number, number_type from person_phone_numbers where person_id = " . $person_id); while (list($number, $type) = @mysqli_fetch_row($res2)) { $numbers[] = new Phone($number, $type); } $person->setPhoneNumbers($numbers);*/ } if (isset($fields['ims']) || in_array('@all', $fields)) { //'A' we haven`t ims at all /*$ims = array(); $res2 = mysqli_query($this->db, "select value, value_type from person_ims where person_id = " . $person_id); while (list($value, $type) = @mysqli_fetch_row($res2)) { $ims[] = new Im($value, $type); } $person->setIms($ims);*/ } if (isset($fields['accounts']) || in_array('@all', $fields)) { //'A' we haven`t accounts at all /*$accounts = array(); $res2 = mysqli_query($this->db, "select domain, userid, username from person_accounts where person_id = " . $person_id); while (list($domain, $userid, $username) = @mysqli_fetch_row($res2)) { $accounts[] = new Account($domain, $userid, $username); } $person->setAccounts($accounts);*/ } if (isset($fields['quotes']) || in_array('@all', $fields)) { //'A' we haven`t quotes at all /*$strings = array(); $res2 = mysqli_query($this->db, "select quote from person_quotes where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setQuotes($strings);*/ } if (isset($fields['sports']) || in_array('@all', $fields)) { //'A' we haven`t sports at all /*$strings = array(); $res2 = mysqli_query($this->db, "select sport from person_sports where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setSports($strings);*/ } if (isset($fields['tags']) || in_array('@all', $fields)) { $strings = array(); if (!empty($row['latitude'])) { $aProfileTags = preg_split("/[;,\\s]/", $_REQUEST['tags']); foreach ($aProfileTags as $sTag) { $strings[] = $sTag; } /*$res2 = mysqli_query($this->db, "select tag from person_tags where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; }*/ $person->setTags($strings); } } if (isset($fields['turnOns']) || in_array('@all', $fields)) { //'A' we haven`t turnOns at all /*$strings = array(); $res2 = mysqli_query($this->db, "select turn_on from person_turn_ons where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setTurnOns($strings);*/ } if (isset($fields['turnOffs']) || in_array('@all', $fields)) { //'A' we haven`t turnOffs at all /*$strings = array(); $res2 = mysqli_query($this->db, "select turn_off from person_turn_offs where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setTurnOffs($strings);*/ } if (isset($fields['urls']) || in_array('@all', $fields)) { //'A' we haven`t urls at all /*$strings = array(); $res2 = mysqli_query($this->db, "select url from person_urls where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = new Url($data, null, null); } $strings[] = new Url($this->url_prefix . '/profile/' . $person_id, null, 'profile'); // always include profile URL $person->setUrls($strings);*/ } $ret[$person_id] = $person; } } try { $ret = $this->filterResults($ret, $options); $ret['totalSize'] = count($ret); } catch (Exception $e) { $ret['totalSize'] = count($ret) - 1; $ret['filtered'] = 'false'; } if ($first !== false && $max !== false && is_numeric($first) && is_numeric($max) && $first >= 0 && $max > 0) { $count = 0; $result = array(); foreach ($ret as $id => $person) { if ($id == 'totalSize' || $id == 'filtered') { $result[$id] = $person; continue; } if ($count >= $first && $count < $first + $max) { $result[$id] = $person; } ++$count; } return $result; } else { return $ret; } }
private function setupPeopleData() { $xml = $this->fetchStateDocument(); $this->allPeople = array(); $this->friendIdMap = array(); foreach ($xml->people->person as $personNode) { $name = (string) $personNode['name']; $id = (string) $personNode['id']; $person = new Person($id, new Name($this->turnEvil($name))); $phoneItem = (string) $personNode['phone']; if (!empty($phoneItem)) { $phones = array(); $phones[] = new Phone($this->turnEvil($phoneItem), null); $person->setPhoneNumbers($phones); } $genderItem = (string) $personNode['gender']; if (!empty($genderItem)) { if ($genderItem == 'F') { $person->setGender('FEMALE'); } else { $person->setGender('MALE'); } } $this->allPeople[$id] = $person; $this->friendIdMap[$id] = $this->getFriends($personNode); } }
function Main() { switch ($this->formArray["formAction"]) { case "edit": $UserDetails = new SoapObject(NCCBIZ . "UserDetails.php", "urn:Object"); if (!($xmlStr = $UserDetails->getUserDetails($this->formArray["userID"]))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "User record not found"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "error xmlDoc"); } else { $user = new User(); $user->parseDomDocument($domDoc); $this->formArray["userID"] = $user->getUserID(); $this->formArray["userType"] = $user->getUserType(); $this->formArray["username"] = $user->getUsername(); $this->formArray["password"] = $user->getPassword(); $this->formArray["personID"] = $user->getPersonID(); $this->formArray["status"] = $user->getStatus(); } } $PersonDetails = new SoapObject(NCCBIZ . "PersonDetails.php", "urn:Object"); if (!($xmlStr = $PersonDetails->getPersonDetails($this->formArray["personID"]))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "Person record not found"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "error xmlDoc"); } else { $person = new Person(); $person->parseDomDocument($domDoc); list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $person->getBirthday()); $this->formArray["personID"] = $person->getPersonID(); $this->formArray["lastName"] = $person->getLastName(); $this->formArray["firstName"] = $person->getFirstName(); $this->formArray["middleName"] = $person->getMiddleName(); $this->formArray["gender"] = $person->getGender(); $this->formArray["birth_year"] = removePreZero($dateArr["year"]); $this->formArray["birth_month"] = removePreZero($dateArr["month"]); $this->formArray["birth_day"] = removePreZero($dateArr["day"]); $this->formArray["maritalStatus"] = $person->getMaritalStatus(); $this->formArray["tin"] = $person->getTin(); $address = $person->addressArray[0]; if (is_a($address, Address)) { $this->formArray["addressID"] = $address->getAddressID(); $this->formArray["number"] = $address->getNumber(); $this->formArray["street"] = $address->getStreet(); $this->formArray["barangay"] = $address->getBarangay(); $this->formArray["district"] = $address->getDistrict(); $this->formArray["municipalityCity"] = $address->getMunicipalitycity(); $this->formArray["province"] = $address->getProvince(); } $this->formArray["telephone"] = $person->getTelephone(); $this->formArray["mobileNumber"] = $person->getMobileNumber(); $this->formArray["email"] = $person->getEmail(); } } $this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock"); $this->tpl->set_var("NewUserPasswordBlock", ""); $this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock"); $this->tpl->set_var("oldNewUserRowspan", 5); //$this->tpl->set_var("oldNewUserRowspan", 3); $this->tpl->parse("OldUserPasswordBlock", "OldUserPassword", true); break; case "save": /* if($this->isOldPasswordCorrect()==false){ $this->message = "Error. Cannot Save. Old password incorrect to create new password."; $this->tpl->set_var("message", $this->message); $this->tpl->parse("MessageBlock", "Message", true); $this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock"); $this->tpl->set_var("NewUserPasswordBlock", ""); $this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock"); $this->tpl->set_var("oldNewUserRowspan", 3); $this->tpl->parse("OldUserPasswordBlock", "OldUserPassword", true); break; } */ if ($this->formArray["newPassword"] != "" && $this->formArray["newPassword"] != "null") { $this->formArray["password"] = md5($this->formArray["newPassword"]); } if ($this->usernameAlreadyExists() == true) { $this->message = "Error. Cannot Save. Username already exists."; $this->tpl->set_var("message", $this->message); $this->tpl->parse("MessageBlock", "Message", true); $this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock"); $this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock"); if ($this->formArray["personID"] != "") { $this->tpl->set_var("NewUserPasswordBlock", ""); $this->tpl->set_var("oldNewUserRowspan", 3); $this->tpl->parse("OldUserPasswordBlock", "OldUserPassword", true); } else { $this->tpl->set_var("oldNewUserRowspan", 2); $this->tpl->parse("NewUserPasswordBlock", "NewUserPassword", true); $this->tpl->set_var("OldUserPasswordBlock", ""); } break; } $PersonEncode = new SoapObject(NCCBIZ . "PersonEncode.php", "urn:Object"); if ($this->formArray["personID"] != "") { $PersonDetails = new SoapObject(NCCBIZ . "PersonDetails.php", "urn:Object"); if (!($xmlStr = $PersonDetails->getPersonDetails($this->formArray["personID"]))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "Person record not found"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "error xmlDoc"); } else { $person = new Person(); $person->parseDomDocument($domDoc); $address = $person->addressArray[0]; if (is_a($address, Address)) { $address->setAddressID($this->formArray["addressID"]); $address->setNumber($this->formArray["number"]); $address->setStreet($this->formArray["street"]); $address->setBarangay($this->formArray["barangay"]); $address->setDistrict($this->formArray["district"]); $address->setMunicipalityCity($this->formArray["municipalityCity"]); $address->setProvince($this->formArray["province"]); $address->setDomDocument(); } $person->setPersonID($this->formArray["personID"]); $person->setPersonType("adminUser"); $person->setLastName($this->formArray["lastName"]); $person->setFirstName($this->formArray["firstName"]); $person->setMiddleName($this->formArray["middleName"]); $person->setGender($this->formArray["gender"]); $person->setBirthday($this->birthdate); $person->setMaritalStatus($this->formArray["maritalStatus"]); $person->setTin($this->formArray["tin"]); $person->setAddressArray($address); $person->setTelephone($this->formArray["telephone"]); $person->setMobileNumber($this->formArray["mobileNumber"]); $person->setEmail($this->formArray["email"]); $person->setDomDocument(); $doc = $person->getDomDocument(); //echo $doc->html_dump_mem(); $xmlStr = $doc->dump_mem(true); if (!($ret = $PersonEncode->updatePerson($xmlStr))) { exit("error update"); } } } } else { $address = new Address(); $address->setNumber($this->formArray["number"]); $address->setStreet($this->formArray["street"]); $address->setBarangay($this->formArray["barangay"]); $address->setDistrict($this->formArray["district"]); $address->setMunicipalityCity($this->formArray["municipalityCity"]); $address->setProvince($this->formArray["province"]); $address->setDomDocument(); $person = new Person(); $person->setPersonID($this->formArray["personID"]); $person->setPersonType("adminUser"); $person->setLastName($this->formArray["lastName"]); $person->setFirstName($this->formArray["firstName"]); $person->setMiddleName($this->formArray["middleName"]); $person->setGender($this->formArray["gender"]); $person->setBirthday($this->birthdate); $person->setMaritalStatus($this->formArray["maritalStatus"]); $person->setTin($this->formArray["tin"]); $person->setAddressArray($address); $person->setTelephone($this->formArray["telephone"]); $person->setMobileNumber($this->formArray["mobileNumber"]); $person->setEmail($this->formArray["email"]); $person->setDomDocument(); $doc = $person->getDomDocument(); $xmlStr = $doc->dump_mem(true); //echo $this->formArray["ownerID"].$xmlStr; if (!($ret = $PersonEncode->savePerson($xmlStr, $this->formArray["ownerID"]))) { exit("error save"); } } $this->formArray["personID"] = $ret; $UserEncode = new SoapObject(NCCBIZ . "UserEncode.php", "urn:Object"); if ($this->formArray["userID"] != "") { $UserDetails = new SoapObject(NCCBIZ . "UserDetails.php", "urn:Object"); if (!($xmlStr = $UserDetails->getUserDetails($this->formArray["userID"]))) { exit("User record not found"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "error xmlDoc"); } else { $user = new User(); $user->parseDomDocument($domDoc); $user->setUserID($this->formArray["userID"]); $user->setUserType($this->formArray["userType"]); $user->setUsername($this->formArray["username"]); $user->setPassword($this->formArray["password"]); $user->setPersonID($this->formArray["personID"]); $user->setStatus($this->formArray["status"]); $user->setDomDocument(); $doc = $user->getDomDocument(); $xmlStr = $doc->dump_mem(true); if (!($ret = $UserEncode->updateUser($xmlStr))) { exit("error update"); } } } } else { $user = new User(); //$user->setUserID($this->formArray["userID"]); $user->setUserType($this->formArray["userType"]); $user->setUsername($this->formArray["username"]); $user->setPassword(md5($this->formArray["password"])); $user->setPersonID($this->formArray["personID"]); $user->setStatus($this->formArray["status"]); $user->setDomDocument(); $doc = $user->getDomDocument(); $xmlStr = $doc->dump_mem(true); if (!($ret = $UserEncode->saveUser($xmlStr))) { exit("error save"); } } header("location: UserClose.php" . $this->sess->url("")); exit; break; case "cancel": header("location: UserClose.php" . $this->sess->url("")); exit; break; default: $this->tpl->set_block("rptsTemplate", "UserID", "UserIDBlock"); $this->tpl->set_var("UserIDBlock", ""); $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock"); $this->tpl->set_var("ACKBlock", ""); $this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock"); $this->tpl->set_var("oldNewUserRowspan", 2); $this->tpl->parse("NewUserPasswordBlock", "NewUserPassword", true); $this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock"); $this->tpl->set_var("OldUserPasswordBlock", ""); } $this->setForm(); if ($this->message == "") { $this->tpl->set_var("MessageBlock", ""); } $this->tpl->parse("templatePage", "rptsTemplate"); $this->tpl->finish("templatePage"); $this->tpl->p("templatePage"); }
function Main() { switch ($this->formArray["formAction"]) { case "edit": $PersonDetails = new SoapObject(NCCBIZ . "PersonDetails.php", "urn:Object"); if (!($xmlStr = $PersonDetails->getPersonDetails($this->formArray["personID"]))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "record not found"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "error xmlDoc"); } else { $person = new Person(); $person->parseDomDocument($domDoc); list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $person->getBirthday()); $this->formArray["personID"] = $person->getPersonID(); $this->formArray["lastName"] = $person->getLastName(); $this->formArray["firstName"] = $person->getFirstName(); $this->formArray["middleName"] = $person->getMiddleName(); $this->formArray["gender"] = $person->getGender(); $this->formArray["birth_year"] = removePreZero($dateArr["year"]); $this->formArray["birth_month"] = removePreZero($dateArr["month"]); $this->formArray["birth_day"] = removePreZero($dateArr["day"]); $this->formArray["maritalStatus"] = $person->getMaritalStatus(); $this->formArray["tin"] = $person->getTin(); $address = $person->addressArray[0]; if (is_a($address, Address)) { $this->formArray["addressID"] = $address->getAddressID(); $this->formArray["number"] = $address->getNumber(); $this->formArray["street"] = $address->getStreet(); $this->formArray["barangay"] = $address->getBarangay(); $this->formArray["district"] = $address->getDistrict(); $this->formArray["municipalityCity"] = $address->getMunicipalitycity(); $this->formArray["province"] = $address->getProvince(); } $this->formArray["telephone"] = $person->getTelephone(); $this->formArray["mobileNumber"] = $person->getMobileNumber(); $this->formArray["email"] = $person->getEmail(); } } break; case "save": $PersonEncode = new SoapObject(NCCBIZ . "PersonEncode.php", "urn:Object"); if ($this->formArray["personID"] != "") { $PersonDetails = new SoapObject(NCCBIZ . "PersonDetails.php", "urn:Object"); if (!($xmlStr = $PersonDetails->getPersonDetails($this->formArray["personID"]))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "record not found"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "error xmlDoc"); } else { $person = new Person(); $person->parseDomDocument($domDoc); $address = $person->addressArray[0]; if (is_a($address, Address)) { $address->setAddressID($this->formArray["addressID"]); $address->setNumber($this->formArray["number"]); $address->setStreet($this->formArray["street"]); $address->setBarangay($this->formArray["barangay"]); $address->setDistrict($this->formArray["district"]); $address->setMunicipalityCity($this->formArray["municipalityCity"]); $address->setProvince($this->formArray["province"]); $address->setDomDocument(); } $person->setPersonID($this->formArray["personID"]); $person->setLastName($this->formArray["lastName"]); $person->setFirstName($this->formArray["firstName"]); $person->setMiddleName($this->formArray["middleName"]); $person->setGender($this->formArray["gender"]); $person->setBirthday($this->birthdate); $person->setMaritalStatus($this->formArray["maritalStatus"]); $person->setTin($this->formArray["tin"]); $person->setAddressArray($address); $person->setTelephone($this->formArray["telephone"]); $person->setMobileNumber($this->formArray["mobileNumber"]); $person->setEmail($this->formArray["email"]); $person->setDomDocument(); $doc = $person->getDomDocument(); $xmlStr = $doc->dump_mem(true); if (!($ret = $PersonEncode->updatePerson($xmlStr))) { exit("error update"); } } } } else { $address = new Address(); $address->setNumber($this->formArray["number"]); $address->setStreet($this->formArray["street"]); $address->setBarangay($this->formArray["barangay"]); $address->setDistrict($this->formArray["district"]); $address->setMunicipalityCity($this->formArray["municipalityCity"]); $address->setProvince($this->formArray["province"]); $address->setDomDocument(); $person = new Person(); $person->setPersonID($this->formArray["personID"]); $person->setLastName($this->formArray["lastName"]); $person->setFirstName($this->formArray["firstName"]); $person->setMiddleName($this->formArray["middleName"]); $person->setGender($this->formArray["gender"]); $person->setBirthday($this->birthdate); $person->setMaritalStatus($this->formArray["maritalStatus"]); $person->setTin($this->formArray["tin"]); $person->setAddressArray($address); $person->setTelephone($this->formArray["telephone"]); $person->setMobileNumber($this->formArray["mobileNumber"]); $person->setEmail($this->formArray["email"]); $person->setDomDocument(); $doc = $person->getDomDocument(); $xmlStr = $doc->dump_mem(true); //echo $this->formArray["ownerID"].$xmlStr; if (!($ret = $PersonEncode->savePerson($xmlStr, $this->formArray["ownerID"]))) { exit("error save"); } } $this->formArray["personID"] = $ret; header("location: ChangeOfOwnershipPropertyInfoClose.php" . $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"], "personID" => $ret, "formAction" => "view"))); exit; break; case "cancel": header("location: PersonList.php"); exit; break; default: if ($this->formArray["locID"]) { $ODDetails = new SoapObject(NCCBIZ . "ODDetails.php", "urn:Object"); if (!($xmlStr = $ODDetails->getLocation($this->formArray["locID"]))) { exit("xml failed"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { } else { $loc = new LocationAddress(); $loc->parseDomDocument($domDoc); foreach ($loc as $key => $value) { $this->formArray[$key] = $value; } } } } $this->tpl->set_block("rptsTemplate", "personID", "personIDBlock"); $this->tpl->set_var("personIDBlock", ""); $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock"); $this->tpl->set_var("ACKBlock", ""); } $this->setForm(); $this->tpl->parse("templatePage", "rptsTemplate"); $this->tpl->finish("templatePage"); $this->tpl->p("templatePage"); }
if ($child->getId() === '0') { PersonManager::addPerson($child, 'true'); $child = PersonManager::getSinglePerson('id', PersonManager::getLastID()); } else { PersonManager::updatePerson($child); } $confirmation->setIdOwner($child->getId()); //Process The GodFather if ($_POST["nameGodFather"] !== '') { $godFather = PersonManager::getSinglePerson('names', $_POST["nameGodFather"], 'lastname1', $_POST["lastname1GodFather"], 'lastname2', $_POST["lastname2GodFather"]); if ($godFather === NULL) { $godFather = new Person(); $godFather->setNames($_POST["nameGodFather"]); $godFather->setLastname1($_POST["lastname1GodFather"]); $godFather->setLastname2($_POST["lastname2GodFather"]); $godFather->setGender('M'); PersonManager::addPerson($godFather, 'true'); $godFather = PersonManager::getSinglePerson('id', PersonManager::getLastID()); } $confirmation->setIdGodFather($godFather->getId()); } //Get The Book Registry Data $reverse = substr($_POST["reverseBookRegistry"], 0, 1); if ($reverse === 'Y' || $reverse === 'S') { $reverse = 'Y'; } $bookRegistry = ConfirmationManager::getSingleConfirmationRegistry('book', $_POST["bookBookRegistry"], 'page', $_POST["pageBookRegistry"], 'number', $_POST["numBookRegistry"], 'reverse', $reverse); if ($bookRegistry === NULL) { $bookRegistry = new ConfirmationRegistry(); $bookRegistry->setBook($_POST["bookBookRegistry"]); $bookRegistry->setPage($_POST["pageBookRegistry"]);
public function getPeople($ids, $fields, $options, $token) { $first = $options->getStartIndex(); $max = $options->getCount(); $this->checkDb(); $ret = array(); $filterQuery = ''; if ($options->getFilterBy() == 'hasApp') { // remove the filterBy field, it's taken care of in the query already, otherwise filterResults will disqualify all results $options->setFilterBy(null); $appId = $token->getAppId(); $filterQuery = " and id in (select member_id from " . TABLE_PREFIX . "social_applications where application_id = {$appId})"; } elseif ($options->getFilterBy() == 'all') { $options->setFilterBy(null); } $query = "SELECT member.*, info.interests, info.associations, info.awards FROM " . TABLE_PREFIX . "members member LEFT JOIN " . TABLE_PREFIX . "social_member_additional_information info ON member.member_id=info.member_id WHERE member.member_id IN (" . implode(',', $ids) . ") {$filterQuery} ORDER BY member.member_id "; $res = mysql_query($query, $this->db); if ($res) { while ($row = mysql_fetch_assoc($res)) { $member_id = intval($row['member_id']); $name = new Name($row['first_name'] . ' ' . $row['last_name']); $name->setGivenName($row['first_name']); $name->setFamilyName($row['last_name']); $person = new Person($row['member_id'], $name); $person->setDisplayName($name->getFormatted()); $person->setAboutMe($row['about_me']); $person->setAge($row['age']); $person->setChildren($row['children']); $person->setBirthday(date('Y-m-d', $row['date_of_birth'])); $person->setEthnicity($row['ethnicity']); $person->setFashion($row['fashion']); $person->setHappiestWhen($row['happiest_when']); $person->setHumor($row['humor']); $person->setJobInterests($row['job_interests']); $person->setLivingArrangement($row['living_arrangement']); $person->setLookingFor($row['looking_for']); $person->setNickname($row['nickname']); $person->setPets($row['pets']); $person->setPoliticalViews($row['political_views']); $person->setProfileSong($row['profile_song']); $person->setProfileUrl($this->url_prefix . '/profile/' . $row['member_id']); $person->setProfileVideo($row['profile_video']); $person->setRelationshipStatus($row['relationship_status']); $person->setReligion($row['religion']); $person->setRomance($row['romance']); $person->setScaredOf($row['scared_of']); $person->setSexualOrientation($row['sexual_orientation']); $person->setStatus($row['status']); $person->setThumbnailUrl(!empty($row['thumbnail_url']) ? $this->url_prefix . $row['thumbnail_url'] : ''); if (!empty($row['thumbnail_url'])) { // also report thumbnail_url in standard photos field (this is the only photo supported by ATutor) $person->setPhotos(array(new Photo($this->url_prefix . 'get_profile_img.php?id=' . $row['member_id'], 'thumbnail', true))); } $person->setUtcOffset(sprintf('%+03d:00', $row['time_zone'])); // force "-00:00" utc-offset format if (!empty($row['drinker'])) { $person->setDrinker($row['drinker']); } if (!empty($row['gender'])) { $person->setGender(strtolower($row['gender'])); } if (!empty($row['email'])) { //TODO: Assumed <static> object TYPE to be "home". Change it if ATutor starts accepting more than one email $email = new Email(strtolower($row['email']), 'home'); $person->setEmails($email); } if (!empty($row['interests'])) { $strings = explode(',', $row['interests']); $person->setInterests($strings); } //TODO: Not in ATutor yet, skeleton field if (!empty($row['smoker'])) { $person->setSmoker($row['smoker']); } /* the following fields require additional queries so are only executed if requested */ if (isset($fields['activities']) || isset($fields['@all'])) { $activities = array(); $sql = "select title from " . TABLE_PREFIX . "social_activities where member_id = " . $member_id; $res2 = mysql_query($sql, $this->db); while (list($activity) = mysql_fetch_row($res2)) { $activities[] = $activity; } $person->setActivities($activities); } if (isset($fields['addresses']) || isset($fields['@all'])) { $addresses = array(); $sql = "select address, postal, city, province, country from " . TABLE_PREFIX . "members m where m.member_id = " . $member_id; $res2 = mysql_query($sql, $this->db); while ($row = mysql_fetch_assoc($res2)) { if (empty($row['unstructured_address'])) { $row['unstructured_address'] = trim($row['street_address'] . " " . $row['province'] . " " . $row['country']); } $addres = new Address($row['unstructured_address']); $addres->setCountry($row['country']); $addres->setLatitude($row['latitude']); $addres->setLongitude($row['longitude']); $addres->setLocality($row['locality']); $addres->setPostalCode($row['postal_code']); $addres->setRegion($row['province']); $addres->setStreetAddress($row['street_address']); $addres->setType($row['address_type']); //FIXME quick and dirty hack to demo PC $addres->setPrimary(true); $addresses[] = $addres; } $person->setAddresses($addresses); } //TODO: Not in ATutor yet, skeleton field /* if (isset($fields['bodyType']) || isset($fields['@all'])) { $res2 = mysql_query($db, "select * from ".TABLE_PREFIX."person_body_type where person_id = " . $person_id); if (@mysql_num_rows($res2)) { $row = @mysql_fetch_assic($res2); $bodyType = new BodyType(); $bodyType->setBuild($row['build']); $bodyType->setEyeColor($row['eye_color']); $bodyType->setHairColor($row['hair_color']); $bodyType->setHeight($row['height']); $bodyType->setWeight($row['weight']); $person->setBodyType($bodyType); } } */ //TODO: Not in ATutor yet, skeleton field /* if (isset($fields['books']) || isset($fields['@all'])) { $books = array(); $res2 = mysqli_query($db, "select book from ".TABLE_PREFIX."person_books where person_id = " . $person_id); while (list($book) = @mysqli_fetch_row($res2)) { $books[] = $book; } $person->setBooks($books); } */ //TODO: Not in ATutor yet, skeleton field /* if (isset($fields['cars']) || isset($fields['@all'])) { $cars = array(); $res2 = mysqli_query($db, "select car from ".TABLE_PREFIX."person_cars where person_id = " . $person_id); while (list($car) = @mysqli_fetch_row($res2)) { $cars[] = $car; } $person->setCars($cars); } */ //TODO: Not in ATutor yet, skeleton field /* if (isset($fields['currentLocation']) || isset($fields['@all'])) { $addresses = array(); $res2 = mysqli_query($db, "select a.* from ".TABLE_PREFIX."person_current_location pcl, ".TABLE_PREFIX."person_addresses pa, ".TABLE_PREFIX."addresses a where a.id = pcl.address_id and pa.person_id = " . $person_id); if (@mysqli_num_rows($res2)) { $row = mysqli_fetch_array($res2, MYSQLI_ASSOC); if (empty($row['unstructured_address'])) { $row['unstructured_address'] = trim($row['street_address'] . " " . $row['region'] . " " . $row['country']); } $addres = new Address($row['unstructured_address']); $addres->setCountry($row['country']); $addres->setLatitude($row['latitude']); $addres->setLongitude($row['longitude']); $addres->setLocality($row['locality']); $addres->setPostalCode($row['postal_code']); $addres->setRegion($row['region']); $addres->setStreetAddress($row['street_address']); $addres->setType($row['address_type']); $person->setCurrentLocation($addres); } } */ //TODO: Email is a singleton in ATutor, expand it. A person may have 1+ emails nowadays. //added to the above with all the other member's properties /* if (isset($fields['emails']) || isset($fields['@all'])) { $emails = array(); $sql = "select address, email_type from ".TABLE_PREFIX."person_emails where person_id = " . $person_id; $res2 = mysql_query(); while (list($address, $type) = @mysqli_fetch_row($res2)) { $emails[] = new Email(strtolower($address), $type); // TODO: better email canonicalization; remove dups } $person->setEmails($emails); } */ //TODO: Not in ATutor yet, skeleton field /* if (isset($fields['food']) || isset($fields['@all'])) { $foods = array(); $res2 = mysqli_query($db, "select food from ".TABLE_PREFIX."person_foods where person_id = " . $person_id); while (list($food) = @mysqli_fetch_row($res2)) { $foods[] = $food; } $person->setFood($foods); } */ //TODO: Not in ATutor yet, skeleton field /* if (isset($fields['heroes']) || isset($fields['@all'])) { $strings = array(); $res2 = mysqli_query($db, "select hero from ".TABLE_PREFIX."person_heroes where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setHeroes($strings); } */ //Added with the above profile, interests is in CSV /* if (isset($fields['interests']) || isset($fields['@all'])) { $strings = array(); $res2 = mysqli_query($db, "select interest from ".TABLE_PREFIX."person_interests where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setInterests($strings); } */ $organizations = array(); $fetchedOrg = false; if (isset($fields['jobs']) || isset($fields['@all'])) { $sql = "SELECT * FROM " . TABLE_PREFIX . "social_member_position WHERE member_id = " . $member_id; $res2 = mysql_query($sql, $this->db); while ($row = mysql_fetch_assoc($res2)) { $organization = new Organization($row['company']); $organization->setDescription($row['description']); $organization->setEndDate($row['to']); $organization->setField($row['field']); $organization->setName($row['company']); $organization->setSalary($row['salary']); $organization->setStartDate($row['from']); $organization->setSubField($row['']); $organization->setTitle($row['title']); $organization->setWebpage($row['webpage']); $organization->setType('job'); //TODO: Address: To be implemented /* if ($row['address_id']) { $res3 = mysqli_query($db, "select * from ".TABLE_PREFIX."addresses where id = " . mysqli_real_escape_string($db, $row['address_id'])); if (mysqli_num_rows($res3)) { $row = mysqli_fetch_array($res3, MYSQLI_ASSOC); if (empty($row['unstructured_address'])) { $row['unstructured_address'] = trim($row['street_address'] . " " . $row['region'] . " " . $row['country']); } $addres = new Address($row['unstructured_address']); $addres->setCountry($row['country']); $addres->setLatitude($row['latitude']); $addres->setLongitude($row['longitude']); $addres->setLocality($row['locality']); $addres->setPostalCode($row['postal_code']); $addres->setRegion($row['region']); $addres->setStreetAddress($row['street_address']); $addres->setType($row['address_type']); $organization->setAddress($address); } } */ $organizations[] = $organization; } $fetchedOrg = true; } if (isset($fields['schools']) || isset($fields['@all'])) { $res2 = mysql_query("SELECT * FROM " . TABLE_PREFIX . "social_member_education WHERE member_id = " . $member_id, $this->db); while ($row = mysql_fetch_assoc($res2)) { $organization = new Organization($row['university']); $organization->setDescription($row['description']); $organization->setEndDate($row['to']); $organization->setField($row['field']); $organization->setName($row['university']); $organization->setSalary(''); $organization->setStartDate($row['from']); $organization->setSubField(''); $organization->setTitle($row['degree']); $organization->setWebpage(''); $organization->setType('school'); //TODO: Address: To be implemented /* if ($row['address_id']) { $res3 = mysqli_query($db, "select * from ".TABLE_PREFIX."addresses where id = " . mysqli_real_escape_string($db, $row['address_id'])); if (mysqli_num_rows($res3)) { $row = mysqli_fetch_array($res3, MYSQLI_ASSOC); if (empty($row['unstructured_address'])) { $row['unstructured_address'] = trim($row['street_address'] . " " . $row['region'] . " " . $row['country']); } $addres = new Address($row['unstructured_address']); $addres->setCountry($row['country']); $addres->setLatitude($row['latitude']); $addres->setLongitude($row['longitude']); $addres->setLocality($row['locality']); $addres->setPostalCode($row['postal_code']); $addres->setRegion($row['region']); $addres->setStreetAddress($row['street_address']); $addres->setType($row['address_type']); $organization->setAddress($address); } } */ $organizations[] = $organization; } $fetchedOrg = true; } if ($fetchedOrg) { $person->setOrganizations($organizations); } //TODO languagesSpoken, currently missing the languages / countries tables so can't do this yet //TODO: Not in ATutor yet, skeleton field /* if (isset($fields['movies']) || isset($fields['@all'])) { $strings = array(); $res2 = mysqli_query($db, "select movie from ".TABLE_PREFIX."person_movies where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setMovies($strings); } if (isset($fields['music']) || isset($fields['@all'])) { $strings = array(); $res2 = mysqli_query($db, "select music from ".TABLE_PREFIX."person_music where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setMusic($strings); } */ if (isset($fields['phoneNumbers']) || isset($fields['@all'])) { $numbers = array(); $res2 = mysql_query("SELECT phone FROM " . TABLE_PREFIX . "members where member_id = " . $member_id, $this->db); if ($res2) { while ($number = mysql_fetch_assoc($res2)) { $numbers[] = new Phone($number, 'Home'); //default to 'Home' until ATutor supports Mobile, etc. } } $person->setPhoneNumbers($numbers); } /* if (isset($fields['ims']) || isset($fields['@all'])) { $ims = array(); $res2 = mysqli_query($db, "select value, value_type from ".TABLE_PREFIX."person_ims where person_id = " . $person_id); while (list($value, $type) = @mysqli_fetch_row($res2)) { $ims[] = new Im($value, $type); } $person->setIms($ims); } if (isset($fields['accounts']) || isset($fields['@all'])) { $accounts = array(); $res2 = mysqli_query($db, "select domain, userid, username from ".TABLE_PREFIX."person_accounts where person_id = " . $person_id); while (list($domain, $userid, $username) = @mysqli_fetch_row($res2)) { $accounts[] = new Account($domain, $userid, $username); } $person->setAccounts($accounts); } if (isset($fields['quotes']) || isset($fields['@all'])) { $strings = array(); $res2 = mysqli_query($db, "select quote from ".TABLE_PREFIX."person_quotes where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setQuotes($strings); } if (isset($fields['sports']) || isset($fields['@all'])) { $strings = array(); $res2 = mysqli_query($db, "select sport from ".TABLE_PREFIX."person_sports where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setSports($strings); } if (isset($fields['tags']) || isset($fields['@all'])) { $strings = array(); $res2 = mysqli_query($db, "select tag from ".TABLE_PREFIX."person_tags where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setTags($strings); } if (isset($fields['turnOns']) || isset($fields['@all'])) { $strings = array(); $res2 = mysqli_query($db, "select turn_on from ".TABLE_PREFIX."person_turn_ons where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setTurnOns($strings); } if (isset($fields['turnOffs']) || isset($fields['@all'])) { $strings = array(); $res2 = mysqli_query($db, "select turn_off from ".TABLE_PREFIX."person_turn_offs where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setTurnOffs($strings); } */ if (isset($fields['urls']) || isset($fields['@all'])) { $strings = array(); $res2 = mysql_query("SELECT url, site_name FROM " . TABLE_PREFIX . "social_member_websites WHERE member_id = " . $member_id, $this->db); if ($res2) { while ($data = mysql_fetch_assoc($res2)) { /** * see * http://www.opensocial.org/Technical-Resources/opensocial-spec-v081/opensocial-reference#opensocial.Url */ $strings[] = new Url($data['url'], null, $data['site_name']); } } $strings[] = new Url($this->url_prefix . '/profile/' . $member_id, null, 'profile'); // always include profile URL $person->setUrls($strings); } $ret[$member_id] = $person; } } try { $ret = $this->filterResults($ret, $options); $ret['totalSize'] = count($ret); } catch (Exception $e) { $ret['totalSize'] = count($ret) - 1; $ret['filtered'] = 'false'; } if ($first !== false && $max !== false && is_numeric($first) && is_numeric($max) && $first >= 0 && $max > 0) { $count = 0; $result = array(); foreach ($ret as $id => $person) { if ($id == 'totalSize' || $id == 'filtered') { $result[$id] = $person; continue; } if ($count >= $first && $count < $first + $max) { $result[$id] = $person; } ++$count; } return $result; } else { return $ret; } }
$address->setDomDocument(); $address1 = new Address(); //$address->setAddressID(124); $address1->setNumber("unit 2415 Megaplaza Building"); $address1->setStreet("ADB Avenue corner Garnett Street"); $address1->setBarangay("Barangay San Antonio"); $address1->setDistrict("Ortigas Center"); $address1->setMunicipalityCity("Pasig City"); $address1->setProvince("Metro Manila"); $address1->setDomDocument(); $person = new Person(); //$person->setPersonID(126); $person->setFirstName("Nelson Juan"); $person->setMiddleName("Miranda"); $person->setLastName(date("H:i:s")); $person->setGender("male"); $person->setBirthday("1977/07/09"); $person->setMaritalStatus("single"); $person->setTin("1234567890"); $person->setTelephone("026584746"); $person->setMobileNumber("09175302791"); $person->setEmail("*****@*****.**"); $person->setAddressArray($address); $person->setAddressArray($address1); $person->setDomDocument(); $domDoc = $person->getDomDocument(); $xmlStr = $domDoc->dump_mem(true); $obj = new PersonEncode(); //echo "hello<br>"; echo $xmlStr; //echo $obj->updatePerson($xmlStr);
/** * Get User(s) * Return array of Person Model Objects * * @param * $ids of the userIds * @param * $profileDetails profile fields to fetched for the users * @param * $options other query options to get Users * @return * $ret array of person objects */ public function getPeople($ids, $profileDetails, $options) { $ret = array(); foreach ($ids as $id) { $user = array(); $res = db_query("SELECT * FROM {profile_values} INNER JOIN {profile_fields} ON {profile_values}.fid = {profile_fields}.fid WHERE uid =%d", $id); if ($res) { while ($row = db_fetch_array($res)) { $user[$row['name']] = $row['value']; $user['uid'] = $row['uid']; } if (!empty($user)) { $user_id = $user['uid']; $name = new Name($user['profile_fname'] . ' ' . $user['profile_lname']); $name->setGivenName($user['profile_fname']); $name->setFamilyName($user['profile_lname']); $address = new Address("UNSTRUCTUREDADDRESS"); $address->setLocality($user['profile_city']); $address->setCountry($user['profile_country']); $person = new Person($user['uid'], $name); $person->setAddresses(array($address)); $person->setNickname($user['profile_nickname']); $person->setProfileUrl($this->url_prefix . 'user/' . $user['uid']); $person->setDisplayName($user['profile_fname'] . ' ' . $user['profile_lname']); $res = db_query("SELECT picture FROM {users} WHERE uid = %d", $id); $row = db_fetch_array($res); $person->setThumbnailUrl(!empty($row['picture']) ? $this->url_prefix . $row['picture'] : ''); if (strtolower($user['profile_gender']) == 'female') { $person->setGender('FEMALE'); } else { $person->setGender('MALE'); } $ret[$user_id] = $person; } } } //Invoke hook_people_alter() implementations $this->drupalAlter('people', $ret, $profileDetails, $options); return $ret; }
/** * @expectedException \InvalidArgumentException * @expectedExceptionMessage Invalid gender specified. */ public function testSetInvalidGender() { $max = new Person('Max', 'Mustermann', Person::GENDER_MALE); $max->setGender('invalid'); }
/** * Tests Person->setGender() */ public function testSetGender() { $this->Person->setGender('MALE'); $this->assertEquals('Male', $this->Person->gender->displayValue); }
public function getPeople($ids, $fields, $options, $token) { $first = $options->getStartIndex(); $max = $options->getCount(); $this->checkDb(); $ret = array(); $filterQuery = ''; if ($options->getFilterBy() == 'hasApp') { // remove the filterBy field, it's taken care of in the query already, otherwise filterResults will disqualify all results $options->setFilterBy(null); $appId = $token->getAppId(); $filterQuery = " and id in (select person_id from person_applications where application_id = {$appId})"; } elseif ($options->getFilterBy() == 'all') { $options->setFilterBy(null); } elseif ($options->getFilterBy() == '@friends') { $options->setFilterBy(null); $somePersonId = $options->getFilterValue(); if ($options->getFilterValue() == '@viewer') { $somePersonId = $token->getViewerId(); } elseif ($options->getFilterValue() == '@owner') { $somePersonId = $token->getOwnerId(); } $filteredIds = array(); foreach ($ids as $personId) { if (in_array($somePersonId, $this->getFriendIds($personId))) { $filteredIds[] = $personId; } } $ids = $filteredIds; } $query = "select * from persons where id in (" . implode(',', $ids) . ") {$filterQuery} order by id "; $res = mysqli_query($this->db, $query); if ($res) { while ($row = @mysqli_fetch_array($res, MYSQLI_ASSOC)) { $person_id = $row['id']; $name = $this->convertName($row); $person = new Person($row['id'], $name); $person->setDisplayName($name->getFormatted()); $person->setAboutMe($row['about_me']); $person->setAge($row['age']); $person->setChildren($row['children']); $person->setBirthday(date('Y-m-d', $row['date_of_birth'])); $person->setEthnicity($row['ethnicity']); $person->setFashion($row['fashion']); $person->setHappiestWhen($row['happiest_when']); $person->setHumor($row['humor']); $person->setJobInterests($row['job_interests']); $person->setLivingArrangement($row['living_arrangement']); $person->setLookingFor($row['looking_for']); $person->setNickname($row['nickname']); $person->setPets($row['pets']); $person->setPoliticalViews($row['political_views']); $person->setProfileSong($row['profile_song']); $person->setProfileUrl($this->url_prefix . '/profile/' . $row['id']); $person->setProfileVideo($row['profile_video']); $person->setRelationshipStatus($row['relationship_status']); $person->setReligion($row['religion']); $person->setRomance($row['romance']); $person->setScaredOf($row['scared_of']); $person->setSexualOrientation($row['sexual_orientation']); $person->setStatus($row['status']); $person->setThumbnailUrl(!empty($row['thumbnail_url']) ? $this->url_prefix . $row['thumbnail_url'] : ''); if (!empty($row['thumbnail_url'])) { // also report thumbnail_url in standard photos field (this is the only photo supported by partuza) $person->setPhotos(array(new Photo($this->url_prefix . $row['thumbnail_url'], 'thumbnail', true))); } $person->setUtcOffset(sprintf('%+03d:00', $row['time_zone'])); // force "-00:00" utc-offset format if (!empty($row['drinker'])) { $person->setDrinker($row['drinker']); } if (!empty($row['gender'])) { $person->setGender(strtolower($row['gender'])); } if (!empty($row['smoker'])) { $person->setSmoker($row['smoker']); } /* the following fields require additional queries so are only executed if requested */ if (isset($fields['activities']) || in_array('@all', $fields)) { $activities = array(); $res2 = mysqli_query($this->db, "select activity from person_activities where person_id = " . $person_id); while (list($activity) = @mysqli_fetch_row($res2)) { $activities[] = $activity; } $person->setActivities($activities); } if (isset($fields['addresses']) || in_array('@all', $fields)) { $addresses = array(); $res2 = mysqli_query($this->db, "select addresses.* from person_addresses, addresses where addresses.id = person_addresses.address_id and person_addresses.person_id = " . $person_id); while ($row = @mysqli_fetch_array($res2, MYSQLI_ASSOC)) { $address = $this->convertAddress($row); //FIXME quick and dirty hack to demo PC $address->setPrimary(true); $addresses[] = $address; } $person->setAddresses($addresses); } if (isset($fields['bodyType']) || in_array('@all', $fields)) { $res2 = mysqli_query($this->db, "select * from person_body_type where person_id = " . $person_id); if (@mysqli_num_rows($res2)) { $row = @mysqli_fetch_array($res2, MYSQLI_ASSOC); $bodyType = new BodyType(); $bodyType->setBuild($row['build']); $bodyType->setEyeColor($row['eye_color']); $bodyType->setHairColor($row['hair_color']); $bodyType->setHeight($row['height']); $bodyType->setWeight($row['weight']); $person->setBodyType($bodyType); } } if (isset($fields['books']) || in_array('@all', $fields)) { $books = array(); $res2 = mysqli_query($this->db, "select book from person_books where person_id = " . $person_id); while (list($book) = @mysqli_fetch_row($res2)) { $books[] = $book; } $person->setBooks($books); } if (isset($fields['cars']) || in_array('@all', $fields)) { $cars = array(); $res2 = mysqli_query($this->db, "select car from person_cars where person_id = " . $person_id); while (list($car) = @mysqli_fetch_row($res2)) { $cars[] = $car; } $person->setCars($cars); } if (isset($fields['currentLocation']) || in_array('@all', $fields)) { $addresses = array(); $res2 = mysqli_query($this->db, "select addresses.* from person_current_location, person_addresses, addresses where addresses.id = person_current_location.address_id and person_addresses.person_id = " . $person_id); if (@mysqli_num_rows($res2)) { $row = mysqli_fetch_array($res2, MYSQLI_ASSOC); $addres = $this->convertAddress($row); $person->setCurrentLocation($addres); } } if (isset($fields['emails']) || in_array('@all', $fields)) { $emails = array(); $res2 = mysqli_query($this->db, "select address, email_type from person_emails where person_id = " . $person_id); while (list($address, $type) = @mysqli_fetch_row($res2)) { $emails[] = new Email(strtolower($address), $type); // TODO: better email canonicalization; remove dups } $person->setEmails($emails); } if (isset($fields['food']) || in_array('@all', $fields)) { $foods = array(); $res2 = mysqli_query($this->db, "select food from person_foods where person_id = " . $person_id); while (list($food) = @mysqli_fetch_row($res2)) { $foods[] = $food; } $person->setFood($foods); } if (isset($fields['heroes']) || in_array('@all', $fields)) { $strings = array(); $res2 = mysqli_query($this->db, "select hero from person_heroes where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setHeroes($strings); } if (isset($fields['interests']) || in_array('@all', $fields)) { $strings = array(); $res2 = mysqli_query($this->db, "select interest from person_interests where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setInterests($strings); } $organizations = array(); $fetchedOrg = false; if (isset($fields['jobs']) || in_array('@all', $fields)) { $res2 = mysqli_query($this->db, "select organizations.* from person_jobs, organizations where organizations.id = person_jobs.organization_id and person_jobs.person_id = " . $person_id); while ($row = mysqli_fetch_array($res2, MYSQLI_ASSOC)) { $organizations[] = $this->convertOrganization($row, 'job'); } $fetchedOrg = true; } if (isset($fields['schools']) || in_array('@all', $fields)) { $res2 = mysqli_query($this->db, "select organizations.* from person_schools, organizations where organizations.id = person_schools.organization_id and person_schools.person_id = " . $person_id); while ($row = mysqli_fetch_array($res2, MYSQLI_ASSOC)) { $organizations[] = $this->convertOrganization($row, 'school'); } $fetchedOrg = true; } if ($fetchedOrg) { $person->setOrganizations($organizations); } //TODO languagesSpoken, currently missing the languages / countries tables so can't do this yet if (isset($fields['movies']) || in_array('@all', $fields)) { $strings = array(); $res2 = mysqli_query($this->db, "select movie from person_movies where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setMovies($strings); } if (isset($fields['music']) || in_array('@all', $fields)) { $strings = array(); $res2 = mysqli_query($this->db, "select music from person_music where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setMusic($strings); } if (isset($fields['phoneNumbers']) || in_array('@all', $fields)) { $numbers = array(); $res2 = mysqli_query($this->db, "select number, number_type from person_phone_numbers where person_id = " . $person_id); while (list($number, $type) = @mysqli_fetch_row($res2)) { $numbers[] = new Phone($number, $type); } $person->setPhoneNumbers($numbers); } if (isset($fields['ims']) || in_array('@all', $fields)) { $ims = array(); $res2 = mysqli_query($this->db, "select value, value_type from person_ims where person_id = " . $person_id); while (list($value, $type) = @mysqli_fetch_row($res2)) { $ims[] = new Im($value, $type); } $person->setIms($ims); } if (isset($fields['accounts']) || in_array('@all', $fields)) { $accounts = array(); $res2 = mysqli_query($this->db, "select domain, userid, username from person_accounts where person_id = " . $person_id); while (list($domain, $userid, $username) = @mysqli_fetch_row($res2)) { $accounts[] = new Account($domain, $userid, $username); } $person->setAccounts($accounts); } if (isset($fields['quotes']) || in_array('@all', $fields)) { $strings = array(); $res2 = mysqli_query($this->db, "select quote from person_quotes where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setQuotes($strings); } if (isset($fields['sports']) || in_array('@all', $fields)) { $strings = array(); $res2 = mysqli_query($this->db, "select sport from person_sports where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setSports($strings); } if (isset($fields['tags']) || in_array('@all', $fields)) { $strings = array(); $res2 = mysqli_query($this->db, "select tag from person_tags where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setTags($strings); } if (isset($fields['turnOns']) || in_array('@all', $fields)) { $strings = array(); $res2 = mysqli_query($this->db, "select turn_on from person_turn_ons where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setTurnOns($strings); } if (isset($fields['turnOffs']) || in_array('@all', $fields)) { $strings = array(); $res2 = mysqli_query($this->db, "select turn_off from person_turn_offs where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = $data; } $person->setTurnOffs($strings); } if (isset($fields['urls']) || in_array('@all', $fields)) { $strings = array(); $res2 = mysqli_query($this->db, "select url from person_urls where person_id = " . $person_id); while (list($data) = @mysqli_fetch_row($res2)) { $strings[] = new Url($data, null, null); } $strings[] = new Url($this->url_prefix . '/profile/' . $person_id, null, 'profile'); // always include profile URL $person->setUrls($strings); } $ret[$person_id] = $person; } } try { $ret = $this->filterResults($ret, $options); $ret['totalSize'] = count($ret); } catch (Exception $e) { $ret['totalSize'] = count($ret) - 1; $ret['filtered'] = 'false'; } if ($first !== false && $max !== false && is_numeric($first) && is_numeric($max) && $first >= 0 && $max > 0) { $count = 0; $result = array(); foreach ($ret as $id => $person) { if ($id == 'totalSize' || $id == 'filtered') { $result[$id] = $person; continue; } if ($count >= $first && $count < $first + $max) { $result[$id] = $person; } ++$count; } return $result; } else { return $ret; } }
public function executeStepSave(sfWebRequest $request) { $passenger_session_step5 = $this->getUser()->getAttribute('passangers_step5'); if (!$passenger_session_step5) { return $this->forward('passanger', 'step5_4'); } //save Person data $person = new Person(); $person->setTitle($passenger_session_step5['title']); $person->setFirstName($passenger_session_step5['firstname']); $person->setLastName($passenger_session_step5['lastname']); $person->setAddress1($passenger_session_step5['address1']); $person->setAddress2($passenger_session_step5['address2']); $person->setCity($passenger_session_step5['city']); $person->setCounty($passenger_session_step5['county']); $person->setState($passenger_session_step5['state']); $person->setCountry($passenger_session_step5['country']); $person->setZipcode($passenger_session_step5['zipcode']); $person->setDayPhone($passenger_session_step5['day_phone']); $person->setDayComment($passenger_session_step5['day_comment']); $person->setEveningPhone($passenger_session_step5['eve_phone']); $person->setEveningComment($passenger_session_step5['eve_comment']); $person->setMobilePhone($passenger_session_step5['mobile_phone']); $person->setMobileComment($passenger_session_step5['mobile_comment']); $person->setPagerPhone($passenger_session_step5['pager_phone']); $person->setPagerComment($passenger_session_step5['pager_comment']); $person->setOtherPhone($passenger_session_step5['other_comment']); $person->setOtherComment($passenger_session_step5['other_comment']); $person->setFaxPhone1($passenger_session_step5['fax_phone1']); $person->setFaxComment1($passenger_session_step5['fax_comment1']); $person->setAutoFax($passenger_session_step5['auto_fax']); $person->setFaxPhone2($passenger_session_step5['fax_phone2']); $person->setFaxComment2($passenger_session_step5['fax_comment2']); $person->setEmail($passenger_session_step5['email']); $person->setEmailTextOnly($passenger_session_step5['textonly']); $person->setEmailBlocked($passenger_session_step5['emailblocked']); $person->setComment($passenger_session_step5['comment']); $person->setBlockMailings($passenger_session_step5['blockmailings']); $person->setNewsletter($passenger_session_step5['newsletter']); $person->setGender($passenger_session_step5['gender']); $person->setDeceased($passenger_session_step5['deceased']); $person->setDeceasedComment($passenger_session_step5['deceased_comment']); $person->setSecondaryEmail($passenger_session_step5['secemail']); $person->setDeceasedDate($passenger_session_step5['deceased_date']); $person->setMiddleName($passenger_session_step5['middlename']); $person->setSuffix($passenger_session_step5['suffix']); $person->setNickname($passenger_session_step5['nickname']); $person->setVeteran($passenger_session_step5['military']); $person->save(); //save Passenger data $passenger = new Passenger(); $passenger->setPersonId($person->getId()); if ($passenger_session_step5['passenger_type_id'] == 0) { $passenger->setPassengerTypeId(null); } else { $passenger->setPassengerTypeId($passenger_session_step5['passenger_type_id']); } $passenger->setParent($passenger_session_step5['parent']); $passenger->setDateOfBirth($passenger_session_step5['date_of_birth']); $passenger->setWeight($passenger_session_step5['weight']); $passenger->setIllness($passenger_session_step5['illness']); $passenger->setPassengerIllnessCategoryId($passenger_session_step5['passenger_illness_category_id']); $passenger->setLanguageSpoken($passenger_session_step5['language_spoken']); $passenger->setBestContactMethod($passenger_session_step5['best_contact_method']); $passenger->setFinancial($passenger_session_step5['facility_name']); $passenger->setPublicConsiderations($passenger_session_step5['public_considerations']); $passenger->setPrivateConsiderations($passenger_session_step5['private_considerations']); $passenger->setGroundTransportationComment($passenger_session_step5['ground_transportation_comment']); $passenger->setTravelHistoryNotes($passenger_session_step5['travel_history_notes']); $passenger->setReleasingPhysician($passenger_session_step5['releasing_physician']); $passenger->setReleasingPhone($passenger_session_step5['releasing_phone']); $passenger->setReleasingFax1($passenger_session_step5['releasing_fax1']); $passenger->setReleasingFax1Comment($passenger_session_step5['releasing_fax1_comment']); $passenger->setReleasingEmail($passenger_session_step5['releasing_email']); $passenger->setNeedMedicalRelease($passenger_session_step5['need_medical_release']); $passenger->setMedicalReleaseRequested($passenger_session_step5['medical_release_requested']); $passenger->setMedicalReleaseReceived($passenger_session_step5['medical_release_received']); $passenger->setTreatingPhysician($passenger_session_step5['treating_physician']); $passenger->setTreatingPhone($passenger_session_step5['treating_phone']); $passenger->setTreatingFax1($passenger_session_step5['treating_fax1']); $passenger->setTreatingFax1Comment($passenger_session_step5['treating_fax1_comment']); $passenger->setTreatingEmail($passenger_session_step5['treating_email']); $passenger->setLanguageSpoken($passenger_session_step5['language_spoken']); $passenger->setLodgingPhone($passenger_session_step5['lodging_phone']); $passenger->setLodgingPhoneComment($passenger_session_step5['lodging_phone_comment']); $passenger->setFacilityName($passenger_session_step5['facility_name']); $passenger->setFacilityPhone($passenger_session_step5['facility_phone']); $passenger->setFacilityPhoneComment($passenger_session_step5['facility_phone_comment']); $passenger->setEmergencyContactName($passenger_session_step5['emergency_contact_name']); $passenger->setEmergencyContactPrimaryPhone($passenger_session_step5['emergency_contact_primary_phone']); $passenger->setEmergencyContactPrimaryComment($passenger_session_step5['emergency_contact_primary_comment']); $passenger->setEmergencyContactSecondaryPhone($passenger_session_step5['emergency_contact_secondary_phone']); $passenger->setEmergencyContactSecondaryComment($passenger_session_step5['emergency_contact_secondary_comment']); $passenger->save(); $key = $passenger_session_step5['key']; $this->getUser()->setFlash('success', 'Passenger information has been successfully created!'); $this->redirect('@passenger'); //removing used session like passenger data unset($passenger_session_step5p[$key]); $this->getUser()->setAttribute('passanger_step5', $passenger_session_step5); }
/** * Tests Person->setGender() */ public function testSetGender() { $this->Person->setGender('MALE'); $this->assertEquals('MALE', $this->Person->gender); }
public function getPeople($ids, $profileDetails) { $ret = array(); $query = "select * from user_profile where user_id in (" . implode(',', $ids) . ")"; $res = mysql_query($query); if ($res) { while ($row = @mysql_fetch_assoc($res)) { $person_id = $row['user_id']; $name = new Name($row['first_name'] . ' ' . $row['last_name']); $name->setGivenName($row['first_name']); $name->setFamilyName($row['last_name']); $person = new Person($row['user_id'], $name); $person->setProfileUrl($row['profile_url']); $date = date($row['date_of_birth']); $person->setDateOfBirth($date); $address = new Address($row['city']); $address->setLocality($row['city']); $person->setAddresses($address); $interests = $row['interests']; $interests = explode(',', $interests); $person->setInterests($interests); $person->setThumbnailUrl(!empty($row['user_image']) ? $this->url_prefix . $row['user_image'] : ''); if (!empty($row['Gender'])) { if ($row['Gender'] == 'f') { $person->setGender('FEMALE'); } else { $person->setGender('MALE'); } } $ret[$person_id] = $person; } } return $ret; }
/** * Only Acceptable values are MALE or FEMALE * * @param Person $rawOSPerson * @see http://code.google.com/apis/opensocial/docs/0.7/reference/opensocial.Enum.Gender.html */ private static function enforceGender(Person &$rawOSPerson) { $gender = $rawOSPerson->getGender(); if ($gender == 'M' || $gender == 'm') { $rawOSPerson->setGender('MALE'); } else { $rawOSPerson->setGender('FEMALE'); } }