<div class="container-fluid" id="contact">
<section class="container">
<div class="row">
<div class="col-xs-12 col-sm-10 col-sm-offset-1 pt-40">
<div class="well">
<legend>Envoyer un message à <?= $user->username?></legend>
<?= $this->Form->create($message, ['type' => 'file']) ?>
<?= $this->Form->input('to_user_id', ['required' => true, 'label' => false, 'default' => $user->id, 'type' => 'hidden']) ?>
<?= $this->Form->input('referer', ['required' => true, 'label' => false, 'default' => $message->referer, 'type' => 'hidden']) ?>
<div class="row">
<div class="form-group col-sm-6">
<label for="objet" class="control-label">Objet de votre message :</label>
<?= $this->Form->input('title', ['label' => false, 'class' => 'form-control']) ?>
</div>
</div>
<div class="row">
<div class="form-group col-sm-12">
<label for="message" class="control-label">Votre message :</label>
<?= $this->Form->input('content', ['type' => 'textarea' ,'label' => false, 'class' => 'form-control']) ?>
</div>
</div>
<label for="upload" class="control-label">Pièce jointe : (<span class="text-warning small">Uniquement des fichiers images en format jpg ou png et de moins de 2Mo.</span>)</label>
<? if ($this->
Form->
isFieldError('attachments')) { echo $this->
Form->
error('attachments');
} ?>
<?php if(!$this->request->is('mobile')){ ?>
<div class="row">
<div class="form-group col-sm-3">
<div class="fileinput fileinput-new" data-provides="fileinput">
<div class="fileinput-new thumbnail" style="width: 200px; height: 200px;">
<?php
if(isset($message->
attachments[0]['name'])){
echo $this->
Html->
image('https://www.placehold.it/200x200/EFEFEF/AAAAAA&text=' .
$message['attachments'][0]['name'],
['escape' =>
false]);
} else {
echo $this->
Html->
image('https://www.placehold.it/200x200/EFEFEF/AAAAAA&text=no+image',
['escape' =>
false]);
}
?>
</div>
<div class="fileinput-preview fileinput-exists thumbnail" style="width: 200px; height: 200px;"></div>
<div>
<span class="btn btn-default btn-file">
<span class="fileinput-new"><?= __("Choisir image") ?></span>
<span class="fileinput-exists"><?= __("Modifier") ?></span>
<?= $this->Form->input('attachments[0]', ['type' => 'file', 'accept' => 'image/*',
'label' => false,
'templates' => ['inputContainer' => '{{content}}</span>', 'inputContainerError' => '{{content}}</span>{{error}}'],
'default' => $message['attachments'][0]
]) ?>
</span>
<a href="#" class="btn btn-danger fileinput-exists" data-dismiss="fileinput"><?= __("Supprimer") ?></a>
</div>
</div>
</div>
<div class="form-group col-sm-3">
<div class="fileinput fileinput-new" data-provides="fileinput">
<div class="fileinput-preview thumbnail" style="width: 200px; height: 200px;">
<?php
if(!
is_null($message->
attachments[1]['name'])){
echo $this->
Html->
image('https://www.placehold.it/200x200/EFEFEF/AAAAAA&text=' .
$message['attachments'][1]['name'],
['escape' =>
false]);
} else {
echo $this->
Html->
image('https://www.placehold.it/200x200/EFEFEF/AAAAAA&text=no+image',
['escape' =>
false]);
}
?>
</div>
<div>
<span class="btn btn-default btn-file">
<span class="fileinput-new"><?= __("Choisir image") ?></span>
<span class="fileinput-exists"><?= __("Modifier") ?></span>
<?= $this->Form->input('attachments[1]', ['type' => 'file', 'label' => false, 'templates' => ['inputContainer' => '{{content}}</span>', 'inputContainerError' => '{{content}}</span>{{error}}']]) ?>
</span>
<a href="#" class="btn btn-danger fileinput-exists" data-dismiss="fileinput"><?= __("Supprimer") ?></a>
</div>
</div>
</div>
<div class="form-group col-sm-3">
<div class="fileinput fileinput-new" data-provides="fileinput">
<div class="fileinput-preview thumbnail" style="width: 200px; height: 200px;"></div>
<div>
<span class="btn btn-default btn-file">
<span class="fileinput-new"><?= __("Choisir image") ?></span>
<span class="fileinput-exists"><?= __("Modifier") ?></span>
<?= $this->Form->input('attachments[2]', ['type' => 'file', 'label' => false, 'templates' => ['inputContainer' => '{{content}}</span>', 'inputContainerError' => '{{content}}</span>{{error}}']]) ?>
</span>
<a href="#" class="btn btn-danger fileinput-exists" data-dismiss="fileinput"><?= __("Supprimer") ?></a>
</div>
</div>
</div>
<div class="form-group col-sm-3">
<div class="fileinput fileinput-new" data-provides="fileinput">
<div class="fileinput-preview thumbnail" style="width: 200px; height: 200px;"></div>
<div>
<span class="btn btn-default btn-file">
<span class="fileinput-new"><?= __("Choisir image") ?></span>
<span class="fileinput-exists"><?= __("Modifier") ?></span>
<?= $this->Form->input('attachments[3]', ['type' => 'file', 'label' => false, 'templates' => ['inputContainer' => '{{content}}</span>', 'inputContainerError' => '{{content}}</span>{{error}}']]) ?>
</span>
<a href="#" class="btn btn-danger fileinput-exists" data-dismiss="fileinput"><?= __("Supprimer") ?></a>
</div>
</div>
</div>
</div>
<?php
} else {
?>
<div class="row">
<div class="form-group col-xs-6">
<div class="fileinput fileinput-new" data-provides="fileinput">
<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 200px;"></div>
<div>
<span class="btn btn-default btn-file">
<span class="fileinput-new"><?= __("Choisir image") ?></span>
<span class="fileinput-exists"><?= __("Modifier") ?></span>
<?= $this->Form->input('attachment[0]', ['type' => 'file', 'label' => false, 'templates' => ['inputContainer' => '{{content}}</span>', 'inputContainerError' => '{{content}}</span>{{error}}']]) ?>
</span>
<a href="#" class="btn btn-danger fileinput-exists" data-dismiss="fileinput"><?= __("Supprimer") ?></a>
</div>
</div>
</div>
<div class="form-group col-xs-6">
<div class="fileinput fileinput-new" data-provides="fileinput">
<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 200px;"></div>
<div>
<span class="btn btn-default btn-file">
<span class="fileinput-new"><?= __("Choisir image") ?></span>
<span class="fileinput-exists"><?= __("Modifier") ?></span>
<?= $this->Form->input('attachment[1]', ['type' => 'file', 'label' => false, 'templates' => ['inputContainer' => '{{content}}</span>', 'inputContainerError' => '{{content}}</span>{{error}}']]) ?>
</span>
<a href="#" class="btn btn-danger fileinput-exists" data-dismiss="fileinput"><?= __("Supprimer") ?></a>
</div>
</div>
</div>
<?php } ?>
<hr>
<div class="row text-center">
<?= $this->Form->button('Envoyer', ['type' => 'submit', 'class' => 'btn btn-success']) ?>
</div>
<?= $this->Form->end(); ?>
</div>
</div>
</div>
</section>
</div>
<?= $this->Html->css('/assets/jasny-bootstrap-3.1.3/dist/css/jasny-bootstrap.min', ['block' => 'css']) ?>
<?= $this->Html->script('/assets/jasny-bootstrap-3.1.3/dist/js/jasny-bootstrap.min', ['block' => 'script']) ?>