Ejemplo n.º 1
0
 /**
  * Export grid data in given format
  * 
  * @param string $format Export format
  * @param array $infos Export informations
  * @return mixed
  */
 protected function _exportFile($format, $infos = null)
 {
     if (!is_null($this->_typeModel)) {
         $this->_typeModel->beforeGridExport($format, null);
     }
     $block = Mage::getSingleton('core/layout')->createBlock($this->getBlockType());
     if (!is_null($infos)) {
         $block->blcg_setExportInfos($infos);
     }
     if (!is_null($this->_typeModel)) {
         $this->_typeModel->beforeGridExport($format, $block);
     }
     switch ($format) {
         case 'csv':
             $return = $block->getCsvFile();
             break;
         case 'xml':
             $return = $block->getExcelFile();
             break;
         default:
             $return = null;
             break;
     }
     if (!is_null($this->_typeModel)) {
         $this->_typeModel->afterGridExport($format, $block);
     }
     return $return;
 }