From a1de8def6bfdb9b49ca774510cc1a26371633a4c Mon Sep 17 00:00:00 2001 From: Olivier Perez Date: Thu, 16 Apr 2015 13:10:28 +0200 Subject: [PATCH] Smartysize step 2 of date poll creation --- create_date_poll.php | 96 +++++++----------------------- js/app/date_poll.js | 5 +- tpl/create_date_poll_step_2.tpl | 102 ++++++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+), 77 deletions(-) create mode 100644 tpl/create_date_poll_step_2.tpl diff --git a/create_date_poll.php b/create_date_poll.php index 2cffcda..5ad011e 100644 --- a/create_date_poll.php +++ b/create_date_poll.php @@ -218,84 +218,30 @@ if (!isset($_SESSION['form']->title) || !isset($_SESSION['form']->admin_name) || // Step 2/4 : Select dates of the poll } else { - Utils::print_header(__('Step 2 date', 'Poll dates (2 on 3)')); - bandeau_titre(__('Step 2 date', 'Poll dates (2 on 3)')); - echo ' -
-
-
-

'. __('Step 2 date', 'Choose the dates of your poll') .'

-
-

'. __('Step 2 date', 'To schedule an event you need to propose at least two choices (two hours for one day or two days).').'

-

'. __('Step 2 date', 'You can add or remove additionnal days and hours with the buttons') .' '. __('Remove') .' '. __('Add') .'

-

'. __('Step 2 date', 'For each selected day, you can choose, or not, meeting hours (e.g.: "8h", "8:30", "8h-10h", "evening", etc.)').'

-
'; + // Prefill form->choices + if (count($_SESSION['form']->getChoices()) == 0) { + $c = new Choice(''); + $c->addSlot(''); + $c->addSlot(''); + $c->addSlot(''); + $_SESSION['form']->addChoice($c); + $c = new Choice(''); + $c->addSlot(''); + $c->addSlot(''); + $c->addSlot(''); + $_SESSION['form']->addChoice($c); + $c = new Choice(''); + $c->addSlot(''); + $c->addSlot(''); + $c->addSlot(''); + $_SESSION['form']->addChoice($c); + } - // Fields days : 3 by default - $nb_days = (isset($_SESSION['totalchoixjour'])) ? count($_SESSION['totalchoixjour']) : 3; - for ($i = 0; $i < $nb_days; $i++) { - $day_value = isset($_SESSION['totalchoixjour'][$i]) ? strftime('%d/%m/%Y', $_SESSION['totalchoixjour'][$i]) : ''; - echo ' -
-
- - -
- - -
- ('. __('Date', 'dd/mm/yyyy') .') -
'."\n"; + // Display step 2 + $smarty->assign('title', __('Step 2 date', 'Poll dates (2 on 3)')); - // Fields hours : 3 by default - $moments = isset($_SESSION['horaires' . $i]) ? $_SESSION['horaires' . $i] : []; - for ($j = 0; $j < max(count($moments), 3); $j++) { - $hour_value = isset($_SESSION['horaires'.$i][$j]) ? $_SESSION['horaires'.$i][$j] : ''; - echo ' -
- - -
'."\n"; - } - echo ' -
- - -
-
-
'; - } - echo ' -
- -
- - -
-
-
- - '. __('Generic', 'Back') . ' - -
-
-
-
- - - - '."\n"; - - bandeau_pied(); + $smarty->display('create_date_poll_step_2.tpl'); } } diff --git a/js/app/date_poll.js b/js/app/date_poll.js index 7faf044..67c71a0 100644 --- a/js/app/date_poll.js +++ b/js/app/date_poll.js @@ -15,7 +15,8 @@ * Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaƫl DROZ * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) */ -(function () { + +$(document).ready(function () { // Global variables @@ -200,4 +201,4 @@ if ($selected_days.find('fieldset').length > 1) { $removeaday_and_copyhours.removeClass('disabled'); } -})(); \ No newline at end of file +}); \ No newline at end of file diff --git a/tpl/create_date_poll_step_2.tpl b/tpl/create_date_poll_step_2.tpl new file mode 100644 index 0000000..82d22b0 --- /dev/null +++ b/tpl/create_date_poll_step_2.tpl @@ -0,0 +1,102 @@ +{extends file='page.tpl'} + +{block name="header"} + + +{/block} + +{block name=main} +
+
+
+

{__('Step 2 date', 'Choose the dates of your poll')}

+ +
+

{__('Step 2 date', 'To schedule an event you need to propose at least two choices (two hours for one day or two days).')}

+ +

{__('Step 2 date', 'You can add or remove additionnal days and hours with the buttons')} + + {__('Generic', 'Remove')} + + {__('Generic', 'Add')} +

+ +

{__('Step 2 date', 'For each selected day, you can choose, or not, meeting hours (e.g.: "8h", "8:30", "8h-10h", "evening", etc.)')}

+
+ + {foreach $choices as $i=>$choice} + {if $choice->getName()} + {$day_value = strftime('%d/%m/%Y', $choice->getName())} + {else} + {$day_value = ''} + {/if} +
+
+ + + +
+ + +
+ ({__('Date', 'dd/mm/yyyy')}) +
+ + {foreach $choice->getSlots() as $j=>$slot} +
+ + +
+ {/foreach} + +
+
+ + +
+
+
+
+ {/foreach} + + +
+ +
+ + +
+
+
+ + {__('Generic', 'Back')} + +
+
+
+
+{/block}