Browse Source

[Administration] Utilisateurs admin : lien vers la modification du profil

feature/rotating_product
Guillaume Bourgeois 5 months ago
parent
commit
549e1e567e
3 changed files with 6 additions and 6 deletions
  1. +2
    -2
      backend/controllers/UserAdminController.php
  2. +2
    -2
      backend/views/user-admin/email_deliverability.php
  3. +2
    -2
      backend/views/user-admin/index.php

+ 2
- 2
backend/controllers/UserAdminController.php View File

return $this->redirect('index'); return $this->redirect('index');
} }


public function actionRedirectView(int $idUserProducer)
public function actionRedirectUpdate(int $idUserProducer)
{ {
$userCurrent = $this->getUserCurrent(); $userCurrent = $this->getUserCurrent();
$userProducer = $this->getUserProducerModule()->getRepository()->findOneUserProducerById($idUserProducer); $userProducer = $this->getUserProducerModule()->getRepository()->findOneUserProducerById($idUserProducer);
$user = $userProducer->user; $user = $userProducer->user;
$producer = $userProducer->producer; $producer = $userProducer->producer;
$this->getUserModule()->getBuilder()->switchProducer($userCurrent, $producer); $this->getUserModule()->getBuilder()->switchProducer($userCurrent, $producer);
return $this->redirect(['user/view', 'id' => $user->id]);
return $this->redirect(['user/update', 'id' => $user->id]);
} }
else { else {
$this->addFlash('error', "L'utilisateur n'a pas été trouvé."); $this->addFlash('error', "L'utilisateur n'a pas été trouvé.");

+ 2
- 2
backend/views/user-admin/email_deliverability.php View File

], ],
[ [
'attribute' => 'producers', 'attribute' => 'producers',
'label' => 'Producteurs',
'label' => 'Profils',
'format' => 'raw', 'format' => 'raw',
'contentOptions' => ['class' => 'column-hide-on-mobile align-center'], 'contentOptions' => ['class' => 'column-hide-on-mobile align-center'],
'value' => function ($user) use ($userProducerModule) { 'value' => function ($user) use ($userProducerModule) {
$userProducersArray = $userProducerModule->getRepository()->findUserProducersByUser($user); $userProducersArray = $userProducerModule->getRepository()->findUserProducersByUser($user);


foreach($userProducersArray as $userProducer) { foreach($userProducersArray as $userProducer) {
$html .= '<a href="'.Yii::$app->urlManager->createUrl(['user-admin/redirect-view', 'idUserProducer' => $userProducer->id]).'" class="btn btn-default"><span class="glyphicon glyphicon-eye-open"></span> '.$userProducer->producer->name.'</a> ';
$html .= '<a href="'.Yii::$app->urlManager->createUrl(['user-admin/redirect-update', 'idUserProducer' => $userProducer->id]).'" class="btn btn-default"><span class="glyphicon glyphicon-user"></span> '.$userProducer->producer->name.'</a> ';
} }


return $html; return $html;

+ 2
- 2
backend/views/user-admin/index.php View File

], ],
[ [
'attribute' => 'producers', 'attribute' => 'producers',
'label' => 'Producteurs',
'label' => 'Profils',
'format' => 'raw', 'format' => 'raw',
'contentOptions' => ['class' => 'column-hide-on-mobile align-center'], 'contentOptions' => ['class' => 'column-hide-on-mobile align-center'],
'value' => function ($user) use ($userProducerModule) { 'value' => function ($user) use ($userProducerModule) {
$userProducersArray = $userProducerModule->getRepository()->findUserProducersByUser($user); $userProducersArray = $userProducerModule->getRepository()->findUserProducersByUser($user);


foreach($userProducersArray as $userProducer) { foreach($userProducersArray as $userProducer) {
$html .= '<a href="'.Yii::$app->urlManager->createUrl(['user-admin/redirect-view', 'idUserProducer' => $userProducer->id]).'" class="btn btn-default"><span class="glyphicon glyphicon-eye-open"></span> '.$userProducer->producer->name.'</a> ';
$html .= '<a href="'.Yii::$app->urlManager->createUrl(['user-admin/redirect-update', 'idUserProducer' => $userProducer->id]).'" class="btn btn-default"><span class="glyphicon glyphicon-user"></span> '.$userProducer->producer->name.'</a> ';
} }


return $html; return $html;

Loading…
Cancel
Save