Exemple #1
0
 protected function _addColumnFilterToCollection($column)
 {
     if ($column->getId() == 'in_banners') {
         $bannerIds = $this->_getSelectedBanners();
         if (empty($bannerIds)) {
             $bannerIds = 0;
         }
         if ($column->getFilter()->getValue()) {
             $this->getCollection()->addFieldToFilter('main_table.banner_id', array('in' => $bannerIds));
         } else {
             if ($bannerIds) {
                 $this->getCollection()->addFieldToFilter('main_table.banner_id', array('nin' => $bannerIds));
             }
         }
     } else {
         parent::_addColumnFilterToCollection($column);
     }
     return $this;
 }
Exemple #2
0
 /**
  * Set banners' positions of saved banners
  *
  * @return Enterprise_Banner_Block_Adminhtml_Widget_Chooser
  */
 protected function _prepareCollection()
 {
     parent::_prepareCollection();
     foreach ($this->getCollection() as $item) {
         foreach ($this->getSelectedBanners() as $pos => $banner) {
             if ($banner == $item->getBannerId()) {
                 $item->setPosition($pos + 1);
             }
         }
     }
     return $this;
 }
Exemple #3
0
 protected function _addColumnFilterToCollection($column)
 {
     if ($column->getId() == 'in_banners') {
         $bannerIds = $this->getSelectedBanners();
         if (empty($bannerIds)) {
             $bannerIds = 0;
         }
         if ($column->getFilter()->getValue()) {
             $this->getCollection()->addBannerIdsFilter($bannerIds);
         } else {
             if ($bannerIds) {
                 $this->getCollection()->addBannerIdsFilter($bannerIds, true);
             }
         }
     } else {
         parent::_addColumnFilterToCollection($column);
     }
     return $this;
 }