本文整理汇总了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;
}
}
示例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;
}
}
示例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;
}
示例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);
}
}