Example #1
0
 public function render(Varien_Object $row)
 {
     $origStores = $row->getData($this->getColumn()->getIndex());
     $stores = array();
     if (is_array($origStores)) {
         foreach ($origStores as $origStore) {
             if (is_numeric($origStore) && $origStore == 0) {
                 $stores[] = Mage::helper('adminhtml')->__('All Store Views');
             } elseif (is_numeric($origStore) && ($storeName = $this->_getStoreModel()->getStoreName($origStore))) {
                 if ($this->getColumn()->getStoreView()) {
                     $store = $this->_getStoreModel()->getStoreNameWithWebsite($origStore);
                 } else {
                     $store = $this->_getStoreModel()->getStoreNamePath($origStore);
                 }
                 $layers = array();
                 foreach (explode('/', $store) as $key => $value) {
                     $layers[] = str_repeat(" ", $key * 3) . $value;
                 }
                 $stores[] = implode('<br/>', $layers);
             } else {
                 $stores[] = $origStore;
             }
         }
     } else {
         if (is_numeric($origStores) && ($storeName = $this->_getStoreModel()->getStoreName($origStores))) {
             if ($this->getColumn()->getStoreView()) {
                 $store = $this->_getStoreModel()->getStoreNameWithWebsite($origStores);
             } else {
                 $store = $this->_getStoreModel()->getStoreNamePath($origStores);
             }
             $layers = array();
             foreach (explode('/', $store) as $key => $value) {
                 $layers[] = str_repeat("&nbsp;", $key * 3) . $value;
             }
             $stores[] = implode('<br/>', $layers);
         } elseif (is_numeric($origStores) && $origStores == 0) {
             $stores[] = Mage::helper('adminhtml')->__('All Store Views');
         } elseif (is_null($origStores) && $row->getStoreName()) {
             return $row->getStoreName() . ' ' . $this->__('[deleted]');
         } else {
             $stores[] = $origStores;
         }
     }
     return $stores ? join('<br/> ', $stores) : '&nbsp;';
 }
Example #2
0
 /**
  * Render row store views.
  *
  * @param Varien_Object $row
  *
  * @return string
  */
 public function render(Varien_Object $row)
 {
     $out = '';
     $skipAllStoresLabel = $this->_getShowAllStoresLabelFlag();
     $skipEmptyStoresLabel = $this->_getShowEmptyStoresLabelFlag();
     $origStores = $row->getData($this->getColumn()->getIndex());
     $storeCollection = Mage::getModel('seoautolink/link')->getCollection();
     $storeCollection->getSelect()->joinLeft(array('store_table' => Mage::getSingleton('core/resource')->getTableName('seoautolink/link_store')), 'main_table.link_id = store_table.link_id', array())->where('store_table.link_id in (?)', array($origStores))->reset(Zend_Db_Select::COLUMNS)->columns('store_id', 'store_table');
     $origStores = array();
     foreach ($storeCollection as $store) {
         $origStores[] = $store->getStoreId();
     }
     if (is_null($origStores) && $row->getStoreName()) {
         $scopes = array();
         foreach (explode("\n", $row->getStoreName()) as $k => $label) {
             $scopes[] = str_repeat('&nbsp;', $k * 3) . $label;
         }
         $out .= implode('<br/>', $scopes) . $this->__(' [deleted]');
         return $out;
     }
     if (empty($origStores) && !$skipEmptyStoresLabel) {
         return '';
     }
     if (!is_array($origStores)) {
         $origStores = array($origStores);
     }
     if (empty($origStores)) {
         return '';
     } elseif (in_array(0, $origStores) && count($origStores) == 1 && !$skipAllStoresLabel) {
         return Mage::helper('adminhtml')->__('All Store Views');
     }
     $data = $this->_getStoreModel()->getStoresStructure(false, $origStores);
     foreach ($data as $website) {
         $out .= $website['label'] . '<br/>';
         foreach ($website['children'] as $group) {
             $out .= str_repeat('&nbsp;', 3) . $group['label'] . '<br/>';
             foreach ($group['children'] as $store) {
                 $out .= str_repeat('&nbsp;', 6) . $store['label'] . '<br/>';
             }
         }
     }
     return $out;
 }
Example #3
0
 public function render(Varien_Object $row)
 {
     $out = '';
     $skipAllStoresLabel = $this->_getShowAllStoresLabelFlag();
     $skipEmptyStoresLabel = $this->_getShowEmptyStoresLabelFlag();
     $origStores = $row->getData($this->getColumn()->getIndex());
     if (is_null($origStores) && $row->getStoreName()) {
         $scopes = array();
         foreach (explode("\n", $row->getStoreName()) as $k => $label) {
             $scopes[] = str_repeat('&nbsp;', $k * 3) . $label;
         }
         $out .= implode('<br/>', $scopes) . $this->__(' [deleted]');
         return $out;
     }
     if (empty($origStores) && !$skipEmptyStoresLabel) {
         return '';
     }
     if (!is_array($origStores)) {
         $origStores = array($origStores);
     }
     if (empty($origStores)) {
         return '';
     } elseif (in_array(0, $origStores) && count($origStores) == 1 && !$skipAllStoresLabel) {
         return Mage::helper('adminhtml')->__('All Store Views');
     }
     $data = $this->_getStoreModel()->getStoresStructure(false, $origStores);
     foreach ($data as $website) {
         $out .= $website['label'] . '<br/>';
         foreach ($website['children'] as $group) {
             $out .= str_repeat('&nbsp;', 3) . $group['label'] . '<br/>';
             foreach ($group['children'] as $store) {
                 $href = Mage::app()->getStore($store['value'])->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . $row->getIdentifier();
                 $out .= str_repeat('&nbsp;', 6) . '<a target="blank" href="' . $href . '">' . $store['label'] . '</a><br/>';
             }
         }
     }
     return $out;
 }
 public function render(Varien_Object $row)
 {
     $skipAllStoresLabel = $this->_getShowAllStoresLabelFlag();
     $origStores = $row->getData($this->getColumn()->getIndex());
     $showNumericStores = (bool) $this->getColumn()->getShowNumericStores();
     $stores = array();
     if (!is_array($origStores)) {
         $origStores = array($origStores);
     }
     foreach ($origStores as $origStore) {
         if (is_numeric($origStore)) {
             if (0 == $origStore) {
                 if (!$skipAllStoresLabel) {
                     $stores[] = Mage::helper('adminhtml')->__('All Store Views');
                 }
             } elseif ($storeName = $this->_getStoreModel()->getStoreName($origStore)) {
                 if ($this->getColumn()->getStoreView()) {
                     $store = $this->_getStoreModel()->getStoreNameWithWebsite($origStore);
                 } else {
                     $store = $this->_getStoreModel()->getStoreNamePath($origStore);
                 }
                 $layers = array();
                 foreach (explode('/', $store) as $key => $value) {
                     $layers[] = ' ' . $value;
                 }
                 $stores[] = implode(' > ', $layers);
             } elseif ($showNumericStores) {
                 $stores[] = $origStore;
             }
         } elseif (is_null($origStore) && $row->getStoreName()) {
             $stores[] = $row->getStoreName() . ' ' . $this->__('[deleted]');
         } else {
             $stores[] = $origStore;
         }
     }
     return $stores ? join(' > ', $stores) : ' ';
 }
Example #5
0
 /**
  * Render row store views for export
  *
  * @param Varien_Object $row
  * @return string
  */
 public function renderExport(Varien_Object $row)
 {
     $out = '';
     $skipAllStoresLabel = $this->_getShowAllStoresLabelFlag();
     $origStores = $row->getData($this->getColumn()->getIndex());
     if (is_null($origStores) && $row->getStoreName()) {
         $scopes = array();
         foreach (explode("\n", $row->getStoreName()) as $k => $label) {
             $scopes[] = str_repeat(' ', $k * 3) . $label;
         }
         $out .= implode("\r\n", $scopes) . $this->__(' [deleted]');
         return $out;
     }
     if (!is_array($origStores)) {
         $origStores = array($origStores);
     }
     if (in_array(0, $origStores) && !$skipAllStoresLabel) {
         return Mage::helper('Mage_Backend_Helper_Data')->__('All Store Views');
     }
     $data = $this->_getStoreModel()->getStoresStructure(false, $origStores);
     foreach ($data as $website) {
         $out .= $website['label'] . "\r\n";
         foreach ($website['children'] as $group) {
             $out .= str_repeat(' ', 3) . $group['label'] . "\r\n";
             foreach ($group['children'] as $store) {
                 $out .= str_repeat(' ', 6) . $store['label'] . "\r\n";
             }
         }
     }
     return $out;
 }