本文整理汇总了PHP中Email::setEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Email::setEmail方法的具体用法?PHP Email::setEmail怎么用?PHP Email::setEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Email
的用法示例。
在下文中一共展示了Email::setEmail方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Email
function test_setEmail()
{
//Arrange
$name = "Bill";
$email = "bill@gmail.com";
$subject = "Just saying hi";
$message = "Hello to you good sir";
$notarobot = "123";
$test_email = new Email($name, $email, $subject, $message, $notarobot);
//Act
$new_email = "billy@gmail.com";
$test_email->setEmail($new_email);
$result = $test_email->getEmail();
//Assert
$this->assertEquals("billy@gmail.com", $result);
}
示例2: Email
$get = $_GET['email_id'];
$query = "select * from subscribers where id = '{$get}'";
$obj_email = new Email();
$obj_email->fetchRow($query);
$first_name = $obj_email->getFirstName();
$last_name = $obj_email->getLastName();
$email = $obj_email->getEmail();
$is_activated = $obj_email->getIsActivated();
include "email_form.php";
}
if (isset($_POST['Submit'])) {
// Validation
$em = new Email();
$em->setFirstName(trim($_POST['first_name']));
$em->setLastName(trim($_POST['last_name']));
$em->setEmail(trim($_POST['email']));
$em->setTitle(trim($_POST['title']));
$em->setIsActivated(trim($_POST['is_active']));
$em->checkEmpty();
if (!isset($em->empty_fields)) {
$email_id = $_GET['email_id'];
$query = "UPDATE subscribers SET\r\n\t\tfirst_name = '" . $em->getFirstName() . "', \r\n\t\tlast_name = '" . $em->getLastName() . "', \r\n\t\ttitle = '" . $em->getTitle() . "', \r\n\t\temail_address = '" . $em->getEmail() . "', \r\n\t\tis_activated = '" . $em->getIsActivated() . "' where id='{$email_id}'";
$em->save($query);
} else {
//echo "The following fields are required to be filled <br />";
echo $em->empty_fields;
$em->empty_fields = "";
}
}
if (isset($em->error)) {
echo $em->error;
示例3: executeSignup
public function executeSignup($request)
{
// check invite id
$this->invite = InvitePeer::getFromField(InvitePeer::ID, $request->getParameter('invite_id'));
if (!$this->invite) {
$this->invite = InvitePeer::getFromField(InvitePeer::ID, $this->getUser()->getInviteId());
}
if ($request->isMethod('post')) {
$this->form = new SignupForm();
// process signup
$this->form->bind($request->getParameter('signup'));
if ($this->form->isValid()) {
$user = new User();
$profile = new Profile();
$email = new Email();
$tag = new Tag();
// setup profile
$profile->setFirstName($this->form->getValue('first_name'));
$profile->setLastName($this->form->getValue('last_name'));
// set prefered language
$current_language = LanguagePeer::retrieveByCulture($this->getUser()->getCulture());
if (!$current_language) {
$current_language = LanguagePeer::getDefaultLanguage();
}
$profile->setLanguage($current_language);
// set email
$email->setEmail($this->form->getValue('email'));
$email->setIsConfirmed(false);
$email->setIsPrimary(true);
$email->setConfirmCode($email->generateConfirmCode());
$email->setType(ContactPeer::TP_PERSONAL);
// setup new user
$user->setPasswd($this->form->getValue('password'));
// add profile and contact to user
$user->addProfile($profile);
$user->addEmail($email);
if ($this->invite) {
$user->setUserRelatedByInvitedBy($this->invite->getUser());
// add jotags to bookmark
if ($this->invite->getInviteTagsJoinTag()) {
foreach ($this->invite->getInviteTagsJoinTag() as $tagbm) {
// add to bookmark
$b = new Bookmark();
$b->setTag($tagbm->getTag());
$user->addBookmark($b);
}
}
// delete invite from db
$this->invite->delete();
// add initial credit to the user
$user->setCredits(OptionPeer::retrieveOption('BONUS_INVITE_CREDIT'));
} else {
$user->setCredits(OptionPeer::retrieveOption('BONUS_INIT_CREDIT'));
}
// save
$user->save();
$this->getUser()->clearInviteId();
// generate JOTAG. We must do it after save because we use ID in the algorithm
$tag->setJotag($user->generateRandomJOTAG());
$tag->setIsPrimary(true);
$tag->setStatus(TagPeer::ST_NEW);
$tag->setBadge(BadgePeer::getDefaultBadge());
$tag->setUser($user);
// link primary email to tag
$tm = new TagEmail();
$tm->setEmail($email);
$tag->addTagEmail($tm);
// save new tag
$tag->save();
// send confirmation email
Mailer::sendEmail($email->getEmail(), 'signupConfirmation', array('user' => $user, 'email' => $email), $user->getPreferedLanguage());
$this->setMessage("SIGNUP", "SUCCESS", array($email->getEmail()));
if (!$this->isWebserviceCall()) {
$this->redirect('@homepage');
}
}
} else {
$first = $last = $email = "";
if ($this->invite) {
// pre-populate first/last name, if available from invite
$first = $this->invite->getFirstName();
$last = $this->invite->getLastName();
$email = $this->invite->getEmail();
}
$this->form = new SignupForm(array('first_name' => $first, 'last_name' => $last, 'email' => $email));
// set invite id, if available
$this->getUser()->setInviteId($this->invite ? $this->invite->getId() : null);
}
}
示例4: atualizarFornecedor
public function atualizarFornecedor()
{
$campos = array('idFornecedor', 'nome', 'descricao', 'cidade', 'endereco', 'bairro', 'numero');
$telefones = array('idTel', 'ddd', 'numeroTel', 'referenciaTel');
$qtdDeTelefones = 2;
$qtdDeEmails = 2;
$status = "";
$validacaoOk = true;
$fornecedorTemp = new Fornecedor();
//Validação simples dos campos de fornecedor
//Forma genércia para a validação de quaisquer campos
foreach ($campos as $c) {
if (!isset($_POST["{$c}"])) {
$status = $status . "Campo " . $c . " nao enviado <br />";
$validacaoOk = false;
} else {
if (strlen($_POST["{$c}"]) <= 0) {
$status = $status . "Preencha o campo " . $c . " corretamente <br />";
$validacaoOk = false;
}
}
}
//Validação simples dos telefones
//Forma genércia para a validação de quaisquer campos em qualquer quantidade
for ($i = 0; $i < $qtdDeTelefones; $i++) {
foreach ($telefones as $t) {
if (!isset($_POST["{$t}"][$i])) {
$status = $status . "Campo " . $t . " nao enviado <br />";
$validacaoOk = false;
} else {
if (strlen($_POST["{$t}"][$i]) <= 0) {
$status = $status . "Preencha o campo " . $t . " corretamente <br />";
$validacaoOk = false;
}
}
}
}
if ($validacaoOk) {
$fornecedor = new Fornecedor();
$fornecedor->setId($_POST['idFornecedor']);
$fornecedor->setNome($_POST['nome']);
$fornecedor->setDescricao($_POST['descricao']);
$fornecedor->setCidade($_POST['cidade']);
$fornecedor->setEndereco($_POST['endereco']);
$fornecedor->setBairro($_POST['bairro']);
$fornecedor->setNumero($_POST['numero']);
//Depois de validar os telefones, posso adiciona-los ao fornecedor
for ($i = 0; $i < $qtdDeTelefones; $i++) {
$fornecedor->adicionarTelefone($_POST['ddd']["{$i}"], $_POST['numeroTel']["{$i}"], $_POST['referenciaTel']["{$i}"], $_POST['idTel'][$i]);
}
//Depois de verificar o envio dos emails, posso adiciona-los ao fornecedor
for ($i = 0; $i < $qtdDeEmails; $i++) {
$email = new Email();
$email->setId($_POST['idEmail'][$i]);
$email->setEmail($_POST["email"]["{$i}"]);
$email->setReferencia($_POST["referenciaEmail"]["{$i}"]);
$fornecedor->adicionarEmail($email);
}
$status = $this->service->atualizarFornecedor($fornecedor);
}
$fornecedores = $this->service->listarFornecedores();
include 'View/Content/listarFornecedores.php';
}
示例5: save
public function save($con = null)
{
if ($this->getObject()->isNew()) {
$signup = true;
} else {
$signup = false;
}
$object = parent::save();
// update profile
$values = $this->getValues();
$profile = $object->getProfile();
// save and remove photo from values
$photo = $values["profile"]["photo"];
unset($values["profile"]["photo"]);
// update profile object
$profile->fromArray($values["profile"], BasePeer::TYPE_FIELDNAME);
$profile->setUser($object);
// new photo??
if ($photo) {
$fileName = $profile->getPhoto(false);
if (!$fileName) {
$fileName = $profile->generateAvatarName() . '.jpg';
}
$photo->save(sfConfig::get('sf_userimage_dir') . DIRECTORY_SEPARATOR . $fileName);
$profile->setPhoto($fileName);
}
if ($values["profile"]["remove_photo"]) {
$fileName = $profile->getPhoto(false);
if ($fileName) {
$profile->setPhoto(null);
$profile->save();
// remove from filesystem
unlink(sfConfig::get('sf_userimage_dir') . DIRECTORY_SEPARATOR . $fileName);
} else {
$profile->save();
}
} else {
$profile->save();
}
// if creating, setup email and permanent jotag
if ($signup) {
// setup email
$email = new Email();
$email->setEmail($this->getValue('email'));
$email->setIsConfirmed(true);
$email->setIsPrimary(true);
$email->setType(ContactPeer::TP_PERSONAL);
$email->setUser($object);
$email->save();
// generate JOTAG.
$tag = new Tag();
$tag->setJotag($object->generateRandomJOTAG());
$tag->setIsPrimary(true);
$tag->setStatus(TagPeer::ST_ACTIVE);
$tag->setUser($object);
// link primary email to tag
$tm = new TagEmail();
$tm->setEmail($email);
$tag->addTagEmail($tm);
// save new tag
$tag->save();
}
return $object;
}
示例6: findPerson
/**
* Try to find this person in the database.
* If we cannot find them, create a new person record.
*
* @return Person
*/
public static function findPerson($post)
{
$search = array();
// Translates Open311 parameters into PersonList search parameters
// open311 => personList
$fields = array('first_name' => 'firstname', 'last_name' => 'lastname', 'email' => 'email', 'phone' => 'phoneNumber', 'device_id' => 'phoneDeviceId');
foreach ($fields as $open311Field => $crmField) {
if (!empty($post[$open311Field])) {
$search[$crmField] = $post[$open311Field];
}
}
// If the user provided any personal info, do a person search
if (count($search)) {
$table = new PersonTable();
$list = $table->find($search);
// When we find one and only one record, use the record we found
if (count($list) == 1) {
$person = $list->current();
} else {
$p = array();
foreach ($fields as $key => $field) {
if (!empty($post[$key])) {
$p[$field] = $post[$key];
}
}
if (count($p)) {
$person = new Person();
try {
$person->handleUpdate($p);
$person->save();
if (!empty($post['email'])) {
$email = new Email();
$email->setPerson($person);
$email->setEmail($post['email']);
$email->save();
}
if (!empty($post['phone']) || !empty($post['device_id'])) {
$phone = new Phone();
$phone->setPerson($person);
if (!empty($post['phone'])) {
$phone->setNumber($post['phone']);
}
if (!empty($post['device_id'])) {
$phone->setDeviceId($post['device_id']);
}
$phone->save();
}
} catch (\Exception $e) {
unset($person);
}
}
}
}
return isset($person) ? $person : null;
}
示例7: Person
*
* This script should only be used by people with root access
* on the web server.
* If you are planning on using local authentication, you must
* provide a password here. The password will be encrypted when
* the new person's account is saved
*
* If you are doing Employee or CAS authentication you do
* not need to save a password into the database.
*
* @copyright 2011-2014 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
use Application\Models\Person;
include '../configuration.inc';
$person = new Person();
// Fill these out as needed
$person->setFirstname('Admin');
$person->setLastname('Person');
$person->setUsername('administrator');
$person->setAuthenticationMethod('local');
#$person->setPassword('');
// You most likely want Administrator
$person->setRole('Administrator');
$person->save();
// Don't forget to create an email address
$email = new Email();
$email->setPerson($person);
$email->setEmail('admin@localhost');
$email->save();
示例8: Merchant
$id_email = '';
$name = '';
$email = '';
//Objects
$merchant = new Merchant();
$filter = new Filter();
$emailobj = new Email();
$lender = new Lender();
if (isset($_GET['id_lender'])) {
$id_lender = $_GET['id_lender'];
$emailobj->setIDLender($id_lender);
}
if (isset($_POST['id_email']) && !is_numeric($_POST['id_email'])) {
$emailobj->setIDLender($_POST['id_lender']);
$emailobj->setName($_POST['name']);
$emailobj->setEmail($_POST['email']);
$emailobj->insertEmail();
}
if (isset($_GET['edit'])) {
$id_email = $_GET['edit'];
$emailobj->Email($_GET['edit']);
$name = $emailobj->getName();
$email = $emailobj->getEmail();
}
if (isset($_POST['id_email']) && is_numeric($_POST['id_email'])) {
$id_lender = $_POST['id_lender'];
$emailobj->setName($_POST['name']);
$emailobj->setEmail($_POST['email']);
$emailobj->setIdEmail($_POST['id_email']);
$emailobj->updateEmail();
header("Location: emails.php?id_lender={$id_lender}");
示例9: buscarFornecedorPorId
public function buscarFornecedorPorId($id)
{
//A estrutura continua sendo para vários registros, mas como é uma
//buscar por id, só teremos um fornecedor, logo teremos loops unitários.
$comando1 = 'select * from fornecedor where id = ?';
$cp1 = $this->bd->prepare($comando1);
$resultado = $cp1->execute(array($id));
while ($f = $cp1->fetchObject()) {
$fornecedor = new Fornecedor();
$fornecedor->setId($f->id);
$fornecedor->setNome($f->nome);
$fornecedor->setDescricao($f->descricao);
$fornecedor->setCidade($f->cidade);
$fornecedor->setEndereco($f->endereco);
$fornecedor->setBairro($f->bairro);
$fornecedor->setNumero($f->numero);
$comando2 = 'select * from telefone where idFornecedor = ?';
$cp2 = $this->bd->prepare($comando2);
$resultado = $cp2->execute(array($id));
while ($t = $cp2->fetchObject()) {
$fornecedor->adicionarTelefone($t->ddd, $t->numero, $t->referencia, $t->id);
}
$comando3 = 'select * from email where idFornecedor = ?';
$cp3 = $this->bd->prepare($comando3);
$resultado = $cp3->execute(array($id));
while ($e = $cp3->fetchObject()) {
$email = new Email();
$email->setId($e->id);
$email->setEmail($e->email);
$email->setReferencia($e->referencia);
$fornecedor->adicionarEmail($email);
}
}
return $fornecedor;
}