Mage_Poll_VoteController Class Reference

Inheritance diagram for Mage_Poll_VoteController:

Mage_Core_Controller_Front_Action Mage_Core_Controller_Varien_Action

List of all members.

Public Member Functions

 addAction ()

Protected Attributes

 $_cookieCheckActions = array('add')


Detailed Description

Definition at line 34 of file VoteController.php.


Member Function Documentation

addAction (  ) 

Check poll data

Definition at line 43 of file VoteController.php.

00044     {
00045         $pollId     = intval($this->getRequest()->getParam('poll_id'));
00046         $answerId   = intval($this->getRequest()->getParam('vote'));
00047 
00048         $poll = Mage::getModel('poll/poll')->load($pollId);
00049 
00050         /**
00051          * Check poll data
00052          */
00053         if ($poll->getId() && !$poll->getClosed() && !$poll->isVoted()) {
00054             $vote = Mage::getModel('poll/poll_vote')
00055                 ->setPollAnswerId($answerId)
00056                 ->setIpAddress(ip2long($this->getRequest()->getServer('REMOTE_ADDR')))
00057                 ->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId());
00058 
00059             $poll->addVote($vote);
00060             Mage::getSingleton('core/session')->setJustVotedPoll($pollId);
00061         }
00062         $this->_redirectReferer();
00063     }


Member Data Documentation

$_cookieCheckActions = array('add') [protected]

Reimplemented from Mage_Core_Controller_Varien_Action.

Definition at line 41 of file VoteController.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:34 2009 for Magento by  doxygen 1.5.8