diff --git a/app/classes/Framadate/Services/PurgeService.php b/app/classes/Framadate/Services/PurgeService.php index 2d92233d241a873a9af469cead974be17ad566fe..e0a4aa746102cbbc1de1ac8cf5b2d7a2f060fdf5 100644 --- a/app/classes/Framadate/Services/PurgeService.php +++ b/app/classes/Framadate/Services/PurgeService.php @@ -23,6 +23,11 @@ class PurgeService { $this->commentRepository = RepositoryFactory::commentRepository(); } + public function repeatedCleanings() { + $this->purgeOldPolls(); + $this->cleanDemoPoll(); + } + /** * This methode purges all old polls (the ones with end_date in past). * diff --git a/create_classic_poll.php b/create_classic_poll.php index 920b0aecf4a931a94536c1aa7a4cb411377bf4c8..193b7c88588634ccfc1d96fce40b228a785be217 100644 --- a/create_classic_poll.php +++ b/create_classic_poll.php @@ -107,8 +107,7 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || ( // Clean Form data in $_SESSION unset($_SESSION['form']); - // Delete old polls - $purgeService->purgeOldPolls(); + $purgeService->repeatedCleanings(); // creation message $sessionService->set("Framadate", "messagePollCreated", TRUE); diff --git a/create_date_poll.php b/create_date_poll.php index a66330d799baa723b6f921845b1fb5a3a5f266fb..69a5b93bc53c2b59c9f86315a3cdd1cc6e132919 100644 --- a/create_date_poll.php +++ b/create_date_poll.php @@ -231,8 +231,7 @@ switch ($step) { // Clean Form data in $_SESSION unset($_SESSION['form']); - // Delete old polls - $purgeService->purgeOldPolls(); + $purgeService->repeatedCleanings(); // creation message $sessionService->set("Framadate", "messagePollCreated", TRUE); diff --git a/index.php b/index.php index 0052b98374dafe38f7ccc42eaf7ec37fa6707b87..4782288f33f97b72ffb292583f325eec0b1f8a0a 100644 --- a/index.php +++ b/index.php @@ -35,14 +35,19 @@ $pollService = new PollService($connect, new $logService()); /* 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 ); $smarty->assign('show_what_is_that', $config['show_what_is_that']); $smarty->assign('show_the_software', $config['show_the_software']); $smarty->assign('show_cultivate_your_garden', $config['show_cultivate_your_garden']); $smarty->assign('col_size', 12 / $nbcol); -$smarty->assign('demo_poll', $demoPoll); +$smarty->assign('demo_poll_url', $demoPollURL); $smarty->assign('title', __('Generic', 'Make your polls')); diff --git a/tpl/admin/config.tpl b/tpl/admin/config.tpl index b0ae98f5a06f00beee52ddc439f30010b91c7549..e3b22c042333f9f936ee823ff2708e64e22db920 100644 --- a/tpl/admin/config.tpl +++ b/tpl/admin/config.tpl @@ -82,6 +82,13 @@ const MAX_SLOTS_PER_POLL = 366; // Number of seconds before we allow to resend an "Remember Edit Link" email. 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 = [ /* general config */ diff --git a/tpl/index.tpl b/tpl/index.tpl index 2524f1f718fbf3dee490745ec397b0797c9b6ed8..1d3bafd08d334c3ef41aea0f1676b19162b83beb 100644 --- a/tpl/index.tpl +++ b/tpl/index.tpl @@ -58,10 +58,10 @@ <li>{__('1st section', 'Discuss and make a decision')}</li> </ol> - {if $demo_poll != null} + {if $demo_poll_url} <p> {__('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> {/if} </div>