本文整理汇总了PHP中IsDateFieldType函数的典型用法代码示例。如果您正苦于以下问题:PHP IsDateFieldType函数的具体用法?PHP IsDateFieldType怎么用?PHP IsDateFieldType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsDateFieldType函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: db_field2time
function db_field2time($value,$type)
{
// is called when searhing in View as:Time fields
if(IsDateFieldType($type))
return "time(".$value.")";
return $value;
}
示例2: ImportDataFromExcel
/**
* Import data from an Excel file
* @param PHPExcel fileHandle
* @param Array fieldsData
* @param Array keys
* @param ImportPage importPageObject
* @param Boolean autoinc
* @param Boolean useFirstLine
* @param String dateFormat
* @return Array
*/
function ImportDataFromExcel($fileHandle, $fieldsData, $keys, $importPageObject, $autoinc, $useFirstLine, $dateFormat)
{
global $cCharset;
$metaData = array();
$metaData["totalRecords"] = 0;
$errorMessages = array();
$unprocessedData = array();
$updatedRecords = 0;
$addedRecords = 0;
$startRow = $useFirstLine ? 1 : 2;
foreach ($fileHandle->getWorksheetIterator() as $worksheet) {
$highestRow = $worksheet->getHighestRow();
// get a litteral index of the 'highest' column (e.g. 'K')
$highestColumn = $worksheet->getHighestColumn();
// get an index number of the 'highest' column (e.g. 11)
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
for ($row = $startRow; $row <= $highestRow; $row++) {
$fieldValuesData = array();
for ($col = 0; $col < $highestColumnIndex; $col++) {
if (!isset($fieldsData[$col])) {
continue;
}
$importFieldName = $fieldsData[$col]["fName"];
$cell = $worksheet->getCellByColumnAndRow($col, $row);
$cellValue = $cell->getValue();
if (PHPExcel_Shared_Date::isDateTime($cell)) {
$cellDateFormat = $fileHandle->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode();
$cellTextValue = PHPExcel_Style_NumberFormat::ToFormattedString($cellValue, $cellDateFormat);
$cellValue = getDBDateValue($cellTextValue, $cellDateFormat);
} else {
if (is_a($cellValue, 'PHPExcel_RichText')) {
$cellValue = $cellValue->getPlainText();
}
if (IsDateFieldType($fieldsData[$col]["type"])) {
$cellValue = getDBDateValue($cellValue, $dateFormat);
}
$error_handler = set_error_handler("empty_error_handler");
$cellValue = PHPExcel_Shared_String::ConvertEncoding($cellValue, $cCharset, 'UTF-8');
if ($error_handler) {
set_error_handler($error_handler);
}
$matches = array();
preg_match('/^="(=.*)"$/i', $cellValue, $matches);
if (array_key_exists(1, $matches)) {
$cellValue = $matches[1];
}
}
$fieldValuesData[$importFieldName] = $cellValue;
}
$importPageObject->importRecord($fieldValuesData, $keys, $autoinc, $addedRecords, $updatedRecords, $errorMessages, $unprocessedData);
$metaData["totalRecords"] = $metaData["totalRecords"] + 1;
}
}
$metaData["addedRecords"] = $addedRecords;
$metaData["updatedRecords"] = $updatedRecords;
$metaData["errorMessages"] = $errorMessages;
$metaData["unprocessedData"] = $unprocessedData;
return $metaData;
}
示例3: getControl
function getControl($field, $id = "")
{
// if conrol does not created previously
if (!array_key_exists($field, $this->controls)) {
include_once getabspath("classes/controls/Control.php");
$isUserControl = false;
$cTypes = new ControlTypes();
$editFormat = $this->pSetEdit->getEditFormat($field);
if ($editFormat == EDIT_FORMAT_TEXT_FIELD && IsDateFieldType($this->pSetEdit->getFieldType($field))) {
$editFormat = EDIT_FORMAT_DATE;
}
if ($this->pageType == PAGE_SEARCH || $this->pageType == PAGE_LIST) {
// Text field may be Lookup field on some page
if ($editFormat == EDIT_FORMAT_TEXT_FIELD && $this->pSetEdit->getPageTypeByFieldEditFormat($field, EDIT_FORMAT_LOOKUP_WIZARD) != "") {
$localPSet = new ProjectSettings($this->pSetEdit->_table, $this->pSetEdit->getPageTypeByFieldEditFormat($field, EDIT_FORMAT_LOOKUP_WIZARD));
if ($localPSet->getLWLinkField($field) != $localPSet->getLWDisplayField($field)) {
$className = "LookupTextField";
} else {
$className = $cTypes->forSearch[$editFormat];
}
} else {
$className = $cTypes->forSearch[$editFormat];
}
} else {
$className = $cTypes->forEdit[$editFormat];
}
if (!$className) {
if ($editFormat != "") {
$className = "Edit" . $editFormat;
$isUserControl = true;
include_once getabspath("classes/controls/UserControl.php");
if (!is_null($this->pageObject)) {
$this->pageObject->AddJSFile("include/runnerJS/controls/" . $className . ".js", "include/runnerJS/Control.js");
}
} else {
$className = $cTypes->forEdit[EDIT_FORMAT_TEXT_FIELD];
}
} else {
if ($className == $cTypes->forEdit[EDIT_FORMAT_FILE] && $this->pSetEdit->isCompatibilityMode($field)) {
$className = "FileFieldSingle";
}
}
$this->controls[$field] = createControlClass($className, $field, $this->pageObject != null ? $this->pageObject : $this, $id);
$this->controls[$field]->container = $this;
if ($isUserControl) {
$this->controls[$field]->format = $className;
$this->controls[$field]->initUserControl();
}
}
if ($id != "") {
$this->controls[$field]->setID($id);
}
return $this->controls[$field];
}
示例4: showDBValue
public function showDBValue(&$data, $keylink)
{
$result = "";
if (IsDateFieldType($this->fieldType)) {
$result = str_format_time(db2time($data[$this->field]));
} else {
$numbers = parsenumbers($data[$this->field]);
if (!count($numbers)) {
return "";
}
while (count($numbers) < 3) {
$numbers[] = 0;
}
$result = str_format_time(array(0, 0, 0, $numbers[0], $numbers[1], $numbers[2]));
}
return $this->checkForEncoding($result, $keylink);
}
示例5: getTextValue
/**
* @param &Array data
* @return String
*/
public function getTextValue(&$data)
{
$result = "";
if (IsDateFieldType($this->fieldType)) {
return str_format_time(db2time($data[$this->field]));
}
$numbers = parsenumbers($data[$this->field]);
if (!count($numbers)) {
return "";
}
while (count($numbers) < 3) {
$numbers[] = 0;
}
if (count($numbers) == 6) {
return str_format_time(array(0, 0, 0, $numbers[3], $numbers[4], $numbers[5]));
}
// sometimes data is datetime
return str_format_time(array(0, 0, 0, $numbers[0], $numbers[1], $numbers[2]));
}
示例6: getAxisDisplayValue
/**
* Get axes displyed values
* @param Number index
* @param String value
* @return String
*/
protected function getAxisDisplayValue($index, $value)
{
global $locale_info;
if ($value == "" || is_null($value)) {
return "";
}
$groupFieldsData = $this->xml_array["group_fields"];
$field = $groupFieldsData[$index]["name"];
$int_type = $groupFieldsData[$index]["int_type"];
if ($this->fromWizard) {
$control = $this->viewControls->getControl($field);
}
if ($int_type == 0) {
// The 'Normal' interval is set
if ($this->fromWizard) {
$data = array($field => $value);
return $control->showDBValue($data, "");
}
if ($this->table_type != "db") {
$fieldIdentifier = $this->xml_array["tables"][0] . "_" . $field;
} else {
$fieldIdentifier = $this->CrossGoodFieldName($field);
}
if ($this->xml_array['totals'][$fieldIdentifier]['curr'] == true) {
return str_format_currency($value);
}
return xmlencode($value);
}
$ftype = $this->getFieldType($field);
if (IsNumberType($ftype)) {
$start = $value - $value % $int_type;
$end = $start + $int_type;
if ($this->fromWizard) {
$dataStart = array($field => $start);
$dataEnd = array($field => $end);
return $control->showDBValue($dataStart, "") . " - " . $control->showDBValue($dataEnd, "");
}
if ($this->table_type != "db") {
$fieldIdentifier = $this->xml_array["tables"][0] . "_" . $field;
} else {
$fieldIdentifier = $this->CrossGoodFieldName($field);
}
if ($this->xml_array['totals'][$fieldIdentifier]['curr'] == true) {
return str_format_currency($start) . " - " . str_format_currency($end);
}
return $start . " - " . $end;
}
if (IsCharType($ftype)) {
return xmlencode(substr($value, 0, $int_type));
}
if (IsDateFieldType($ftype)) {
$dvalue = substr($value, 0, 4) . '-' . substr($value, 4, 2) . '-' . substr($value, 6, 2);
if (strlen($value) == 10) {
$dvalue .= " " . substr($value, 8, 2) . "00:00";
} elseif (strlen($value) == 12) {
$dvalue .= " " . substr($value, 8, 2) . ":" . substr($value, 10, 2) . ":00";
}
$tm = db2time($dvalue);
if (!count($tm)) {
return "";
}
switch ($int_type) {
case 1:
// DATE_INTERVAL_YEAR
return $tm[0];
case 2:
// DATE_INTERVAL_QUARTER
return $tm[0] . "/Q" . $tm[1];
case 3:
// DATE_INTERVAL_MONTH
return @$locale_info["LOCALE_SABBREVMONTHNAME" . $tm[1]] . " " . $tm[0];
case 4:
// DATE_INTERVAL_WEEK
$dates = $this->getDatesByWeek($tm[1] + 1, $tm[0]);
return format_shortdate(db2time($dates[0])) . ' - ' . format_shortdate(db2time($dates[1]));
case 5:
// DATE_INTERVAL_DAY
return format_shortdate($tm);
case 6:
// DATE_INTERVAL_HOUR
$tm[4] = 0;
$tm[5] = 0;
return str_format_datetime($tm);
case 7:
// DATE_INTERVAL_MINUTE
$tm[5] = 0;
return str_format_datetime($tm);
default:
return str_format_datetime($tm);
}
}
return "";
}
示例7: GetGroupDisplay
function GetGroupDisplay($field, $value) {
global $locale_info, $rpt_array, $tbl, $fields_type;
for ($i = 0; $i < count($rpt_array['group_fields']) - 1; $i++){
$arr = $rpt_array['group_fields'][$i];
foreach ($rpt_array['totals'] as $fld){
if ($arr['name'] == fldname($fld)) {
if (!is_wr_custom())
$ftype = WRGetFieldType($fld['table'] . "." . $fld['name']);
else
$ftype = $fields_type[$fld['name']];
if ($field == $arr['name']) {
if ($arr['int_type'] == 0) {
$prefix = "";
if (!is_wr_db())
$prefix = $rpt_array["tables"][0] . "_";
else
$field = GoodFieldName($field);
if ($rpt_array['totals'][$prefix . $field]['curr'] == "true")
return str_format_currency($value);
else
return $value;
} elseif (IsNumberType($ftype)) {
$start = $value - ($value % $arr['int_type']);
$end = $start + $arr['int_type'];
$prefix = "";
if (!is_wr_db())
$prefix = $rpt_array["tables"][0] . "_";
else
$field = GoodFieldName($field);
if ($rpt_array['totals'][$prefix . $field]['curr'] == "true")
return str_format_currency($start) . " - " . str_format_currency($end);
else
return $start . " - " . $end;
} elseif (IsCharType($ftype)) {
return substr($value, 0, $arr['int_type']);
} elseif (IsDateFieldType($ftype)) {
$tm = db2time($value);
if (!count($tm))
return "";
if ($arr['int_type'] == 1) { // DATE_INTERVAL_YEAR
return $tm[0];
} elseif ($arr['int_type'] == 2) { // DATE_INTERVAL_QUARTER
return $tm[0] . "/Q" . floor(($tm[1] - 1) / 4 + 1);
} elseif ($arr['int_type'] == 3) { // DATE_INTERVAL_MONTH
return @$locale_info["LOCALE_SABBREVMONTHNAME" . $tm[1]] . " " . $tm[0];
} elseif ($arr['int_type'] == 4) { // DATE_INTERVAL_WEEK
$start = getweekstart($tm);
$end = adddays($start, 6);
return format_shortdate($start) . " - " . format_shortdate($end);
} elseif ($arr['int_type'] == 5) { // DATE_INTERVAL_DAY
return format_shortdate($tm);
} elseif ($arr['int_type'] == 6) { // DATE_INTERVAL_HOUR
$tm[4] = 0;
$tm[5] = 0;
return str_format_datetime($tm);
} elseif ($arr['int_type'] == 7) { // DATE_INTERVAL_MINUTE
$tm[5] = 0;
return str_format_datetime($tm);
} else {
return str_format_datetime($tm);
}
}
}
}
}
}
}
示例8: SQLWhere
/**
* Get the WHERE clause conditions string for the search or suggest SQL query
* @param String SearchFor
* @param String strSearchOption
* @param String SearchFor2
* @param String etype
* @param Boolean isSuggest
*/
function SQLWhere($SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest)
{
$baseResult = $this->baseSQLWhere($strSearchOption);
if ($baseResult === false) {
return "";
}
if ($baseResult != "") {
return $baseResult;
}
if (!strlen($SearchFor)) {
return "";
}
$value1 = $this->pageObject->cipherer->MakeDBValue($this->field, $SearchFor, $etype, true);
$value2 = false;
$cleanvalue2 = false;
if ($strSearchOption == "Between") {
$cleanvalue2 = prepare_for_db($this->field, $SearchFor2, $etype);
$value2 = make_db_value($this->field, $SearchFor2, $etype);
}
if ($strSearchOption != "Contains" && $strSearchOption != "Starts with" && ($value1 === "null" || $value2 === "null") && !$this->pageObject->cipherer->isFieldPHPEncrypted($this->field)) {
return "";
}
if (($strSearchOption == "Contains" || $strSearchOption == "Starts with") && !$this->isStringValidForLike($SearchFor)) {
return "";
}
$searchIsCaseInsensitive = $this->pageObject->pSetEdit->getNCSearch();
if (IsCharType($this->type) && !$this->btexttype) {
$gstrField = $this->getFieldSQLDecrypt();
if (!$this->pageObject->cipherer->isFieldPHPEncrypted($this->field) && $searchIsCaseInsensitive) {
$value1 = $this->connection->upper($value1);
$value2 = $this->connection->upper($value2);
$gstrField = $this->connection->upper($gstrField);
}
} elseif ($strSearchOption == "Contains" || $strSearchOption == "Starts with") {
$gstrField = $this->connection->field2char($this->getFieldSQLDecrypt(), $this->type);
} elseif ($this->pageObject->pSetEdit->getViewFormat($this->field) == FORMAT_TIME) {
$gstrField = $this->connection->field2time($this->getFieldSQLDecrypt(), $this->type);
} else {
$gstrField = $this->getFieldSQLDecrypt();
}
if ($strSearchOption == "Contains") {
if ($this->pageObject->cipherer->isFieldPHPEncrypted($this->field)) {
return $gstrField . "=" . $this->pageObject->cipherer->MakeDBValue($this->field, $SearchFor);
}
$SearchFor = $this->connection->escapeLIKEpattern($SearchFor);
if (IsCharType($this->type) && !$this->btexttype && $searchIsCaseInsensitive) {
return $gstrField . " " . $this->like . " " . $this->connection->upper($this->connection->prepareString("%" . $SearchFor . "%"));
}
return $gstrField . " " . $this->like . " " . $this->connection->prepareString("%" . $SearchFor . "%");
}
if ($strSearchOption == "Equals") {
return $gstrField . "=" . $value1;
}
if ($strSearchOption == "Starts with") {
$SearchFor = $this->connection->escapeLIKEpattern($SearchFor);
if (IsCharType($this->type) && !$this->btexttype && $searchIsCaseInsensitive) {
return $gstrField . " " . $this->like . " " . $this->connection->upper($this->connection->prepareString($SearchFor . "%"));
}
return $gstrField . " " . $this->like . " " . $this->connection->prepareString($SearchFor . "%");
}
if ($strSearchOption == "More than") {
return $gstrField . ">" . $value1;
}
if ($strSearchOption == "Less than") {
return $gstrField . "<" . $value1;
}
if ($strSearchOption == "Equal or more than") {
return $gstrField . ">=" . $value1;
}
if ($strSearchOption == "Equal or less than") {
return $gstrField . "<=" . $value1;
}
if ($strSearchOption == "Between") {
$ret = $gstrField . ">=" . $value1 . " and ";
if (IsDateFieldType($this->type)) {
$timeArr = db2time($cleanvalue2);
// for dates without time, add one day
if ($timeArr[3] == 0 && $timeArr[4] == 0 && $timeArr[5] == 0) {
$timeArr = adddays($timeArr, 1);
$value2 = $timeArr[0] . "-" . $timeArr[1] . "-" . $timeArr[2];
$value2 = add_db_quotes($this->field, $value2, $this->pageObject->tName);
$ret .= $gstrField . "<" . $value2;
} else {
$ret .= $gstrField . "<=" . $value2;
}
} else {
$ret .= $gstrField . "<=" . $value2;
}
return $ret;
}
return "";
}
示例9: getControl
/**
* @param String field
* @param String id (optional)
* @param Array extraParmas (optional)
* @return Control
*/
function getControl($field, $id = "", $extraParmas = array())
{
if (count($extraParmas) && $extraParmas["getDetKeyReadOnlyCtrl"]) {
include_once getabspath("classes/controls/Control.php");
$cTypes = new ControlTypes();
$className = $cTypes->forEdit[EDIT_FORMAT_READONLY];
$ctrl = createControlClass($className, $field, $this->pageObject != null ? $this->pageObject : $this, $id, $this->connection);
$ctrl->container = $this;
return $ctrl;
}
if (count($extraParmas) && $extraParmas["getConrirmFieldCtrl"]) {
include_once getabspath("classes/controls/Control.php");
$cTypes = new ControlTypes();
$className = $cTypes->forEdit[EDIT_FORMAT_PASSWORD];
$ctrl = createControlClass($className, $field, $this->pageObject != null ? $this->pageObject : $this, $id, $this->connection);
if ($extraParmas['isConfirm']) {
$ctrl->field = GetPasswordField();
}
$ctrl->container = $this;
return $ctrl;
}
// if conrol does not created previously
if (!array_key_exists($field, $this->controls)) {
include_once getabspath("classes/controls/Control.php");
$userControl = false;
$cTypes = new ControlTypes();
$editFormat = $this->pSetEdit->getEditFormat($field);
if ($editFormat == EDIT_FORMAT_TEXT_FIELD && IsDateFieldType($this->pSetEdit->getFieldType($field))) {
$editFormat = EDIT_FORMAT_DATE;
}
if ($this->pageType == PAGE_SEARCH || $this->pageType == PAGE_LIST) {
// Text field may be Lookup field on some page
$pageTypebyLookupFormat = $this->pSetEdit->getPageTypeByFieldEditFormat($field, EDIT_FORMAT_LOOKUP_WIZARD);
if ($editFormat == EDIT_FORMAT_TEXT_FIELD && $pageTypebyLookupFormat != "") {
$localPSet = new ProjectSettings($this->pSetEdit->_table, $pageTypebyLookupFormat);
if ($localPSet->getLinkField($field) != $localPSet->getDisplayField($field)) {
$className = "LookupTextField";
} else {
$className = $cTypes->forSearch[$editFormat];
}
} else {
$className = $cTypes->forSearch[$editFormat];
}
} else {
$className = $cTypes->forEdit[$editFormat];
}
if ($className == $cTypes->forEdit[EDIT_FORMAT_FILE] && $this->pSetEdit->isBasicUploadUsed($field)) {
$className = "FileFieldSingle";
}
if (!$className) {
if ($editFormat != "") {
$className = "Edit" . $editFormat;
$userControl = true;
include_once getabspath("classes/controls/UserControl.php");
if (!is_null($this->pageObject)) {
$this->pageObject->AddJSFile("include/runnerJS/controls/" . $className . ".js", "include/runnerJS/Control.js");
}
} else {
$className = $cTypes->forEdit[EDIT_FORMAT_TEXT_FIELD];
}
}
$this->controls[$field] = createControlClass($className, $field, $this->pageObject != null ? $this->pageObject : $this, $id, $this->connection);
$this->controls[$field]->container = $this;
if ($userControl) {
$this->controls[$field]->format = $className;
$this->controls[$field]->initUserControl();
}
}
if ($id !== "") {
$this->controls[$field]->setID($id);
}
return $this->controls[$field];
}
示例10: getValForTimePicker
/**
* Get value for field edit as time and get dpTime settings
* @param integer $convention - 24 or 12 hours format for timePicker
* @param string $type - type of field
* @param string $value - value of field
* @param boolean $useTimePicker - use timePicker or not
* @return array
*/
function getValForTimePicker($type, $value, $locale)
{
$val = "";
$dbtime = array();
if (IsDateFieldType($type)) {
$dbtime = db2time($value);
if (count($dbtime)) {
$val = format_datetime_custom($dbtime, $locale);
}
} else {
$arr = parsenumbers($value);
if (count($arr)) {
while (count($arr) < 3) {
$arr[] = 0;
}
$dbtime = array(0, 0, 0, $arr[0], $arr[1], $arr[2]);
$val = format_datetime_custom($dbtime, $locale);
}
}
return array('val' => $val, 'dbTime' => $dbtime);
}
示例11: PrepareValue
function PrepareValue($value, $type)
{
if (IsDateFieldType($type)) {
return db_datequotes($value);
}
if (NeedQuotes($type)) {
return db_prepare_string($value);
} else {
return 0 + $value;
}
}
示例12: SQLWhere
function SQLWhere($SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest)
{
if ($this->lookupType == LT_LISTOFVALUES) {
return parent::SQLWhere($SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest);
}
$baseResult = $this->baseSQLWhere($strSearchOption);
if ($baseResult === false) {
return "";
}
if ($baseResult != "") {
return $baseResult;
}
$displayFieldType = $this->type;
if ($this->lookupType == LT_QUERY) {
$displayFieldType = $this->lookupPSet->getFieldType($this->field);
$this->btexttype = IsTextType($displayFieldType);
}
if ($this->multiselect) {
$SearchFor = splitvalues($SearchFor);
} else {
$SearchFor = array($SearchFor);
}
$ret = "";
if ($this->linkAndDisplaySame) {
$gstrField = GetFullFieldName($this->field, "", false);
} else {
$gstrField = GetFullFieldName($this->displayFieldName, $this->lookupTable, false);
}
if ($this->customDisplay) {
$gstrField = $this->lwDisplayFieldWrapped;
} else {
if (!$this->linkAndDisplaySame && $this->lookupType == LT_QUERY && IsCharType($displayFieldType) && !$this->btexttype && !$this->ciphererDisplay->isFieldPHPEncrypted($this->displayFieldName)) {
$gstrField = $this->lookupPSet->isEnableUpper(GetFullFieldName($this->displayFieldName, $this->lookupTable, false));
}
}
foreach ($SearchFor as $value) {
if (!($value == "null" || $value == "Null" || $value == "")) {
if (strlen(trim($ret))) {
$ret .= " or ";
}
if (!$this->multiselect) {
if ($strSearchOption == "Starts with") {
$value .= '%';
}
if ($isSuggest || $strSearchOption == "Contains") {
$value = '%' . $value . '%';
}
if ($isSuggest || $strSearchOption == "Contains" || $strSearchOption == "Starts with" || $strSearchOption == "More than" || $strSearchOption == "Less than" || $strSearchOption == "Equal or more than" || $strSearchOption == "Equal or less than" || $strSearchOption == "Between" || $strSearchOption == "Equals" && $this->LCType == LCT_AJAX && !$this->linkAndDisplaySame) {
$value = $this->escapeSearchValForMySQL($value);
if ($this->lookupType == LT_QUERY && IsCharType($displayFieldType) && !$this->btexttype) {
$value = $this->lookupPSet->isEnableUpper(db_prepare_string($value));
} else {
$value = db_prepare_string($value);
}
} else {
if ($strSearchOption == "Equals") {
$value = make_db_value($this->field, $value);
}
}
}
if ($strSearchOption == "Equals") {
if (!($value == "null" || $value == "Null")) {
if ($this->LCType == LCT_AJAX && !$this->linkAndDisplaySame) {
$condition = $gstrField . '=' . $value;
} else {
$condition = GetFullFieldName($this->field, "", false) . '=' . $value;
}
}
} else {
if ($strSearchOption == "Starts with" || $strSearchOption == "Contains" && !$this->multiselect) {
$condition = $gstrField . " " . $this->like . " " . $value;
} else {
if ($strSearchOption == "More than") {
$condition = $gstrField . " > " . $value;
} else {
if ($strSearchOption == "Less than") {
$condition = $gstrField . "<" . $value;
} else {
if ($strSearchOption == "Equal or more than") {
$condition = $gstrField . ">=" . $value1;
} else {
if ($strSearchOption == "Equal or less than") {
$condition = $gstrField . "<=" . $value1;
} else {
if ($strSearchOption == "Between") {
if ($this->lookupType == LT_QUERY && IsCharType($displayFieldType) && !$this->btexttype) {
$value2 = $this->lookupPSet->isEnableUpper(db_prepare_string($SearchFor2));
} else {
$value2 = db_prepare_string($SearchFor2);
}
$condition = $gstrField . ">=" . $value . " and ";
if (IsDateFieldType($this->type)) {
$timeArr = db2time($SearchFor2);
// for dates without time, add one day
if ($timeArr[3] == 0 && $timeArr[4] == 0 && $timeArr[5] == 0) {
$timeArr = adddays($timeArr, 1);
$SearchFor2 = $timeArr[0] . "-" . $timeArr[1] . "-" . $timeArr[2];
$SearchFor2 = add_db_quotes($this->field, $SearchFor2, $this->pageObject->tName);
$condition .= $gstrField . "<" . $SearchFor2;
} else {
//.........这里部分代码省略.........
示例13: ImportFromCSV
function ImportFromCSV($uploadfile, $strOriginalTableName, $ext, $keys, &$keys_present, &$total_records, &$error_message, &$goodlines, $pageObject, $cipherer)
{
global $conn, $gSettings;
$ret = 1;
$fields = array();
$fields = getImportCVSFields($uploadfile);
// populate field names array
for ($j=0;$j<count($fields);$j++)
{
$fields[$j] = $fields[$j];
if(substr($fields[$j],0,1)=="\"" && substr($fields[$j],-1)=="\"")
$fields[$j]=substr($fields[$j],1,-1);
}
$fields = getFieldNamesByHeaders($fields, $strOriginalTableName, $ext);
if($fields == null) // if error happened
return;
$keys_present=1;
for($k=0; $k<count($keys); $k++)
{
if (!in_array(RemoveFieldWrappers($keys[$k]),$fields))
{
$keys_present=0;
break;
}
}
$autoinc = false;
if(in_array("id",$fields))
$autoinc=true;
if(GetDatabaseType() == 2 && $autoinc)
{
$sql="SET IDENTITY_INSERT ".AddTableWrappers($strOriginalTableName)." ON";
db_exec($sql,$conn);
}
$total_records = 0;
$line = "";
$row = 0;
// parse records from file
if (($handle = OpenCSVFile($uploadfile)) !== FALSE)
{
while (($data = GetCSVLine($handle, 1000000, ",")) !== FALSE)
{
// first rec contain only fields names
if ($row === 0)
{
$row++;
continue;
}
$arr = array();
foreach($data as $key=>$val)
{
$type = $gSettings->getFieldType($fields[$key]);
if(IsDateFieldType($type))
{
$value = localdatetime2db($val);
if ( $value !== FALSE && strlen($value) && $value != 'null' )
$arr[$fields[$key]] = $value;
else
$arr[$fields[$key]] = NULL;
}
elseif(IsTimeType($type))
{
$value = localtime2db($val);
if ( $value !== FALSE && strlen($value) && !is_null($val) && strlen($val) )
$arr[$fields[$key]] = $value;
else
$arr[$fields[$key]] = NULL;
}
else
$arr[$fields[$key]] = $val;
}
$ret = InsertRecord($arr, $row, $error_message, $goodlines, $keys, $keys_present,
$strOriginalTableName, $pageObject, $cipherer, $autoinc);
$row++;
}
CloseCSVFile($handle);
}
$total_records = $row-1;
if(GetDatabaseType() == 2 && $autoinc)
{
$sql="SET IDENTITY_INSERT ".AddTableWrappers($strOriginalTableName)." OFF";
db_exec($sql,$conn);
}
return $ret;
}
示例14: field2time
/**
* @param Mixed value
* @param Number type
* @return String
*/
public function field2time($value, $type)
{
if (IsDateFieldType($type)) {
return "time(" . $value . ")";
}
return $value;
}
示例15: getFilterControl
/**
* The static function creating the Filter control basing on the control's type
* @param String fName
* @param Object pageObj
* @param Number id
* @param Object viewControls
* @return Object
*/
static function getFilterControl($fName, $pageObj, $id, $viewControls)
{
$contorlType = $pageObj->pSet->getFilterFieldFormat($fName);
switch($contorlType)
{
case FF_VALUE_LIST:
include_once getabspath("classes/controls/FilterValuesList.php");
return new FilterValuesList($fName, $pageObj, $id, $viewControls);
case FF_BOOLEAN:
include_once getabspath("classes/controls/Control.php");
include_once getabspath("classes/controls/CheckboxField.php");
include_once getabspath("classes/controls/FilterBoolean.php");
return new FilterBoolean($fName, $pageObj, $id, $viewControls);
case FF_INTERVAL_LIST:
include_once getabspath("classes/controls/FilterIntervalList.php");
return new FilterIntervalList($fName, $pageObj, $id, $viewControls);
case FF_INTERVAL_SLIDER:
include_once getabspath("classes/controls/FilterIntervalSlider.php");
$fieldType = $pageObj->pSet->getFieldType($fName);
if( IsDateFieldType($fieldType) )
{
include_once getabspath("classes/controls/FilterIntervalDateSlider.php");
return new FilterIntervalDateSlider($fName, $pageObj, $id, $viewControls);
}
if( IsTimeType($fieldType) )
{
include_once getabspath("classes/controls/FilterIntervalDateSlider.php");
include_once getabspath("classes/controls/FilterIntervalTimeSlider.php");
return new FilterIntervalTimeSlider($fName, $pageObj, $id, $viewControls);
}
return new FilterIntervalSlider($fName, $pageObj, $id, $viewControls);
default:
include_once getabspath("classes/controls/FilterValuesList.php");
return new FilterValuesList($fName, $pageObj, $id, $viewControls);
}
}