當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Customers::Create方法代碼示例

本文整理匯總了PHP中Customers::Create方法的典型用法代碼示例。如果您正苦於以下問題:PHP Customers::Create方法的具體用法?PHP Customers::Create怎麽用?PHP Customers::Create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Customers的用法示例。


在下文中一共展示了Customers::Create方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: insert

 public function insert($params)
 {
     $this->authenticate();
     $form = new Api_Form_CustomerForm(array('action' => '#', 'method' => 'post'));
     #Add email validator
     $mailValidator = new Shineisp_Validate_Email();
     $form->getElement('email')->addValidator($mailValidator);
     $form->addElement('password', 'password', array('filters' => array('StringTrim'), 'required' => true, 'decorators' => array('Composite'), 'validators' => array(array('regex', false, '/^[a-zA-Z0-9\\-\\_\\.\\%\\!\\$]{6,20}$/')), 'description' => 'Write here your password. (min.6 chars - max.20 chars)', 'label' => 'Password', 'class' => 'text-input large-input'));
     if (array_key_exists('countrycode', $params)) {
         $country_id = Countries::getIDbyCode($params['countrycode']);
         if ($country_id == null) {
             throw new Shineisp_Api_Exceptions(400005, ":: 'countrycode' not valid");
             exit;
         }
         unset($params['coutrycode']);
         $params['country_id'] = $country_id;
     }
     if (array_key_exists('provincecode', $params) && $params['provincecode'] != "") {
         $params['area'] = $params['provincecode'];
         unset($params['provincecode']);
     }
     if ($form->isValid($params)) {
         if ($params['status'] == false) {
             $params['status'] = 'disabled';
         }
         $idcustomers = Customers::Create($params);
         $customer = Customers::find($idcustomers);
         return $customer['uuid'];
     } else {
         $errors = $form->getMessages();
         $message = "";
         foreach ($errors as $field => $errorsField) {
             $message .= "Field '{$field}'<br/>";
             foreach ($errorsField as $error => $describe) {
                 $message .= " => {$error} ({$describe})";
             }
         }
         throw new Shineisp_Api_Exceptions(400004, ":\n{$message}");
         exit;
     }
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:41,代碼來源:Customers.php

示例2: insert

 public function insert($params)
 {
     $this->authenticate();
     $form = new Api_Form_CustomerForm(array('action' => '#', 'method' => 'post'));
     if (array_key_exists('countrycode', $params)) {
         $country_id = Countries::getIDbyCode($params['countrycode']);
         if ($country_id == null) {
             throw new Shineisp_Api_Exceptions(400005, ":: 'countrycode' not valid");
             exit;
         }
         unset($params['coutrycode']);
         $params['country_id'] = $country_id;
     }
     if (array_key_exists('provincecode', $params) && $params['provincecode'] != "") {
         $params['area'] = $params['provincecode'];
         unset($params['provincecode']);
     }
     if ($form->isValid($params)) {
         if ($params['status'] == false) {
             $params['status'] = 'disabled';
         }
         $idcustomers = Customers::Create($params);
         $customer = Customers::find($idcustomers);
         return $customer['uuid'];
     } else {
         $errors = $form->getMessages();
         $message = "";
         foreach ($errors as $field => $errorsField) {
             $message .= "Field '{$field}'<br/>";
             foreach ($errorsField as $error => $describe) {
                 $message .= " => {$error} ({$describe})";
             }
         }
         throw new Shineisp_Api_Exceptions(400004, ":\n{$message}");
         exit;
     }
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:37,代碼來源:Customers.php

示例3: CreateCustomer

 /**
  * Create a customer using the cart information and it creates 
  * the Nic Handle in order to communicate with the default registrars 
  */
 private function CreateCustomer($params, $createNicHandle = false)
 {
     $params['contacttypes'] = 1;
     // Telephone
     $params['contact'] = $params['telephone'];
     $customerID = Customers::Create($params);
     return $customerID;
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:12,代碼來源:CartController.php

示例4: dosignupAction

 /**
  * Signup Action Controller
  */
 public function dosignupAction()
 {
     $request = $this->getRequest();
     $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $form = new Default_Form_SignupForm(array('action' => '/customer/dosignup', 'method' => 'post'));
     $this->view->form = $form;
     $post = $request->getPost();
     if (is_array($post)) {
         if (!$form->isValid($request->getPost())) {
             // Invalid entries
             $this->view->form = $form;
             return $this->_helper->viewRenderer('signup');
             // re-render the signup form
         }
         // Get the values posted
         $params = $form->getValues();
         // Create the user
         Customers::Create($params);
         // Send the user to the auto login page
         $url = '/default/index/fastlogin/id/' . Shineisp_Commons_Hasher::hash_string($params['email']);
         $redirector->gotoUrl($url);
     }
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:26,代碼來源:CustomerController.php


注:本文中的Customers::Create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。