New edition possibility is taken into account

- Also added Framadate\Message à link attribute
	- Added local anchor #edit with vote edition
	- For now, when the poll owner check the new edit option (ie: "Votes are editable solely by their owner"), users get their update link on vote creation
This commit is contained in:
Antonin 2015-04-05 17:44:29 +02:00
parent 1f55167e2c
commit a3f5763edd
14 changed files with 42 additions and 20 deletions

View file

@ -22,6 +22,7 @@ use Framadate\Services\InputService;
use Framadate\Services\MailService;
use Framadate\Message;
use Framadate\Utils;
use Framadate\Editable;
include_once __DIR__ . '/app/inc/init.php';
@ -155,7 +156,12 @@ if (!empty($_POST['save'])) { // Save edition of an old vote
// Add vote
$result = $pollService->addVote($poll_id, $name, $choices);
if ($result) {
$message = new Message('success', _('Update vote successfully.'));
if ($poll->editable == Editable::EDITABLE_BY_OWN) {
$urlEditVote = Utils::getUrlSondage($poll_id, false, $result->uniqId);
$message = new Message('success', __('studs', "Your vote has been registered successfully, but be careful : regarding this poll options, you need to keep this personal link to edit your own vote : "), $urlEditVote);
} else {
$message = new Message('success', _('Update vote successfully.'));
}
sendUpdateNotification($poll, $mailService, $name, ADD_VOTE);
} else {
$message = new Message('danger', _('Update vote failed.'));