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


PHP Mage_Adminhtml_Block_Widget_Grid::addColumn方法代码示例

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


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

示例1: addColumn

 /**
  * Add column to grid
  * Overriden to add support for visibility_filter column option
  * It stands for conditional visibility of the column depending on filter field values
  * Value of visibility_filter supports (filter_field_name => filter_field_value) pairs
  *
  * @param   string $columnId
  * @param   array $column
  * @return  Magestore_Affiliateplusstatistic_Block_Report_Grid_Abstract
  */
 public function addColumn($columnId, $column)
 {
     if (is_array($column) && array_key_exists('visibility_filter', $column)) {
         $filterData = $this->getFilterData();
         $visibilityFilter = $column['visibility_filter'];
         if (!is_array($visibilityFilter)) {
             $visibilityFilter = array($visibilityFilter);
         }
         foreach ($visibilityFilter as $k => $v) {
             if (is_int($k)) {
                 $filterFieldId = $v;
                 $filterFieldValue = true;
             } else {
                 $filterFieldId = $k;
                 $filterFieldValue = $v;
             }
             if (!$filterData->hasData($filterFieldId) || $filterData->getData($filterFieldId) != $filterFieldValue) {
                 return $this;
                 // don't add column
             }
         }
     }
     return parent::addColumn($columnId, $column);
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:34,代码来源:Abstract.php

示例2: addColumn

 /**
  * Add column to grid
  *
  * @param   string $columnId
  * @param   array || Varien_Object $column
  * @return  Magestore_RewardPoints_Block_Adminhtml_Customer_Edit_Tab_History
  */
 public function addColumn($columnId, $column)
 {
     $columnId = 'rewardpoints_transaction_' . $columnId;
     return parent::addColumn($columnId, $column);
 }
开发者ID:kanotest15,项目名称:cbmagento,代码行数:12,代码来源:History.php

示例3: addColumn

 public function addColumn($columnId, $column)
 {
     // fix error duplicate name
     $columnId = 'payperlead_' . $columnId;
     return parent::addColumn($columnId, $column);
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:6,代码来源:Lead.php

示例4: addColumn

 /**
  * Add column to grid
  *
  * @param   string $columnId
  * @param   array || Varien_Object $column
  * @return  Mage_Adminhtml_Block_Widget_Grid
  */
 public function addColumn($columnId, $column)
 {
     return parent::addColumn($this->_columnPrefix . $columnId, $column);
 }
开发者ID:monarcmoso,项目名称:beta2,代码行数:11,代码来源:Abstract.php

示例5: prepareColumns

 public function prepareColumns(Mage_Adminhtml_Block_Widget_Grid $grid, $selected_columns = null)
 {
     if ($selected_columns === null) {
         $selected_columns = $this->getSelectedColumnsArray(self::XML_PATH_ORDER_GRID_COLUMN);
     }
     $order_columns = $this->prepareGridColumns();
     foreach ($selected_columns as $column) {
         if (isset($order_columns[$column])) {
             $grid->addColumn($column, $order_columns[$column]);
         }
     }
     return $grid;
 }
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:13,代码来源:Grid.php

示例6: 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();
     uasort($columns, array($this, '_sortColumns'));
     $attributes = $this->getAvailableAttributes();
     foreach ($columns as $column) {
         if (!in_array($column['id'], $gridIds)) {
             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($rendererType, $rendererParams, $column['index'], $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));
                 }
                 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
                 $grid->getColumn($column['id'])->setWidth($column['width'])->setAlign($column['align'])->setHeader($column['header']);
                 $columnsOrders[] = $column['id'];
             } else {
                 // Remove not visible columns
                 $grid->blcg_removeColumn($column['id']);
             }
         }
     }
     // Apply columns orders
     $grid->blcg_resetColumnsOrder();
     $previousId = null;
     foreach ($columnsOrders as $columnId) {
         if (!is_null($previousId)) {
             $grid->addColumnsOrder($columnId, $previousId);
         }
         $previousId = $columnId;
     }
     $grid->sortColumnsByOrder();
     return $this;
 }
开发者ID:aram93,项目名称:mage-enhanced-admin-grids,代码行数:82,代码来源:Grid.php


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