当前位置: 首页>>代码示例>>PHP>>正文


PHP Contact类代码示例

本文整理汇总了PHP中Contact的典型用法代码示例。如果您正苦于以下问题:PHP Contact类的具体用法?PHP Contact怎么用?PHP Contact使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Contact类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的Contact类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。