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


PHP Customer::model方法代码示例

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


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

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     if (Customer::model()->count('active=1') == 0) {
         throw new CHttpException(412, 'No hay clientes activos. Para crear un contacto, primero debe ' . CHtml::link('crear un cliente', array('customer/create')) . '.');
     }
     $model = new Contact('scenarioCreate');
     if (isset($_GET['customer_id'])) {
         $model->customer_id = $_GET['customer_id'];
     }
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Contact'])) {
         $model->attributes = $_POST['Contact'];
         if ($model->save()) {
             if (!empty($_POST['yt1'])) {
                 Yii::app()->user->setFlash('contact-created', "¡El contacto <b><i>&quot;{$model->name}&quot;</i></b> fue creado exitosamente!");
                 if (isset($_GET['customer_id'])) {
                     $this->redirect(array('create', 'customer_id' => $model->customer_id));
                 } else {
                     $this->redirect(array('create'));
                 }
             } else {
                 if (isset($_GET['customer_id'])) {
                     $this->redirect(array('customer/view', 'id' => $model->customer_id));
                 } else {
                     $this->redirect(array('view', 'id' => $model->id));
                 }
             }
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:rodespsan,项目名称:LMEC,代码行数:36,代码来源:ContactController.php

示例2: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($id)
 {
     if (!empty($id) && !Yii::app()->user->isGuest) {
         $customer_email = Yii::app()->user->name;
         $customerModel = Customer::model()->findByAttributes(array('customer_email' => $customer_email));
         $productId = $id;
         $productModel = Product::model()->findByPk($productId);
         $model = new Order();
         $model->order_product_id = $productModel->product_id;
         $model->order_customer_id = $customerModel->customer_id;
         $model->order_amount = $productModel->product_price + $productModel->product_shipping_price;
         if ($model->save()) {
             $attribuits = Order::model()->findByPk($model->order_id);
             $str = "Product Name:{$productModel->product_name}\r\n" . "Order Id:{$attribuits->order_id}\r\n" . "Order Product Id:{$attribuits->order_product_id}\r\n" . "Order Customer Id:{$attribuits->order_customer_id}\r\n" . "Total Amount With Shipping Charges:{$attribuits->order_amount}\r\n";
             $message = new YiiMailMessage();
             $message->subject = "Your order details";
             $message->setBody($str);
             $message->addTo(Yii::app()->user->name);
             $message->from = $customerModel->customer_email;
             Yii::app()->mail->send($message);
             $this->redirect(array('view', 'id' => $model->order_id));
         } else {
             echo "booking failed";
         }
     }
 }
开发者ID:pmswamy,项目名称:training2demo,代码行数:30,代码来源:OrderController.php

示例3: authenticate

 public function authenticate()
 {
     // Special case for admin account
     if ($this->username == 'ccplus1') {
         $model = Meta::model()->findByAttributes(array('field' => 'adminpass'));
         if ($this->password == $model->value) {
             $this->errorCode = self::ERROR_NONE;
         } else {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         }
     } else {
         $user = Customer::model()->findByAttributes(array('billogin' => $this->username));
         if ($user === null) {
             $this->errorCode = self::ERROR_USERNAME_INVALID;
         } else {
             if ($user->bilpass !== $this->password) {
                 $this->errorCode = self::ERROR_PASSWORD_INVALID;
             } else {
                 $this->_id = $user->bilkey;
                 $this->errorCode = self::ERROR_NONE;
             }
         }
     }
     return !$this->errorCode;
 }
开发者ID:E-SOFTinc,项目名称:Mailnetwork_Yii,代码行数:25,代码来源:UserIdentity.php

示例4: check_db_password

 public function check_db_password($attribute, $params)
 {
     $user = Customer::model()->findByPk($this->id);
     if ($user->password != $this->{$attribute}) {
         $this->addError($attribute, '原密码输入错误!');
     }
 }
开发者ID:nwz-orientationsys,项目名称:carsWebsite,代码行数:7,代码来源:Customer.php

示例5: authenticate

 public function authenticate()
 {
     $record = Customer::model()->findByAttributes(array('email' => $this->username));
     if ($record === null) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } else {
         if (!$record->validatePassword($this->password)) {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         } else {
             if ($record->is_active == 0) {
                 $this->_id = $record->id;
                 $this->errorCode = self::ERROR_USER_NOT_ACTIVE;
             } else {
                 $this->_id = $record->id;
                 $this->setState('id', $record->id);
                 $this->setState('name', $record->name);
                 $this->setState("email", $record->email);
                 $this->setState("isAdmin", 0);
                 $this->setState("signup_completed_step", $record->signup_completed_step);
                 $this->errorCode = self::ERROR_NONE;
             }
         }
     }
     return !$this->errorCode;
 }
开发者ID:huynt57,项目名称:bluebee-uet.com,代码行数:25,代码来源:UserIdentity.php

示例6: run

 public function run($id)
 {
     $customer_info = Customer::model()->findByPk($id);
     if ($customer_info->delete()) {
         $this->controller->success('');
     }
 }
开发者ID:WalkerDi,项目名称:mama,代码行数:7,代码来源:DeleteAction.php

示例7: init

 public function init()
 {
     parent::init();
     // Create new field in your users table for store dashboard preference
     // Set table name, user ID field name, user preference field name
     $this->setTableParams('dashboard_page', 'user_id', 'title');
     // set array of portlets
     $this->setPortlets(array(array('id' => 1, 'title' => 'Ultimos clientes', 'content' => Customer::model()->Top(4)), array('id' => 2, 'title' => 'Ultimas reservas', 'content' => Book::model()->Top(4)), array('id' => 3, 'title' => 'Puntos cr&iacute;ticos', 'content' => Point::model()->Top(4)), array('id' => 4, 'title' => 'Ultimos boletines', 'content' => Mail::model()->Top(4)), array('id' => 5, 'title' => 'Informes', 'content' => Functions::lastReports()), array('id' => 6, 'title' => 'Ultimas facturas', 'content' => Invoice::model()->Top(4))));
     //set content BEFORE dashboard
     $this->setContentBefore();
     // uncomment the following to apply jQuery UI theme
     // from protected/components/assets/themes folder
     $this->applyTheme('ui-lightness');
     // uncomment the following to change columns count
     //$this->setColumns(4);
     // uncomment the following to enable autosave
     $this->setAutosave(true);
     // uncomment the following to disable dashboard header
     $this->setShowHeaders(false);
     // uncomment the following to enable context menu and add needed items
     /*
     $this->menu = array(
         array('label' => 'Index', 'url' => array('index')),
     );
     */
 }
开发者ID:FranHurtado,项目名称:hotels,代码行数:26,代码来源:DashController.php

示例8: actionSendReminderEmails

 /**
  * Send reminder emails to those who haven't paid for their next week's box
  */
 public function actionSendReminderEmails()
 {
     $Customers = Customer::model()->findAllWithNoOrders();
     foreach ($Customers as $Cust) {
         $validator = new CEmailValidator();
         if ($validator->validateValue(trim($Cust->User->email))) {
             $User = $Cust->User;
             $User->auto_login_key = $User->generatePassword(50, 4);
             $User->update_time = new CDbExpression('NOW()');
             $User->update();
             $adminEmail = SnapUtil::config('boxomatic/adminEmail');
             $adminEmailFromName = SnapUtil::config('boxomatic/adminEmailFromName');
             $message = new YiiMailMessage('Running out of orders');
             $message->view = 'customer_running_out_of_orders';
             $message->setBody(array('Customer' => $Cust, 'User' => $User), 'text/html');
             $message->addTo($Cust->User->email);
             $message->addBcc($adminEmail);
             //$message->addTo('francis.beresford@gmail.com');
             $message->setFrom(array($adminEmail => $adminEmailFromName));
             if (!@Yii::app()->mail->send($message)) {
                 echo '<p style="color:red"><strong>Email failed sending to: ' . $Cust->User->email . '</strong></p>';
             } else {
                 echo '<p>Running out of orders message sent to: ' . $Cust->User->email . '</p>';
             }
         } else {
             echo '<p style="color:red"><strong>Email not valid: "' . $Cust->User->email . '"</strong></p>';
         }
     }
     echo '<p><strong>Finished.</strong></p>';
     //Yii::app()->end();
 }
开发者ID:snapfrozen,项目名称:boxomatic,代码行数:34,代码来源:CronController.php

示例9: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($id)
 {
     $this->customerData = Customer::model()->findByPk($id);
     $model = MagicSpool::model()->findByAttributes(array('cus_id' => getCurCusId()));
     $magic_model = new MagicSpoonOptions();
     if (!$model) {
         $model = new MagicSpool();
         $magic_model = new MagicSpoonOptions();
     }
     DynamicCall::GetEdit1stPdf(getCurCusId());
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['MagicSpool'])) {
         $model->attributes = $_POST['MagicSpool'];
         $model->one = $_POST['MagicSpool']['one'];
         $model->two = $_POST['MagicSpool']['two'];
         $model->three = $_POST['MagicSpool']['three'];
         $model->four = $_POST['MagicSpool']['four'];
         if (Yii::app()->user->isUser()) {
             $model->cus_id = $id;
         }
         if ($model->save()) {
             //                if (Yii::app()->user->isUser()):
             $this->redirect(createUrl('site/menu', array('id' => $id)));
             //                endif;
             //                $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model, 'magic_model' => $magic_model));
 }
开发者ID:VishalSuriMcc,项目名称:jaspersiform,代码行数:34,代码来源:MagicSpoolController.php

示例10: actionCoupon_activate

 public function actionCoupon_activate($id)
 {
     if ($this->userHasRedeemedCoupon($id)) {
         $this->render('coupon_already_redeemed');
         return;
     }
     $this->layout = "main";
     $model = new CouponRedemption();
     $customer = Customer::model()->findByPk(Yii::app()->user->getId());
     if ($customer == null) {
         throw new CHttpException(400, 'Invalid request. No customer found!');
     }
     $model->phone = $customer->mobile;
     if (isset($_POST['CouponRedemption'])) {
         $model->attributes = $_POST['CouponRedemption'];
         $model->date_created = date("Y-m-d h:i:s");
         if ($model->save()) {
             $this->redirect(array('listing/coupon_activated', 'id' => $model->credemption_id));
         }
     }
     if (isset($_GET['CouponRedemption'])) {
         $model->attributes = $_GET['CouponRedemption'];
     }
     $model->coupon_id = $id;
     $this->render('coupon_activate', array('model' => $model));
 }
开发者ID:yasirgit,项目名称:hotmall,代码行数:26,代码来源:ListingController.php

示例11: insertSampleRecord

 private function insertSampleRecord()
 {
     $rawPostedData = array("shippingAddress" => array("shipping_address_street" => "#018 Gaddang Street Barangay Quirino", "shipping_address_city" => "Solano", "shipping_address_province" => "Nueva Vizcaya", "shipping_address_country" => "Philippines"), "orderInformation" => array("notes" => "this is a random note . heres a proof . " . uniqid(), "invoice_number" => uniqid(), "sales_person" => "Marcials Furniture", "ship_date" => "November 25,2015", "order_date" => "November 23,2015", "ordered_products" => array(array("product_name" => "wooden chair 2x", "description" => "a wooden chair made of wood", "quantity" => 10, "unit_price" => 3000, "line_total" => 30000), array("product_name" => "wooden chair 3x", "description" => "a wooden chair made of wood but with color", "quantity" => 20, "unit_price" => 4000, "line_total" => 80000), array("product_name" => "Banana Chair", "description" => "A chair that is shaped like a banana", "quantity" => 10, "unit_price" => 3000, "line_total" => 30000)), "sub_total" => 140000, "tax" => 0.5, "shipping" => 2, "total" => 140702, "paid" => 141000, "change" => 298), "customerModel" => array("title" => "Mr", "firstname" => "john " . Customer::model()->count(), "middlename" => "middle " . Customer::model()->count(), "lastname" => "doe " . Customer::model()->count(), "contact_number" => "09069148369"));
     $this->totalPaid += 141000;
     $invoiceDataPersistor = new InvoiceDataPersistor($rawPostedData);
     $invoiceDataPersistor->save();
     return $invoiceDataPersistor;
 }
开发者ID:kevindaus,项目名称:Order-Billing-Inventory-System-Marcials-Furniture,代码行数:8,代码来源:WeeklySalesReportTest.php

示例12: getIsGuest

 public function getIsGuest()
 {
     $customer = Customer::model()->findByPk($this->id);
     if ($customer !== null) {
         return CPropertyValue::ensureInteger($customer->record_type) === Customer::GUEST;
     }
     return parent::getIsGuest();
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:8,代码来源:WebUser.php

示例13: actionUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  */
 public function actionUpdate()
 {
     $model = $this->loadUser();
     $profile = $model->profile;
     //$model->c_group_id = $model->groups;
     $this->loadAddress($model->id);
     //$this->performAjaxValidation(array($model,$profile), 'customer-form');
     if (isset($_POST['Customer']) || isset($_POST['Staff'])) {
         if (isset($_POST['Customer'])) {
             $model->attributes = $_POST['Customer'];
         } else {
             $model->attributes = $_POST['Staff'];
         }
         //$model->status = $_POST['Customer']['status'];
         $profile->attributes = $_POST['Profile'];
         //$profile->branch_id = $_POST['Profile']['branch_id'];
         if ($model->validate() && $profile->validate() && $this->validateAddress()) {
             $old_password = Customer::model()->notsafe()->findByPk($model->id);
             /*if ($old_password->password!=$model->password) {
             			$model->password=PasswordHelper::hashPassword($model->password);
             			$model->activkey=PasswordHelper::hashPassword(microtime().$model->password);
             		}*/
             $model->save();
             $profile->save();
             $criteria = new CDbCriteria();
             $criteria->condition = 'user_id=:user_id';
             $criteria->params = array(':user_id' => $model->id);
             /*CustomerCGroup::model()->deleteAll($criteria);
             		if(!empty($_POST['Customer']['c_group_id'])){
             			
             			foreach ($_POST['Customer']['c_group_id'] as $groupid){
             				$userGroup = new CustomerCGroup;
             				$userGroup->user_id = $model->id;
             				$userGroup->c_group_id = $groupid;
             				$userGroup->save();
             			}
             		}*/
             //$data = CheckoutAddress::model()->findAll('user_id=:user_id', array(':user_id'=>$model->id));
             CheckoutAddress::model()->deleteAll('user_id=:user_id', array(':user_id' => $model->id));
             foreach ($this->_address as $address) {
                 $address->user_id = $model->id;
                 $address->save();
             }
             Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, Yii::t('info', 'Your Profile was successfully updated'));
             //$this->renderPartial('view', array('model' => $model,'profile'=>$profile,'address'=>$this->_address), false, true);
             echo json_encode(array('redirect' => $this->createUrl('view')));
             Yii::app()->end();
         } else {
             $profile->validate();
             $this->validateAddress();
         }
     }
     if (Yii::app()->getRequest()->getIsAjaxRequest()) {
         $this->renderPartial('update', array('model' => $model, 'profile' => $profile, 'address' => $this->_address), false, true);
         Yii::app()->end();
     }
     $this->render('update', array('model' => $model, 'profile' => $profile, 'address' => $this->_address));
 }
开发者ID:Rudianasaja,项目名称:cycommerce,代码行数:62,代码来源:CustomerController.php

示例14: getModel

 public function getModel()
 {
     if (!$this->_model) {
         if ($this->id) {
             $this->_model = Customer::model()->findByPk($this->id);
         } else {
             $this->_model = Customer::model();
         }
     }
     return $this->_model;
 }
开发者ID:yasirgit,项目名称:hotmall,代码行数:11,代码来源:FrontendUser.php

示例15: tearDown

 public function tearDown()
 {
     /*delete all productOrders*/
     ProductOrders::model()->deleteAll();
     /*delete all products*/
     Product::model()->deleteAll();
     /*delete all orders*/
     Orders::model()->deleteAll();
     /*delete all customers*/
     Customer::model()->deleteAll();
 }
开发者ID:kevindaus,项目名称:Order-Billing-Inventory-System-Marcials-Furniture,代码行数:11,代码来源:AnnualReportTest.php


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