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


PHP Customers::newsletter_subscription方法代码示例

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


在下文中一共展示了Customers::newsletter_subscription方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processAction

 /**
  * processAction
  * Update the record previously selected
  * @return unknown_type
  */
 public function processAction()
 {
     $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $form = $this->getForm("/profile/process");
     $request = $this->getRequest();
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('index', 'index', 'default');
     }
     if ($form->isValid($request->getPost())) {
         // Get the id
         $id = $this->getRequest()->getParam('customer_id');
         try {
             // Set the new values
             if (is_numeric($id)) {
                 $customer = Doctrine::getTable('Customers')->find($id);
                 $oldCustomer = $customer->toArray();
                 // Get the values posted
                 $params = $form->getValues();
                 $customer->company = $params['company'];
                 $customer->firstname = $params['firstname'];
                 $customer->lastname = $params['lastname'];
                 $customer->email = $params['email'];
                 $customer->birthdate = Shineisp_Commons_Utilities::formatDateIn($params['birthdate']);
                 if (!empty($params['password'])) {
                     $customer->password = MD5($params['password']);
                 }
                 $customer->birthplace = $params['birthplace'];
                 $customer->birthdistrict = $params['birthdistrict'];
                 $customer->birthcountry = $params['birthcountry'];
                 $customer->birthnationality = $params['birthnationality'];
                 $customer->vat = $params['vat'];
                 $customer->taxpayernumber = $params['taxpayernumber'];
                 $customer->type_id = !empty($params['company_type_id']) ? $params['company_type_id'] : NULL;
                 $customer->legalform_id = $params['legalform'];
                 $customer->gender = $params['gender'];
                 // Save the data
                 $customer->save();
                 $id = is_numeric($id) ? $id : $customer->getIncremented();
                 // Manage the address of the customer
                 $address = new Addresses();
                 $mainAddress = $address->findOneByUserId($id);
                 if ($mainAddress) {
                     $address = $mainAddress;
                 }
                 $address->address = $params['address'];
                 $address->city = $params['city'];
                 $address->code = $params['code'];
                 $address->country_id = $params['country_id'];
                 $address->area = $params['area'];
                 $address->customer_id = $id;
                 $address->save();
                 if (!empty($params['contact'])) {
                     $contacts = new Contacts();
                     $contacts->contact = $params['contact'];
                     $contacts->type_id = $params['contacttypes'];
                     $contacts->customer_id = $id;
                     $contacts->save();
                 }
                 // Add or Remove the customer email in the newsletter list
                 Customers::newsletter_subscription($id, $params['newsletter']);
                 $retval = Shineisp_Commons_Utilities::getEmailTemplate('profile_changed');
                 if ($retval) {
                     $subject = $retval['subject'];
                     $subject = str_replace("[user]", $params['firstname'] . " " . $params['lastname'], $retval['subject']);
                     // Alert the administrator about the changing of the customer information
                     $body = $retval['template'];
                     $body = str_replace("[user]", $params['firstname'] . " " . $params['lastname'], $body);
                     $body = str_replace("[old]", print_r($oldCustomer, true), $body);
                     $body = str_replace("[new]", print_r($customer->toArray(), true), $body);
                     $isp = Shineisp_Registry::get('ISP');
                     Shineisp_Commons_Utilities::SendEmail($isp->email, $isp->email, null, $subject, $body);
                 }
             }
         } catch (Exception $e) {
             echo $e->getMessage();
             die;
         }
         return $this->_helper->redirector('account', 'profile', 'default', array('mex' => 'The task requested has been executed successfully.', 'status' => 'success'));
     } else {
         $this->view->form = $form;
         $this->view->title = $this->translator->translate("Profile details");
         $this->view->description = $this->translator->translate("Update here your details filling the applicant form with all the information about you.");
         return $this->_helper->viewRenderer('applicantform');
     }
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:91,代码来源:ProfileController.php

示例2: optOut

 public static function optOut($md5email)
 {
     if (!empty($md5email)) {
         // Check if the email owner is one of the registered customers
         $customer = Customers::getCustomerbyEmailMd5($md5email);
         if (!empty($customer[0]['customer_id'])) {
             Customers::newsletter_subscription($customer[0]['customer_id'], false);
         } else {
             // Remove the email address from the email subscribers
             Doctrine_Query::create()->delete('NewslettersSubscribers')->where('MD5(email)', $md5email)->delete();
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:16,代码来源:NewslettersSubscribers.php


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