本文整理汇总了PHP中Person::get_first_name方法的典型用法代码示例。如果您正苦于以下问题:PHP Person::get_first_name方法的具体用法?PHP Person::get_first_name怎么用?PHP Person::get_first_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person::get_first_name方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testConstructor
function testConstructor()
{
$test_person = new Person("John", "Smith", "10-12-87", "Male", "555 Main Street", "Flushing", "NY", "11111", "20724415902", "2072654046", "john.smith@stjohns.edu", "volunteer", " ", "Schedule", "I like helping out", "55555", "03-14-14", "email");
echo "Testing first name" . '</br>';
if ($test_person->get_first_name() == "John") {
echo 'First name test succeeded </br>';
} else {
echo 'First name test failed </br>';
}
if ($test_person->get_last_name() == "Smith") {
echo 'last name test succeeded </br>';
} else {
echo 'last name test failed </br>';
}
if ($test_person->get_gender() == "Male") {
echo 'gender test succeeded </br>';
} else {
echo 'gender test failed </br>';
}
if ($test_person->get_address() == "555 Main Street") {
echo 'address test succeeded </br>';
} else {
echo 'address test failed </br>';
}
if ($test_person->get_city() == "Flushing") {
echo 'city test succeeded </br>';
} else {
echo 'city test failed </br>';
}
if ($test_person->get_state() == "NY") {
echo 'state test succeeded </br>';
} else {
echo 'state test failed </br>';
}
if ($test_person->get_zip() == "11111") {
echo 'zip test succeeded </br>';
} else {
echo 'zip test failed </br>';
}
if ($test_person->get_county() == "Queens") {
echo 'county test succeeded </br>';
} else {
echo 'county test failed </br>';
}
if ($test_person->get_phone1() == "20724415902") {
echo 'phone1 test succeeded </br>';
} else {
echo 'phone1 test failed </br>';
}
if ($test_person->get_phone2() == "2072654046") {
echo 'phone2 test succeeded </br>';
} else {
echo 'phone2 test failed </br>';
}
}
示例2: testPersonModule
function testPersonModule()
{
$myPerson = new Person("Taylor", "Talmage", "928 SU", "Brunswick", "ME", 04011, 2074415902, 2072654046, "ttalmage@bowdoin.edu", "volunteer", "soupkitchen", "C", "active", "Mon:1,Tue:3,Wed:1", "09-19-13,09-16-13", "02-19-89", "03-14-08", "this is a note", "Taylor2074415902");
//first assertion - check that a getter is working from the superconstructor's initialized data
$this->assertTrue($myPerson->get_first_name() == "Taylor");
$this->assertTrue($myPerson->get_type() == "volunteer");
$this->assertTrue($myPerson->get_status() == "active");
$this->assertEqual($myPerson->get_availability(), array("Mon:1", "Tue:3", "Wed:1"));
$this->assertTrue($myPerson->get_last_name() !== "notMyLastName");
echo "testPerson complete";
}
示例3: testPersonModule
function testPersonModule()
{
$myPerson = new Person("Susan", "L", "portland", "928 SU", "Portland", "ME", 04011, 2074415902, "home", 2072654046, "cell", "susanl@aol.com", "volunteer", "", "", "active", "USM", "student", 3, "semester", "I like helping out", "cooking", "", "Mon:9-12:portland,Sun:evening:portland", "", "", "89-02-19", "08-03-14", "internet", "this is a note", "");
//first assertion - check that a getter is working from the superconstructor's initialized data
$this->assertTrue($myPerson->get_first_name() == "Susan");
$this->assertTrue($myPerson->get_type() == array("volunteer"));
$this->assertTrue($myPerson->get_status() == "active");
$this->assertTrue($myPerson->get_city() == "Portland");
$this->assertTrue($myPerson->get_phone1() == 2074415902);
$this->assertTrue($myPerson->get_employer() == "USM");
$this->assertEqual($myPerson->get_availability(), array("Mon:9-12:portland", "Sun:evening:portland"));
$this->assertTrue($myPerson->get_last_name() !== "notMyLastName");
$this->assertTrue($myPerson->get_phone1type() !== "work");
$this->assertTrue($myPerson->get_howdidyouhear() == "internet");
$this->assertTrue($myPerson->get_birthday() == "89-02-19");
echo "testPerson complete";
}
示例4: testPersonModule
function testPersonModule()
{
$this->assertEqual(true, true);
$this->assertTrue(true);
$this->assertFalse(false);
//fake person to test
$test_person = new Person("Smith", "John", "123 College Street", "Brunswick", "ME", "04011", "(207)555-1234", "", "email@bowdoin.edu", "guest", "", "Jane Smith", "98-01-01", "parent", "");
//testing getter functions
$this->assertTrue($test_person->get_first_name() == "John");
$this->assertTrue($test_person->get_last_name() == "Smith");
$this->assertTrue($test_person->get_address() == "123 College Street");
$this->assertTrue($test_person->get_city() == "Brunswick");
$this->assertTrue($test_person->get_state() == "ME");
$this->assertTrue($test_person->get_zip() == "04011");
$this->assertTrue($test_person->get_phone1() == "(207)555-1234");
$this->assertTrue($test_person->get_phone2() == "");
$this->assertTrue($test_person->get_email() == "email@bowdoin.edu");
$this->assertTrue($test_person->get_patient_name() == "Jane Smith");
$this->assertTrue($test_person->get_patient_birthdate() == "98-01-01");
$this->assertTrue($test_person->get_patient_relation() == "parent");
//tests the 'check_type' function
$this->assertTrue($test_person->check_type("guest"));
//checks that the checkin dates array returns false correctly
$this->assertFalse(in_array("11-02-01", $test_person->get_prior_bookings()));
//adds a checkin date and checks that it was added to the array
$test_person->add_prior_booking("10-05-01John2075551234");
$this->assertTrue(in_array("10-05-01John2075551234", $test_person->get_prior_bookings()));
//tests adding and checking type
$this->assertFalse($test_person->check_type("social worker"));
$test_person->add_type("social worker");
$this->assertTrue($test_person->check_type("social worker"));
//checks the manager notes getter and setter
$this->assertFalse($test_person->get_mgr_notes(), "note");
$test_person->set_mgr_notes("here is a note");
$this->assertEqual($test_person->get_mgr_notes(), "here is a note");
echo "testPerson complete";
}
示例5: removeContactGroup
function removeContactGroup($group)
{
//global the variables
global $contactForm;
//if the user confirms the delete then delete the id
if (isset($_POST['deleteYes'])) {
//if the id is valid delete
if (is_numeric($_GET['contactID']) && is_numeric($_GET['contactTypeID'])) {
$contact = new Person($_GET['contactID']);
$contactType = new PersonType($_GET['contactTypeID']);
if ($group->remove_contact($_GET['contactID'], $_GET['contactTypeID'])) {
$status = "success";
$_SESSION['action'] = "Removed from " . $contactType->get_name() . ": " . $contact->get_first_name() . " " . $contact->get_last_name();
echo "<meta http-equiv=\"REFRESH\" content=\"0;url=" . $_SERVER['PHP_SELF'] . "?action=showGroup&groupID=" . $_GET['groupID'] . "&delete={$status}\">";
} else {
$link = $_SERVER['PHP_SELF'] . "?action=showGroup&groupID=" . $_GET['groupID'];
$contactForm->error("Warning: Failed to remove customer. Reason: " . $group->get_error(), $link);
}
}
} else {
if (isset($_POST['deleteNo'])) {
echo "<meta http-equiv=\"REFRESH\" content=\"0;url=" . $_SERVER['PHP_SELF'] . "?action=showGroup&groupID=" . $_GET['groupID'] . "\">";
} else {
$contactForm->prompt("Are you sure you want to delete?");
}
}
}
示例6: getallheaders
<?php
//allow access to API
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Headers:email,password');
//use files
require_once 'classes/person.php';
require_once 'classes/generatetoken.php';
//read headers
$headers = getallheaders();
//check if headers were received
if (isset($headers['email']) & isset($headers['password'])) {
try {
//create object
$p = new Person($headers['email'], $headers['password']);
//display j
echo '{"status":0,
"id":"' . $p->get_id() . '",
"name":"' . $p->get_first_name() . '",
"email":"' . $headers['email'] . '",
"token":"' . generate_token($p->get_email()) . '"
}';
} catch (RecordNotFoundException $ex) {
echo '{"status": "1","errorMessage":"' . $ex->get_message() . '"}';
}
} else {
echo '{"status":2,"errorMessage":"invalidHeaders"}';
}
示例7: process_form
$availability = null;
} else {
$postavail = array();
foreach ($_POST['availability'] as $postday) {
$postavail[] = $postday;
}
$availability = implode(',', $postavail);
}
if ($_POST['isstudent'] == "yes") {
$position = "student";
$employer = $_POST['nameofschool'];
} else {
$position = $_POST['position'];
$employer = $_POST['employer'];
}
$person = new Person($person->get_first_name(), $_POST['last_name'], $_POST['location'], $_POST['address'], $_POST['city'], $_POST['state'], $_POST['zip'], $person->get_phone1(), $_POST['phone1type'], $_POST['phone2'], $_POST['phone2type'], $_POST['email'], implode(',', $_POST['type']), $_POST['screening_type'], implode(',', $_POST['screening_status']), $_POST['status'], $employer, $position, $_POST['credithours'], $_POST['commitment'], $_POST['motivation'], $_POST['specialties'], $_POST['convictions'], $availability, $_POST['schedule'], $_POST['hours'], $_POST['birthday'], $_POST['start_date'], $_POST['howdidyouhear'], $_POST['notes'], $_POST['old_pass']);
include 'personForm.inc';
} else {
process_form($id, $person);
}
echo "</div>";
include 'footer.inc';
echo '</div></body></html>';
die;
}
/**
* process_form sanitizes data, concatenates needed data, and enters it all into a database
*/
function process_form($id, $person)
{
//echo($_POST['first_name']);
示例8: Person
$json = '{ "status" : 0, "childs" : [';
$json .= '{ "id" : "' . $c->get_id() . '",
"photo" : "' . $c->get_photo() . '",
"firstname" : "' . $c->get_first_name() . '",
"lastname" : "' . $c->get_last_name() . '",
"dateofbirth" : "' . $c->get_date_of_birth() . '",
"skills" : "' . $c->get_skills() . '",
"status" : "' . $c->get_status() . '",';
$id = $c->get_tutor();
$tutor = new Person($id);
$json .= '
"tutor" : {
"id" : "' . $tutor->get_id() . '",
"role" : "' . $tutor->get_role() . '",
"photo" : "' . $tutor->get_photo() . '",
"firstname" : "' . $tutor->get_first_name() . '",
"lastname" : "' . $tutor->get_last_name() . '",
"date_of_birth" : "' . $tutor->get_date_of_birth() . '",
"email" : "' . $tutor->get_email() . '",
"phone" : "' . $tutor->get_phone() . '",
"address" : "' . $tutor->get_address() . '"
},';
$id_transporter = $c->get_transporter();
$transporter = new Transporter($id_transporter);
$json .= '
"transporter" : {
"id" : "' . $transporter->get_id() . '",
"photo" : "' . $transporter->get_photo() . '",
"firstname" : "' . $transporter->get_first_name() . '",
"lastname" : "' . $transporter->get_last_name() . '",
示例9: getallheaders
require_once 'classes/generatetoken.php';
require_once 'classes/transporter.php';
require_once 'classes/person.php';
//get headers
$headers = getallheaders();
//validate parameter and headers
if (isset($_GET['id']) & isset($headers['email']) & isset($headers['token'])) {
//validate
if ($headers['token'] == generate_token($headers['email'])) {
try {
$t = new Person($_GET['id']);
$json = '{ "status" : 0, "tutors" : [';
//read makes
$json .= '{ "id" : "' . $t->get_id() . '",
"photo" : "' . $t->get_photo() . '",
"firstname" : "' . $t->get_first_name() . '",
"lastname" : "' . $t->get_last_name() . '",
"dateofbirth" : "' . $t->get_date_of_birth() . '",
"email" : "' . $t->get_email() . '",
"phone" : "' . $t->get_phone() . '",
"address" : "' . $t->get_address() . '",
"childs" : [';
$childs = $t->get_childs();
$second = true;
foreach ($childs as $c) {
if ($second) {
$second = false;
} else {
$json .= ',';
}
$json .= '{ "id" : "' . $c->get_id() . '",
示例10: Person
<?php
require_once 'classes/person.php';
require_once 'classes/connection.php';
try {
$p = new Person("hogi@gmail.com");
echo $p->get_first_name();
} catch (RecordNotFoundException $ex) {
echo $ex->get_message();
}
示例11: testConstructor
function testConstructor()
{
$test_person = new Person("John", "Smith", "10-12-87", "Male", "555 Main Street", "Flushing", "NY", "11111", "20724415902", "2072654046", "john.smith@stjohns.edu", "volunteer", " ", "Schedule", "I like helping out", "55555", "03-14-14", "email");
echo "Testing first name" . '</br>';
if ($test_person->get_first_name() == "John") {
echo 'First name test succeeded </br>';
} else {
echo 'First name test failed </br>';
}
if ($test_person->get_last_name() == "Smith") {
echo 'last name test succeeded </br>';
} else {
echo 'last name test failed </br>';
}
if ($test_person->get_gender() == "Male") {
echo 'gender test succeeded </br>';
} else {
echo 'gender test failed </br>';
}
if ($test_person->get_address() == "555 Main Street") {
echo 'address test succeeded </br>';
} else {
echo 'address test failed </br>';
}
if ($test_person->get_city() == "Flushing") {
echo 'city test succeeded </br>';
} else {
echo 'city test failed </br>';
}
if ($test_person->get_state() == "NY") {
echo 'state test succeeded </br>';
} else {
echo 'state test failed </br>';
}
if ($test_person->get_zip() == "11111") {
echo 'zip test succeeded </br>';
} else {
echo 'zip test failed </br>';
}
if ($test_person->get_phone1() == "20724415902") {
echo 'phone1 test succeeded </br>';
} else {
echo 'phone1 test failed </br>';
}
if ($test_person->get_phone2() == "2072654046") {
echo 'phone2 test succeeded </br>';
} else {
echo 'phone2 test failed </br>';
}
if ($test_person->get_email() == "john.smith@stjohns.edu") {
echo 'email test succeeded </br>';
} else {
echo 'email test failed </br>';
}
if ($test_person->get_type() == "volunteer") {
echo 'type test succeedeed </br>';
} else {
echo 'type test failed </br>';
}
if ($test_person->get_schedule() == "Schedule") {
echo 'schedule test succeeded </br>';
} else {
echo 'schedule test failed </br>';
}
error_log($test_person->get_schedule());
if ($test_person->get_notes() == "I like helping out") {
echo 'notes test succeeded </br>';
} else {
echo 'notes test failed </br>';
}
if ($test_person->get_password() == "55555") {
echo 'password test succeeded </br>';
} else {
echo 'password test failed </br>';
}
if ($test_person->get_availabiltiy() == "03-14-14") {
echo 'availability test succeeded </br>';
} else {
echo ' availability test failed </br>';
}
if ($test_person->get_id() == "John20724415902") {
echo 'id test succeeded </br>';
} else {
echo ' id test failed </br>';
}
if ($test_person->get_contact_preference() == "email") {
echo 'contact preference test succeeded </br>';
} else {
echo ' contact preference test failed </br>';
}
}