public function actionCreate() { $this->htmlOption = array('class' => 'icon-head head-products', 'header' => "添加客户", 'button' => array(array('class' => 'scalable save', 'id' => 'form-save', 'header' => '保存'))); $model = new customer_entity(); if ($_POST['customer']) { $model->attributes = $_POST['customer']; if ($model->save()) { customer_group::addment($model->customer_ID, $_POST['customer_group'], $model->customer_default_group_ID); $this->redirect(array('index')); } } $this->constructScript('create'); $this->render('create', array('model' => $model, 'groups' => $_POST['customer_group'])); }
public function register() { $customer = new customer_entity(); $customer->customer_email = $this->customer_email; $customer->customer_active = 1; $customer->customer_default_group_ID = 1; $customer->customer_first_name = $this->customer_firstname; $customer->customer_last_name = $this->customer_lastname; $customer->customer_gender = $this->customer_gender; $customer->customer_password = $this->customer_pwd; if ($customer->save()) { customer_group::addment($customer->customer_ID, null, 1); return true; } return false; }