nettoyage du sondage de démonstration

https://framagit.org/framasoft/framadate/issues/316
This commit is contained in:
m 2018-04-14 08:48:24 +02:00
parent 3b54590bde
commit 00b871df5c
6 changed files with 23 additions and 8 deletions

View File

@ -23,6 +23,11 @@ class PurgeService {
$this->commentRepository = RepositoryFactory::commentRepository(); $this->commentRepository = RepositoryFactory::commentRepository();
} }
public function repeatedCleanings() {
$this->purgeOldPolls();
$this->cleanDemoPoll();
}
/** /**
* This methode purges all old polls (the ones with end_date in past). * This methode purges all old polls (the ones with end_date in past).
* *

View File

@ -107,8 +107,7 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || (
// Clean Form data in $_SESSION // Clean Form data in $_SESSION
unset($_SESSION['form']); unset($_SESSION['form']);
// Delete old polls $purgeService->repeatedCleanings();
$purgeService->purgeOldPolls();
// creation message // creation message
$sessionService->set("Framadate", "messagePollCreated", TRUE); $sessionService->set("Framadate", "messagePollCreated", TRUE);

View File

@ -231,8 +231,7 @@ switch ($step) {
// Clean Form data in $_SESSION // Clean Form data in $_SESSION
unset($_SESSION['form']); unset($_SESSION['form']);
// Delete old polls $purgeService->repeatedCleanings();
$purgeService->purgeOldPolls();
// creation message // creation message
$sessionService->set("Framadate", "messagePollCreated", TRUE); $sessionService->set("Framadate", "messagePollCreated", TRUE);

View File

@ -35,14 +35,19 @@ $pollService = new PollService($connect, new $logService());
/* PAGE */ /* PAGE */
/* ---- */ /* ---- */
$demoPoll = $pollService->findById('aqg259dth55iuhwm'); $demoPollURL = "";
if (defined("DEMO_POLL_ID")) {
$demoPollURL = Utils::getUrlSondage(DEMO_POLL_ID);
}
$nbcol = max( $config['show_what_is_that'] + $config['show_the_software'] + $config['show_cultivate_your_garden'], 1 ); $nbcol = max( $config['show_what_is_that'] + $config['show_the_software'] + $config['show_cultivate_your_garden'], 1 );
$smarty->assign('show_what_is_that', $config['show_what_is_that']); $smarty->assign('show_what_is_that', $config['show_what_is_that']);
$smarty->assign('show_the_software', $config['show_the_software']); $smarty->assign('show_the_software', $config['show_the_software']);
$smarty->assign('show_cultivate_your_garden', $config['show_cultivate_your_garden']); $smarty->assign('show_cultivate_your_garden', $config['show_cultivate_your_garden']);
$smarty->assign('col_size', 12 / $nbcol); $smarty->assign('col_size', 12 / $nbcol);
$smarty->assign('demo_poll', $demoPoll); $smarty->assign('demo_poll_url', $demoPollURL);
$smarty->assign('title', __('Generic', 'Make your polls')); $smarty->assign('title', __('Generic', 'Make your polls'));

View File

@ -82,6 +82,13 @@ const MAX_SLOTS_PER_POLL = 366;
// Number of seconds before we allow to resend an "Remember Edit Link" email. // Number of seconds before we allow to resend an "Remember Edit Link" email.
const TIME_EDIT_LINK_EMAIL = 60; const TIME_EDIT_LINK_EMAIL = 60;
// uncomment to display a link to the demo poll at the home page
//const DEMO_POLL_ID = "aqg259dth55iuhwm";
// number of recent votes that are not deleted
const DEMO_POLL_NUMBER_VOTES = 10;
// Config // Config
$config = [ $config = [
/* general config */ /* general config */

View File

@ -58,10 +58,10 @@
<li>{__('1st section', 'Discuss and make a decision')}</li> <li>{__('1st section', 'Discuss and make a decision')}</li>
</ol> </ol>
{if $demo_poll != null} {if $demo_poll_url}
<p> <p>
{__('1st section', 'Do you want to')} {__('1st section', 'Do you want to')}
<a href="{poll_url id='aqg259dth55iuhwm'}">{__('1st section', 'view an example?')}</a> <a href="{$demo_poll_url|html}">{__('1st section', 'view an example?')}</a>
</p> </p>
{/if} {/if}
</div> </div>