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


PHP WebserviceField::getFieldDataType方法代码示例

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


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

示例1: getConditionValue

 /**
  *
  * @param mixed $value
  * @param String $operator
  * @param WebserviceField $field
  */
 private function getConditionValue($value, $operator, $field)
 {
     $operator = strtolower($operator);
     $db = PearDatabase::getInstance();
     $inEqualityFieldTypes = ['currency', 'percentage', 'double', 'integer', 'number'];
     if (is_string($value) && $this->ignoreComma == false) {
         $commaSeparatedFieldTypes = array('picklist', 'multipicklist', 'owner', 'date', 'datetime', 'time', 'tree');
         if (in_array($field->getFieldDataType(), $commaSeparatedFieldTypes)) {
             $valueArray = explode(',', $value);
             if ($field->getFieldDataType() == 'multipicklist' && in_array($operator, array('e', 'n'))) {
                 $valueArray = getCombinations($valueArray);
                 foreach ($valueArray as $key => $value) {
                     $valueArray[$key] = ltrim($value, ' |##| ');
                 }
             }
         } else {
             $valueArray = array($value);
         }
     } elseif (is_array($value)) {
         $valueArray = $value;
     } else {
         $valueArray = array($value);
     }
     $sql = array();
     if ($operator == 'between' || $operator == 'bw' || $operator == 'notequal') {
         if ($field->getFieldName() == 'birthday') {
             $valueArray[0] = getValidDBInsertDateTimeValue($valueArray[0]);
             $valueArray[1] = getValidDBInsertDateTimeValue($valueArray[1]);
             $sql[] = "BETWEEN DATE_FORMAT(" . $db->quote($valueArray[0]) . ", '%m%d') AND " . "DATE_FORMAT(" . $db->quote($valueArray[1]) . ", '%m%d')";
         } else {
             if ($this->isDateType($field->getFieldDataType())) {
                 $start = explode(' ', $valueArray[0]);
                 $end = explode(' ', $valueArray[1]);
                 if ($operator == 'between' && count($start) == 2 && count($end) == 2) {
                     $valueArray[0] = getValidDBInsertDateTimeValue($start[0] . ' ' . $start[1]);
                     if ($start[0] == $end[0]) {
                         $dateTime = new DateTime($valueArray[0]);
                         $nextDay = $dateTime->modify('+1 days');
                         $nextDay = strtotime($nextDay->format('Y-m-d H:i:s')) - 1;
                         $nextDay = date('Y-m-d H:i:s', $nextDay);
                         $values = explode(' ', $nextDay);
                         $valueArray[1] = getValidDBInsertDateTimeValue($values[0]) . ' ' . $values[1];
                     } else {
                         $end = $valueArray[1];
                         $dateObject = new DateTimeField($end);
                         $valueArray[1] = $dateObject->getDBInsertDateTimeValue();
                     }
                 } else {
                     $valueArray[0] = getValidDBInsertDateTimeValue($valueArray[0]);
                     $dateTimeStart = explode(' ', $valueArray[0]);
                     if ($dateTimeStart[1] == '00:00:00' && $operator != 'between') {
                         $valueArray[0] = $dateTimeStart[0];
                     }
                     $valueArray[1] = getValidDBInsertDateTimeValue($valueArray[1]);
                     $dateTimeEnd = explode(' ', $valueArray[1]);
                     if ($dateTimeEnd[1] == '00:00:00' || $dateTimeEnd[1] == '23:59:59') {
                         $valueArray[1] = $dateTimeEnd[0];
                     }
                 }
             }
             if ($operator == 'notequal') {
                 $sql[] = "NOT BETWEEN " . $db->quote($valueArray[0]) . " AND " . $db->quote($valueArray[1]);
             } else {
                 $sql[] = "BETWEEN " . $db->quote($valueArray[0]) . " AND " . $db->quote($valueArray[1]);
             }
         }
         return $sql;
     }
     foreach ($valueArray as $value) {
         if (!$this->isStringType($field->getFieldDataType())) {
             $value = trim($value);
         }
         if ($operator == 'empty' || $operator == 'y') {
             $sql[] = sprintf("IS NULL OR %s = ''", $this->getSQLColumn($field->getFieldName()));
             continue;
         }
         if ($operator == 'ny') {
             $sql[] = sprintf("IS NOT NULL AND %s != ''", $this->getSQLColumn($field->getFieldName()));
             continue;
         }
         if (strtolower(trim($value)) == 'null' || trim($value) == '' && !$this->isStringType($field->getFieldDataType()) && ($operator == 'e' || $operator == 'n')) {
             if ($operator == 'e') {
                 $sql[] = "IS NULL";
                 continue;
             }
             $sql[] = "IS NOT NULL";
             continue;
         } elseif ($field->getFieldDataType() == 'boolean') {
             $value = strtolower($value);
             if ($value == 'yes') {
                 $value = 1;
             } elseif ($value == 'no') {
                 $value = 0;
             }
//.........这里部分代码省略.........
开发者ID:artisan4710,项目名称:YetiForceCRM,代码行数:101,代码来源:QueryGenerator.php

示例2: getConditionValue

 /**
  *
  * @param mixed $value
  * @param String $operator
  * @param WebserviceField $field
  */
 private function getConditionValue($value, $operator, $field)
 {
     $operator = strtolower($operator);
     $db = PearDatabase::getInstance();
     $inEqualityFieldTypes = ['currency', 'percentage', 'double', 'integer', 'number'];
     if (is_string($value) && $this->ignoreComma == false) {
         $commaSeparatedFieldTypes = ['picklist', 'multipicklist', 'owner', 'date', 'datetime', 'time', 'tree', 'sharedOwner', 'sharedOwner'];
         if (in_array($field->getFieldDataType(), $commaSeparatedFieldTypes)) {
             $valueArray = explode(',', $value);
             if ($field->getFieldDataType() == 'multipicklist' && in_array($operator, ['e', 'n'])) {
                 $valueArray = getCombinations($valueArray);
                 foreach ($valueArray as $key => $value) {
                     $valueArray[$key] = ltrim($value, ' |##| ');
                 }
             }
         } else {
             if ($field->getFieldDataType() == 'multiReferenceValue') {
                 $valueArray = explode(',', $value);
                 foreach ($valueArray as $key => $value) {
                     $valueArray[$key] = '|#|' . $value . '|#|';
                 }
             } else {
                 $valueArray = [$value];
             }
         }
     } elseif (is_array($value)) {
         $valueArray = $value;
     } else {
         $valueArray = [$value];
     }
     $sql = array();
     if ($operator == 'between' || $operator == 'bw' || $operator == 'notequal') {
         if ($field->getFieldName() == 'birthday') {
             $valueArray[0] = getValidDBInsertDateTimeValue($valueArray[0]);
             $valueArray[1] = getValidDBInsertDateTimeValue($valueArray[1]);
             $sql[] = "BETWEEN DATE_FORMAT(" . $db->quote($valueArray[0]) . ", '%m%d') AND " . "DATE_FORMAT(" . $db->quote($valueArray[1]) . ", '%m%d')";
         } else {
             if ($this->isDateType($field->getFieldDataType())) {
                 $start = explode(' ', $valueArray[0]);
                 $end = explode(' ', $valueArray[1]);
                 if ($operator == 'between' && count($start) == 2 && count($end) == 2) {
                     $valueArray[0] = getValidDBInsertDateTimeValue($start[0] . ' ' . $start[1]);
                     if ($start[0] == $end[0]) {
                         $dateTime = new DateTime($valueArray[0]);
                         $nextDay = $dateTime->modify('+1 days');
                         $nextDay = strtotime($nextDay->format('Y-m-d H:i:s')) - 1;
                         $nextDay = date('Y-m-d H:i:s', $nextDay);
                         $values = explode(' ', $nextDay);
                         $valueArray[1] = getValidDBInsertDateTimeValue($values[0]) . ' ' . $values[1];
                     } else {
                         $end = $valueArray[1];
                         $dateObject = new DateTimeField($end);
                         $valueArray[1] = $dateObject->getDBInsertDateTimeValue();
                     }
                 } else {
                     $valueArray[0] = getValidDBInsertDateTimeValue($valueArray[0]);
                     $dateTimeStart = explode(' ', $valueArray[0]);
                     if ($dateTimeStart[1] == '00:00:00' && $operator != 'between') {
                         $valueArray[0] = $dateTimeStart[0];
                     }
                     $valueArray[1] = getValidDBInsertDateTimeValue($valueArray[1]);
                     $dateTimeEnd = explode(' ', $valueArray[1]);
                     if ($dateTimeEnd[1] == '00:00:00' || $dateTimeEnd[1] == '23:59:59') {
                         $valueArray[1] = $dateTimeEnd[0];
                     }
                 }
             }
             if ($operator == 'notequal') {
                 $sql[] = "NOT BETWEEN " . $db->quote($valueArray[0]) . " AND " . $db->quote($valueArray[1]);
             } else {
                 $sql[] = "BETWEEN " . $db->quote($valueArray[0]) . " AND " . $db->quote($valueArray[1]);
             }
         }
         return $sql;
     }
     foreach ($valueArray as $value) {
         if (!$this->isStringType($field->getFieldDataType())) {
             $value = trim($value);
         }
         if ($operator == 'empty' || $operator == 'y') {
             $sql[] = sprintf("IS NULL OR %s = ''", $this->getSQLColumn($field->getFieldName()));
             continue;
         }
         if ($operator == 'ny') {
             $sql[] = sprintf("IS NOT NULL AND %s != ''", $this->getSQLColumn($field->getFieldName()));
             continue;
         }
         if (strtolower(trim($value)) == 'null' || trim($value) == '' && !$this->isStringType($field->getFieldDataType()) && ($operator == 'e' || $operator == 'n')) {
             if ($operator == 'e') {
                 $sql[] = "IS NULL";
                 continue;
             }
             $sql[] = "IS NOT NULL";
             continue;
//.........这里部分代码省略.........
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:101,代码来源:QueryGenerator.php

示例3: getConditionValue

 /**
  *
  * @param mixed $value
  * @param String $operator
  * @param WebserviceField $field
  */
 private function getConditionValue($value, $operator, $field)
 {
     $operator = strtolower($operator);
     $db = PearDatabase::getInstance();
     $noncommaSeparatedFieldTypes = array('currency', 'percentage', 'double', 'integer', 'number');
     if (in_array($field->getFieldDataType(), $noncommaSeparatedFieldTypes)) {
         if (is_array($value)) {
             $valueArray = $value;
         } else {
             $valueArray = array($value);
         }
         // if ($field->getFieldDataType() == 'multipicklist' && in_array($operator, array('e', 'n'))) {
         // $valueArray = getCombinations($valueArray);
         // foreach ($valueArray as $key => $value) {
         // $valueArray[$key] = ltrim($value, ' |##| ');
         // }
         // }
     } elseif (is_string($value)) {
         $valueArray = explode(',', $value);
     } elseif (is_array($value)) {
         $valueArray = $value;
     } else {
         $valueArray = array($value);
     }
     $sql = array();
     if ($operator == 'exists') {
         global $current_user, $adb;
         $mid = getTabModuleName($field->getTabId());
         $qg = new QueryGenerator($mid, $current_user);
         $qg->addCondition($field->getFieldName(), $value, 'e');
         $sql[] = 'SELECT EXISTS(SELECT 1 ' . $qg->getFromClause() . $qg->getWhereClause() . ')';
         return $sql;
     }
     if ($operator == 'i' or $operator == 'in' or $operator == 'ni' or $operator == 'nin') {
         $vals = array_map(array($db, 'quote'), $valueArray);
         $sql[] = (($operator == 'ni' or $operator == 'nin') ? ' NOT ' : '') . 'IN (' . implode(',', $vals) . ')';
         return $sql;
     }
     if ($operator == 'between' || $operator == 'bw' || $operator == 'notequal') {
         if ($field->getFieldName() == 'birthday') {
             $valueArray[0] = getValidDBInsertDateTimeValue($valueArray[0]);
             $valueArray[1] = getValidDBInsertDateTimeValue($valueArray[1]);
             $sql[] = "BETWEEN DATE_FORMAT(" . $db->quote($valueArray[0]) . ", '%m%d') AND " . "DATE_FORMAT(" . $db->quote($valueArray[1]) . ", '%m%d')";
         } else {
             if ($this->isDateType($field->getFieldDataType())) {
                 $valueArray[0] = getValidDBInsertDateTimeValue($valueArray[0]);
                 $valueArray[1] = getValidDBInsertDateTimeValue($valueArray[1]);
             }
             $sql[] = "BETWEEN " . $db->quote($valueArray[0]) . " AND " . $db->quote($valueArray[1]);
         }
         return $sql;
     }
     $yes = strtolower(getTranslatedString('yes'));
     $no = strtolower(getTranslatedString('no'));
     foreach ($valueArray as $value) {
         if (!$this->isStringType($field->getFieldDataType())) {
             $value = trim($value);
         }
         if ($operator == 'empty' || $operator == 'y') {
             $sql[] = sprintf("IS NULL OR %s = ''", $this->getSQLColumn($field->getFieldName()));
             continue;
         }
         if ($operator == 'ny') {
             $sql[] = sprintf("IS NOT NULL AND %s != ''", $this->getSQLColumn($field->getFieldName()));
             continue;
         }
         if (strtolower(trim($value)) == 'null' || trim($value) == '' && !$this->isStringType($field->getFieldDataType()) && ($operator == 'e' || $operator == 'n')) {
             if ($operator == 'e') {
                 $sql[] = "IS NULL";
                 continue;
             }
             $sql[] = "IS NOT NULL";
             continue;
         } elseif ($field->getFieldDataType() == 'boolean') {
             $value = strtolower($value);
             if ($value == 'yes' or $value == $yes) {
                 $value = 1;
             } elseif ($value == 'no' or $value == $no) {
                 $value = 0;
             }
         } elseif ($this->isDateType($field->getFieldDataType())) {
             $value = getValidDBInsertDateTimeValue($value);
             if (empty($value)) {
                 $sql[] = 'IS NULL or ' . $field->getTableName() . '.' . $field->getFieldName() . " = ''";
                 return $sql;
             }
         } elseif ($field->getFieldDataType() == 'picklist' || $field->getFieldDataType() == 'multipicklist') {
             if (!isValueInPicklist($value, $field->getFieldName())) {
                 $value = getTranslationKeyFromTranslatedValue($this->module, $value);
             }
         } else {
             if ($field->getFieldDataType() === 'currency') {
                 $uiType = $field->getUIType();
                 if ($uiType == 72) {
//.........这里部分代码省略.........
开发者ID:kikojover,项目名称:corebos,代码行数:101,代码来源:QueryGenerator.php

示例4: getConditionValue

 /**
  *
  * @param mixed $value
  * @param String $operator
  * @param WebserviceField $field
  */
 private function getConditionValue($value, $operator, $field)
 {
     $operator = strtolower($operator);
     $db = PearDatabase::getInstance();
     if (is_string($value) && $this->ignoreComma == false) {
         $valueArray = explode(',', $value);
         if ($field->getFieldDataType() == 'multipicklist' && in_array($operator, array('e', 'n'))) {
             $valueArray = getCombinations($valueArray);
             foreach ($valueArray as $key => $value) {
                 $valueArray[$key] = ltrim($value, ' |##| ');
             }
         }
     } elseif (is_array($value)) {
         $valueArray = $value;
     } else {
         $valueArray = array($value);
     }
     $sql = array();
     if ($operator == 'between' || $operator == 'bw' || $operator == 'notequal') {
         if ($field->getFieldName() == 'birthday') {
             $valueArray[0] = getValidDBInsertDateTimeValue($valueArray[0]);
             $valueArray[1] = getValidDBInsertDateTimeValue($valueArray[1]);
             $sql[] = "BETWEEN DATE_FORMAT(" . $db->quote($valueArray[0]) . ", '%m%d') AND " . "DATE_FORMAT(" . $db->quote($valueArray[1]) . ", '%m%d')";
         } else {
             if ($this->isDateType($field->getFieldDataType())) {
                 $valueArray[0] = getValidDBInsertDateTimeValue($valueArray[0]);
                 $dateTimeStart = explode(' ', $valueArray[0]);
                 if ($dateTimeStart[1] == '00:00:00' && $operator != 'between') {
                     $valueArray[0] = $dateTimeStart[0];
                 }
                 $valueArray[1] = getValidDBInsertDateTimeValue($valueArray[1]);
                 $dateTimeEnd = explode(' ', $valueArray[1]);
                 if ($dateTimeEnd[1] == '00:00:00') {
                     $valueArray[1] = $dateTimeEnd[0];
                 }
             }
             if ($operator == 'notequal') {
                 $sql[] = "NOT BETWEEN " . $db->quote($valueArray[0]) . " AND " . $db->quote($valueArray[1]);
             } else {
                 $sql[] = "BETWEEN " . $db->quote($valueArray[0]) . " AND " . $db->quote($valueArray[1]);
             }
         }
         return $sql;
     }
     foreach ($valueArray as $value) {
         if (!$this->isStringType($field->getFieldDataType())) {
             $value = trim($value);
         }
         if ($operator == 'empty' || $operator == 'y') {
             $sql[] = sprintf("IS NULL OR %s = ''", $this->getSQLColumn($field->getFieldName()));
             continue;
         }
         if (strtolower(trim($value)) == 'null' || trim($value) == '' && !$this->isStringType($field->getFieldDataType()) && ($operator == 'e' || $operator == 'n')) {
             if ($operator == 'e') {
                 $sql[] = "IS NULL";
                 continue;
             }
             $sql[] = "IS NOT NULL";
             continue;
         } elseif ($field->getFieldDataType() == 'boolean') {
             $value = strtolower($value);
             if ($value == 'yes') {
                 $value = 1;
             } elseif ($value == 'no') {
                 $value = 0;
             }
         } elseif ($this->isDateType($field->getFieldDataType())) {
             $value = getValidDBInsertDateTimeValue($value);
             $dateTime = explode(' ', $value);
             if ($dateTime[1] == '00:00:00') {
                 $value = $dateTime[0];
             }
         }
         if ($field->getFieldName() == 'birthday' && !$this->isRelativeSearchOperators($operator)) {
             $value = "DATE_FORMAT(" . $db->quote($value) . ", '%m%d')";
         } else {
             $value = $db->sql_escape_string($value);
         }
         if (trim($value) == '' && ($operator == 's' || $operator == 'ew' || $operator == 'c') && ($this->isStringType($field->getFieldDataType()) || $field->getFieldDataType() == 'picklist' || $field->getFieldDataType() == 'multipicklist')) {
             $sql[] = "LIKE ''";
             continue;
         }
         if (trim($value) == '' && $operator == 'k' && $this->isStringType($field->getFieldDataType())) {
             $sql[] = "NOT LIKE ''";
             continue;
         }
         switch ($operator) {
             case 'e':
                 $sqlOperator = "=";
                 break;
             case 'n':
                 $sqlOperator = "<>";
                 break;
             case 's':
//.........这里部分代码省略.........
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:101,代码来源:QueryGenerator.php

示例5: getConditionValue

 /**
  *
  * @param mixed $value
  * @param String $operator
  * @param WebserviceField $field
  */
 private function getConditionValue($value, $operator, $field)
 {
     $operator = strtolower($operator);
     $db = PearDatabase::getInstance();
     if (is_string($value)) {
         $valueArray = explode(',', $value);
     } elseif (is_array($value)) {
         $valueArray = $value;
     } else {
         $valueArray = array($value);
     }
     $sql = array();
     if ($operator == 'between' || $operator == 'bw') {
         if ($field->getFieldName() == 'birthday') {
             $valueArray[0] = getValidDBInsertDateTimeValue($valueArray[0]);
             $valueArray[1] = getValidDBInsertDateTimeValue($valueArray[1]);
             $sql[] = "BETWEEN DATE_FORMAT(" . $db->quote($valueArray[0]) . ", '%m%d') AND " . "DATE_FORMAT(" . $db->quote($valueArray[1]) . ", '%m%d')";
         } else {
             if ($this->isDateType($field->getFieldDataType())) {
                 $valueArray[0] = getValidDBInsertDateTimeValue($valueArray[0]);
                 $valueArray[1] = getValidDBInsertDateTimeValue($valueArray[1]);
             }
             $sql[] = "BETWEEN " . $db->quote($valueArray[0]) . " AND " . $db->quote($valueArray[1]);
         }
         return $sql;
     }
     foreach ($valueArray as $value) {
         if (!$this->isStringType($field->getFieldDataType())) {
             $value = trim($value);
         }
         if (strtolower(trim($value)) == 'null' || trim($value) == '' && !$this->isStringType($field->getFieldDataType()) && ($operator == 'e' || $operator == 'n')) {
             if ($operator == 'e') {
                 $sql[] = "IS NULL";
                 continue;
             }
             $sql[] = "IS NOT NULL";
             continue;
         } elseif ($field->getFieldDataType() == 'boolean') {
             $value = strtolower($value);
             if ($value == 'yes') {
                 $value = 1;
             } elseif ($value == 'no') {
                 $value = 0;
             }
         } elseif ($this->isDateType($field->getFieldDataType())) {
             $value = getValidDBInsertDateTimeValue($value);
         }
         if ($field->getFieldName() == 'birthday' && !$this->isRelativeSearchOperators($operator)) {
             $value = "DATE_FORMAT(" . $db->quote($value) . ", '%m%d')";
         } else {
             $value = $db->sql_escape_string($value);
         }
         if (trim($value) == '' && ($operator == 's' || $operator == 'ew' || $operator == 'c') && ($this->isStringType($field->getFieldDataType()) || $field->getFieldDataType() == 'picklist' || $field->getFieldDataType() == 'multipicklist')) {
             $sql[] = "LIKE ''";
             continue;
         }
         if (trim($value) == '' && $operator == 'k' && $this->isStringType($field->getFieldDataType())) {
             $sql[] = "NOT LIKE ''";
             continue;
         }
         switch ($operator) {
             case 'e':
                 $sqlOperator = "=";
                 break;
             case 'n':
                 $sqlOperator = "<>";
                 break;
             case 's':
                 $sqlOperator = "LIKE";
                 $value = "{$value}%";
                 break;
             case 'ew':
                 $sqlOperator = "LIKE";
                 $value = "%{$value}";
                 break;
             case 'c':
                 $sqlOperator = "LIKE";
                 $value = "%{$value}%";
                 break;
             case 'k':
                 $sqlOperator = "NOT LIKE";
                 $value = "%{$value}%";
                 break;
             case 'l':
                 $sqlOperator = "<";
                 break;
             case 'g':
                 $sqlOperator = ">";
                 break;
             case 'm':
                 $sqlOperator = "<=";
                 break;
             case 'h':
                 $sqlOperator = ">=";
//.........这里部分代码省略.........
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:101,代码来源:QueryGenerator.php


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