$hr->debug = false; $hr->setAccount($argv[1]); $hr->setToken($argv[2]); $people = $hr->findPeopleBySearchTerm("Tag Tagger"); foreach ($people as $p) { $p->delete(); } print "Adding a new person...\n"; $person = new HighrisePerson($hr); $person->setFirstName("Tag"); $person->setLastName("Tagger"); $person->setVisibleTo("Owner"); $person->addTag("tag-1"); $person->addTag("tag-2"); $person->addTag("tag-300"); $person->save(); print "Saved Person:\n"; print_r($person); print "Adding another tag...\n"; $person->addTag("tag-444"); $person->save(); print "Find People named Tag Tagger:\n"; $people = $hr->findPeopleBySearchTerm("Tag Tagger"); print_r($people); print "Remove tag-1 from all people named Tag Tagger...\n"; foreach ($people as $p) { unset($p->tags['tag-1']); $p->save(); } print "Find People named Tag Tagger:\n"; $people = $hr->findPeopleBySearchTerm("Tag Tagger");
$new_person->setFirstName("John Test"); $new_person->setLastName("Doe"); $new_person->setTitle("Nowhere Man"); $new_person->setBackground("Some background here"); $new_person->setCompanyName("Test Corp"); $new_person->addEmailAddress("*****@*****.**"); $new_person->addEmailAddress("*****@*****.**", "work"); $new_person->addPhoneNumber("+1 555-555-5555", "Work"); $new_person->addPhoneNumber("+1 555-555-1111", "Home"); $new_person->addTwitterAccount("johndoe"); $new_person->addTwitterAccount("johndoework", "Business"); $new_person->addWebAddress("http://john.wordpress.com", "Personal"); $new_person->addWebAddress("http://corporation.com/~john"); $new_person->addInstantMessenger("MSN", "*****@*****.**"); $new_person->addInstantMessenger("AIM", "*****@*****.**", "Work"); $new_person->save(); $new_person = null; $people = $hr->findPeopleBySearchTerm("John Test Doe"); print count($people) . " matched search term John Test before deletion.\n"; foreach ($people as $person) { if ($person->getFirstName() != "John Test" || $person->getLastName() != "Doe" || $person->getTitle() != "Nowhere Man" || $person->getBackground() != "Some background here") { die("INVALID PERSON"); } // TODO: Test Company // TODO: Test Address // Test Email Addresses if (count($person->email_addresses) != 2) { die("Invalid number of email addresses"); } if ($person->email_addresses[0]->getAddress() != "*****@*****.**" || $person->email_addresses[0]->getLocation() != "Home") { die("Invalid Home email address 1");