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


PHP Properties::searchRecognizedUnitsGroups方法代码示例

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


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

示例1: addValuesColumnQuery

 public function addValuesColumnQuery($query, $field, $val)
 {
     $sql_part = array();
     $sql_params = array();
     $value_from = $val['lower_value'];
     $value_to = $val['upper_value'];
     $unit = $val['property_unit'];
     // We have only 1 Value
     if ($value_from != '' && $value_to == '') {
         if ($unit == '') {
             $sql_part[] = '  ( lower_value = ? OR  upper_value = ?) ';
             $sql_params[] = $value_from;
             $sql_params[] = $value_from;
             //We don't know the filed unit
         } elseif (Properties::searchRecognizedUnitsGroups($unit) === false) {
             $sql_part[] = '  ( lower_value = ? OR  upper_value = ?) AND property_unit = ? ';
             $sql_params[] = $value_from;
             $sql_params[] = $value_from;
             $sql_params[] = $unit;
         } else {
             // Recognized unit
             $sql_params[] = $value_from;
             $sql_params[] = $unit;
             $sql_params[] = $unit;
             $unitGroupStr = implode(',', array_fill(0, count($unitGroup), '?'));
             $sql_part[] = ' ( convert_to_unified ( ?,  ? ) BETWEEN lower_value_unified AND  upper_value_unified) AND is_property_unit_in_group(property_unit, ?)  ';
         }
     } elseif ($value_from != '' && $value_to != '') {
         if ($unit == '') {
             $sql_part[] = ' ( ( lower_value = ? OR  upper_value = ?) OR ( lower_value = ? OR  upper_value = ?) )';
             $sql_params[] = $value_from;
             $sql_params[] = $value_from;
             $sql_params[] = $value_to;
             $sql_params[] = $value_to;
             //We don't know the filed unit
         } elseif (Properties::searchRecognizedUnitsGroups($unit) === false) {
             $sql_part[] = ' ( ( lower_value = ? OR  upper_value = ?) OR ( lower_value = ? OR  upper_value = ?) )  AND property_unit = ? ';
             $sql_params[] = $value_from;
             $sql_params[] = $value_from;
             $sql_params[] = $value_to;
             $sql_params[] = $value_to;
             $sql_params[] = $unit;
         } else {
             // Recognized unit
             $conn_MGR = Doctrine_Manager::connection();
             $lv = $conn_MGR->quote($value_from, 'string');
             $uv = $conn_MGR->quote($value_to, 'string');
             $unit = $conn_MGR->quote($unit, 'string');
             $sql_part[] = "\n            (\n              ( lower_value_unified BETWEEN convert_to_unified({$lv},{$unit}) AND convert_to_unified({$uv},{$unit}))\n              OR\n              ( upper_value_unified BETWEEN convert_to_unified({$lv},{$unit}) AND convert_to_unified({$uv},{$unit}))\n            )\n            OR\n            (\n              lower_value_unified BETWEEN 0 AND convert_to_unified({$lv},{$unit})\n              AND\n              upper_value_unified BETWEEN convert_to_unified({$uv},{$unit}) AND 'Infinity'\n        )";
             $query->andWhere("is_property_unit_in_group(property_unit,{$unit})");
         }
     }
     if (!empty($sql_part)) {
         $query->andWhere(implode(' AND ', $sql_part), $sql_params);
     }
     return $query;
 }
开发者ID:naturalsciences,项目名称:Darwin,代码行数:57,代码来源:PropertiesFormFilter.class.php

示例2: addPropertiesQuery

 public function addPropertiesQuery($query, $type, $applies_to, $value_from, $value_to, $unit)
 {
     $sql_part = array();
     $sql_params = array();
     if (trim($type) != '') {
         $sql_part[] = ' property_type = ? ';
         $sql_params[] = $type;
     }
     if (trim($applies_to) != '') {
         $sql_part[] = ' applies_to = ? ';
         $sql_params[] = $applies_to;
     }
     $value_from = trim($value_from);
     $value_to = trim($value_to);
     $unit = trim($unit);
     if ($value_from == '' && $value_to != '') {
         $value_from = $value_to;
         $value_to = '';
     }
     // We have only 1 Value
     if ($value_from != '' && $value_to == '') {
         if ($unit == '') {
             $sql_part[] = '  ( p.lower_value = ? OR  p.upper_value = ?) ';
             $sql_params[] = $value_from;
             $sql_params[] = $value_from;
             //We don't know the filed unit
         } elseif (Properties::searchRecognizedUnitsGroups($unit) === false) {
             $sql_part[] = '  ( p.lower_value = ? OR  p.upper_value = ?) AND property_unit = ? ';
             $sql_params[] = $value_from;
             $sql_params[] = $value_from;
             $sql_params[] = $unit;
         } else {
             // Recognized unit
             $sql_params[] = $value_from;
             $sql_params[] = $unit;
             $sql_params[] = $unit;
             $sql_part[] = ' ( convert_to_unified ( ?,  ? ) BETWEEN p.lower_value_unified AND  p.upper_value_unified) AND is_property_unit_in_group(property_unit, ?)  ';
         }
     } elseif ($value_from != '' && $value_to != '') {
         if ($unit == '') {
             $sql_part[] = ' ( ( p.lower_value = ? OR  p.upper_value = ?) OR ( p.lower_value = ? OR  p.upper_value = ?) )';
             $sql_params[] = $value_from;
             $sql_params[] = $value_from;
             $sql_params[] = $value_to;
             $sql_params[] = $value_to;
             //We don't know the filed unit
         } elseif (Properties::searchRecognizedUnitsGroups($unit) === false) {
             $sql_part[] = ' ( ( p.lower_value = ? OR  p.upper_value = ?) OR ( p.lower_value = ? OR  p.upper_value = ?) )  AND property_unit = ? ';
             $sql_params[] = $value_from;
             $sql_params[] = $value_from;
             $sql_params[] = $value_to;
             $sql_params[] = $value_to;
             $sql_params[] = $unit;
         } else {
             // Recognized unit
             $conn_MGR = Doctrine_Manager::connection();
             $lv = $conn_MGR->quote($value_from, 'string');
             $uv = $conn_MGR->quote($value_to, 'string');
             $unit = $conn_MGR->quote($unit, 'string');
             $sql_part[] = "\n            (\n              ( p.lower_value_unified BETWEEN convert_to_unified({$lv},{$unit}) AND convert_to_unified({$uv},{$unit}))\n              OR\n              ( p.upper_value_unified BETWEEN convert_to_unified({$lv},{$unit}) AND convert_to_unified({$uv},{$unit}))\n            )\n            OR\n            (\n              p.lower_value_unified BETWEEN 0 AND convert_to_unified({$lv},{$unit})\n              AND\n              p.upper_value_unified BETWEEN convert_to_unified({$uv},{$unit}) AND 'Infinity'\n        )";
             $query->andWhere("is_property_unit_in_group(property_unit,{$unit})");
         }
     } elseif ($unit != '') {
         $sql_part[] = ' property_unit = ? ';
         $sql_params[] = $unit;
     }
     if (!empty($sql_part)) {
         $query->innerJoin('s.SubProperties p');
         $query->groupBy("s.id");
         $query->andWhere(implode(' AND ', $sql_part), $sql_params);
         $this->with_group = true;
     }
     return $query;
 }
开发者ID:naturalsciences,项目名称:Darwin,代码行数:74,代码来源:SpecimensFormFilter.class.php


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