|
|
@@ -1,9 +1,43 @@
|
|
|
<?php require(dirname(__FILE__).'/header.inc.php'); ?>
|
|
|
+<?php if ($this->getCampain()->getDescr()) { ?>
|
|
|
+<div class="panel panel-default">
|
|
|
+ <?php if ($this->getCampain()->getName()) { ?>
|
|
|
+ <div class="panel-heading">
|
|
|
+ <h2><?php echo htmlentities($this->getCampain()->getName()); ?></h2>
|
|
|
+ </div>
|
|
|
+ <?php } ?>
|
|
|
+ <div class="panel-body">
|
|
|
+ <?php echo htmlentities($this->getCampain()->getDescr()); ?>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+<?php } elseif ($this->getCampain()->getName()) { ?>
|
|
|
+<h2><?php echo htmlentities($this->getCampain()->getName()); ?></h2>
|
|
|
+<?php } ?>
|
|
|
+<?php if ($this->isAdmin()) { ?>
|
|
|
+<div class="panel panel-default"><div class="panel-heading">Lien public:</div>
|
|
|
+<div class="panel-body"><div class="highlight"><code><a href="<?php echo $this->getPublink(); ?>" target="_blank">
|
|
|
+<?php echo $this->getPublink(); ?>
|
|
|
+</a></code></div></div></div>
|
|
|
+<?php if ($this->haserror() && count($this->getusers()) >= 2) { ?>
|
|
|
+<div class="alert alert-danger">
|
|
|
+les contraintes entre les utilisateurs ne permettent pas de résoudre le tirage au sort.
|
|
|
+</div>
|
|
|
+<?php } /* / randomizer error */ else if ($this->haserror()) { ?>
|
|
|
+<div class="alert alert-danger">
|
|
|
+Il n'y a pas suffisament de participants pour effectuer le tirage au sort.
|
|
|
+</div>
|
|
|
+<?php } /* / User count error */ } /* ! admin : public link */ ?>
|
|
|
+<?php if ($this->hasUsererror()) { ?>
|
|
|
+<div class="alert alert-danger">
|
|
|
+L'utilisateur est déjà enregistré pour le tirage.
|
|
|
+</div>
|
|
|
+<?php } /* / user exists error */ ?>
|
|
|
+<div class="panel panel-default"><div class="panel-body">
|
|
|
<form method="POST" action="#" class="userlist">
|
|
|
<table class="table">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
- <th>Utilisateur</th>
|
|
|
+ <th>Utilisateurs</th>
|
|
|
<?php foreach ($this->getUsers() as $i): ?>
|
|
|
<th class="text-center"><?php echo $i->getDisplay(); ?>
|
|
|
<?php endforeach; ?>
|
|
|
@@ -52,10 +86,42 @@
|
|
|
<input type="submit" class="btn btn-default" value="Valider" />
|
|
|
<?php endif; ?>
|
|
|
</form>
|
|
|
-<?php if (!$this->getCampain()->isFinished()): ?>
|
|
|
-<form method="POST">
|
|
|
- <input type="hidden" name="launch" value="1" />
|
|
|
- <input type="submit" class="btn btn-default" value="Confirmer et envoyer les e-mails" />
|
|
|
-</form>
|
|
|
-<?php endif; ?>
|
|
|
+</div></div>
|
|
|
+<?php if (!$this->getCampain()->isFinished() && $this->isAdmin()): ?>
|
|
|
+<div class="panel panel-default"><div class="panel-body">
|
|
|
+ <p>Quand toutes les personnes auront été inscrites au tirage au sort, vous pourrez cliquer sur le bouton ci-dessous pour effectuer le tirage au sort et envoyer les e-mails aux participants.</p>
|
|
|
+ <form method="POST">
|
|
|
+ <input type="hidden" name="launch" value="1" />
|
|
|
+ <input type="submit" class="btn btn-default" value="Confirmer et envoyer les e-mails" />
|
|
|
+ </form>
|
|
|
+</div></div>
|
|
|
+<?php elseif ($this->isAdmin()): ?>
|
|
|
+<div class="panel panel-default">
|
|
|
+ <div class="panel-heading">
|
|
|
+ Résultat du tirage:
|
|
|
+ <div class="pull-right">
|
|
|
+ <button type="button" class="btn btn-default btn-xs spoiler-trigger" data-toggle="collapse">Voir les résultats</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="panel-collapse collapse out"><div class="panel-body">
|
|
|
+ <table class="table table-stripped">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>L'utilisateur</th>
|
|
|
+ <th>offre à</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <?php $userCount = count($this->getCampain()->getResult());
|
|
|
+ for ($i =0; $i < $userCount; $i++): ?>
|
|
|
+ <tr>
|
|
|
+ <td><?php echo htmlentities($this->getCampain()->getResult()[$i]); ?></td>
|
|
|
+ <td><?php echo htmlEntities($this->getCampain()->getResult()[($i +1) % $userCount]); ?></td>
|
|
|
+ </tr>
|
|
|
+ <?php endfor; ?>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div></div>
|
|
|
+</div>
|
|
|
+<?php endif; /* !admin */ ?>
|
|
|
<?php require(dirname(__FILE__).'/footer.inc.php'); ?>
|