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


PHP Address::model方法代码示例

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


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

示例1: saveAndDeleteMedia

 private function saveAndDeleteMedia($type)
 {
     /** @var $model Media [ ] */
     $model = new Media();
     $mockRecord = $this->getMockRecord();
     $instruction = Deal::model()->findByPk($mockRecord['med_row']);
     $this->assertNotEmpty($instruction, "instruction not exist");
     $property = Property::model()->findByPk($instruction->dea_prop);
     $this->assertNotEmpty($property, "property not exist");
     $this->assertNotNull($property->addressId, "property has no address");
     $address = Address::model()->findByPk($property->addressId);
     $this->assertNotEmpty($address, " Address not exist");
     $model->setAttributes($this->getMockRecord());
     $model->file = $this->getMockCuploadedImage('image/jpeg', 1);
     if ($type == Media::TYPE_PHOTO) {
         $model->setCropFactor($this->getCropFactor());
     } elseif ($type == Media::TYPE_EPC || $type == Media::TYPE_FLOORPLAN) {
         $model->otherMedia = $type;
     }
     $this->assertTrue($model->validate(), "record not validated");
     $this->assertTrue($model->save(), "record not saved");
     foreach ($model->getImageSizes() as $imageSize) {
         $this->assertFileExists($model->getFullPath($imageSize), $imageSize . " does not exist");
     }
     $this->deleteMedia($model->med_id);
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:26,代码来源:MediaTest.php

示例2: loadModel

 public function loadModel($address_id, $comp_id)
 {
     $model = Address::model()->findByAttributes(array('address_id' => $address_id, 'comp_id' => $comp_id));
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:mehulsbhatt,项目名称:sale_purchase_tracking,代码行数:8,代码来源:AddressController.php

示例3: actionAdd

 public function actionAdd($id = 0)
 {
     if (!empty($id)) {
         $Insurance = Insurance::model()->findByPk($id);
         if (!Yii::app()->user->checkAccess('admin') && ((Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY || Yii::app()->user->getProfile()->company_id != $Insurance->user->company_id) && (Yii::app()->getUser()->getProfile()->modules->insurance != '1' || $Insurance->user_id != Yii::app()->user->id) || Yii::app()->getUser()->getProfile()->company->active == '0')) {
             throw new CHttpException(403);
         }
         $Address = $Insurance->address;
         $ContentManager = null;
     } else {
         if (Yii::app()->user->getProfile()->content_manager == '0') {
             if (!Yii::app()->user->checkAccess('admin') && (Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY && Yii::app()->getUser()->getProfile()->modules->insurance != '1' || Yii::app()->getUser()->getProfile()->company->active == '0')) {
                 throw new CHttpException(403);
             } elseif (!Yii::app()->getUser()->getProfile()->company->validate) {
                 $this->redirect('/complete');
             }
             $ContentManager = null;
         } else {
             $ContentManager = new ContentManager();
         }
         $Insurance = new Insurance();
         $Address = new Address();
         $Address->setscenario('insurance');
     }
     //if(isset($_POST['save'])) {
     if (!empty($_POST)) {
         if (!empty($Insurance->address)) {
             Address::model()->deleteByPk($Insurance->address->address_id);
         }
         if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) {
             $ContentManager->setAttributes($_POST['ContentManager'], false);
             $contentValid = $ContentManager->validate();
         } else {
             $contentValid = true;
         }
         $Insurance->setAttributes($_POST['Insurance'], false);
         $Address->setAttributes($_POST['Address'], false);
         $valid = $Address->validate();
         $valid = $Insurance->validate() && $valid && $contentValid;
         if ($valid) {
             if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) {
                 $Insurance->user_id = User::createFakeUser($ContentManager);
                 $Insurance->contact_id = $Insurance->user_id;
             }
             $Address->save();
             $Insurance->address_id = $Address->address_id;
             $Insurance->save();
             $Insurance->autosearch();
             //                $this->redirect('/insurance');
             $this->render('insuranceaddsuccess', ['Insurance' => $Insurance, 'contacts' => User::getContact()]);
             exit;
         }
     }
     $this->render('add', ['Insurance' => $Insurance, 'Address' => $Address, 'contacts' => User::getContact(), 'ContentManager' => $ContentManager]);
 }
开发者ID:alexanderkuz,项目名称:test-yii2,代码行数:55,代码来源:DefaultController.php

示例4: actionAccountUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionAccountUpdate()
 {
     // check if user has permissions to permissionsConfiguration
     if (Yii::app()->user->checkAccess('permissionsConfiguration')) {
         // with user.account_id load account data
         $model = Accounts::model()->findByPk(Yii::app()->user->Accountid);
         // if account hasn't address create an Address object, else load
         if (!empty($model->address_id)) {
             $address = Address::model()->findByPk($model->address_id);
         } else {
             $address = new Address();
         }
         // if Accounts and Address form exist
         if (isset($_POST['Accounts'], $_POST['Address'])) {
             // set form elements to model attributes
             $model->attributes = $_POST['Accounts'];
             $address->attributes = $_POST['Address'];
             // validate both models
             $valid = $address->validate();
             $valid = $model->validate() && $valid;
             if ($valid) {
                 // save image path, if uploaded
                 if (isset($_FILES['Accounts']['name']['image']) && !empty($_FILES['Accounts']['name']['image'])) {
                     // create an instance of file uploaded
                     $model->image = CUploadedFile::getInstance($model, 'image');
                     if (!$model->image->getError()) {
                         $this->tmpFileName = trim(date('dmYHis-z-') . microtime());
                         $extension = $model->image->getExtensionName();
                         $extensionAllowed = array('jpg', 'jpeg', 'png');
                         // verify only allowed extensions
                         if (in_array($extension, $extensionAllowed)) {
                             // save image from tmp folder to defined folder, after set account_logo path
                             if ($model->image->saveAs(ConfigurationController::FOLDERIMAGES . $this->tmpFileName . '.' . $extension)) {
                                 $model->account_logo = ConfigurationController::FOLDERIMAGES . $this->tmpFileName . '.' . $extension;
                             }
                         }
                     }
                 }
                 // save address
                 $address->save(false);
                 $model->address_id = $address->primaryKey;
                 // save model
                 $model->save(false);
                 // to prevent F5 keypress, redirect to account page
                 $this->redirect(Yii::app()->createUrl('configuration/account'));
             }
         }
         $this->layout = 'column2';
         $this->render('accounts/update', array('model' => $model, 'address' => $address));
     } else {
         throw new CHttpException(403, Yii::t('site', '403_Error'));
     }
 }
开发者ID:lanzelotik,项目名称:celestic-community,代码行数:58,代码来源:ConfigurationController.php

示例5: actionCheckout

 /**
  * 订单确认页面
  */
 public function actionCheckout()
 {
     $userId = $this->user_id;
     if (empty($userId)) {
         $this->redirect('/user/login');
     }
     $addList = Address::model()->getUserAddressList($userId);
     $payList = Payment::model()->getPaymentList();
     $plist = Cart::model()->getCartList($userId);
     $couponlist = Coupon::model()->getUserUsingCouponList($userId);
     if (empty($plist['list'])) {
         $this->redirect('/?from=no_deal');
     }
     $viewData = array();
     $viewData['addList'] = $addList;
     $viewData['list'] = $plist['list'];
     $viewData['total'] = $plist['total'];
     $viewData['couponlist'] = $couponlist;
     $viewData['payList'] = $payList;
     $this->render('cart/checkout', $viewData);
 }
开发者ID:conghua1013,项目名称:yii,代码行数:24,代码来源:CartController.php

示例6: actionAddcall

 public function actionAddcall($id = 0)
 {
     $flZayavka = 1;
     if (!empty($id)) {
         $this->pageTitle = Yii::t('MarketModule.default', 'Редактирование спецтехники');
         $title = Yii::t('MarketModule.default', 'Редактирование заявки на спецтехнику');
     } else {
         $this->pageTitle = Yii::t('MarketModule.default', 'Добавление спецтехники');
         $title = Yii::t('MarketModule.default', 'Добавление заявки на спецтехнику');
     }
     $this->breadcrumbs = array_merge([CHtml::encode(Yii::t('MarketModule.default', 'Заявки на спецтехнику')) => ['/specialtechniquecall']], [CHtml::encode($this->pageTitle)]);
     if (!empty($id)) {
         $SpecialTechnique = SpecialTechnique::model()->findByPk($id);
         if (!Yii::app()->user->checkAccess('admin') && ((Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY || Yii::app()->user->getProfile()->company_id != $SpecialTechnique->user->company_id) && (Yii::app()->getUser()->getProfile()->modules->specialtech != '1' || $SpecialTechnique->user_id != Yii::app()->user->id) || Yii::app()->getUser()->getProfile()->company->active == '0')) {
             throw new CHttpException(403);
         }
         $Address = $SpecialTechnique->address;
         $CostForm = $SpecialTechnique->getCostForm();
         $ContentManager = null;
     } else {
         if (Yii::app()->user->getProfile()->content_manager == '0') {
             if (!Yii::app()->user->checkAccess('admin') && (Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY && Yii::app()->getUser()->getProfile()->modules->specialtech != '1' || Yii::app()->getUser()->getProfile()->company->active == '0')) {
                 throw new CHttpException(403);
             } elseif (!Yii::app()->getUser()->getProfile()->company->validate) {
                 $this->redirect('/complete');
             }
             $ContentManager = null;
         } else {
             $ContentManager = new ContentManager();
         }
         $SpecialTechnique = new SpecialTechnique();
         $Address = new Address();
         $Address->setscenario('specialtechnique');
         $CostForm = new CostForm();
     }
     $contacts = User::getContact();
     if (!empty($_POST)) {
         if (!empty($SpecialTechnique->address)) {
             Address::model()->deleteByPk($SpecialTechnique->address->address_id);
         }
         $SpecialTechnique->setAttributes($_POST['SpecialTechnique'], false);
         $SpecialTechnique->type_request = 'request';
         $CostForm->setAttributes($_POST['CostForm'], false);
         $Address->setAttributes($_POST['Address'], false);
         if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) {
             $ContentManager->setAttributes($_POST['ContentManager'], false);
             $contentValid = $ContentManager->validate();
         } else {
             $contentValid = true;
         }
         $valid = $Address->validate();
         $valid = $SpecialTechnique->validate() && $CostForm->validate() && $valid && $contentValid;
         if (!$valid) {
             Yii::import('bootstrap.widgets.TbActiveForm');
             if ($ContentManager) {
                 echo TbActiveForm::validate(array($SpecialTechnique, $Address, $CostForm, $ContentManager));
             } else {
                 echo TbActiveForm::validate(array($SpecialTechnique, $Address, $CostForm));
             }
             Yii::app()->end();
         } else {
             if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) {
                 $SpecialTechnique->user_id = User::createFakeUser($ContentManager);
                 $SpecialTechnique->contact_id = $SpecialTechnique->user_id;
             }
             $Address->save();
             $SpecialTechnique->address_id = $Address->address_id;
             $SpecialTechnique->save();
             $SpecialTechnique->setRelations($_POST['SpecialTechnique']);
             $SpecialTechnique->setCost($CostForm);
             $SpecialTechnique->autosearch();
             //$this->redirect('/specialtechniquecall');
             echo CJSON::encode(array('status' => '500', 'redirect' => '/specialaddcallsuccess/' . $SpecialTechnique->special_technique_id));
             Yii::app()->end();
         }
     }
     $this->render('add', ['showPhoto' => false, 'CostForm' => $CostForm, 'SpecialTechnique' => $SpecialTechnique, 'contacts' => $contacts, 'Address' => $Address, 'title' => $title, 'ContentManager' => $ContentManager, 'flZayavka' => $flZayavka]);
 }
开发者ID:alexanderkuz,项目名称:test-yii2,代码行数:78,代码来源:CarmarketController.php

示例7: saveUserLastAddressDefault

 /**
  * 保存用户的最后地址信息为默认信息
  * @param $userId
  * @param $add_id
  * @return bool
  */
 public function saveUserLastAddressDefault($userId, $add_id)
 {
     if (empty($add_id) || empty($userId)) {
         return false;
     }
     $info = Address::model()->findByPk($add_id);
     if ($info && $info->is_default != 1) {
         $info->is_default = 1;
         $info->save();
     }
     $sql = 'update bg_address set is_default= 0 where user_id = ' . $userId . ' and id != ' . $add_id;
     Yii::app()->shop->createCommand($sql)->query();
     return true;
 }
开发者ID:conghua1013,项目名称:yii,代码行数:20,代码来源:Address.php

示例8: actionCheckout

 public function actionCheckout()
 {
     $cart = Yii::app()->user->getState('special_order');
     if (!empty($cart)) {
         $user = Yii::app()->user;
         $address = array();
         //$address = Address::model()->findAll('id=:id', array(':id'=>41));
         if (!$user->isGuest) {
             $address = Address::model()->findAll('user_id=:id AND country_id=:c_id', array(':id' => $user->id, ':c_id' => 156));
         }
         if (!empty($_GET['golp']) && is_numeric($_GET['golp'])) {
             $id = 0;
             $id = $_GET['golp'];
             $naddress = Address::model()->findAll('user_id=:user_id AND id=:id', array(':user_id' => $user->id, ':id' => $id));
             $model = CheckoutAddress::model()->findByPk($id);
             if (empty($naddress)) {
                 Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR, 'The address you selected is invalid');
                 if (Yii::app()->getRequest()->getIsAjaxRequest()) {
                     $this->renderPartial('/cart/_shipping', array('model' => $model, 'address' => $address), false, true);
                     Yii::app()->end();
                 }
                 $this->render('/cart/_shipping', array('model' => $model, 'address' => $address));
                 Yii::app()->end();
             }
             //Yii::app()->user->setState('user_cart', $cart);
             if (Yii::app()->getRequest()->getIsAjaxRequest()) {
                 $this->renderPartial('_view', array('model' => $order), false, true);
             } else {
                 $this->render('view', array('model' => $order));
             }
             Yii::app()->end();
         } else {
             $model = new CheckoutAddress();
         }
         if (isset($_POST['Address'])) {
             $_POST['CheckoutAddress'] = $_POST['Address'];
         }
         if (isset($_POST['CheckoutAddress'])) {
             $model->attributes = $_POST['CheckoutAddress'];
             $model->user_id = 0;
             if (!empty($user->id)) {
                 $model->user_id = $user->id;
             }
             $model->country_id = 156;
             if ($model->save()) {
                 $order = new SpecialOrder();
                 $order->product_name = $cart['product_name'];
                 $order->product_quantity = $cart['product_quantity'];
                 $order->product_colour = $cart['product_colour'];
                 $order->specification = $cart['specification'];
                 $order->comment = $cart['comment'];
                 $order->email = $model->email;
                 $order->telephone = $model->telephone;
                 $order->firstname = $model->firstname;
                 $order->lastname = $model->lastname;
                 $order->address_1 = $model->address_1;
                 $order->address_2 = $model->address_2;
                 $order->city = $model->city;
                 $order->postal_code = $model->postal_code;
                 $order->country_id = 156;
                 $order->zone_id = $model->zone_id;
                 $order->ip = Yii::app()->request->userHostAddress;
                 $order->user_agent = Yii::app()->request->userAgent;
                 $order->order_status_id = 1;
                 $order->payment_code = uniqid() . rand(1, 9);
                 $order->save();
                 //Yii::app()->user->setState('user_cart', $cart);
                 if (Yii::app()->getRequest()->getIsAjaxRequest()) {
                     $this->renderPartial('_view', array('model' => $order), false, true);
                 } else {
                     $this->render('view', array('model' => $order));
                 }
                 Yii::app()->end();
             }
         }
         if (Yii::app()->getRequest()->getIsAjaxRequest()) {
             $this->renderPartial('/cart/_shipping', array('model' => $model, 'address' => $address), false, true);
             Yii::app()->end();
         }
         $this->render('/cart/_shipping', array('model' => $model, 'address' => $address));
         Yii::app()->end();
     }
     $this->redirect(array('specialorder'));
 }
开发者ID:Rudianasaja,项目名称:cycommerce,代码行数:84,代码来源:SpecialOrderController.php

示例9: dirname

<?php

namespace Afosto\ActiveAnts;

require_once dirname(__FILE__) . '/vendor/autoload.php';
//Include our configs
require_once dirname(__FILE__) . '/../config.php';
//Make sure this directory is writable
$cacheDirectory = dirname(__FILE__) . '/../cache/';
App::start($url, $user, $password, $cacheDirectory);
$product = Product::model()->setName('testProduct')->setSku('testSku');
if (!$product->save()) {
    echo $product->getMessage();
}
$item = OrderItem::model()->setSku('testSku', false)->setGrossPrice(1.21)->setName('testProduct')->setTaxRate(21);
$address = Address::model()->setName('Afosto SaaS BV')->setAddress('Protonstraat', 9, 'a')->setCity('Groningen')->setCountry('NL')->setPostalcode('9743AL');
$order = Order::model()->setEmail('support@afosto.com')->setOrderId('#' . rand(100, 999))->setPhoneNumber('test')->addOrderItem($item)->setBillingAddress($address)->setShippingAddress();
//$order->setPickupPoint('NL-111101', '1111AA', 'Straatnaam 10a' , 'Groningen');
if (!$order->save()) {
    echo $order->getMessage();
}
$purchase = PurchaseOrder::model()->addItem('testSku', 1)->addReference('testPurchaseOrder');
if (!$purchase->save()) {
    echo $purchase->getMessage();
}
foreach (Stock::model()->findAll() as $stock) {
    echo $stock->sku . ': ' . $stock->stock . "\n";
}
开发者ID:afosto,项目名称:active-ants,代码行数:28,代码来源:index.php

示例10: saveOrderInfo

 /**
  * 保存订单信息.
  * @param $cartInfo
  * @return array
  * @throws exception
  */
 protected function saveOrderInfo($userId, $request, $cartInfo)
 {
     $addid = $request['addrid'];
     $addInfo = Address::model()->findByPk($addid);
     if (empty($userId)) {
         throw new exception('请登录后再提交订单!');
     }
     if (empty($addInfo)) {
         throw new exception('地址不存在,请添加后再提交订单!');
     } elseif ($addInfo['user_id'] != $userId) {
         throw new exception('地址异常修改地址后再提交订单!');
     } elseif ($addInfo['is_default'] != 1) {
         Address::model()->saveUserLastAddressDefault($userId, $addInfo['id']);
     }
     $m = new Order();
     $m->order_sn = Order::model()->getOrderSn();
     $m->user_id = $userId;
     $m->order_status = 0;
     $m->pay_id = $request['payid'];
     $m->shipping_fee = $cartInfo['total']['shipping_fee'];
     $m->order_amount = $cartInfo['total']['final_amount'];
     $m->product_amount = $cartInfo['total']['product_amount'];
     $m->quantity = $cartInfo['total']['quantity'];
     $m->coupon_id = $cartInfo['total']['coupon_id'];
     //$m->coupon_type 	= $cartInfo['total']['coupon_type'];
     $m->coupon_amount = $cartInfo['total']['coupon_amount'];
     $m->consignee = $addInfo['consignee'];
     $m->mobile = $addInfo['mobile'];
     $m->province = $addInfo['province'];
     $m->city = $addInfo['city'];
     $m->district = $addInfo['district'];
     $m->address = $addInfo['address'];
     $m->email = '';
     $m->remark = $request['remark'];
     //备注
     $m->cps_msg = '';
     $m->source = 1;
     $m->add_time = time();
     $id = $m->save();
     if (empty($id)) {
         throw new exception('订单生成失败!');
     }
     $oInfo = array();
     $oInfo['order_id'] = $m->id;
     $oInfo['order_sn'] = $m->order_sn;
     return $oInfo;
 }
开发者ID:conghua1013,项目名称:yii,代码行数:53,代码来源:Cart.php

示例11:

echo $form->dropDownList($model, 'country_id', GxHtml::listDataEx(Country::model()->findAllAttributes(null, true)));
?>
		<?php 
echo $form->error($model, 'country_id');
?>
		</div><!-- row -->
		<div class="row">
		<?php 
echo $form->labelEx($model, 'last_update');
?>
		<?php 
echo $form->textField($model, 'last_update');
?>
		<?php 
echo $form->error($model, 'last_update');
?>
		</div><!-- row -->

		<label><?php 
echo GxHtml::encode($model->getRelationLabel('addresses'));
?>
</label>
		<?php 
echo $form->checkBoxList($model, 'addresses', GxHtml::encodeEx(GxHtml::listDataEx(Address::model()->findAllAttributes(null, true)), false, true));
?>

<?php 
echo GxHtml::submitButton('Save');
$this->endWidget();
?>
</div><!-- form -->
开发者ID:schmunk42,项目名称:yii-sakila-crud,代码行数:31,代码来源:_form.php

示例12: actionEdit

 public function actionEdit($id)
 {
     $model = Address::model()->with('clients', 'properties')->findByPk($id);
     if (!$model) {
         throw new CHttpException(404, 'Address [id = ' . $id . '] is not found');
     }
     if (isset($_POST['Address']) && $_POST['Address']) {
         $model->attributes = $_POST['Address'];
         if ($model->save()) {
             $this->redirect(array('edit', 'id' => $model->id));
         }
     }
     $this->render('edit', ['model' => $model]);
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:14,代码来源:AddressController.php

示例13: testModel

 public function testModel()
 {
     $this->assertEquals('Address', get_class(Address::model()), 'Class name should match model.');
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:4,代码来源:AddressTest.php

示例14: actionUpdateCust

 /**
  * 顾客详细信息(包括客户详细信息及健康信息)确认&修改
  */
 public function actionUpdateCust($id)
 {
     $user_model = User::model();
     $user_info = $user_model->findByPk($id);
     $cust_model = Customer::model();
     $cust_info = $cust_model->findByPk($id);
     $addr_model = Address::model();
     $query = 'select * from tbl_address where addr_cust_id=' . $id;
     $addr_info = $addr_model->findBySql($query);
     $custhi_model = Cust_Health_Info::model();
     $custhi_info = $custhi_model->findByPk($id);
     if (!isset($custhi_info)) {
         //未找到记录的话,需要新建记录
         $custhi_info = new Cust_Health_Info();
     }
     $custhr_model = Cust_Health_Reply::model();
     $query = 'select * from tbl_cust_health_reply where custhr_cust_id=' . $id;
     $custhr_info = $custhr_model->findAllBySql($query);
     if (isset($_POST['User'])) {
         if (isset($user_info)) {
             $user_info->attributes = $_POST['User'];
             $user_info->save();
         }
         if (isset($cust_info)) {
             $cust_info->attributes = $_POST['Customer'];
             //将作为用户名的手机号填入顾客信息里
             $cust_info->cust_mobile1 = $_POST['User']['usr_username'];
             //将用户喜爱的项目按位计算并保存
             $cust_prefer = 0;
             //如果啥都没选的话,下记字符串应该为空,否则为数组(内容为数字)
             if ($_POST['Customer']['cust_prefer'] != '') {
                 for ($i = 0; $i < count($_POST['Customer']['cust_prefer']); $i++) {
                     if ($_POST['Customer']['cust_prefer'][$i]) {
                         $cust_prefer |= (int) $_POST['Customer']['cust_prefer'][$i];
                     }
                 }
             } else {
                 $cust_prefer = 0;
             }
             $cust_info->cust_prefer = $cust_prefer;
             //将用户喜爱的美疗师按位计算并保存
             $cust_beautician = 0;
             //如果啥都没选的话,下记字符串应该为空,否则为字符串数组(内容为数字)
             if ($_POST['Customer']['cust_beautician'] != '') {
                 for ($i = 0; $i < count($_POST['Customer']['cust_beautician']); $i++) {
                     if ($_POST['Customer']['cust_beautician'][$i]) {
                         $cust_beautician |= (int) $_POST['Customer']['cust_beautician'][$i];
                     }
                 }
             } else {
                 $cust_beautician = 0;
             }
             $cust_info->cust_beautician = $cust_beautician;
             $cust_info->save();
         }
         if (isset($addr_info)) {
             $addr_info->attributes = $_POST['Address'];
             $addr_info->save();
         }
         if (isset($custhi_info)) {
             $custhi_info->attributes = $_POST['Cust_Health_Info'];
             $custhi_info->pk_custhi_cust_id = $id;
             $custhi_info->custhi_height = (double) $_POST['Cust_Health_Info']['custhi_height'];
             $custhi_info->custhi_weight = (double) $_POST['Cust_Health_Info']['custhi_weight'];
             $custhi_info->custhi_date = date("Y-m-d H:i:s", time());
             $custhi_info->save();
         }
         $this->redirect("./index.php?r=user/showCust");
     }
     $this->renderPartial('updateCust', array('user_info' => $user_info, 'cust_info' => $cust_info, 'addr_info' => $addr_info, 'custhi_info' => $custhi_info, 'custhr_info' => $custhr_info));
 }
开发者ID:hirvonen,项目名称:backStage_yii,代码行数:74,代码来源:UserController.php

示例15: array

<?php

$this->breadcrumbs = array($model->label(2) => array('index'), 'Manage');
$this->menu = array(array('label' => 'List' . ' ' . $model->label(2), 'url' => array('index')), array('label' => 'Create' . ' ' . $model->label(), 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('staff-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1><?php 
echo 'Manage' . ' ' . GxHtml::encode($model->label(2));
?>
</h1>

<p>
You may optionally enter a comparison operator (&lt;, &lt;=, &gt;, &gt;=, &lt;&gt; or =) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php 
echo GxHtml::link('Advanced Search', '#', array('class' => 'search-button'));
?>
<div class="search-form">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'staff-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('staff_id', 'first_name', 'last_name', array('name' => 'address_id', 'value' => 'GxHtml::valueEx($data->address)', 'filter' => GxHtml::listDataEx(Address::model()->findAllAttributes(null, true))), 'picture', 'email', array('class' => 'CButtonColumn'))));
开发者ID:schmunk42,项目名称:yii-sakila-crud,代码行数:27,代码来源:admin.php


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