public function actionEditmoreinfo($user_id) { $user_more_info = UserInfoAR::model()->findByPk($user_id); $this->assign('user_more', $user_more_info); $maritalStatus = MaritalStatus::model()->findAll(); // 'MaritalStatus', 'marital_status_id'), $hometown = Hometown::model()->findAll(); // 'Province', 'hometown_id'), $nation = Nation::model()->findAll(); // 'Nation', 'nation_id'), $bodyType = BodyType::model()->findAll(); // 'BodyType', 'body_type_id'), $education = Education::model()->findAll(); // 'Education', 'education_id'), $school = School::model()->findAll(); // 'School', 'school_id'), $province = Province::model()->findAll(); // 'Province', 'province_id'), $job = Job::model()->findAll(); // '$maritalSta, $this->assign('maritalStatus', $maritalStatus); $this->assign('hometown', $hometown); $this->assign('nation', $nation); $this->assign('bodyType', $bodyType); $this->assign('education', $education); $this->assign('school', $school); $this->assign('province', $province); $this->assign('job', $job); }
public function __construct($baseShape, $includeMimeContent = null, $bodyType = null, $additionalProperties = null) { if (!DefaultShapeNames::isValidShape($baseShape)) { throw new InvalidArgumentException('Provided base shape is invalid'); } if ($bodyType === null) { $bodyType = BodyType::TYPE_BEST; } elseif (!BodyType::isValidBodyType($bodyType)) { throw new InvalidArgumentException('Provided body type is invalid'); } $this->BaseShape = $baseShape; $this->IncludeMimeContent = Boolean::getBoolean($includeMimeContent); $this->BodyType = $bodyType; }
/** * Tests BodyType->setWeight() */ public function testSetWeight() { $this->BodyType->setWeight('weight'); $this->assertEquals('weight', $this->BodyType->getWeight()); }
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; } }