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


PHP WebserviceField::getUIType方法代码示例

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


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

示例1: getConditionValue


//.........这里部分代码省略.........
                 if ($operator == 'a') {
                     // for after comparator we should check the date after the given
                     $dateTime = new DateTime($value);
                     $modifiedDate = $dateTime->modify('+1 days');
                     $nextday = $modifiedDate->format('Y-m-d H:i:s');
                     $temp = strtotime($nextday) - 1;
                     $date = date('Y-m-d H:i:s', $temp);
                     $value = getValidDBInsertDateTimeValue($date);
                 } else {
                     $dateTime = new DateTime($value);
                     $prevday = $dateTime->format('Y-m-d H:i:s');
                     $temp = strtotime($prevday) - 1;
                     $date = date('Y-m-d H:i:s', $temp);
                     $value = getValidDBInsertDateTimeValue($date);
                 }
             } else {
                 $value = getValidDBInsertDateTimeValue($value);
                 $dateTime = explode(' ', $value);
                 if ($dateTime[1] == '00:00:00') {
                     $value = $dateTime[0];
                 }
             }
         } else {
             if (in_array($field->getFieldDataType(), $inEqualityFieldTypes)) {
                 $table = get_html_translation_table(HTML_ENTITIES, ENT_COMPAT, vglobal('default_charset'));
                 $chars = implode('', array_keys($table));
                 if (preg_match("/[{$chars}]+/", $value) === 1) {
                     if ($operator == 'g' || $operator == 'l') {
                         $value = substr($value, 4);
                     } else {
                         if ($operator == 'h' || $operator == 'm') {
                             $value = substr($value, 5);
                         }
                     }
                 }
             } else {
                 if ($field->getFieldDataType() === 'currency') {
                     $uiType = $field->getUIType();
                     if ($uiType == 72) {
                         $value = CurrencyField::convertToDBFormat($value, null, true);
                     } elseif ($uiType == 71) {
                         $value = CurrencyField::convertToDBFormat($value);
                     }
                 }
             }
         }
         if ($field->getFieldName() == 'birthday' && !$this->isRelativeSearchOperators($operator)) {
             $value = "DATE_FORMAT(" . $db->quote($value) . ", '%m%d')";
         } else {
             $value = $db->sql_escape_string($value, true);
         }
         if ($field->getFieldDataType() == 'multiReferenceValue' && in_array($operator, ['e', 's', 'ew', 'c'])) {
             $sql[] = "LIKE '%{$value}%'";
             continue;
         } else {
             if ($field->getFieldDataType() == 'multiReferenceValue' && in_array($operator, ['n', 'k'])) {
                 $sql[] = "NOT LIKE '%{$value}%'";
                 continue;
             }
         }
         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 == 'om' && in_array($field->getFieldName(), $this->ownerFields)) {
             $sql[] = " = '" . Users_Record_Model::getCurrentUserModel()->get('id') . "'";
             continue;
         }
         if ($field->getUIType() == 120) {
             $shownersTable = Vtiger_SharedOwner_UIType::getShownerTable($this->getModule());
             if ($operator == 'om') {
                 $sql[] = 'vtiger_crmentity.crmid IN (SELECT DISTINCT crmid FROM ' . $shownersTable . ' WHERE userid = ' . Users_Record_Model::getCurrentUserModel()->get('id') . ')';
             } else {
                 if (in_array($operator, ['e', 's', 'ew', 'c'])) {
                     $sql[] = 'vtiger_crmentity.crmid IN (SELECT DISTINCT crmid FROM ' . $shownersTable . ' WHERE userid = ' . $value . ')';
                 } else {
                     if (in_array($operator, ['n', 'k'])) {
                         $sql[] = 'vtiger_crmentity.crmid NOT IN (SELECT DISTINCT crmid FROM ' . $shownersTable . ' WHERE userid = ' . $value . ')';
                     }
                 }
             }
             continue;
         }
         if (trim($value) == '' && $operator == 'k' && $this->isStringType($field->getFieldDataType())) {
             $sql[] = "NOT LIKE ''";
             continue;
         }
         $sqlOperatorData = $this->getSqlOperator($operator, $value);
         $sqlOperator = $sqlOperatorData[0];
         $value = $sqlOperatorData[1];
         if (!$this->isNumericType($field->getFieldDataType()) && ($field->getFieldName() != 'birthday' || $field->getFieldName() == 'birthday' && $this->isRelativeSearchOperators($operator))) {
             $value = "'{$value}'";
         }
         if ($this->isNumericType($field->getFieldDataType()) && empty($value)) {
             $value = '0';
         }
         $sql[] = "{$sqlOperator} {$value}";
     }
     return $sql;
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:101,代码来源:QueryGenerator.php

示例2: getConditionValue


//.........这里部分代码省略.........
                 if ($operator == 'a') {
                     // for after comparator we should check the date after the given
                     $dateTime = new DateTime($value);
                     $modifiedDate = $dateTime->modify('+1 days');
                     $nextday = $modifiedDate->format('Y-m-d H:i:s');
                     $temp = strtotime($nextday) - 1;
                     $date = date('Y-m-d H:i:s', $temp);
                     $value = getValidDBInsertDateTimeValue($date);
                 } else {
                     $dateTime = new DateTime($value);
                     $prevday = $dateTime->format('Y-m-d H:i:s');
                     $temp = strtotime($prevday) - 1;
                     $date = date('Y-m-d H:i:s', $temp);
                     $value = getValidDBInsertDateTimeValue($date);
                 }
             } else {
                 $value = getValidDBInsertDateTimeValue($value);
                 $dateTime = explode(' ', $value);
                 if ($dateTime[1] == '00:00:00') {
                     $value = $dateTime[0];
                 }
             }
         } else {
             if (in_array($field->getFieldDataType(), $inEqualityFieldTypes)) {
                 if ($operator == 'g' || $operator == 'l') {
                     $value = substr($value, 4);
                 } else {
                     if ($operator == 'h' || $operator == 'm') {
                         $value = substr($value, 5);
                     }
                 }
             } else {
                 if ($field->getFieldDataType() === 'currency') {
                     $uiType = $field->getUIType();
                     if ($uiType == 72) {
                         $value = CurrencyField::convertToDBFormat($value, null, true);
                     } elseif ($uiType == 71) {
                         $value = CurrencyField::convertToDBFormat($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 == 'om' && in_array($field->getFieldName(), $this->ownerFields)) {
             $sql[] = " = '" . Users_Record_Model::getCurrentUserModel()->get('id') . "'";
             continue;
         }
         if (trim($value) == '' && $operator == 'k' && $this->isStringType($field->getFieldDataType())) {
             $sql[] = "NOT LIKE ''";
             continue;
         }
         switch ($operator) {
             case 'e':
                 $sqlOperator = "=";
                 break;
             case 'n':
                 $sqlOperator = "<>";
                 break;
开发者ID:artisan4710,项目名称:YetiForceCRM,代码行数:67,代码来源: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


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