Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Poll_Block_ActivePoll
  • Mage_Poll_Block_Poll
  • Mage_Poll_Helper_Data
  • Mage_Poll_Model_Mysql4_Poll
  • Mage_Poll_Model_Mysql4_Poll_Answer
  • Mage_Poll_Model_Mysql4_Poll_Answer_Collection
  • Mage_Poll_Model_Mysql4_Poll_Collection
  • Mage_Poll_Model_Mysql4_Poll_Vote
  • Mage_Poll_Model_Poll
  • Mage_Poll_Model_Poll_Answer
  • Mage_Poll_Model_Poll_Vote
  • Mage_Poll_Model_Resource_Poll
  • Mage_Poll_Model_Resource_Poll_Answer
  • Mage_Poll_Model_Resource_Poll_Answer_Collection
  • Mage_Poll_Model_Resource_Poll_Collection
  • Mage_Poll_Model_Resource_Poll_Vote
  • Mage_Poll_VoteController
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Magento
 4:  *
 5:  * NOTICE OF LICENSE
 6:  *
 7:  * This source file is subject to the Open Software License (OSL 3.0)
 8:  * that is bundled with this package in the file LICENSE.txt.
 9:  * It is also available through the world-wide-web at this URL:
10:  * http://opensource.org/licenses/osl-3.0.php
11:  * If you did not receive a copy of the license and are unable to
12:  * obtain it through the world-wide-web, please send an email
13:  * to license@magentocommerce.com so we can send you a copy immediately.
14:  *
15:  * DISCLAIMER
16:  *
17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
18:  * versions in the future. If you wish to customize Magento for your
19:  * needs please refer to http://www.magentocommerce.com for more information.
20:  *
21:  * @category    Mage
22:  * @package     Mage_Poll
23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
25:  */
26: 
27: /**
28:  * Poll answers model
29:  *
30:  * @method Mage_Poll_Model_Resource_Poll_Answer _getResource()
31:  * @method Mage_Poll_Model_Resource_Poll_Answer getResource()
32:  * @method int getPollId()
33:  * @method Mage_Poll_Model_Poll_Answer setPollId(int $value)
34:  * @method string getAnswerTitle()
35:  * @method Mage_Poll_Model_Poll_Answer setAnswerTitle(string $value)
36:  * @method int getVotesCount()
37:  * @method Mage_Poll_Model_Poll_Answer setVotesCount(int $value)
38:  * @method int getAnswerOrder()
39:  * @method Mage_Poll_Model_Poll_Answer setAnswerOrder(int $value)
40:  *
41:  * @category    Mage
42:  * @package     Mage_Poll
43:  * @author      Magento Core Team <core@magentocommerce.com>
44:  */
45: 
46: class Mage_Poll_Model_Poll_Answer extends Mage_Core_Model_Abstract
47: {
48:     protected function _construct()
49:     {
50:         $this->_init('poll/poll_answer');
51:     }
52: 
53:     public function countPercent($poll)
54:     {
55:         $this->setPercent(
56:             round(($poll->getVotesCount() > 0 ) ? ($this->getVotesCount() * 100 / $poll->getVotesCount()) : 0, 2)
57:         );
58:         return $this;
59:     }
60: 
61:     protected function _afterSave()
62:     {
63:         Mage::getModel('poll/poll')
64:             ->setId($this->getPollId())
65:             ->resetVotesCount();
66:     }
67: 
68:     protected function _beforeDelete()
69:     {
70:         $this->setPollId($this->load($this->getId())->getPollId());
71:     }
72: 
73:     protected function _afterDelete()
74:     {
75:         Mage::getModel('poll/poll')
76:             ->setId($this->getPollId())
77:             ->resetVotesCount();
78:     }
79: }
80: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0