From 48cd77a5fc09b782d94066b02f4971ad44723e4b Mon Sep 17 00:00:00 2001 From: Olivier Perez Date: Wed, 4 May 2016 00:08:29 +0200 Subject: [PATCH] Use Smarty to display step 3/4 of poll creation --- create_classic_poll.php | 49 +++++------------------------ create_date_poll.php | 51 +++++-------------------------- tpl/create_classic_poll_step3.tpl | 48 +++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 85 deletions(-) create mode 100644 tpl/create_classic_poll_step3.tpl diff --git a/create_classic_poll.php b/create_classic_poll.php index 9a15a83..6e8ffbd 100644 --- a/create_classic_poll.php +++ b/create_classic_poll.php @@ -64,7 +64,7 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || ( } // Step 4 : Data prepare before insert in DB - if (isset($_POST['confirmecreation'])) { + if (isset($_POST['confirmation'])) { // Define expiration date $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 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 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 - echo ' -
-
-
-
-

' . __('Step 3', 'List of your choices') . '

- ' . $summary . ' -
-
-

' . __('Step 3', 'Your poll will automatically be archived') . ' ' . $config['default_poll_duration'] . ' ' . __('Generic', 'days') . ' ' .__('Step 3', 'after the last date of your poll.') . ' -
' . __('Step 3', 'You can set a closer archiving date for it.') . '

-
- -
-
- - -
-
- ' . __('Date', 'dd/mm/yyyy') . ' -
-
-
-

' . __('Step 3', 'Once you have confirmed the creation of your poll, you will be automatically redirected on the administration page of your poll.') . '

'; - if ($config['use_smtp'] == true) { - echo ' -

' . __('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.') . '

'; - } - echo ' -
-

- - -

-
-
-
' . "\n"; + $smarty->assign('title', __('Step 3', 'Removal date and confirmation (3 on 3)')); + $smarty->assign('summary', $summary); + $smarty->assign('end_date_str', $end_date_str); + $smarty->assign('default_poll_duration', $config['default_poll_duration']); + $smarty->assign('use_smtp', $config['use_smtp']); - bandeau_pied(); + $smarty->display('create_classic_poll_step3.tpl'); // Step 2/4 : Select choices of the poll } else { diff --git a/create_date_poll.php b/create_date_poll.php index 71ab2d4..6f8be7c 100644 --- a/create_date_poll.php +++ b/create_date_poll.php @@ -165,11 +165,6 @@ if (!isset($_SESSION['form']->title) || !isset($_SESSION['form']->admin_name) || // Step 3/4 : Confirm poll creation 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 = ''; + $end_date_str = utf8_encode(strftime($date_format['txt_date'], $max_expiry_time)); // textual date - echo ' -
-
-
-

'. __('Step 3', 'Confirm the creation of your poll') .'

-
-

'. __('Step 3', 'List of your choices').'

- '. $summary .' -
-
-

' . __f('Step 3', 'Your poll will be automatically archived in %d days.', $config['default_poll_duration']) . ' -
' . __('Step 3', 'You can set a closer archiving date for it.') .'

-
- -
-
- - -
-
- ('. __('Date', 'dd/mm/yyyy') .') -
-
-
-

'. __('Step 3', 'Once you have confirmed the creation of your poll, you will be automatically redirected on the administration page of your poll.'). '

'; - if($config['use_smtp'] == true) { - echo '

' . __('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.') .'

'; - } - echo ' -
-

- - -

-
-
-
'."\n"; + $smarty->assign('title', __('Step 3', 'Removal date and confirmation (3 on 3)')); + $smarty->assign('summary', $summary); + $smarty->assign('end_date_str', $end_date_str); + $smarty->assign('default_poll_duration', $config['default_poll_duration']); + $smarty->assign('use_smtp', $config['use_smtp']); + + $smarty->display('create_classic_poll_step3.tpl'); - bandeau_pied(); // Step 2/4 : Select dates of the poll } else { diff --git a/tpl/create_classic_poll_step3.tpl b/tpl/create_classic_poll_step3.tpl new file mode 100644 index 0000000..ff46744 --- /dev/null +++ b/tpl/create_classic_poll_step3.tpl @@ -0,0 +1,48 @@ +{extends file='page.tpl'} + +{block name="header"} + + +{/block} + +{block name="main"} +
+
+
+
+

{__('Step 3', 'List of your choices')}

+ {$summary} +
+
+

{__('Step 3', 'Your poll will automatically be archived')} {$default_poll_duration} {__('Generic', 'days')} {__('Step 3', 'after the last date of your poll.')} +
{__('Step 3', 'You can set a closer archiving date for it.')}

+
+ +
+
+ + +
+
+ {__('Date', 'dd/mm/yyyy')} +
+
+
+

{__('Step 3', 'Once you have confirmed the creation of your poll, you will be automatically redirected on the administration page of your poll.')}

+ {if $use_smtp} +

{__('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.')}

+ {/if} +
+

+ + +

+
+
+
+{/block} \ No newline at end of file