本文整理汇总了PHP中Contact::getFirstName方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::getFirstName方法的具体用法?PHP Contact::getFirstName怎么用?PHP Contact::getFirstName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact::getFirstName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: chr
function build_csv_from_contact(Contact $contact, $checked) {
$str = '';
if (isset($checked['first_name']) && $checked['first_name'] == 'checked') $str .= self::build_csv_field($contact->getFirstName());
if (isset($checked['surname']) && $checked['surname'] == 'checked') $str .= self::build_csv_field($contact->getSurname());
if (isset($checked['email']) && $checked['email'] == 'checked') $str .= self::build_csv_field($contact->getEmailAddress('personal'));
if (isset($checked['company_id']) && $checked['company_id'] == 'checked') $str .= self::build_csv_field($contact->getCompany() ? $contact->getCompany()->getObjectName() : "");
if (isset($checked['w_web_page']) && $checked['w_web_page'] == 'checked') $str .= self::build_csv_field($contact->getWebPageUrl('work'));
$work_address = $contact->getAddress('work');
if ($work_address){
if (isset($checked['w_address']) && $checked['w_address'] == 'checked') $str .= self::build_csv_field($work_address->getStreet());
if (isset($checked['w_city']) && $checked['w_city'] == 'checked') $str .= self::build_csv_field($work_address->getStreet());
if (isset($checked['w_state']) && $checked['w_state'] == 'checked') $str .= self::build_csv_field($work_address->getState());
if (isset($checked['w_zipcode']) && $checked['w_zipcode'] == 'checked') $str .= self::build_csv_field($work_address->getZipcode());
if (isset($checked['w_country']) && $checked['w_country'] == 'checked') $str .= self::build_csv_field($work_address->getCountryName());
}
if (isset($checked['w_phone_number']) && $checked['w_phone_number'] == 'checked') $str .= self::build_csv_field($contact->getPhoneNumber('work',true));
if (isset($checked['w_phone_number2']) && $checked['w_phone_number2'] == 'checked') $str .= self::build_csv_field($contact->getPhoneNumber('work'));
if (isset($checked['w_fax_number']) && $checked['w_fax_number'] == 'checked') $str .= self::build_csv_field($contact->getPhoneNumber('fax',true));
if (isset($checked['w_assistant_number']) && $checked['w_assistant_number'] == 'checked') $str .= self::build_csv_field($contact->getPhoneNumber('assistant'));
if (isset($checked['w_callback_number']) && $checked['w_callback_number'] == 'checked') $str .= self::build_csv_field($contact->getPhoneNumber('callback'));
if (isset($checked['h_web_page']) && $checked['h_web_page'] == 'checked') $str .= self::build_csv_field($contact->getWebPageUrl('personal'));
$home_address = $contact->getAddress('home');
if ($home_address){
if (isset($checked['h_address']) && $checked['h_address'] == 'checked') $str .= self::build_csv_field($home_address->getStreet());
if (isset($checked['h_city']) && $checked['h_city'] == 'checked') $str .= self::build_csv_field($home_address->getCity());
if (isset($checked['h_state']) && $checked['h_state'] == 'checked') $str .= self::build_csv_field($home_address->getState());
if (isset($checked['h_zipcode']) && $checked['h_zipcode'] == 'checked') $str .= self::build_csv_field($home_address->getZipcode());
if (isset($checked['h_country']) && $checked['h_country'] == 'checked') $str .= self::build_csv_field($home_address->getCountryName());
}
if (isset($checked['h_phone_number']) && $checked['h_phone_number'] == 'checked') $str .= self::build_csv_field($contact->getPhoneNumber('home',true));
if (isset($checked['h_phone_number2']) && $checked['h_phone_number2'] == 'checked') $str .= self::build_csv_field($contact->getPhoneNumber('home'));
if (isset($checked['h_fax_number']) && $checked['h_fax_number'] == 'checked') $str .= self::build_csv_field($contact->getPhoneNumber('fax'));
if (isset($checked['h_mobile_number']) && $checked['h_mobile_number'] == 'checked') $str .= self::build_csv_field($contact->getPhoneNumber('mobile'));
if (isset($checked['h_pager_number']) && $checked['h_pager_number'] == 'checked') $str .= self::build_csv_field($contact->getPhoneNumber('pager'));
if (isset($checked['o_web_page']) && $checked['o_web_page'] == 'checked') $str .= self::build_csv_field($contact->getWebPageUrl('other'));
$other_address = $contact->getAddress('other');
if ($other_address){
if (isset($checked['o_address']) && $checked['o_address'] == 'checked') $str .= self::build_csv_field($other_address->getStreet());
if (isset($checked['o_city']) && $checked['o_city'] == 'checked') $str .= self::build_csv_field($other_address->getCity());
if (isset($checked['o_state']) && $checked['o_state'] == 'checked') $str .= self::build_csv_field($other_address->getState());
if (isset($checked['o_zipcode']) && $checked['o_zipcode'] == 'checked') $str .= self::build_csv_field($other_address->getZipcode());
if (isset($checked['o_country']) && $checked['o_country'] == 'checked') $str .= self::build_csv_field($other_address->getCountryName());
}
if (isset($checked['o_phone_number']) && $checked['o_phone_number'] == 'checked') $str .= self::build_csv_field($contact->getPhoneNumber('other',true));
if (isset($checked['o_phone_number2']) && $checked['o_phone_number2'] == 'checked') $str .= self::build_csv_field($contact->getPhoneNumber('other'));
if (isset($checked['o_birthday']) && $checked['o_birthday'] == 'checked') $str .= self::build_csv_field($contact->getBirthday());
$personal_emails = $contact->getContactEmails('personal');
if (isset($checked['email2']) && $checked['email2'] == 'checked' && !is_null($personal_emails) && isset($personal_emails[0]))
$str .= self::build_csv_field($personal_emails[0]->getEmailAddress());
if (isset($checked['email3']) && $checked['email3'] == 'checked' && !is_null($personal_emails) && isset($personal_emails[1]))
$str .= self::build_csv_field($personal_emails[1]->getEmailAddress());
if (isset($checked['job_title']) && $checked['job_title'] == 'checked') $str .= self::build_csv_field($contact->getJobTitle());
if (isset($checked['department']) && $checked['department'] == 'checked') $str .= self::build_csv_field($contact->getDepartment());
$str = str_replace(array(chr(13).chr(10), chr(13), chr(10)), ' ', $str); //remove line breaks
return $str;
}
示例2: updateContact
public function updateContact(Contact $contact)
{
if ($contact != null && ($contact->getId() == null || $contact->getId() == -1)) {
return false;
}
try {
if ($contact->getAddress() != null && $contact->getAddress()->getId() != null && $contact->getAddress()->getId() != -1) {
$this->addressService->updateAddress($contact->getAddress());
}
if (!parent::getBdd()->inTransaction()) {
parent::getBdd()->beginTransaction();
}
$query = "UPDATE CONTACT SET firstName = :fName, name = :name, mail = :mail,\n phone = :phone, phone2 = :phone2, phone3 = :phone3, company = :company, type = :type, exchangeId = :exchangeId\n WHERE id = :id";
$request = parent::getBdd()->prepare($query);
$request->bindParam(':id', $contact->getId());
if ($contact->getFirstName() != null) {
$request->bindParam(':fName', $contact->getFirstName());
} else {
$request->bindValue(':fName', null);
}
if ($contact->getName() != null) {
$request->bindParam(':name', $contact->getName());
} else {
$request->bindValue(':name', null);
}
if ($contact->getMail() != null) {
$request->bindParam(':mail', $contact->getMail());
} else {
$request->bindValue(':mail', null);
}
if ($contact->getPhone() != null) {
$request->bindParam(':phone', $contact->getPhone());
} else {
$request->bindValue(':phone', null);
}
if ($contact->getPhone2() != null) {
$request->bindParam(':phone2', $contact->getPhone2());
} else {
$request->bindValue(':phone2', null);
}
if ($contact->getPhone3() != null) {
$request->bindParam(':phone3', $contact->getPhone3());
} else {
$request->bindValue(':phone3', null);
}
if ($contact->getCompany() != null) {
$request->bindParam(':company', $contact->getCompany());
} else {
$request->bindValue(':company', null);
}
if ($contact->getType() != null && $contact->getType()->getId() != null && $contact->getType()->getId() != -1) {
$request->bindParam(':type', $contact->getType()->getId());
} elseif ($contact->getType() != null && ($contact->getType()->getId() == null || $contact->getType()->getId() == -1) && $contact->getType()->getLabel() != null) {
$typeId = $this->typeService->getTypeIdByLabel($contact->getType()->getLabel());
if ($typeId != -1) {
$request->bindParam(':type', $typeId);
} else {
$request->bindValue(':type', null);
}
} else {
$request->bindValue(':type', null);
}
if ($contact->getExchangeId() != null) {
$request->bindParam(':exchangeId', $contact->getExchangeId());
} else {
$request->bindValue(':exchangeId', null);
}
$request->execute();
parent::getBdd()->commit();
$request->closeCursor();
return true;
} catch (Exception $e) {
error_log($e->getMessage());
}
return false;
}
示例3: addContact
public function addContact(Contact $c)
{
try {
$request = new EWSType_CreateItemType();
$contact = new EWSType_ContactItemType();
if ($c->getFirstName() != null) {
$contact->GivenName = $c->getFirstName();
}
if ($c->getType() != null) {
$contact->Surname = $c->getName() . ' -- ' . $c->getType()->getLabel();
} else {
$contact->Surname = $c->getName();
}
if ($c->getMail() != null) {
$email = new EWSType_EmailAddressDictionaryEntryType();
$email->Key = new EWSType_EmailAddressKeyType();
$email->Key->_ = EWSType_EmailAddressKeyType::EMAIL_ADDRESS_1;
$email->_ = $c->getMail();
$contact->EmailAddresses = new EWSType_EmailAddressDictionaryType();
$contact->EmailAddresses->Entry[] = $email;
}
if ($c->getCompany() != null) {
$contact->CompanyName = $c->getCompany();
}
$addr = $c->getAddress();
if ($addr != null) {
$address = new EWSType_PhysicalAddressDictionaryEntryType();
$address->Key = new EWSType_PhysicalAddressKeyType();
$address->Key->_ = EWSType_PhysicalAddressKeyType::BUSINESS;
if ($addr->getLine1() != null) {
if ($addr->getLine2() != null) {
$address->Street = $addr->getLine1() . ' ' . $addr->getLine2();
} else {
$address->Street = $addr->getLine1();
}
}
if ($addr->getCity() != null) {
$address->City = $addr->getCity();
}
if ($addr->getZipCode() != null) {
$address->PostalCode = $addr->getZipCode();
}
$contact->PhysicalAddresses = new EWSType_PhysicalAddressDictionaryType();
$contact->PhysicalAddresses->Entry[] = $address;
}
if ($c->getPhone() != null) {
$phone = new EWSType_PhoneNumberDictionaryEntryType();
$phone->Key = new EWSType_PhoneNumberKeyType();
$phone->Key->_ = EWSType_PhoneNumberKeyType::BUSINESS_PHONE;
$phone->_ = $c->getPhone();
$contact->PhoneNumbers->Entry[] = $phone;
}
if ($c->getPhone2() != null) {
$phone = new EWSType_PhoneNumberDictionaryEntryType();
$phone->Key = new EWSType_PhoneNumberKeyType();
$phone->Key->_ = EWSType_PhoneNumberKeyType::BUSINESS_PHONE_2;
$phone->_ = $c->getPhone2();
if ($contact->PhoneNumbers == null) {
$contact->PhoneNumbers = new EWSType_PhoneNumberDictionaryType();
}
$contact->PhoneNumbers->Entry[] = $phone;
}
if ($c->getPhone3() != null) {
$phone = new EWSType_PhoneNumberDictionaryEntryType();
$phone->Key = new EWSType_PhoneNumberKeyType();
$phone->Key->_ = EWSType_PhoneNumberKeyType::OTHER_PHONE;
$phone->_ = $c->getPhone3();
if ($contact->PhoneNumbers == null) {
$contact->PhoneNumbers = new EWSType_PhoneNumberDictionaryType();
}
$contact->PhoneNumbers->Entry[] = $phone;
}
$contact->FileAsMapping = new EWSType_FileAsMappingType();
//?
$contact->FileAsMapping->_ = EWSType_FileAsMappingType::FIRST_SPACE_LAST;
$request->Items->Contact[] = $contact;
$result = parent::getEws()->CreateItem($request);
if ($result->ResponseMessages->CreateItemResponseMessage->Items->Contact->ItemId->Id != null) {
$c->setExchangeId($result->ResponseMessages->CreateItemResponseMessage->Items->Contact->ItemId->Id);
}
return true;
} catch (Exception $e) {
error_log($e->getMessage());
}
return false;
}
示例4: disapproveContact
private function disapproveContact($id)
{
$id = (int) $id;
$contact = new Contact($id);
$db = \Database::newDB();
$tbl = $db->addTable('prop_contacts');
$tbl->addFieldConditional('id', $id);
$db->delete();
$vars = array('first_name' => $contact->getFirstName(), 'last_name' => $contact->getLastName(), 'site_title' => \Layout::getPageTitle(true), 'site_address' => \PHPWS_Core::getHomeHttp(true), 'email_address' => \PHPWS_Settings::get('properties', 'email'));
$template = new \Template($vars);
$template->setModuleTemplate('properties', 'disapprovalLetter.html');
$content = $template->get();
$this->emailInfo('Manager account not approved', $content, $contact->getEmailAddress());
}
示例5: array
}
$app = new Silex\Application();
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
//home page
$app->get("/", function () use($app) {
return $app['twig']->render('address_book.html.twig', array('contacts' => Contact::getAll()));
});
//created a contact page
$app->post("/create_contact", function () use($app) {
$contact = new Contact($_POST['first_name'], $_POST['last_name'], $_POST['image_path'], new Address($_POST['street'], $_POST['city'], $_POST['state'], $_POST['zip']), $_POST['phone'], $_POST['email']);
$contact->save();
return $app['twig']->render('created_contact.html.twig', array('newcontact' => $contact));
});
//view results of search page
$app->get("/results", function () use($app) {
$user_contact = strtolower($_GET['user_contact']);
$contacts = $_SESSION['list_of_contacts'];
$contacts_match = $_SESSION['matching_contacts'];
foreach ($contacts as $contact) {
if ($user_contact == strtolower($contact->getFirstName())) {
array_push($contacts_match, $contact);
}
}
return $app['twig']->render('matching_contacts.html.twig', array('matching_contacts' => $contacts_match));
});
//delete all contacts page
$app->post("/delete_contacts", function () use($app) {
Contact::deleteAll();
return $app['twig']->render('delete_contacts.html.twig');
});
return $app;