예제 #1
0
 /**
  * Limit CMS Poll save
  *
  * @param Mage_Poll_Model_Poll $model
  */
 public function pollSaveBefore($model)
 {
     $originalStoreIds = $model->getResource()->lookupStoreIds($model->getId());
     if ($model->getId() && !$this->_role->hasStoreAccess($originalStoreIds)) {
         $this->_throwSave();
     }
     if (!$this->_role->getIsWebsiteLevel()) {
         $this->_throwSave();
     }
     $model->setData('store_ids', $this->_forceAssignToStore($this->_updateSavingStoreIds($model->getData('store_ids'), $originalStoreIds)));
 }
예제 #2
0
 public function loadStoreIds(Mage_Poll_Model_Poll $object)
 {
     $pollId = $object->getId();
     $storeIds = array();
     if ($pollId) {
         $select = $this->_getReadAdapter()->select()->from($this->getTable('poll/poll_store'), 'store_id')->where('poll_id = ?', $pollId);
         $storeIds = $this->_getReadAdapter()->fetchCol($select);
     }
     $object->setStoreIds($storeIds);
 }
 public function loadStoreIds(Mage_Poll_Model_Poll $object)
 {
     $pollId = $object->getId();
     $storeIds = array();
     if ($pollId) {
         $storeIds = $this->lookupStoreIds($pollId);
     }
     $object->setStoreIds($storeIds);
 }