admin: Add some work to poll information pane.
This commit is contained in:
parent
844315ada4
commit
410d2127ce
|
@ -29,6 +29,7 @@ $admin_poll_id = null;
|
|||
$poll_id = null;
|
||||
$poll = null;
|
||||
$message = null;
|
||||
$editingVoteId = 0;
|
||||
|
||||
/* Services */
|
||||
/*----------*/
|
||||
|
@ -58,7 +59,8 @@ $comments = $pollService->allCommentsByPollId($poll_id);
|
|||
|
||||
|
||||
// Assign data to template
|
||||
$smarty->assign('poll_id', $admin_poll_id);
|
||||
$smarty->assign('poll_id', $poll_id);
|
||||
$smarty->assign('admin_poll_id', $admin_poll_id);
|
||||
$smarty->assign('poll', $poll);
|
||||
$smarty->assign('title', _('Poll') . ' - ' . $poll->title);
|
||||
$smarty->assign('slots', $pollService->splitSlots($slots));
|
||||
|
@ -67,5 +69,6 @@ $smarty->assign('best_moments', $pollService->computeBestMoments($votes));
|
|||
$smarty->assign('comments', $comments);
|
||||
$smarty->assign('editingVoteId', $editingVoteId);
|
||||
$smarty->assign('message', $message);
|
||||
$smarty->assign('admin', true);
|
||||
|
||||
$smarty->display('studs.tpl');
|
|
@ -69,6 +69,7 @@ $lang = ($_SESSION['langue']!='') ? strtolower($_SESSION['langue']) : 'fr';
|
|||
$date_format['txt_full'] = _("%A, den %e. %B %Y"); //summary in choix_date.php and removal date in choix_(date|autre).php
|
||||
$date_format['txt_short'] = "%A %e %B %Y"; // radio title
|
||||
$date_format['txt_day'] = "%a %e";
|
||||
$date_format['txt_date'] = _("%Y-%m-%d");
|
||||
if (strtoupper(substr(PHP_OS,0,3))=='WIN'){ //%e can't be used on Windows platform, use %#d instead
|
||||
foreach($date_format as $k => $v) {
|
||||
$date_format[$k] = preg_replace('#(?<!%)((?:%%)*)%e#','\1%#d', $v); //replace %e by %#d for windows
|
||||
|
|
|
@ -85,7 +85,7 @@ a.bg-primary:hover {
|
|||
background-color: #FCF3E3;
|
||||
}
|
||||
.bg-danger,a.bg-danger:hover {
|
||||
background-color: #F2E7E5;
|
||||
background-color: #FDE0DC;
|
||||
}
|
||||
|
||||
/* Alerts */
|
||||
|
|
|
@ -28,6 +28,7 @@ include_once __DIR__ . '/app/inc/init.php';
|
|||
$poll_id = null;
|
||||
$poll = null;
|
||||
$message = null;
|
||||
$editingVoteId = 0;
|
||||
|
||||
/* Services */
|
||||
/*----------*/
|
||||
|
@ -56,8 +57,6 @@ if (!$poll) {
|
|||
if (!empty($_POST['edit_vote'])) {
|
||||
// TODO Try what does filter_input with a wrong value
|
||||
$editingVoteId = filter_input(INPUT_POST, 'edit_vote', FILTER_VALIDATE_INT);
|
||||
} else {
|
||||
$editingVoteId = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,6 +80,7 @@ if (!empty($_POST['save'])) { // Save edition of an old vote
|
|||
$result = $pollService->updateVote($poll_id, $editedVote, $choices);
|
||||
if ($result) {
|
||||
$message = new Message('success', _('Update vote successfully.'));
|
||||
// TODO Send mail to notify the poll admin
|
||||
} else {
|
||||
$message = new Message('danger', _('Update vote failed.'));
|
||||
}
|
||||
|
@ -101,6 +101,7 @@ if (!empty($_POST['save'])) { // Save edition of an old vote
|
|||
$result = $pollService->addVote($poll_id, $name, $choices);
|
||||
if ($result) {
|
||||
$message = new Message('success', _('Update vote successfully.'));
|
||||
// TODO Send mail to notify the poll admin
|
||||
} else {
|
||||
$message = new Message('danger', _('Update vote failed.'));
|
||||
}
|
||||
|
@ -147,5 +148,6 @@ $smarty->assign('best_moments', $pollService->computeBestMoments($votes));
|
|||
$smarty->assign('comments', $comments);
|
||||
$smarty->assign('editingVoteId', $editingVoteId);
|
||||
$smarty->assign('message', $message);
|
||||
$smarty->assign('admin', false);
|
||||
|
||||
$smarty->display('studs.tpl');
|
||||
|
|
|
@ -1,27 +1,32 @@
|
|||
<div class="jumbotron">
|
||||
{* TODO Add a form maybe *}
|
||||
<div class="jumbotron{if $admin} bg-danger{/if}">
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<h3>{$poll->title}</h3>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="btn-group pull-right">
|
||||
<button onclick="print(); return false;" class="btn btn-default"><span class="glyphicon glyphicon-print"></span>{_('Print')}</button>
|
||||
<a href="{$SERVER_URL}export.php?poll={$poll_id}&mode=csv" class="btn btn-default"><span class="glyphicon glyphicon-download-alt"></span>{_('Export to CSV')}</a>
|
||||
<button onclick="print(); return false;" class="btn btn-default"><span class="glyphicon glyphicon-print"></span> {_('Print')}</button>
|
||||
<a href="{$SERVER_URL}export.php?poll={$poll_id}&mode=csv" class="btn btn-default"><span class="glyphicon glyphicon-download-alt"></span> {_('Export to CSV')}</a>
|
||||
{if $admin|default:false}
|
||||
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="glyphicon glyphicon-trash"></span> <span class="sr-only">' . _("Remove") . '</span> <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><button class="btn btn-link" type="submit" name="remove_all_votes">{_('Remove all the votes') }</button></li>
|
||||
<li><button class="btn btn-link" type="submit" name="remove_all_comments">{_('Remove all the comments')}</button></li>
|
||||
<li class="divider" role="presentation"></li>
|
||||
<li><button class="btn btn-link" type="submit" name="delete_poll">{_("Remove the poll")}</button></li>
|
||||
</ul>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="form-group">
|
||||
<h4 class="control-label">{_("Initiator of the poll")}</h4>
|
||||
<p class="form-control-static">{$poll->admin_name}</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="public-link"><a class="public-link" href="{$poll_id|poll_url}">{_("Public link of the poll")}<span class="btn-link glyphicon glyphicon-link"></span></a></label>
|
||||
<input class="form-control" id="public-link" type="text" readonly="readonly" value="{$poll_id|poll_url}" />
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<h4 class="control-label">{_("Initiator of the poll")}</h4>
|
||||
<p class="form-control-static">{$poll->admin_name}</p>
|
||||
</div>
|
||||
|
||||
{if !empty($poll->comment)}
|
||||
<div class="form-group col-md-7">
|
||||
<h4 class="control-label">{_("Description")}</h4><br />
|
||||
|
@ -29,4 +34,21 @@
|
|||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group form-group {if $admin}col-md-5{else}col-md-6{/if}">
|
||||
<label for="public-link"><a class="public-link" href="{$poll_id|poll_url}">{_("Public link of the poll")} <span class="btn-link glyphicon glyphicon-link"></span></a></label>
|
||||
<input class="form-control" id="public-link" type="text" readonly="readonly" value="{$poll_id|poll_url}" />
|
||||
</div>
|
||||
{if $admin}
|
||||
<div class="form-group col-md-5">
|
||||
<label for="admin-link"><a class="admin-link" href="{$admin_poll_id|poll_url:true}">{_("Admin link of the poll")} <span class="btn-link glyphicon glyphicon-link"></span></a></label>
|
||||
<input class="form-control" id="admin-link" type="text" readonly="readonly" value="{$admin_poll_id|poll_url:true}" />
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<h4 class="control-label">{_("Expiration's date")}</h4>
|
||||
<p>{$poll->end_date|date_format:$date_format['txt_date']}</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue