/** * Saves the current object to the database. * * The object saving is done in a transaction and handled by the doSave() method. * * @param mixed $con An optional connection object * * @return mixed The current saved object * * @see doSave() * * @throws sfValidatorError If the form is not valid */ public function save($con = null) { if (!$this->isValid()) { throw $this->getErrorSchema(); } if (null === $con) { $con = $this->getConnection(); } $request = sfContext::getInstance()->getRequest(); $response = sfContext::getInstance()->getResponse(); $actual_cookie = aPollToolkit::getCookieContent($request); $poll = Doctrine_Core::getTable('aPollPoll')->findOneById($this->getValue('poll_id')); aPollToolkit::setShowPollToCookie($request, $response, $poll, aPollToolkit::getPollAllowMultipleSubmissions($poll)); try { $answer = $this->doSave($con); } catch (Exception $exc) { $response->setCookie($actual_cookie); throw $exc; } return $answer; }
?> </li> <ul> <li><?php echo a_('Server time:'); ?> <?php echo format_datetime(time()); ?> </li> <li><?php echo a_('Publication dates: from %date_from% to %date_to%', array('%date_from%' => $poll->getPublishedFrom() ? format_datetime($poll->getPublishedFrom()) : 'unlimited', '%date_to%' => $poll->getPublishedTo() ? format_datetime($poll->getPublishedTo()) : 'unlimited')); ?> </li> </ul> <li><?php echo a_('You already submitted an answer and the poll is configured to not display twice. (see app.yml)'); ?> </li> <ul> <li><?php echo a_('Setting: %setting%', array('%setting%' => true == aPollToolkit::getPollAllowMultipleSubmissions($poll) ? a_('Multiple submissions allowed') : a_('Only one answer allowed'))); ?> </li> </ul> </ul> <?php echo a_('Change these parameters in %link%', array('%link%' => link_to('poll\'s admin', '@a_poll_poll_admin_edit?id=' . $poll->getId()))); ?> </div>