ソースを参照

Adaptations frontend/site/producer

refactoring
コミット
db88b40908
4個のファイルの変更15行の追加13行の削除
  1. +1
    -1
      common/models/LoginForm.php
  2. +3
    -1
      frontend/controllers/SiteController.php
  3. +1
    -1
      frontend/models/AddProducerForm.php
  4. +10
    -10
      frontend/views/site/producer.php

+ 1
- 1
common/models/LoginForm.php ファイルの表示

@@ -88,7 +88,7 @@ class LoginForm extends Model
}],
['id_producer', 'integer'],
['id_producer', function($attribute, $params) {
if ($this->id_producr) {
if ($this->id_producer) {
$producer = Producer::findOne($this->id_producer);
if (!$producer) {
$this->addError($attribute, 'Ce producteur n\'existe pas.');

+ 3
- 1
frontend/controllers/SiteController.php ファイルの表示

@@ -371,7 +371,9 @@ class SiteController extends FrontendController
$loginForm = new LoginForm();
$signupForm = new SignupForm();
$producer = Producer::searchOne($id);
$producer = Producer::searchOne([
'id' => $id
]);
$loginForm->id_producer = $id;
$signupForm->id_producer = $id;

+ 1
- 1
frontend/models/AddProducerForm.php ファイルの表示

@@ -128,7 +128,7 @@ class AddProducerForm extends Model
} else {
$userProducer = new UserProducer();
$userProducer->id_user = User::getCurrentId();
$userProducer->id_producer = $this->id_producr;
$userProducer->id_producer = $this->id_producer;
$userProducer->credit = 0;
$userProducer->actif = 1;
$userProducer->save();

+ 10
- 10
frontend/views/site/producer.php ファイルの表示

@@ -54,14 +54,14 @@ $this->title = 'Producteur '.Html::encode($producer->name) ;
<div class="col-md-6">
<h2>Connexion</h2>
<?php $form = ActiveForm::begin(['id' => 'login-form','enableClientValidation'=> false]); ?>
<?= $form->field($model_login, 'email') ?>
<?= $form->field($model_login, 'password')->passwordInput() ?>
<?= $form->field($model_login, 'rememberMe')->checkbox() ?>
<?= $form->field($loginForm, 'email') ?>
<?= $form->field($loginForm, 'password')->passwordInput() ?>
<?= $form->field($loginForm, 'rememberMe')->checkbox() ?>
<p>
Si vous avez oublié votre mot de passe, vous pouvez le <?= Html::a('réinitialiser', ['site/request-password-reset']) ?>.
</p>
<?php if(strlen($producer->code)): ?>
<?= $form->field($modelLogin, 'code',[
<?= $form->field($loginForm, 'code',[
'inputTemplate' => '<div class="input-group"><span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>{input}</div>',
])
->label('Code du producteur')
@@ -76,14 +76,14 @@ $this->title = 'Producteur '.Html::encode($producer->name) ;
<div class="col-md-6">
<h2>Inscription</h2>
<?php $form = ActiveForm::begin(['id' => 'form-signup','enableClientValidation'=> false]); ?>
<?= $form->field($model_signup, 'email') ?>
<?= $form->field($model_signup, 'password')->passwordInput() ?>
<?= $form->field($model_signup, 'lastname') ?>
<?= $form->field($model_signup, 'name') ?>
<?= $form->field($model_signup, 'phone') ?>
<?= $form->field($signupForm, 'email') ?>
<?= $form->field($signupForm, 'password')->passwordInput() ?>
<?= $form->field($signupForm, 'lastname') ?>
<?= $form->field($signupForm, 'name') ?>
<?= $form->field($signupForm, 'phone') ?>

<?php if(strlen($producer->code)): ?>
<?= $form->field($modelSignup, 'code',[
<?= $form->field($signupForm, 'code',[
'inputTemplate' => '<div class="input-group"><span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>{input}</div>',
])
->label('Code du producteur')

読み込み中…
キャンセル
保存