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


PHP ARSelectFilter::getCondition方法代码示例

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


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

示例1: deleteRecords

 public function deleteRecords(ARSelectFilter $filter)
 {
     $del = new ARDeleteFilter($filter->getCondition());
     ActiveRecordModel::deleteRecordSet($this->className, $del, $this->getReferencedData());
 }
开发者ID:saiber,项目名称:livecart,代码行数:5,代码来源:DataImport.php

示例2: __construct

 public function __construct(LiveCart $application, ARSelectFilter $filter, $modelClass = false, $columnTypes = array())
 {
     $this->application = $application;
     $this->modelClass = $modelClass;
     $this->filter = $filter;
     $this->columnTypes = $columnTypes;
     $request = $this->application->getRequest();
     // set recordset boundaries (limits)
     $filter->setLimit($request->get('page_size', 10), $request->get('offset', 0));
     // set order
     if ($request->isValueSet('sort_col')) {
         $handle = $this->getFieldHandle($request->get('sort_col'), self::SORT_HANDLE);
         if ($handle) {
             $filter->setOrder($handle, $request->get('sort_dir'));
         }
     }
     // apply filters
     $filters = $request->get('filters');
     if (!is_array($filters)) {
         $filters = (array) json_decode($request->get('filters'));
     }
     $conds = array();
     if ($filter->getCondition()) {
         $conds[] = $filter->getCondition();
     }
     foreach ($filters as $field => $value) {
         if (!strlen($value)) {
             continue;
         }
         $value = urldecode($value);
         $handle = $this->getFieldHandle($field, self::FILTER_HANDLE);
         if ($handle instanceof EavFieldCommon) {
             continue;
         } else {
             if (!is_array($handle) && !is_null($handle) && !$handle instanceof ARExpressionHandle) {
                 $fieldInst = $this->getFieldInstance($field);
                 if ($fieldInst && ($fieldInst->getDataType() instanceof ARNumeric || $handle->getField()->getDataType() instanceof ARNumeric)) {
                     $value = preg_replace('/[ ]{2,}/', ' ', $value);
                     $constraints = $fieldInst->getDataType() instanceof ARNumeric ? explode(' ', $value) : array($value);
                     foreach ($constraints as $c) {
                         list($operator, $value) = $this->parseOperatorAndValue($c);
                         if (!is_numeric($value) && $fieldInst->getDataType() instanceof ARNumeric) {
                             continue;
                         }
                         $conds[] = new OperatorCond($handle, $value, $operator);
                     }
                 } else {
                     if ($fieldInst && $fieldInst->getDataType() instanceof ARPeriod) {
                         if (substr($value, 0, 10) == 'daterange ') {
                             $value = str_replace('daterange ', '', $value);
                             list($from, $to) = explode('|', $value);
                             $from = trim($from);
                             $to = trim($to);
                             // convert
                             // 2010-9-1 to 2010-09-01 ( +first or last minute of day)
                             // unset dates to 'inf' (meaning ingnore condition)
                             if ($from == '') {
                                 $from = 'inf';
                             } else {
                                 list($y, $m, $d) = explode('-', $from);
                                 $from = $y . '-' . str_pad($m, 2, '0', STR_PAD_LEFT) . '-' . str_pad($d, 2, '0', STR_PAD_LEFT) . ' 00:00:00';
                             }
                             if ($to == '') {
                                 $to = 'inf';
                             } else {
                                 list($y, $m, $d) = explode('-', $to);
                                 $to = $y . '-' . str_pad($m, 2, '0', STR_PAD_LEFT) . '-' . str_pad($d, 2, '0', STR_PAD_LEFT) . ' 23:59:59';
                             }
                         } else {
                             list($from, $to) = explode(' | ', $value);
                         }
                         $cond = null;
                         // from condition
                         if ('inf' != $from) {
                             $cond = new EqualsOrMoreCond($handle, getDateFromString($from));
                         }
                         // to condition
                         if ('now' != $to && 'inf' != $to) {
                             $condTo = new EqualsOrLessCond($handle, getDateFromString($to));
                             if ($cond) {
                                 $cond->addAnd($condTo);
                             } else {
                                 $cond = $condTo;
                             }
                         }
                         if ($cond) {
                             $conds[] = $cond;
                         }
                     } else {
                         $conds[] = new LikeCond($handle, '%' . $value . '%');
                     }
                 }
             } else {
                 if (is_array($handle)) {
                     $cond = null;
                     foreach ($handle as $h) {
                         $c = new LikeCond($h, '%' . $value . '%');
                         if (!$cond) {
                             $cond = $c;
                         } else {
//.........这里部分代码省略.........
开发者ID:saiber,项目名称:livecart,代码行数:101,代码来源:ActiveGrid.php

示例3: merge

 /**
  * Merges two filters (filter supplied as parameter overwrites order and limit
  * params of this filter)
  *
  * @param ARSelectFilter $filter
  */
 public function merge(ARSelectFilter $filter)
 {
     if ($filter->isConditionSet()) {
         $this->mergeCondition($filter->getCondition());
     }
     if ($filter->isHavingConditionSet()) {
         $this->mergeHavingCondition($filter->getHavingCondition());
     }
     $this->setFieldOrder($filter->getFieldOrder());
     $this->setLimit($filter->getLimit(), $filter->getOffset());
     $groupings = $filter->getGroupingFields();
     $this->fieldListForGroup = array_merge($this->getGroupingFields(), $groupings);
     $joins = $filter->getJoinList();
     $this->joinList = array_merge($this->joinList, $joins);
     $fields = $filter->getFieldList();
     $this->fieldList = array_merge($this->fieldList, $fields);
 }
开发者ID:saiber,项目名称:www,代码行数:23,代码来源:ARSelectFilter.php


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