titre) || !isset($_SESSION['form']->nom) || (($config['use_smtp']) ? !isset($_SESSION['form']->adresse) : false)) { Utils::print_header ( _("Error!") ); bandeau_titre(_("Error!")); echo '

' . _("You haven't filled the first section of the poll creation.") . ' !

' . _("Back to the homepage of ") . ' ' . '' . NOMAPPLICATION . '.

'; bandeau_pied(); } else { // Step 4 : Data prepare before insert in DB if (Utils::issetAndNoEmpty('confirmation')) { // Define expiration date if (!empty($_POST['champdatefin'])) { $registredate = explode('/', $_POST['champdatefin']); if (is_array($registredate) && count($registredate) == 3) { $time = mktime(0,0,0, $registredate[1], $registredate[0], $registredate[2]); if ($time > time() + (24*60*60)) { $_SESSION['form']->champdatefin=$time; } } } if(empty($_SESSION['form']->champdatefin)) { // By default, expiration date is 6 months after last day $_SESSION['form']->champdatefin=end($temp_results)+(86400 * $config['default_poll_duration']); } // Insert poll in database $admin_poll_id = ajouter_sondage( $_SESSION['form']->titre, $_SESSION['form']->commentaires, $_SESSION['form']->nom, $_SESSION['form']->adresse, $_SESSION['form']->formatsondage, $_SESSION['form']->editable, $_SESSION['form']->champdatefin, $_SESSION['form']->receiveNewVotes, $_SESSION['form']->getChoices() ); // Clean Form data in $_SESSION unset($_SESSION['form']); // Delete old polls Utils::cleaningOldPolls($connect, 'admin/logs_studs.txt'); // Redirect to poll administration header('Location:' . Utils::getUrlSondage($admin_poll_id, true)); exit; } else { if (Utils::issetAndNoEmpty('days')) { // Clear previous choices $_SESSION['form']->clearChoices(); for ($i = 0; $i < count($_POST['days']); $i++) { $day = $_POST['days'][$i]; if (!empty($day)) { // Add choice to Form data $time = mktime(0, 0, 0, substr($_POST["days"][$i],3,2),substr($_POST["days"][$i],0,2),substr($_POST["days"][$i],6,4)); $choice = new Choice($time); $_SESSION['form']->addChoice($choice); $schedules = $_POST['horaires'.$i]; for($j = 0; $j < count($schedules); $j++) { if (!empty($schedules[$j])) { $choice->addSlot($schedules[$j]); } } } } } } //le format du sondage est DATE $_SESSION['form']->formatsondage = 'D'; // Step 3/4 : Confirm poll creation if (Utils::issetAndNoEmpty('choixheures') && !isset($_SESSION['form']->totalchoixjour)) { Utils::print_header ( _("Removal date and confirmation (3 on 3)") ); bandeau_titre(_("Removal date and confirmation (3 on 3)")); $_SESSION['form']->sortChoices(); $last_date = $_SESSION['form']->lastChoice()->getName(); $removal_date = $last_date + (86400 * $config['default_poll_duration']); // Summary $summary = ''; echo '

'. _("Confirm the creation of your poll") .'

'. _("List of your choices").'

'. $summary .'

' . _("Your poll will be automatically removed "). $config['default_poll_duration'] . ' ' . _("days") . ' ' ._("after the last date of your poll") . '.
' . _("You can fix another removal date for it.") .'

'. _("(dd/mm/yyyy)") .'

'. _("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 '

' . _("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"; bandeau_pied(); // Step 2/4 : Select dates of the poll } else { Utils::print_header ( _("Poll dates (2 on 3)") ); bandeau_titre(_("Poll dates (2 on 3)")); echo '

'. _("Choose the dates of your poll") .'

'. _("To schedule an event you need to propose at least two choices (two hours for one day or two days).").'

'. _("You can add or remove additionnal days and hours with the buttons") .' '. _("Remove") .' '. _("Add") .'

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

'; // 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 '
'. _("(dd/mm/yyyy)") .'
'."\n"; // Fields hours : 3 by default for ($j=0;$j
'."\n"; } echo '
'; } echo '
'."\n"; bandeau_pied(); } }