title) || !isset($_SESSION['form']->admin_name) || ($config['use_smtp'] && !isset($_SESSION['form']->admin_mail))) { 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 (!empty($_POST['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']->end_date=$time; } } } if(empty($_SESSION['form']->end_date)) { // By default, expiration date is 6 months after last day $_SESSION['form']->end_date=end($temp_results)+(86400 * $config['default_poll_duration']); } // Insert poll in database $ids = $pollService->createPoll($_SESSION['form']); $poll_id = $ids[0]; $admin_poll_id = $ids[1]; // Send confirmation by mail if enabled if ($config['use_smtp'] === true) { $message = _("This is the message you have to send to the people you want to poll. \nNow, you have to send this message to everyone you want to poll."); $message .= "\n\n"; $message .= stripslashes(html_entity_decode($_SESSION['form']->admin_name, ENT_QUOTES, "UTF-8")) . ' ' . _("hast just created a poll called") . ' : "' . stripslashes(htmlspecialchars_decode($_SESSION['form']->title, ENT_QUOTES)) . "\".\n"; $message .= _('Thanks for filling the poll at the link above') . " :\n\n%s\n\n" . _('Thanks for your confidence.') . "\n" . NOMAPPLICATION; $message_admin = _("This message should NOT be sent to the polled people. It is private for the poll's creator.\n\nYou can now modify it at the link above"); $message_admin .= " :\n\n" . "%s \n\n" . _('Thanks for your confidence.') . "\n" . NOMAPPLICATION; $message = sprintf($message, Utils::getUrlSondage($poll_id)); $message_admin = sprintf($message_admin, Utils::getUrlSondage($admin_poll_id, true)); if ($mailService->isValidEmail($_SESSION['form']->admin_mail)) { $mailService->send($_SESSION['form']->admin_mail, '[' . NOMAPPLICATION . '][' . _('Author\'s message') . '] ' . _('Poll') . ' : ' . stripslashes(htmlspecialchars_decode($_SESSION['form']->title, ENT_QUOTES)), $message_admin); $mailService->send($_SESSION['form']->admin_mail, '[' . NOMAPPLICATION . '][' . _('For sending to the polled users') . '] ' . _('Poll') . ' : ' . stripslashes(htmlspecialchars_decode($_SESSION['form']->title, ENT_QUOTES)), $message); } } // Clean Form data in $_SESSION unset($_SESSION['form']); // Delete old polls // TODO Create a PurgeService Utils::cleaningOldPolls($connect, 'admin/logs_studs.txt'); // Redirect to poll administration header('Location:' . Utils::getUrlSondage($admin_poll_id, true)); exit; } else { if (!empty($_POST['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']->format = 'D'; // Step 3/4 : Confirm poll creation if (!empty($_POST['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(); } }