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


PHP Config::getDefaultGridViewColumns方法代码示例

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


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

示例1: getSolrFields

 /**
  * get solr columns for a node based on display columns
  * @return array
  */
 public function getSolrFields($nodeId = false, $templateId = false)
 {
     $nodeId = $nodeId;
     // dummy codacy assignment
     $rez = array('fields' => array(), 'sort' => array());
     $ip =& $this->inputParams;
     $defaultColumns = array_keys(Config::getDefaultGridViewColumns());
     $displayColumns = $this->getDC();
     $DC = empty($displayColumns['data']) ? array() : $displayColumns['data'];
     if (!empty($DC)) {
         foreach ($DC as $columnName => $column) {
             if (is_array($column) && !empty($column['solr_column_name'])) {
                 $rez['fields'][$column['solr_column_name']] = 1;
                 if (empty($column['localSort'])) {
                     if (@$ip['sort'][0]['property'] == $columnName && !empty($ip['sort'][0]['direction'])) {
                         $rez['sort'][] = $column['solr_column_name'] . ' ' . strtolower($ip['sort'][0]['direction']);
                     } elseif (!empty($column['sort'])) {
                         $rez['sort'][] = $column['solr_column_name'] . ' ' . $column['sort'];
                     }
                 }
             } elseif (is_scalar($column)) {
                 $a = explode(':', $column);
                 if ($a[0] == 'solr') {
                     $rez['fields'][$a[1]] = 1;
                 }
             }
         }
     }
     /* user clicked a column to sort by */
     $property = null;
     $dir = 'asc';
     if (!empty($ip['userSort'])) {
         $dir = strtolower($ip['sort'][0]['direction']);
         if (in_array($dir, array('asc', 'desc')) && preg_match('/^[a-z_0-9]+$/i', $ip['sort'][0]['property'])) {
             $prop = $ip['sort'][0]['property'];
             if (!empty($DC[$prop]['solr_column_name'])) {
                 $col = $DC[$prop];
                 //also check if not marked as localSort
                 if (empty($col['localSort'])) {
                     $property = $col['solr_column_name'];
                 }
             } elseif (in_array($prop, $defaultColumns)) {
                 $property = $prop;
             }
         }
     } else {
         /* get user state and check if user has a custom sorting */
         $stateFrom = empty($displayColumns['from']) ? 'default' : $displayColumns['from'];
         $state = $this->getState($stateFrom);
         if (!empty($state['sort']['property'])) {
             $property = $state['sort']['property'];
             $dir = strtolower(Util\coalesce(@$state['sort']['direction'], 'asc'));
             if (!empty($DC[$property]['solr_column_name']) && empty($DC[$property]['localSort'])) {
                 $property = $DC[$property]['solr_column_name'];
             } elseif (!in_array($property, $defaultColumns)) {
                 $property = null;
             }
         }
     }
     if (!empty($property)) {
         $rez['sort'] = 'ntsc asc,' . $property . ' ' . $dir;
     }
     /* end of get user state and check if user has a custom sorting */
     if (!empty($rez['fields'])) {
         $rez['fields'] = array_keys($rez['fields']);
     }
     return $rez;
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:72,代码来源:Base.php


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