当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Adminhtml_Block_Widget_Grid::blcg_getStore方法代码示例

本文整理汇总了PHP中Mage_Adminhtml_Block_Widget_Grid::blcg_getStore方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Adminhtml_Block_Widget_Grid::blcg_getStore方法的具体用法?PHP Mage_Adminhtml_Block_Widget_Grid::blcg_getStore怎么用?PHP Mage_Adminhtml_Block_Widget_Grid::blcg_getStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Adminhtml_Block_Widget_Grid的用法示例。


在下文中一共展示了Mage_Adminhtml_Block_Widget_Grid::blcg_getStore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: applyColumnsToGridBlock

 /**
  * Apply columns values to grid block
  * 
  * @param Mage_Adminhtml_Block_Widget_Grid $grid Grid block instance
  * @param bool $applyFromCollection Whether values from collection columns should be applied
  * @return this
  */
 public function applyColumnsToGridBlock(Mage_Adminhtml_Block_Widget_Grid $grid, $applyFromCollection)
 {
     $gridIds = array_keys($grid->getColumns());
     $columnsOrders = array();
     $columns = $this->getColumns(false, true);
     uasort($columns, array($this, '_sortColumns'));
     $attributes = $this->getAvailableAttributes();
     foreach ($columns as $column) {
         if (!in_array($column['id'], $gridIds, true)) {
             if ($column['is_visible'] && !$column['missing'] && (!$this->isCollectionColumnOrigin($column['origin']) || $applyFromCollection)) {
                 // Add from collection/attribute visible and not missing columns
                 $lockedValues = $this->getColumnLockedValues($column['id']);
                 $data = array('header' => $column['header'], 'align' => $column['align'], 'width' => $column['width'], 'index' => $column['index']);
                 $data = array_merge($data, array_intersect_key($lockedValues, $data));
                 if ($this->isCollectionColumnOrigin($column['origin'])) {
                     if (isset($lockedValues['renderer']) || !is_null($column['renderer_type'])) {
                         // Add collection specific column values
                         if (isset($lockedValues['renderer'])) {
                             $rendererType = $lockedValues['renderer'];
                             $rendererParams = $rendererType == $column['renderer_type'] ? $column['renderer_params'] : array();
                         } else {
                             $rendererType = $column['renderer_type'];
                             $rendererParams = $column['renderer_params'];
                         }
                         $data = array_merge($data, $this->_getCollectionColumnGridValues($column['index'], $rendererType, $rendererParams, $grid->blcg_getStore()));
                     }
                 } elseif ($this->isAttributeColumnOrigin($column['origin'])) {
                     if (!isset($attributes[$column['index']])) {
                         // Unknown attribute
                         continue;
                     }
                     if (is_null($column['store_id'])) {
                         // Grid's store
                         $store = $grid->blcg_getStore();
                     } else {
                         // Specific store
                         $store = Mage::app()->getStore($column['store_id']);
                     }
                     // Use auto-generated unique ID as index
                     $alias = self::GRID_COLUMN_ATTRIBUTE_GRID_ALIAS . str_replace(self::GRID_COLUMN_ATTRIBUTE_ID_PREFIX, '', $column['id']);
                     $data['index'] = $alias;
                     // Tell grid to select current attribute
                     $grid->blcg_addAdditionalAttribute(array('alias' => $alias, 'attribute' => $attributes[$column['index']], 'bind' => 'entity_id', 'filter' => null, 'join_type' => 'left', 'store_id' => $store->getId()));
                     // Add attribute specific column values
                     $data = array_merge($data, $this->_getAttributeColumnGridValues($attributes[$column['index']], $column['renderer_params'], $store));
                 } elseif ($this->isCustomColumnOrigin($column['origin'])) {
                     if (!is_object($column['custom_column'])) {
                         // Unknown column
                         continue;
                     }
                     if (is_null($column['store_id'])) {
                         // Grid's store
                         $store = $grid->blcg_getStore();
                     } else {
                         // Specific store
                         $store = Mage::app()->getStore($column['store_id']);
                     }
                     // Use auto-generated unique ID as index
                     $alias = self::GRID_COLUMN_CUSTOM_GRID_ALIAS . str_replace(self::GRID_COLUMN_CUSTOM_ID_PREFIX, '', $column['id']);
                     $data['index'] = $alias;
                     // Add attribute specific column values
                     $customValues = $this->_getCustomColumnGridvalues($column['id'], $data['index'], $column['custom_column'], $column['renderer_type'], $column['renderer_params'], $column['custom_params'], $store, $grid);
                     if (!is_array($customValues)) {
                         // An error occured while applying custom column
                         continue;
                     }
                     $data = array_merge($data, $customValues);
                 }
                 if (isset($lockedValues['config_values']) && is_array($lockedValues['config_values'])) {
                     $data = array_merge($data, $lockedValues['config_values']);
                 }
                 $grid->addColumn($column['id'], $data);
                 $columnsOrders[] = $column['id'];
             }
         } else {
             if ($column['is_visible']) {
                 // Update visible columns
                 if ($gridColumn = $grid->getColumn($column['id'])) {
                     if (!$this->getIgnoreCustomWidths()) {
                         $gridColumn->setWidth($column['width']);
                     }
                     if (!$this->getIgnoreCustomAlignments()) {
                         $gridColumn->setAlign($column['align']);
                     }
                     if (!$this->getIgnoreCustomHeaders()) {
                         $gridColumn->setHeader($column['header']);
                     }
                 }
                 $columnsOrders[] = $column['id'];
             } else {
                 // Remove not visible columns
                 $grid->blcg_removeColumn($column['id']);
             }
//.........这里部分代码省略.........
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:101,代码来源:Grid.php


注:本文中的Mage_Adminhtml_Block_Widget_Grid::blcg_getStore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。