// echo $form->field($model, 'first_name') ?> <?php echo $form->field($model, 'gender')->radioList(['1' => 'Female', '2' => 'Male', '' => 'Any']); ?> <!-- --><?php // echo $form->field($model, 'last_name') ?> <!-- --><?php //echo $form->field($model, 'bd_date') ?> <p>Age</p> <label> From: <input type="text" style="width: 50px;display: inline;" class="form-control" name="userSearch[min_year]" id="min_year"></label><label>To:<input type="text" style="width: 50px;display: inline;" class="form-control" name="userSearch[max_year]" id="max_year"></label> <?php echo $form->field($model, 'country')->dropDownList(\yii\helpers\ArrayHelper::map(\frontend\models\Countries::find()->all(), 'country_name', 'country_name'), ['prompt' => 'Select Country']); ?> <div class="form-group"> <?php echo Html::submitButton('Search', ['class' => 'btn btn-primary']); ?> <!-- --><?php //= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?> </div> <?php ActiveForm::end();
/* @var $this yii\web\View */ /* @var $model backend\models\UserMain */ $this->title = $model->username; $this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="user-main-view"> <?php if ($model->status == 10) { $status = 'Active'; } else { $status = 'In-Active'; } if ($model->roleId == 2) { $role = 'Vendor'; } else { if ($model->roleId == 3) { $role = 'User'; } else { $role = 'Admin'; } } ?> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['username', 'email:email', ['attribute' => 'status', 'label' => 'Status', 'value' => $status], ['attribute' => 'roleId', 'label' => 'Role', 'value' => $role], 'register.firstName', 'register.lastName', 'register.middleName', 'register.gender', 'register.dob', 'register.mobile', 'register.mobile2', 'register.address1', 'register.address2', ['attribute' => 'country', 'label' => 'Country', 'value' => Countries::getCountryName($model->register->country)], ['attribute' => 'state', 'label' => 'State', 'value' => States::getStateName($model->register->state)], 'register.city', 'register.zip']]); ?> </div>
/** * @return \yii\db\ActiveQuery */ public function getCountry() { return $this->hasOne(Countries::className(), ['id' => 'country_id']); }
public function actionStates() { $out = []; if (isset($_POST['depdrop_parents'])) { $parents = $_POST['depdrop_parents']; if ($parents != null) { $country = $parents[0]; $states = Countries::getStatesByCountry($country); /* $out = [ ['id'=>'<sub-cat-id-1>', 'name'=>'<sub-cat-name1>'], ['id'=>'<sub-cat_id_2>', 'name'=>'<sub-cat-name2>'] ]; */ echo Json::encode(['output' => $states, 'selected' => '']); return; } } echo Json::encode(['output' => '', 'selected' => '']); }
public static function getCountryNameShort($countryId) { $countryName = Countries::find()->select(['sortname'])->asArray()->where(['id' => $countryId])->one(); return $countryName['sortname']; }
} else { $status = 'In-Active'; } if ($model->roleId == 2) { $role = 'Vendor'; } else { if ($model->roleId == 3) { $role = 'User'; } else { $role = 'Admin'; } } ?> <?php if ($model->vendorregister->storeImage != '') { ?> <?php $imgeurl = str_replace("backend", "frontend", Yii::getAlias('@web')) . '/' . $model->vendorregister->storeImage; ?> <?php } ?> <?php echo DetailView::widget(['model' => $model, 'attributes' => [['attribute' => 'vendor_unique_id', 'label' => 'Store Id', 'value' => $model->vendorregister->vendor_unique_id], 'username', 'email:email', ['attribute' => 'storeName', 'label' => 'Store Name', 'value' => $model->vendorregister->storeName], ['attribute' => 'roleId', 'label' => 'Role', 'value' => $role], 'vendorregister.firstName', 'vendorregister.lastName', 'vendorregister.middleName', 'vendorregister.mobile', 'vendorregister.mobile2', ['attribute' => 'fax', 'label' => 'Fax', 'value' => $model->vendorregister->fax], ['attribute' => 'country', 'label' => 'Country', 'value' => Countries::getCountryName($model->vendorregister->country)], ['attribute' => 'state', 'label' => 'State', 'value' => States::getStateName($model->vendorregister->state)], 'vendorregister.city', 'vendorregister.zip', ['attribute' => 'storeAddress', 'label' => 'Store Address', 'value' => $model->vendorregister->storeAddress], 'vendorregister.address2', ['attribute' => 'storeImage', 'format' => 'html', 'value' => Html::img($model->vendorregister->storeImage ? $imgeurl : '@web/images/events-default.png', ['width' => '250px', 'height' => '250px'])], ['attribute' => 'status', 'label' => 'Status', 'value' => $status]]]); ?> </div>
<td><?php echo $model->city; ?> </td> </tr> <tr> <td>State</td> <td><?php echo States::getStateName($model->state); ?> </td> </tr> <tr> <td>Country</td> <td><?php echo Countries::getCountryName($model->country); ?> </td> </tr> <tr> <td>Zip Code</td> <td><?php echo $model->zip; ?> </td> </tr> <tr> <td>Primary Phone</td> <td><?php echo $model->mobile; ?>
public function actionUpdate() { $this->layout = 'profile'; $model = new RegisterMaster(); $userData = RegisterMaster::find()->where(['uid' => Yii::$app->user->id])->one(); $userMain = UserMaster::find()->where(['id' => Yii::$app->user->id])->one(); $model->countriesList = Countries::getCountries(); //print_r(var_dump($userData['country']));exit(); if ($userData['country'] == NULL) { $model->country = 231; } else { $model->country = $userData['country']; } //print_r($model->country);exit(); $states = Countries::getStatesByCountryDefault($model->country); if ($userData['state'] == NULL) { $model->state = 3975; } else { $model->state = $userData['state']; } $model->statesData = $states; if ($model->load(Yii::$app->request->post())) { $model->uid = Yii::$app->user->id; //$model->dob = 'NOW()'; $userExist = RegisterMaster::find()->where(['uid' => Yii::$app->user->id])->one(); if ($userExist != NULL) { //echo "00000000000000000"; $userExist->firstName = $model->firstName; $userExist->lastName = $model->lastName; $userExist->middleName = $model->middleName; $userExist->gender = $model->gender; $userExist->dob = $model->dob; $userExist->mobile = $model->mobile; $userExist->mobile2 = $model->mobile2; $userExist->address1 = $model->address1; $userExist->address2 = $model->address2; $userExist->city = $model->city; $userExist->state = $model->state; $userExist->country = $model->country; $userExist->zip = $model->zip; $userExist->modifiedDate = 'NOW()'; if ($userMain->roleId == 2) { $userExist->storeName = $model->storeName; $userExist->storeAddress = $model->storeAddress; $model->storeImage = UploadedFile::getInstance($model, 'storeImage'); if ($model->storeImage != '') { $imageName = rand(1000, 100000) . $model->storeImage->baseName; $model->storeImage->saveAs('uploads/storeimages/' . $imageName . '.' . $model->storeImage->extension); $model->storeImage = 'uploads/storeimages/' . $imageName . '.' . $model->storeImage->extension; $userExist->storeImage = $model->storeImage; $model->storeImage; } } $userExist->update(); Yii::$app->getSession()->setFlash('success', 'You are successfully Updated Your Profile.'); return $this->redirect(['profile']); } else { $model->email = '*****@*****.**'; $model->save(); Yii::$app->getSession()->setFlash('success', 'You are successfully Updated Your Profile.'); return $this->redirect(['profile']); } } else { $model->email = $userMain->email; $model->roleId = $userMain->roleId; $model->firstName = $userData['firstName']; $model->lastName = $userData['lastName']; $model->middleName = $userData['middleName']; $model->gender = $userData['gender']; $model->dob = $userData['dob']; $model->mobile = $userData['mobile']; $model->mobile2 = $userData['mobile2']; $model->address1 = $userData['address1']; $model->address2 = $userData['address2']; $model->city = $userData['city']; /* $model->state = $userData['state']; $model->country = $userData['country']; */ $model->zip = $userData['zip']; $model->storeName = $userData['storeName']; $model->storeAddress = $userData['storeAddress']; $model->storeImage = $userData['storeImage']; if ($userMain->roleId == 2) { return $this->render('vendorupdate', ['model' => $model]); } else { return $this->render('update', ['model' => $model]); } } }
public function actionUserupdate($id) { $model = new RegisterMaster(); $userData = RegisterMaster::find()->where(['uid' => $id])->one(); $userMain = UserMaster::find()->where(['id' => $id])->one(); $model->countriesList = Countries::getCountries(); $states = Countries::getStatesByCountry($userData['country']); $statesAry = array(); foreach ($states as $state) { $statesAry[$state['id']] = $state['name']; } $model->statesData = $statesAry; if ($model->load(Yii::$app->request->post())) { $model->uid = $id; //$model->dob = 'NOW()'; $userExist = RegisterMaster::find()->where(['uid' => $id])->one(); if ($userExist != NULL) { //echo "00000000000000000"; $userExist->firstName = $model->firstName; $userExist->lastName = $model->lastName; $userExist->middleName = $model->middleName; $userExist->gender = $model->gender; $userExist->dob = $model->dob; $userExist->mobile = $model->mobile; $userExist->mobile2 = $model->mobile2; $userExist->address1 = $model->address1; $userExist->address2 = $model->address2; $userExist->city = $model->city; $userExist->state = $model->state; $userExist->country = $model->country; $userExist->zip = $model->zip; $userExist->modifiedDate = 'NOW()'; if ($userMain->roleId == 2) { $userExist->storeName = $model->storeName; $userExist->storeAddress = $model->storeAddress; $model->storeImage = UploadedFile::getInstance($model, 'storeImage'); if ($model->storeImage != '') { $imageName = rand(1000, 100000) . $model->storeImage->baseName; $model->storeImage->saveAs('uploads/storeimages/' . $imageName . '.' . $model->storeImage->extension); $model->storeImage = 'uploads/storeimages/' . $imageName . '.' . $model->storeImage->extension; $userExist->storeImage = $model->storeImage; $model->storeImage; } } $userExist->update(); Yii::$app->getSession()->setFlash('success', 'You are successfully Updated Your Profile.'); return $this->redirect(['index']); } else { $model->save(); print_r($model); exit; Yii::$app->getSession()->setFlash('success', 'You are successfully Updated Your Profile.'); return $this->redirect(['index']); } } else { $model->username = $userMain->username; $model->email = $userMain->email; $model->roleId = $userMain->roleId; $model->status = $userMain->status; $model->firstName = $userData['firstName']; $model->lastName = $userData['lastName']; $model->middleName = $userData['middleName']; $model->gender = $userData['gender']; $model->dob = $userData['dob']; $model->mobile = $userData['mobile']; $model->mobile2 = $userData['mobile2']; $model->address1 = $userData['address1']; $model->address2 = $userData['address2']; $model->city = $userData['city']; $model->state = $userData['state']; $model->country = $userData['country']; $model->zip = $userData['zip']; $model->storeName = $userData['storeName']; $model->storeAddress = $userData['storeAddress']; $model->storeImage = $userData['storeImage']; $model->id = $userData['uid']; return $this->render('update', ['model' => $model]); } }