*/ | */ | ||||
class EtablissementController extends BackendController { | class EtablissementController extends BackendController { | ||||
public $enableCsrfValidation = false; | |||||
public function behaviors() { | public function behaviors() { | ||||
return [ | return [ | ||||
'verbs' => [ | 'verbs' => [ |
<?= $form->field($model, 'photo')->fileInput() ?> | <?= $form->field($model, 'photo')->fileInput() ?> | ||||
<?php | <?php | ||||
if (strlen($model->photo)) { | if (strlen($model->photo)) { | ||||
$base_url = Url::frontend() ; | |||||
echo '<img src="'.$base_url.'uploads/' . $model->photo . '" width="400px" /><br />'; | |||||
$base_url = Yii::$app->urlManagerProducer->baseUrl ; | |||||
echo '<img src="'.$base_url.'/uploads/' . $model->photo . '" width="400px" /><br />'; | |||||
echo '<input type="checkbox" name="delete_photo" id="delete_photo" /> <label for="delete_photo">Supprimer la photo</label><br /><br />'; | echo '<input type="checkbox" name="delete_photo" id="delete_photo" /> <label for="delete_photo">Supprimer la photo</label><br /><br />'; | ||||
} | } | ||||
?> | ?> |
<?php | |||||
date_default_timezone_set('Europe/Paris'); | |||||
defined('YII_DEBUG') or define('YII_DEBUG', true); | |||||
defined('YII_ENV') or define('YII_ENV', 'dev'); | |||||
require(__DIR__ . '/../../vendor/autoload.php'); | |||||
require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); | |||||
require(__DIR__ . '/../../common/config/bootstrap.php'); | |||||
require(__DIR__ . '/../config/bootstrap.php'); | |||||
$config = yii\helpers\ArrayHelper::merge( | |||||
require(__DIR__ . '/../../common/config/main.php'), | |||||
require(__DIR__ . '/../../common/config/main-local.php'), | |||||
require(__DIR__ . '/../config/main.php'), | |||||
require(__DIR__ . '/../config/main-local.php') | |||||
); | |||||
$application = new yii\web\Application($config); | |||||
date_default_timezone_set('Europe/Paris'); | |||||
setlocale(LC_TIME, 'fr_FR.utf8','fra'); | |||||
$application->run(); |
if ($file) { | if ($file) { | ||||
$file_name = $file->baseName . '-' . uniqid() ; | $file_name = $file->baseName . '-' . uniqid() ; | ||||
$file_name_extension = $file_name .'.'.$file->extension ; | $file_name_extension = $file_name .'.'.$file->extension ; | ||||
$dir_file = '../../frontend/web/uploads/' ; | |||||
$dir_file = '../../producer/web/uploads/' ; | |||||
$path_file = $dir_file . $file_name_extension ; | $path_file = $dir_file . $file_name_extension ; | ||||
$file->saveAs($path_file); | $file->saveAs($path_file); | ||||
<section id="presentation"> | <section id="presentation"> | ||||
<?php if(strlen($producer->photo)): ?> | <?php if(strlen($producer->photo)): ?> | ||||
<div class="photo <?= $col_size ?>"> | <div class="photo <?= $col_size ?>"> | ||||
<img class="img-photo" src="<?= Yii::$app->urlManagerFrontend->baseUrl; ?>/uploads/<?= $producer->photo; ?>" alt="Photo <?= Html::encode($producer->nom) ?>" /> | |||||
<img class="img-photo" src="<?= Yii::$app->urlManager->baseUrl; ?>/uploads/<?= $producer->photo; ?>" alt="Photo <?= Html::encode($producer->nom) ?>" /> | |||||
</div> | </div> | ||||
<?php endif; ?> | <?php endif; ?> | ||||
<?php if(strlen($producer->description)): ?> | <?php if(strlen($producer->description)): ?> |
* | |||||
!.gitignore |