本文整理汇总了PHP中Contact类的典型用法代码示例。如果您正苦于以下问题:PHP Contact类的具体用法?PHP Contact怎么用?PHP Contact使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Contact类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: save
public function save(){
$name = $this->f3->get('POST.name');
$email = $this->f3->get('POST.email');
$comments = $this->f3->get('POST.comments');
$v = new Valitron\Validator(array('Name' => $name,'Email'=>$email,'Comments'=>$comments));
$v->rule('required', ['Name','Email','Comments']);
$v->rule('email',[Email]);
if ($v->validate()) {
$contact = new Contact($this->db);
$data = array(
'name' => $name,
'email' => $email,
'comments' => $comments,
'contact_date' => date('Y-m-d H:i:s')
);
$contact->insert($data);
$response = array(
'status' => true,
'message' => 'Your message saved!'
);
}else{
$response = array(
'status' => false,
'errors' => $v->errors()
);
}
echo json_encode($response);
}
开发者ID:hendrosteven,项目名称:f3-template,代码行数:30,代码来源:ContactController.php
示例2: postContact
public function postContact()
{
global $smarty, $cookie;
session_start();
if ($_SESSION['validate_code'] == strtolower(Tools::getRequest('validate_code'))) {
if ($cookie->isLogged()) {
$user = new User($cookie->id_user);
$_POST['name'] = $user->first_name . ' ' . $user->last_name;
$_POST['email'] = $user->email;
if (isset($_POST['id_user'])) {
unset($_POST['id_user']);
}
$_POST['id_user'] = $user->id;
}
$contact = new Contact();
$contact->copyFromPost();
if ($contact->add()) {
$vars = array('{name}' => $contact->name, '{subject}' => $contact->subject, '{email}' => $contact->email, '{message}' => $contact->content);
Mail::Send('contact', $contact->subject, $vars, Configuration::get('TM_SHOP_EMAIL'));
$this->_success = 'Your message has been successfully sent to our team.';
} else {
$this->_errors = $contact->_errors;
}
} else {
$this->_errors[] = 'Confirmation code is error!';
}
}
开发者ID:yiuked,项目名称:tmcart,代码行数:27,代码来源:ContactView.php
示例3: createDefaultUserPermissionsAllDimension
static function createDefaultUserPermissionsAllDimension(Contact $user, $dimension_id, $remove_previous = true)
{
$role_id = $user->getUserType();
$permission_group_id = $user->getPermissionGroupId();
$dimension = Dimensions::getDimensionById($dimension_id);
if (!$dimension instanceof Dimension || !$dimension->getDefinesPermissions()) {
return;
}
try {
$shtab_permissions = array();
$new_permissions = array();
$role_permissions = self::findAll(array('conditions' => "role_id = '{$role_id}'"));
$members = Members::findAll(array('conditions' => 'dimension_id = ' . $dimension_id));
foreach ($members as $member) {
$member_id = $member->getId();
if ($remove_previous) {
ContactMemberPermissions::delete("permission_group_id = {$permission_group_id} AND member_id = {$member_id}");
}
foreach ($role_permissions as $role_perm) {
if ($member->canContainObject($role_perm->getObjectTypeId())) {
$cmp = new ContactMemberPermission();
$cmp->setPermissionGroupId($permission_group_id);
$cmp->setMemberId($member_id);
$cmp->setObjectTypeId($role_perm->getObjectTypeId());
$cmp->setCanDelete($role_perm->getCanDelete());
$cmp->setCanWrite($role_perm->getCanWrite());
$cmp->save();
$new_permissions[] = $cmp;
$perm = new stdClass();
$perm->m = $member_id;
$perm->r = 1;
$perm->w = $role_perm->getCanWrite();
$perm->d = $role_perm->getCanDelete();
$perm->o = $role_perm->getObjectTypeId();
$shtab_permissions[] = $perm;
}
}
}
if (count($shtab_permissions)) {
$cdp = ContactDimensionPermissions::instance()->findOne(array('conditions' => "permission_group_id = '{$permission_group_id}' AND dimension_id = {$dimension_id}"));
if (!$cdp instanceof ContactDimensionPermission) {
$cdp = new ContactDimensionPermission();
$cdp->setPermissionGroupId($permission_group_id);
$cdp->setContactDimensionId($dimension_id);
$cdp->setPermissionType('check');
$cdp->save();
} else {
if ($cdp->getPermissionType() == 'deny all') {
$cdp->setPermissionType('check');
$cdp->save();
}
}
$stCtrl = new SharingTableController();
$stCtrl->afterPermissionChanged($permission_group_id, $shtab_permissions);
}
return $new_permissions;
} catch (Exception $e) {
throw $e;
}
}
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:60,代码来源:RoleObjectTypePermissions.class.php
示例4: contact
public function contact()
{
$content = Content::find_by_permalink("contact");
$this->assign("content", $content);
$contact = new Contact();
if ($this->post) {
$contact->name = $_POST['name'];
$contact->emailaddress = $_POST['emailaddress'];
$contact->subject = $_POST['subject'];
$contact->message = $_POST['message'];
$contact->ip = Site::RemoteIP();
if ($this->csrf) {
$sent = $contact->send();
if ($sent) {
Site::flash("notice", "The email has been sent");
Redirect("contact");
}
} else {
global $site;
$site['flash']['error'] = "Invalid form submission";
}
}
$this->assign("contact", $contact);
$this->title = "Contact Us";
$this->render("contact/contact.tpl");
}
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:26,代码来源:contact.controller.php
示例5: sendAction
public function sendAction()
{
if ($this->request->isPost() == true) {
$name = $this->request->getPost('name', 'string');
$email = $this->request->getPost('email', 'email');
$comments = $this->request->getPost('comments', 'string');
$name = strip_tags($name);
$comments = strip_tags($comments);
$contact = new Contact();
$contact->name = $name;
$contact->email = $email;
$contact->comments = $comments;
$contact->created_at = new Phalcon_Db_RawValue('now()');
if ($contact->save() == false) {
foreach ($contact->getMessages() as $message) {
Phalcon_Flash::error((string) $message, 'alert alert-error');
}
return $this->_forward('contact/index');
} else {
Phalcon_Flash::success('Thanks, We will contact you in the next few hours', 'alert alert-success');
return $this->_forward('index/index');
}
} else {
return $this->_forward('contact/index');
}
}
开发者ID:racklin,项目名称:invo,代码行数:26,代码来源:ContactController.php
示例6: saveContactUs
/**
* save contact enquiry
*/
public function saveContactUs()
{
$name = Input::get('name');
$email = Input::get('email');
$phone = Input::get('phone');
$contact_method = Input::get('contact_method');
$enquiry = e(Input::get('enquiry'));
$invoice_number = Input::get('invoice_number');
// check for required fields
if (empty($name) || empty($email)) {
echo "Name and email are required. Please submit the form again";
return;
}
// save the data in database first
$contact = new Contact();
$contact->name = $name;
$contact->email = $email;
$contact->phone_number = $phone;
$contact->contact_method = $contact_method;
$contact->enquiry_info = $enquiry;
$contact->invoice_number = $invoice_number;
$contact->save();
// send email
/**
* configure the smtp details in app/config/mail.php
* and after that uncommet the code below to send emails
*/
// Mail::send('emails.contact.contact', Input::all('firstname'),
// function($message){
// $message->to(Config::get('contact.contact_email'))
// ->subject(Config::get('contact.contact_subject'));
// }
// );
echo "Enquiry Submitted. ThankYou.";
}
开发者ID:rajdeol,项目名称:a2assignment,代码行数:38,代码来源:HomeController.php
示例7: sendAction
/**
* Handles the sending the message - storing it in the database
*
* @todo Refactor this to send an email
*/
public function sendAction()
{
if ($this->request->isPost() == true) {
$forward = 'index/index';
$name = $this->request->getPost('name', 'string');
$email = $this->request->getPost('email', 'email');
$comments = $this->request->getPost('comments', 'string');
$name = strip_tags($name);
$comments = strip_tags($comments);
$contact = new Contact();
$contact->name = $name;
$contact->email = $email;
$contact->comments = $comments;
$contact->createdAt = new Phalcon_Db_RawValue('now()');
if ($contact->save() == false) {
foreach ($contact->getMessages() as $message) {
Flash::error((string) $message, 'alert alert-error');
}
$forward = 'contact/index';
} else {
$message = 'Thank you for your input. If your message requires ' . 'a reply, we will contact you as soon as possible.';
Flash::success($message, 'alert alert-success');
}
} else {
$forward = 'contact/index';
}
return $this->_forward($forward);
}
开发者ID:vnlita,项目名称:phalcon-angular-harryhogfootball,代码行数:33,代码来源:ContactController.php
示例8: indexAction
public function indexAction()
{
$this->view->Title = 'Đặt hàng';
$this->view->headTitle($this->view->Title);
$id = $this->getRequest()->getParam("id_product");
$Product = Product::getById($id);
if ($this->getRequest()->isPost()) {
$request = $this->getRequest()->getParams();
$error = $this->_checkForm($request);
if (count($error) == 0) {
$Contact = new Contact();
$Contact->merge($request);
$Contact->created_date = date("Y-m-d H:i:s");
$Contact->save();
//$_SESSION['msg'] = "Yêu cầu đặt hàng của bạn đã được gửi, xin trân thành cảm ơn!";
My_Plugin_Libs::setSplash('<b>Yêu cầu đặt hàng của bạn đã được gửi, xin trân thành cảm ơn!</b>');
$this->_redirect($this->_helper->url('index', 'contact', 'default'));
}
if (count($error)) {
$this->view->error = $error;
}
}
$this->view->Product = $Product;
$this->view->Contact = $Contact;
}
开发者ID:hoaitn,项目名称:base-zend,代码行数:25,代码来源:ContactController.php
示例9: setUp
public function setUp()
{
SugarTestHelper::setUp('beanList');
SugarTestHelper::setUp('beanFiles');
SugarTestHelper::setUp('app_strings');
SugarTestHelper::setUp('app_list_strings');
$GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
$unid = uniqid();
$contact = new Contact();
$contact->id = 'l_' . $unid;
$contact->first_name = 'Greg';
$contact->last_name = 'Brady';
$contact->new_with_id = true;
$contact->save();
$this->_contact = $contact;
if (file_exists(sugar_cached('modules/unified_search_modules.php'))) {
$this->_hasUnifiedSearchModulesConfig = true;
copy(sugar_cached('modules/unified_search_modules.php'), sugar_cached('modules/unified_search_modules.php.bak'));
unlink(sugar_cached('modules/unified_search_modules.php'));
}
if (file_exists('custom/modules/unified_search_modules_display.php')) {
$this->_hasUnifiedSearchModulesDisplay = true;
copy('custom/modules/unified_search_modules_display.php', 'custom/modules/unified_search_modules_display.php.bak');
unlink('custom/modules/unified_search_modules_display.php');
}
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:26,代码来源:UnifiedSearchAdvancedTest.php
示例10: setUp
public function setUp()
{
global $current_user, $currentModule;
$mod_strings = return_module_language($GLOBALS['current_language'], "Contacts");
$beanList = array();
$beanFiles = array();
require 'include/modules.php';
$GLOBALS['beanList'] = $beanList;
$GLOBALS['beanFiles'] = $beanFiles;
$current_user = SugarTestUserUtilities::createAnonymousUser();
$unid = uniqid();
$time = date('Y-m-d H:i:s');
$contact = new Contact();
$contact->id = 'c_' . $unid;
$contact->first_name = 'testfirst';
$contact->last_name = 'testlast';
$contact->new_with_id = true;
$contact->disable_custom_fields = true;
$contact->save();
$this->c = $contact;
$beanList = array();
$beanFiles = array();
require 'include/modules.php';
$GLOBALS['beanList'] = $beanList;
$GLOBALS['beanFiles'] = $beanFiles;
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:26,代码来源:ComposePackageTest.php
示例11: __construct
public function __construct($arrayAccounts)
{
// browse through list
$collection = array();
if ($arrayAccounts) {
foreach ($arrayAccounts as $arrayAccount) {
if (empty($arrayAccount['name_value_list']['account_name'])) {
$arrayAccount['name_value_list']['account_name'] = "";
}
$contact = new Contact();
$contact->setId($arrayAccount['name_value_list']['id']);
$contact->setGroup($arrayAccount['name_value_list']['account_name']);
$contact->setFirstname(htmlspecialchars_decode($arrayAccount['name_value_list']['first_name'], ENT_QUOTES));
$contact->setLastname($arrayAccount['name_value_list']['last_name']);
$contact->setWorkPhone($arrayAccount['name_value_list']['phone_work']);
$contact->setWorkMobile($arrayAccount['name_value_list']['phone_mobile']);
$contact->sethomePhone('');
$contact->sethomeMobile('');
$collection[$contact->getId()] = $contact;
}
// Sort accounts by name
usort($collection, function ($a, $b) {
return strcmp($a->getFirstname(), $b->getFirstname());
});
}
// build ArrayObject using collection
return parent::__construct($collection);
}
开发者ID:stadline,项目名称:SugarCRMBundle,代码行数:28,代码来源:Contacts.php
示例12: sendMail
public function sendMail($template)
{
foreach ($this->contacts as $c) {
$contact = new Contact($c);
$contact->sendMail($template);
}
}
开发者ID:elpadi,项目名称:dahlen-studio,代码行数:7,代码来源:mailing.php
示例13: bindValueAndExecuteInsertOrUpdate
private function bindValueAndExecuteInsertOrUpdate(PDOStatement $stm, Contact $contact)
{
$stm->bindValue(':name', $contact->getName(), PDO::PARAM_STR);
$stm->bindValue(':photo', $contact->getPhoto(), PDO::PARAM_STR);
$stm->bindValue(':email', $contact->getEmail(), PDO::PARAM_STR);
return $stm->execute();
}
开发者ID:lga37,项目名称:contacts,代码行数:7,代码来源:ContactSQLStorage.php
示例14: maintContact
function maintContact()
{
$results = '';
if (isset($_POST['save']) and $_POST['save'] == 'Save') {
// check the token
$badToken = true;
if (!isset($_POST['token']) || !isset($_SESSION['token']) || empty($_POST['token']) || $_POST['token'] !== $_SESSION['token']) {
$results = array('', 'Sorry, go back and try again. There was a security issue.');
$badToken = true;
} else {
$badToken = false;
unset($_SESSION['token']);
// Put the sanitized variables in an associative array
// Use the FILTER_FLAG_NO_ENCODE_QUOTES to allow names like O'Connor
$item = array('id' => (int) $_POST['id'], 'first_name' => filter_input(INPUT_POST, 'first_name', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES), 'last_name' => filter_input(INPUT_POST, 'last_name', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES), 'position' => filter_input(INPUT_POST, 'position', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES), 'email' => filter_input(INPUT_POST, 'email', FILTER_SANITIZE_STRING), 'phone' => filter_input(INPUT_POST, 'phone', FILTER_SANITIZE_STRING));
// Set up a Contact object based on the posts
$contact = new Contact($item);
if ($contact->getId()) {
$results = $contact->editRecord();
} else {
$results = $contact->addRecord();
}
}
}
return $results;
}
开发者ID:piiskop,项目名称:pstk,代码行数:26,代码来源:functions.php
示例15: inscrire
function inscrire()
{
$debug = false;
$contact = new Contact();
if ($_POST["as"] == '') {
// ---- Enregistrement dans "contact" -------- //
if ($_POST["email_news"] != '') {
$num_contact = $contact->isContact($_POST["email_news"], $debug);
unset($val);
$val["id"] = $num_contact;
$val["email"] = $_POST["email_news"];
$val["newsletter"] = "on";
if ($num_contact <= 0) {
$contact->contactAdd($val, $debug);
} else {
$contact->contactModify($val, $debug);
}
}
// ------------------------------------------- //
$erreur = "false";
$message = "Inscription réalisée avec succès";
die('{
"error":' . $erreur . ',
"message":"' . $message . '"
}');
}
}
开发者ID:xav335,项目名称:modulouest,代码行数:27,代码来源:ajax_newsletter.php
示例16: eventAddFeed
/**
* eventAddFeed
* This event is triggered when the note is added in the
* contact.php page.
* Its the last event and assume that the ContactNoteEditSave has
* a primary key from the database table.
* This event action prepare all the data so no additional query is needed
* in the display table.
* @param EventControler
*/
function eventAddFeed(EventControler $evtcl)
{
$this->note = $_SESSION['ContactNoteEditSave']->note;
$this->iduser = $evtcl->iduser_for_feed;
$this->idcontact = $_SESSION['ContactNoteEditSave']->idcontact;
$this->idcontact_note = $_SESSION['ContactNoteEditSave']->idcontact_note;
$user = new User();
$user->getId($this->iduser);
$do_contact = new Contact();
$do_contact->getId($this->idcontact);
if ($evtcl->added_by_cont == 'Yes') {
$this->added_by = $do_contact->getContactFullName();
} else {
$this->added_by = $user->getFullName();
}
$this->contact_full_name = $do_contact->getContactFullName();
$this->contact_image_url = $do_contact->getContactPicture();
if (strlen($this->note) > 200) {
$this->note = substr($this->note, 0, 200);
$this->more = True;
} else {
$this->more = false;
}
$user_relation = new ContactSharing();
$user_array = $user_relation->getCoWorkerByContact($this->idcontact);
@array_push($user_array, $this->iduser);
if (!is_array($user_array) || $user_array === false) {
$user_array = array($evtcl->iduser_for_feed);
}
//print_r($user_array);exit;
$this->addFeed($user_array);
}
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:42,代码来源:WorkFeedContactNotePortal.class.php
示例17: testConvertLinkingExistingContact
/**
* Create a lead and convert it to an existing Account and Contact
*/
public function testConvertLinkingExistingContact()
{
// Create records
$lead = SugarTestLeadUtilities::createLead();
$account = SugarTestAccountUtilities::createAccount();
$contact = SugarTestContactUtilities::createContact();
// ConvertLead to an existing Contact and Account
$_REQUEST = array('module' => 'Leads', 'record' => $lead->id, 'isDuplicate' => 'false', 'action' => 'ConvertLead', 'convert_create_Contacts' => 'false', 'report_to_name' => $contact->name, 'reports_to_id' => $contact->id, 'convert_create_Accounts' => 'false', 'account_name' => $account->name, 'account_id' => $account->id, 'handle' => 'save');
// Call display to trigger conversion
$vc = new ViewConvertLead();
$vc->display();
// Refresh Lead
$leadId = $lead->id;
$lead = new Lead();
$lead->retrieve($leadId);
// Refresh Contact
$contactId = $contact->id;
$contact = new Contact();
$contact->retrieve($contactId);
// Check if contact it's linked properly
$this->assertEquals($contact->id, $lead->contact_id, 'Contact not linked with Lead successfully.');
// Check if account is linked with lead properly
$this->assertEquals($account->id, $lead->account_id, 'Account not linked with Lead successfully.');
// Check if account is linked with contact properly
$this->assertEquals($account->id, $contact->account_id, 'Account not linked with Contact successfully.');
// Check Lead Status, should be converted
$this->assertEquals('Converted', $lead->status, "Lead status should be 'Converted'.");
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:31,代码来源:Bug50127Test.php
示例18: contact_information
function contact_information()
{
$contact = new Contact();
$post = new posts();
global $session, $main_db;
$admin_mail = $post->get_single_post_by('sender_email');
$sender = isset($admin_mail->post_content) ? $admin_mail->post_content : '[email protected]';
if (isset($_POST['user_contact_form'])) {
$data['u_name'] = $_POST['u_name'];
$data['u_mail'] = $_POST['u_email'];
$data['msg_type'] = $_POST['u_msg_type'];
$data['comment'] = $_POST['u_comment'];
$message = '<h3> A user try to contact you! </h3>';
$message .= '<p> Name : ' . $_POST['u_name'] . ' </p>';
$message .= '<p> Email : ' . $_POST['u_email'] . ' </p>';
$message .= '<p> Message Type: ' . $_POST['u_msg_type'] . ' </p>';
$message .= '<p> Comment : ' . $_POST['u_comment'] . ' </p>';
$contact->send_email($_POST['u_email'], 'User contact Information', $message, $sender);
if ($contact->insert_contact($data)) {
$session->message("Thank you for your contact! We will touch you very soon! ");
safe_redirect(get_home_url());
} else {
echo $main_db->last_query;
exit;
}
}
}
开发者ID:sahidhossen,项目名称:project_inkcity,代码行数:27,代码来源:functions.php
示例19: contact_me
/**
* phpwax comes with some very useful tools built in for small sites. This page demonstrates the WaxForm system
* which creates forms for you passed on either existing models or (like in this case) you can create custom
* fields. This also shows you how to send the results via an email
*/
public function contact_me()
{
$this->form = new WaxForm();
//we create the form as $this so it can be accessed inside the views
$this->form->add_element("name", "TextInput", array('validate' => 'required'));
//this adds a field to the form called name, with the type of textinput
$this->form->add_element("email", "TextInput", array('validate' => 'email'));
//this adds the email field
$this->form->add_element("telephone", "TextInput");
//telephone field
/*
this one is slightly different - a textarea & takes another parameter with html attribute names
(as textarea needs those to be valid markup!)
*/
$this->form->add_element("message", "TextareaInput", array("cols" => 30, "rows" => 7));
/*
ok, here is the clever form handling...
- a call to the save function in this case does not save as there is not a model associated with the form, just custom fields
_ the save runs the validation methods for the form and the fields
- if it validates we create a new Contact model (see app/model/Contact.php for details)
- the data returned from the save is passed in to the send_contact method (this sends the email - again see model for details)
- redirect to a simple thank you page (good practice!)
*/
if ($data = $this->form->save()) {
$email = new Contact();
$email->send_contact_form($data);
$this->redirect_to("/thanks");
}
}
开发者ID:phpwax,项目名称:phpwax,代码行数:34,代码来源:PageController.php
示例20: setUp
public function setUp()
{
global $current_user, $currentModule;
global $beanList;
require 'include/modules.php';
$current_user = SugarTestUserUtilities::createAnonymousUser();
$unid = uniqid();
$time = date('Y-m-d H:i:s');
$contact = new Contact();
$contact->id = 'c_' . $unid;
$contact->first_name = 'testfirst';
$contact->last_name = 'testlast';
$contact->new_with_id = true;
$contact->disable_custom_fields = true;
$contact->save();
$this->contact = $contact;
$account = new Account();
$account->id = 'a_' . $unid;
$account->first_name = 'testfirst';
$account->last_name = 'testlast';
$account->assigned_user_id = 'SugarUser';
$account->new_with_id = true;
$account->disable_custom_fields = true;
$account->save();
$this->account = $account;
$ac_id = 'ac_' . $unid;
$this->ac_id = $ac_id;
//Accounts to Contacts
$GLOBALS['db']->query("INSERT INTO accounts_contacts (id , contact_id, account_id, date_modified, deleted) values ('{$ac_id}', '{$contact->id}', '{$account->id}', '{$time}', 0)");
$_REQUEST['relate_id'] = $this->contact->id;
$_REQUEST['relate_to'] = 'projects_contacts';
}
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:32,代码来源:Bug37123Test.php
注:本文中的Contact类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论