Use Smarty to display step 3/4 of poll creation
This commit is contained in:
parent
498a6a740f
commit
48cd77a5fc
@ -64,7 +64,7 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Step 4 : Data prepare before insert in DB
|
// Step 4 : Data prepare before insert in DB
|
||||||
if (isset($_POST['confirmecreation'])) {
|
if (isset($_POST['confirmation'])) {
|
||||||
|
|
||||||
// Define expiration date
|
// Define expiration date
|
||||||
$enddate = filter_input(INPUT_POST, 'enddate', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '#^[0-9]{2}/[0-9]{2}/[0-9]{4}$#']]);
|
$enddate = filter_input(INPUT_POST, 'enddate', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '#^[0-9]{2}/[0-9]{2}/[0-9]{4}$#']]);
|
||||||
@ -124,9 +124,6 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || (
|
|||||||
|
|
||||||
} // Step 3/4 : Confirm poll creation and choose a removal date
|
} // Step 3/4 : Confirm poll creation and choose a removal date
|
||||||
else if (isset($_POST['fin_sondage_autre'])) {
|
else if (isset($_POST['fin_sondage_autre'])) {
|
||||||
Utils::print_header(__('Step 3', 'Removal date and confirmation (3 on 3)'));
|
|
||||||
bandeau_titre(__('Step 3', 'Removal date and confirmation (3 on 3)'));
|
|
||||||
|
|
||||||
|
|
||||||
// Store choices in $_SESSION
|
// Store choices in $_SESSION
|
||||||
if (isset($_POST['choices'])) {
|
if (isset($_POST['choices'])) {
|
||||||
@ -178,45 +175,13 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || (
|
|||||||
|
|
||||||
$end_date_str = utf8_encode(strftime($date_format['txt_date'], $max_expiry_time)); //textual date
|
$end_date_str = utf8_encode(strftime($date_format['txt_date'], $max_expiry_time)); //textual date
|
||||||
|
|
||||||
echo '
|
$smarty->assign('title', __('Step 3', 'Removal date and confirmation (3 on 3)'));
|
||||||
<form name="formulaire" action="' . Utils::get_server_name() . 'create_classic_poll.php" method="POST" class="form-horizontal" role="form">
|
$smarty->assign('summary', $summary);
|
||||||
<div class="row">
|
$smarty->assign('end_date_str', $end_date_str);
|
||||||
<div class="col-md-8 col-md-offset-2">
|
$smarty->assign('default_poll_duration', $config['default_poll_duration']);
|
||||||
<div class="well summary">
|
$smarty->assign('use_smtp', $config['use_smtp']);
|
||||||
<h4>' . __('Step 3', 'List of your choices') . '</h4>
|
|
||||||
' . $summary . '
|
|
||||||
</div>
|
|
||||||
<div class="alert alert-info">
|
|
||||||
<p>' . __('Step 3', 'Your poll will automatically be archived') . ' ' . $config['default_poll_duration'] . ' ' . __('Generic', 'days') . ' ' .__('Step 3', 'after the last date of your poll.') . '
|
|
||||||
<br />' . __('Step 3', 'You can set a closer archiving date for it.') . '</p>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="enddate" class="col-sm-5 control-label">' . __('Step 3', 'Archiving date:') . '</label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<div class="input-group date">
|
|
||||||
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar text-info"></i></span>
|
|
||||||
<input type="text" class="form-control" id="enddate" data-date-format="' . __('Date', 'dd/mm/yyyy') . '" aria-describedby="dateformat" name="enddate" value="' . $end_date_str . '" size="10" maxlength="10" placeholder="' . __('Date', 'dd/mm/yyyy') . '" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<span id="dateformat" class="sr-only">' . __('Date', 'dd/mm/yyyy') . '</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="alert alert-warning">
|
|
||||||
<p>' . __('Step 3', 'Once you have confirmed the creation of your poll, you will be automatically redirected on the administration page of your poll.') . '</p>';
|
|
||||||
if ($config['use_smtp'] == true) {
|
|
||||||
echo '
|
|
||||||
<p>' . __('Step 3', 'Then, you will receive quickly two emails: one contening the link of your poll for sending it to the voters, the other contening the link to the administration page of your poll.') . '</p>';
|
|
||||||
}
|
|
||||||
echo '
|
|
||||||
</div>
|
|
||||||
<p class="text-right">
|
|
||||||
<button class="btn btn-default" onclick="javascript:window.history.back();" title="' . __('Step 3', 'Back to step 2') . '">' . __('Generic', 'Back') . '</button>
|
|
||||||
<button name="confirmecreation" value="confirmecreation" type="submit" class="btn btn-success">' . __('Step 3', 'Create the poll') . '</button>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>' . "\n";
|
|
||||||
|
|
||||||
bandeau_pied();
|
$smarty->display('create_classic_poll_step3.tpl');
|
||||||
|
|
||||||
// Step 2/4 : Select choices of the poll
|
// Step 2/4 : Select choices of the poll
|
||||||
} else {
|
} else {
|
||||||
|
@ -165,11 +165,6 @@ if (!isset($_SESSION['form']->title) || !isset($_SESSION['form']->admin_name) ||
|
|||||||
// Step 3/4 : Confirm poll creation
|
// Step 3/4 : Confirm poll creation
|
||||||
if (!empty($_POST['choixheures']) && !isset($_SESSION['form']->totalchoixjour)) {
|
if (!empty($_POST['choixheures']) && !isset($_SESSION['form']->totalchoixjour)) {
|
||||||
|
|
||||||
Utils::print_header ( __('Step 3', 'Removal date and confirmation (3 on 3)') );
|
|
||||||
bandeau_titre(__('Step 3', 'Removal date and confirmation (3 on 3)'));
|
|
||||||
|
|
||||||
$end_date_str = utf8_encode(strftime($date_format['txt_date'], $max_expiry_time)); // textual date
|
|
||||||
|
|
||||||
// Summary
|
// Summary
|
||||||
$summary = '<ul>';
|
$summary = '<ul>';
|
||||||
$choices = $_SESSION['form']->getChoices();
|
$choices = $_SESSION['form']->getChoices();
|
||||||
@ -185,46 +180,16 @@ if (!isset($_SESSION['form']->title) || !isset($_SESSION['form']->admin_name) ||
|
|||||||
}
|
}
|
||||||
$summary .= '</ul>';
|
$summary .= '</ul>';
|
||||||
|
|
||||||
|
$end_date_str = utf8_encode(strftime($date_format['txt_date'], $max_expiry_time)); // textual date
|
||||||
|
|
||||||
echo '
|
$smarty->assign('title', __('Step 3', 'Removal date and confirmation (3 on 3)'));
|
||||||
<form name="formulaire" action="' . Utils::get_server_name() . 'create_date_poll.php" method="POST" class="form-horizontal" role="form">
|
$smarty->assign('summary', $summary);
|
||||||
<div class="row" id="selected-days">
|
$smarty->assign('end_date_str', $end_date_str);
|
||||||
<div class="col-md-8 col-md-offset-2">
|
$smarty->assign('default_poll_duration', $config['default_poll_duration']);
|
||||||
<h3>'. __('Step 3', 'Confirm the creation of your poll') .'</h3>
|
$smarty->assign('use_smtp', $config['use_smtp']);
|
||||||
<div class="well summary">
|
|
||||||
<h4>'. __('Step 3', 'List of your choices').'</h4>
|
$smarty->display('create_classic_poll_step3.tpl');
|
||||||
'. $summary .'
|
|
||||||
</div>
|
|
||||||
<div class="alert alert-info clearfix">
|
|
||||||
<p>' . __f('Step 3', 'Your poll will be automatically archived in %d days.', $config['default_poll_duration']) . '
|
|
||||||
<br />' . __('Step 3', 'You can set a closer archiving date for it.') .'</p>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="enddate" class="col-sm-5 control-label">'. __('Step 3', 'Archiving date:') .'</label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<div class="input-group date">
|
|
||||||
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar text-info"></i></span>
|
|
||||||
<input type="text" class="form-control" id="enddate" data-date-format="'. __('Date', 'dd/mm/yyyy') .'" aria-describedby="dateformat" name="enddate" value="'.$end_date_str.'" size="10" maxlength="10" placeholder="'. __('Date', 'dd/mm/yyyy') .'" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<span id="dateformat" class="sr-only">('. __('Date', 'dd/mm/yyyy') .')</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="alert alert-warning">
|
|
||||||
<p>'. __('Step 3', 'Once you have confirmed the creation of your poll, you will be automatically redirected on the administration page of your poll.'). '</p>';
|
|
||||||
if($config['use_smtp'] == true) {
|
|
||||||
echo '<p>' . __('Step 3', 'Then, you will receive quickly two emails: one contening the link of your poll for sending it to the voters, the other contening the link to the administration page of your poll.') .'</p>';
|
|
||||||
}
|
|
||||||
echo '
|
|
||||||
</div>
|
|
||||||
<p class="text-right">
|
|
||||||
<button class="btn btn-default" onclick="javascript:window.history.back();" title="'. __('Step 3', 'Back to step 2') . '">'. __('Generic', 'Back') . '</button>
|
|
||||||
<button name="confirmation" value="confirmation" type="submit" class="btn btn-success">'. __('Step 3', 'Create the poll') . '</button>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>'."\n";
|
|
||||||
|
|
||||||
bandeau_pied();
|
|
||||||
|
|
||||||
// Step 2/4 : Select dates of the poll
|
// Step 2/4 : Select dates of the poll
|
||||||
} else {
|
} else {
|
||||||
|
48
tpl/create_classic_poll_step3.tpl
Normal file
48
tpl/create_classic_poll_step3.tpl
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
{extends file='page.tpl'}
|
||||||
|
|
||||||
|
{block name="header"}
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.date_formats = {
|
||||||
|
DATE: '{__('Date', 'DATE')}',
|
||||||
|
DATEPICKER: '{__('Date', 'datepicker')}'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<script type="text/javascript" src="{'js/app/framadatepicker.js'|resource}"></script>
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="main"}
|
||||||
|
<form name="formulaire" method="POST" class="form-horizontal" role="form">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8 col-md-offset-2">
|
||||||
|
<div class="well summary">
|
||||||
|
<h4>{__('Step 3', 'List of your choices')}</h4>
|
||||||
|
{$summary}
|
||||||
|
</div>
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<p>{__('Step 3', 'Your poll will automatically be archived')} {$default_poll_duration} {__('Generic', 'days')} {__('Step 3', 'after the last date of your poll.')}
|
||||||
|
<br />{__('Step 3', 'You can set a closer archiving date for it.')}</p>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="enddate" class="col-sm-5 control-label">{__('Step 3', 'Archiving date:')}</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="input-group date">
|
||||||
|
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar text-info"></i></span>
|
||||||
|
<input type="text" class="form-control" id="enddate" data-date-format="{__('Date', 'dd/mm/yyyy')}" aria-describedby="dateformat" name="enddate" value="{$end_date_str}" size="10" maxlength="10" placeholder="{__('Date', 'dd/mm/yyyy')}" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span id="dateformat" class="sr-only">{__('Date', 'dd/mm/yyyy')}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
<p>{__('Step 3', 'Once you have confirmed the creation of your poll, you will be automatically redirected on the administration page of your poll.')}</p>
|
||||||
|
{if $use_smtp}
|
||||||
|
<p>{__('Step 3', 'Then, you will receive quickly two emails: one contening the link of your poll for sending it to the voters, the other contening the link to the administration page of your poll.')}</p>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
<p class="text-right">
|
||||||
|
<button class="btn btn-default" onclick="javascript:window.history.back();" title="{__('Step 3', 'Back to step 2')}">{__('Generic', 'Back')}</button>
|
||||||
|
<button name="confirmation" value="confirmation" type="submit" class="btn btn-success">{__('Step 3', 'Create the poll')}</button>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{/block}
|
Loading…
Reference in New Issue
Block a user