本文整理汇总了PHP中Address::setLocality方法的典型用法代码示例。如果您正苦于以下问题:PHP Address::setLocality方法的具体用法?PHP Address::setLocality怎么用?PHP Address::setLocality使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Address
的用法示例。
在下文中一共展示了Address::setLocality方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPeople
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;
}
示例2: testSetLocality
/**
* Tests Address->setLocality()
*/
public function testSetLocality()
{
$this->Address->setLocality('locality');
$this->assertEquals('locality', $this->Address->locality);
}
示例3: getPeople
//.........这里部分代码省略.........
$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);
示例4: getPeople
/**
* 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;
}
示例5: convertAddress
/**
* Converts the address fetched from the database to the Address object.
*/
private function convertAddress($row)
{
$formatted = $row['unstructured_address'];
if (empty($formatted)) {
$formatted = trim($row['street_address'] . " " . $row['region'] . " " . $row['country']);
$formatted = empty($formatted) ? $formatted : null;
}
$address = new Address($formatted);
$address->setCountry($row['country']);
$address->setLatitude($row['latitude']);
$address->setLongitude($row['longitude']);
$address->setLocality($row['locality']);
$address->setPostalCode($row['postal_code']);
$address->setRegion($row['region']);
$address->setStreetAddress($row['street_address']);
$address->setType($row['address_type']);
$address->setUnstructuredAddress($row['unstructured_address']);
$address->setExtendedAddress($row['extended_address']);
$address->setPoBox($row['po_box']);
return $address;
}
示例6: getPeople
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']);
//.........这里部分代码省略.........