本文整理汇总了PHP中Contact::setEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::setEmail方法的具体用法?PHP Contact::setEmail怎么用?PHP Contact::setEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact::setEmail方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stregistry_RegisterDomain
/**
* make domain registration api call
*
* @param array $params call params with domain details
*
* @return mixed array containig error message will return if error was ocurred, 'success' string in other case
*/
function stregistry_RegisterDomain($params)
{
// init connection
if (($status = __initConnectionAndAuthorize($params)) !== true) {
return __errorArray($status);
}
$domain = new Domain($params['domainname']);
// create domain contacts
$contactIds = array();
foreach (array('registrant', 'admin', 'tech', 'billing') as $contactType) {
$contact = new Contact();
$contact->setEmail($params['email'])->setPhoneNumber($params['phonenumberformatted'] ?: '')->setName($params['fullname'])->setOrganization($params['companyname'])->setAddress($params['address1'], $params['address1'] ?: '')->setCity($params['city'])->setState($params['fullstate'])->setPostalCode($params['postcode'])->setCountryCode($params['countrycode']);
$json = STRegistry::Contacts()->create($contact);
if (!ResponseHelper::isSuccess($json)) {
return __errorArray(ResponseHelper::fromJSON($json)->message);
}
$contactIds[$contactType] = ResponseHelper::fromJSON($json, 'creData')->result['id'];
}
$domain->setContacts($contactIds['registrant'], $contactIds['admin'], $contactIds['tech'], $contactIds['billing']);
if ($params['idprotection']) {
$domain->setPrivacyContacts(STRegistryPrivacyContact::getRegistrantId(), STRegistryPrivacyContact::getAdminId(), STRegistryPrivacyContact::getTechId(), STRegistryPrivacyContact::getBillingId());
}
// add nameservers
foreach (array('ns1', 'ns2', 'ns3', 'ns4', 'ns5') as $nsKey) {
if (!empty($params[$nsKey])) {
$domain->addNameServer($params[$nsKey]);
}
}
// creating domain
$json = STRegistry::Domains()->create($domain, $params['regperiod']);
if (!ResponseHelper::isSuccess($json)) {
return __errorArray(ResponseHelper::fromJSON($json)->message);
}
return 'success';
}
示例2: console_create_user
function console_create_user($args)
{
$fname = array_shift($args);
$lname = array_shift($args);
$email = array_shift($args);
$admin = array_shift($args) == 'true';
if (is_null($fname) || is_null($lname) || is_null($email)) {
throw new Exception('create_user: Missing arguments. Expected: (fname, lname, email, admin)');
}
$display_name = $fname . " " . $lname;
$username = str_replace(" ", "_", strtolower($display_name));
$user_data = array('username' => $username, 'display_name' => $display_name, 'email' => $email, 'password_generator' => 'random', 'timezone' => 0, 'autodetect_time_zone' => 1, 'create_contact' => false, 'company_id' => owner_company()->getId(), 'send_email_notification' => true, 'personal_project' => 0);
// array
try {
DB::beginWork();
$user = create_user($user_data, $admin, '');
if (!$user->getContact() instanceof Contact) {
$contact = new Contact();
$contact->setFirstName($fname);
$contact->setLastName($lname);
$contact->setEmail($email);
$contact->setUserId($user->getId());
$contact->save();
}
DB::commit();
} catch (Exception $e) {
DB::rollback();
throw $e;
}
}
示例3: createContact
private function createContact(array $data)
{
$contact = new Contact();
$contact->setEmail($data['email']);
$contact->setName($data['name']);
$contact->setPhoto($data['photo']);
return $contact;
}
示例4: getContact
/**
* Recupera um contato pelo email.
* @param string $email O email do contato que se deseja recuperar.
*/
public function getContact($email)
{
$contact = $this->contactStorage->findOne($email);
if ($contact !== null) {
return $contact;
}
$contact = new Contact();
$contact->setEmail($email);
return $contact;
}
示例5: testAddContacts
public function testAddContacts()
{
for ($i = 0; $i < MAX_CONTACTS; $i++) {
$contact = new Contact();
$contact->setId($i);
$contact->setName($this->names[$i % sizeof($this->names)] . " " . $i);
$contact->setEmail($this->names[$i % sizeof($this->names)] . $i . "@email.com");
$contact->setPhoneContact(999999999);
$this->agenda->addContact($contact);
}
}
示例6: testAddContact
function testAddContact () {
/* Creation du contact */
$contact = new Contact();
$contact->setEmail("test@test.fr");
$contact->setFirstName("erwantest");
$contact->setLastName('dagorntest');
$ret = $this->sales->add($contact);
echo '<pre> testAddContact <br>/';
print_r($contact);
echo '<br/> retour :'.$ret;
$this->assertIdentical($ret, true);
$this->assertIdentical(($contact->getId() != ""), true);
/* Modification du contact */
$contact->setFirstName("erwantestModif");
$ret = $this->sales->update($contact);
$this->assertIdentical($ret, true);
/* Suppression du contact */
$ret = $this->sales->delete($contact->getId());
$this->assertIdentical($ret, true);
}
示例7: checkContactAction
/**
* Render contact page for Kiosk application
*
* @param Request $request
* @param null $contactId
* @return array
* @throws \Symfony\Component\Form\Exception\AlreadyBoundException
* @Route("/check_contact/{contactId}",
* name="kiosk_check_contact",
* defaults={"contactId" = null},
* requirements={"contactId" = "\d+"}
* )
* @Template()
*/
public function checkContactAction(Request $request, $contactId = null)
{
$em = $this->getDoctrine()->getManager();
$form = $this->createEmailForm();
$form->bind($request);
$email = $form->get('email')->getData();
if (!$email && is_null($contactId)) {
$hasContact = false;
$contact = null;
} else {
if (!is_null($contactId)) {
$contact = $em->getRepository('BraemCRMBundle:Contact')->find($contactId);
} else {
$contact = $em->getRepository('BraemCRMBundle:Contact')->findOneBy(array('email' => $email));
}
$hasContact = $contact ? true : false;
}
if (!$hasContact) {
$contact = new Contact();
$contact->setEmail($email);
$form = $this->createForm(new ContactKioskType(), $contact, array('em' => $em, 'kiosk.phone.service' => $this->get('kiosk.phone.service')));
}
return array('contact' => $contact, 'hasContact' => $hasContact, 'form' => $form->createView());
}
示例8: createContact
private function createContact()
{
$contact = new Contact();
$contact->setEmail($this->getFieldValue('Email'));
$contact->setLastName($this->getFieldValue('LastName'));
$contact->setFirstName($this->getFieldValue('FirstName'));
$contact->setPhone($this->getFieldValue('Telephone'));
$contact->setSujet($this->getFieldValue('Objet'));
$contact->setWhatId($this->getFieldValue('whatId'));
if ($this->getFieldValue('formname') == 'contact_default') {
$contact->setSujet("Contactez nke : " . $contact->getSujet());
}
$corp = "[Origine : " . $this->getCurrentURL() . "]\n" . $this->getFieldValue('Message');
if ($this->getFieldValue('formname') == 'contact_revendeur') {
$corp .= "Ville de Résidence : " . $this->getFieldValue('Ville') . "\n" . "Port d'attache : " . $this->getFieldValue('Port') . "\n";
//"Chantier naval : ".$this->getFieldValue('ChantierNaval')."\n";
}
$contact->setTexte($corp);
return $contact;
}
示例9: copy
/**
*
* @param MailingList $source
* @param Campaign $campaign
* @param string $name
* @return MailingList|null
*/
public function copy(MailingList $source, Campaign $campaign = null, $name = null)
{
$con = $this->getConnection();
$con->beginTransaction();
try {
$target = new MailingList();
$target->setStatus(MailingListTable::STATUS_DRAFT);
if ($name) {
$target->setName($name);
} else {
$target->setName($source->getName() . ' copy ' . gmdate('Y-M-d H:i'));
}
if ($campaign) {
$target->setCampaign($campaign);
}
$target->save();
$meta_ids = array();
$choice_ids = array();
foreach ($source->getMailingListMeta() as $meta_source) {
/* @var $meta_source MailingListMeta */
$meta = new MailingListMeta();
$meta->setMailingList($target);
$meta->setKind($meta_source->getKind());
$meta->setName($meta_source->getName());
$meta->setSubst($meta_source->getSubst());
$meta->save();
$meta_ids[$meta_source->getId()] = $meta->getId();
foreach ($meta_source->getMailingListMetaChoice() as $choice_source) {
/* @var $choice_source MailingListMetaChoice */
$choice = new MailingListMetaChoice();
$choice->setMailingListMeta($meta);
$choice->setChoice($choice_source->getChoice());
$choice->save();
$choice_ids[$choice_source->getId()] = $choice->getId();
}
}
foreach ($source->getContact() as $contact_source) {
/* @var $contact_source Contact */
$contact = new Contact();
$contact->setMailingList($target);
$contact->setStatus($contact_source->getStatus());
$contact->setEmail($contact_source->getEmail());
$contact->setGender($contact_source->getGender());
$contact->setFirstname($contact_source->getFirstname());
$contact->setLastname($contact_source->getLastname());
$contact->setCountry($contact_source->getCountry());
$contact->save();
foreach ($contact_source->getContactMeta() as $contact_meta_source) {
/* @var $contact_meta_source ContactMeta */
$contact_meta = new ContactMeta();
$contact_meta->setContact($contact);
$contact_meta->setValue($contact_meta_source->getValue());
$contact_meta->setMailingListMetaId($meta_ids[$contact_meta_source->getMailingListMetaId()]);
if ($contact_meta_source->getMailingListMetaChoiceId()) {
$contact_meta->setMailingListMetaChoiceId($choice_ids[$contact_meta_source->getMailingListMetaChoiceId()]);
}
$contact_meta->save();
}
}
$con->commit();
return $target;
} catch (Exception $e) {
$con->rollback();
}
return null;
}
示例10: MailContent
//.........这里部分代码省略.........
$body = utf8_safe($body);
if (array_var($mail_data, 'format') == 'html') {
$mail->setBodyHtml($body);
$mail->setBodyPlain(utf8_safe(html_to_text($body)));
} else {
$mail->setBodyPlain($body);
$mail->setBodyHtml('');
}
$mail->setFrom($account->getEmailAddress());
$mail->setFromName(logged_user()->getDisplayName());
$mail->save();
$mail->setIsRead(logged_user()->getId(), true);
$mail->setTagsFromCSV(array_var($mail_data, 'tags'));
// autoclassify sent email
// if replying a classified email classify on same workspace
$classified = false;
if (array_var($mail_data, 'original_id')) {
$in_reply_to = MailContents::findById(array_var($mail_data, 'original_id'));
if ($in_reply_to instanceof MailContent) {
$workspaces = $in_reply_to->getWorkspaces();
foreach ($workspaces as $w) {
if ($mail->canAdd(logged_user(), $w)) {
$mail->addToWorkspace($w);
$classified = true;
}
}
}
}
if (!$classified && $account->getWorkspace() instanceof Project) {
$mail->addToWorkspace($account->getWorkspace());
}
if (!$classified && active_project() instanceof Project) {
$mail->addToWorkspace(active_project());
}
$object_controller = new ObjectController();
$object_controller->add_custom_properties($mail);
$object_controller->link_to_new_object($mail);
if (array_var($mail_data, 'link_to_objects') != '') {
$lto = explode('|', array_var($mail_data, 'link_to_objects'));
foreach ($lto as $object_string) {
$split_object = explode('-', $object_string);
$object = get_object_by_manager_and_id($split_object[1], $split_object[0]);
if ($object instanceof ProjectDataObject) {
$mail->linkObject($object);
}
}
}
ApplicationLogs::createLog($mail, $mail->getWorkspaces(), ApplicationLogs::ACTION_ADD);
if (user_config_option('create_contacts_from_email_recipients') && can_manage_contacts(logged_user())) {
// automatically create contacts
foreach ($to as $recipient) {
$recipient_name = trim($recipient[0]);
$recipient_address = trim($recipient[1]);
if (!$recipient_address) {
continue;
}
$contact = Contacts::getByEmail($recipient_address);
if (!$contact instanceof Contact) {
try {
$contact = new Contact();
$contact->setEmail($recipient_address);
if ($recipient_name && $recipient_name != $recipient_address) {
$contact->setFirstName($recipient_name);
} else {
$index = strpos($recipient_address, "@");
$recipient_name = substr($recipient_address, 0, $index);
$contact->setFirstName($recipient_name);
}
$contact->save();
} catch (Exception $e) {
// TODO: show error message?
}
}
}
}
DB::commit();
if (!$autosave) {
if ($isDraft) {
flash_success(lang('success save mail'));
ajx_current("empty");
} else {
evt_add("must send mails", array("account" => $mail->getAccountId()));
//flash_success(lang('mail is being sent'));
ajx_current("back");
}
evt_add("email saved", array("id" => $mail->getId(), "instance" => array_var($_POST, 'instanceName')));
} else {
evt_add("draft mail autosaved", array("id" => $mail->getId(), "hf_id" => $mail_data['hf_id']));
flash_success(lang('success autosave draft'));
ajx_current("empty");
}
} catch (Exception $e) {
DB::rollback();
flash_error($e->getMessage());
ajx_current("empty");
}
// try
}
// if
}
示例11: die
/**
* Finish the installation - create owner company and administrator
*
* @param void
* @return null
*/
function complete_installation()
{
if (Companies::getOwnerCompany() instanceof Company) {
die('Owner company already exists');
// Somebody is trying to access this method even if the user already exists
}
// if
$this->setLayout('complete_install');
$form_data = array_var($_POST, 'form');
tpl_assign('form_data', $form_data);
if (array_var($form_data, 'submitted') == 'submitted') {
try {
$admin_password = trim(array_var($form_data, 'admin_password'));
$admin_password_a = trim(array_var($form_data, 'admin_password_a'));
if (trim($admin_password) == '') {
throw new Error(lang('password value required'));
}
// if
if ($admin_password != $admin_password_a) {
throw new Error(lang('passwords dont match'));
}
// if
DB::beginWork();
Users::delete();
// clear users table
Companies::delete();
// clear companies table
// Create the administrator user
$administrator = new User();
$administrator->setId(1);
$administrator->setUsername(array_var($form_data, 'admin_username'));
$administrator->setEmail(array_var($form_data, 'admin_email'));
$administrator->setPassword($admin_password);
$administrator->setIsAdmin(true);
$administrator->setAutoAssign(true);
$administrator->save();
// Create the contact for administrator
$administrator_contact = new Contact();
$administrator_contact->setId(1);
$administrator_contact->setCompanyId(1);
$administrator_contact->setEmail(array_var($form_data, 'admin_email'));
$administrator_contact->setUserId($administrator->getId());
$administrator_contact->setDisplayName($administrator->getUsername());
$administrator_contact->save();
// Create a company
$company = new Company();
$company->setId(1);
$company->setClientOfId(0);
$company->setName(array_var($form_data, 'company_name'));
$company->setCreatedById(1);
$company->save();
DB::commit();
$this->redirectTo('access', 'login');
} catch (Exception $e) {
tpl_assign('error', $e);
DB::rollback();
}
// try
}
// if
}
示例12: create_user
function create_user($user_data, $permissionsString)
{
$user = new User();
$user->setUsername(array_var($user_data, 'username'));
$user->setDisplayName(array_var($user_data, 'display_name'));
$user->setEmail(array_var($user_data, 'email'));
$user->setCompanyId(array_var($user_data, 'company_id'));
$user->setType(array_var($user_data, 'type'));
$user->setTimezone(array_var($user_data, 'timezone'));
if (!logged_user() instanceof User || can_manage_security(logged_user())) {
$user->setCanEditCompanyData(array_var($user_data, 'can_edit_company_data'));
$user->setCanManageSecurity(array_var($user_data, 'can_manage_security'));
$user->setCanManageWorkspaces(array_var($user_data, 'can_manage_workspaces'));
$user->setCanManageConfiguration(array_var($user_data, 'can_manage_configuration'));
$user->setCanManageContacts(array_var($user_data, 'can_manage_contacts'));
$user->setCanManageTemplates(array_var($user_data, 'can_manage_templates'));
$user->setCanManageReports(array_var($user_data, 'can_manage_reports'));
$user->setCanManageTime(array_var($user_data, 'can_manage_time'));
$user->setCanAddMailAccounts(array_var($user_data, 'can_add_mail_accounts'));
$other_permissions = array();
Hook::fire('add_user_permissions', $user, $other_permissions);
foreach ($other_permissions as $k => $v) {
$user->setColumnValue($k, array_var($user_data, $k));
}
}
if (array_var($user_data, 'password_generator', 'random') == 'random') {
// Generate random password
$password = UserPasswords::generateRandomPassword();
} else {
// Validate input
$password = array_var($user_data, 'password');
if (trim($password) == '') {
throw new Error(lang('password value required'));
}
// if
if ($password != array_var($user_data, 'password_a')) {
throw new Error(lang('passwords dont match'));
}
// if
}
// if
$user->setPassword($password);
$user->save();
$user_password = new UserPassword();
$user_password->setUserId($user->getId());
$user_password->setPasswordDate(DateTimeValueLib::now());
$user_password->setPassword(cp_encrypt($password, $user_password->getPasswordDate()->getTimestamp()));
$user_password->password_temp = $password;
$user_password->save();
if (array_var($user_data, 'autodetect_time_zone', 1) == 1) {
set_user_config_option('autodetect_time_zone', 1, $user->getId());
}
if ($user->getType() == 'admin') {
if ($user->getCompanyId() != owner_company()->getId() || logged_user() instanceof User && !can_manage_security(logged_user())) {
// external users can't be admins or logged user has no rights to create admins => set as Normal
$user->setType('normal');
} else {
$user->setAsAdministrator(true);
}
}
/* create contact for this user*/
if (array_var($user_data, 'create_contact', 1)) {
// if contact with same email exists take it, else create new
$contact = Contacts::getByEmail($user->getEmail(), true);
if (!$contact instanceof Contact) {
$contact = new Contact();
$contact->setEmail($user->getEmail());
} else {
if ($contact->isTrashed()) {
$contact->untrash();
}
}
$contact->setFirstname($user->getDisplayName());
$contact->setUserId($user->getId());
$contact->setTimezone($user->getTimezone());
$contact->setCompanyId($user->getCompanyId());
$contact->save();
} else {
$contact_id = array_var($user_data, 'contact_id');
$contact = Contacts::findById($contact_id);
if ($contact instanceof Contact) {
// user created from a contact
$contact->setUserId($user->getId());
$contact->save();
} else {
// if contact with same email exists use it as user's contact, without changing it
$contact = Contacts::getByEmail($user->getEmail(), true);
if ($contact instanceof Contact) {
$contact->setUserId($user->getId());
if ($contact->isTrashed()) {
$contact->untrash();
}
$contact->save();
}
}
}
$contact = $user->getContact();
if ($contact instanceof Contact) {
// update contact data with data entered for this user
$contact->setCompanyId($user->getCompanyId());
//.........这里部分代码省略.........
示例13: array
/**
* Create a contact with the data of a user
*
*/
function create_contact_from_user()
{
ajx_current("empty");
$user = Users::findById(get_id());
if (!$user instanceof User) {
flash_error(lang('user dnx'));
return;
}
// if
if (!logged_user()->canSeeUser($user)) {
flash_error(lang('no access permissions'));
return;
}
// if
if ($user->getContact()) {
if ($contact->isTrashed()) {
try {
DB::beginWork();
$contact->untrash();
DB::commit();
$this->redirectTo('contact', 'card', array('id' => $contact->getId()));
} catch (Exception $e) {
DB::rollback();
flash_error(lang('error add contact from user') . " " . $e->getMessage());
}
} else {
flash_error(lang('user has contact'));
return;
}
}
try {
DB::beginWork();
$contact = new Contact();
$contact->setFirstname($user->getDisplayName());
$contact->setUserId($user->getId());
$contact->setEmail($user->getEmail());
$contact->setTimezone($user->getTimezone());
$contact->setCompanyId($user->getCompanyId());
$contact->save();
DB::commit();
$this->redirectTo('contact', 'card', array('id' => $contact->getId()));
} catch (Exception $exx) {
DB::rollback();
flash_error(lang('error add contact from user') . " " . $exx->getMessage());
}
}
示例14: Societe
<?php
require_once './classes/Prepavenir/Entity/Societe.php';
require_once './classes/Prepavenir/Entity/Contact.php';
$darty = new Societe();
$darty->setNom('Darty');
$darty->setVille('Sannois');
$contact = new Contact();
$contact->setPrenom('Eric');
$contact->setNom('Martin');
$contact->setEmail('eric.martin@darty.fr');
$contact->setTelephone('01 35 67 84 56');
$contact->setSociete($darty);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Détails d'un contact</title>
</head>
<body>
<h2>Détails d'un contact</h2>
<table>
<tr>
<th>Prénom</th>
<td><?php
echo $contact->getPrenom();
?>
</td>
</tr>
<tr>