本文整理汇总了PHP中TimeExpressionParser::getParseErrorMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP TimeExpressionParser::getParseErrorMessage方法的具体用法?PHP TimeExpressionParser::getParseErrorMessage怎么用?PHP TimeExpressionParser::getParseErrorMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeExpressionParser
的用法示例。
在下文中一共展示了TimeExpressionParser::getParseErrorMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
//.........这里部分代码省略.........
}
}
}
$this->_FIELD_VALUES[$vs_field] = $vm_value;
}
break;
case FT_BIT:
if ($vs_cur_value != $vm_value) {
$this->_FIELD_VALUE_CHANGED[$vs_field] = true;
}
$this->_FIELD_VALUES[$vs_field] = $vm_value ? 1 : 0;
break;
case FT_DATETIME:
case FT_HISTORIC_DATETIME:
case FT_DATE:
case FT_HISTORIC_DATE:
if ($this->DIRECT_DATETIMES || $pa_options["SET_DIRECT_DATE"]) {
$this->_FIELD_VALUES[$vs_field] = $vm_value;
$this->_FIELD_VALUE_CHANGED[$vs_field] = true;
} else {
if (!$vm_value && $this->FIELDS[$vs_field]["IS_NULL"]) {
if ($vs_cur_value) {
$this->_FIELD_VALUE_CHANGED[$vs_field] = true;
}
$this->_FIELD_VALUES[$vs_field] = null;
} else {
$o_tep = new TimeExpressionParser();
if ($pa_fields_type == FT_DATE || $pa_fields_type == FT_HISTORIC_DATE) {
$va_timestamps = $o_tep->parseDate($vm_value);
} else {
$va_timestamps = $o_tep->parseDatetime($vm_value);
}
if (!$va_timestamps) {
$this->postError(1805, $o_tep->getParseErrorMessage(), 'BaseModel->set()', $this->tableName() . '.' . $vs_field);
return false;
}
if ($pa_fields_type == FT_HISTORIC_DATETIME || $pa_fields_type == FT_HISTORIC_DATE) {
if ($vs_cur_value != $va_timestamps["start"]) {
$this->_FIELD_VALUES[$vs_field] = $va_timestamps["start"];
$this->_FIELD_VALUE_CHANGED[$vs_field] = true;
}
} else {
$va_timestamps = $o_tep->getUnixTimestamps();
if ($va_timestamps[0] == -1) {
$this->postError(1830, $o_tep->getParseErrorMessage(), 'BaseModel->set()', $this->tableName() . '.' . $vs_field);
return false;
}
if ($vs_cur_value != $va_timestamps["start"]) {
$this->_FIELD_VALUES[$vs_field] = $va_timestamps["start"];
$this->_FIELD_VALUE_CHANGED[$vs_field] = true;
}
}
}
}
break;
case FT_TIME:
if ($this->DIRECT_TIMES || $pa_options["SET_DIRECT_TIME"]) {
$this->_FIELD_VALUES[$vs_field] = $vm_value;
} else {
if (!$vm_value && $this->FIELDS[$vs_field]["IS_NULL"]) {
if ($vs_cur_value) {
$this->_FIELD_VALUE_CHANGED[$vs_field] = true;
}
$this->_FIELD_VALUES[$vs_field] = null;
} else {
$o_tep = new TimeExpressionParser();
示例2: set
/**
* Set field value(s) for the table row represented by this object
*
* @param string|array string $pa_fields representation of a field name
* or array of string representations of field names
* @param mixed $pm_value value to set the given field(s) to
* @param array $pa_options associative array of options
* possible options (keys):
* when dealing with date/time fields:
* - SET_DIRECT_DATE
* - SET_DIRECT_TIME
* - SET_DIRECT_TIMES
*
* for media/files fields:
* - original_filename : (note that it is lower case) optional parameter which enables you to pass the original filename of a file, in addition to the representation in the temporary, global _FILES array;
*
* for text fields:
* - purify : if set then text input is run through HTML Purifier before being set
*/
public function set($pa_fields, $pm_value = "", $pa_options = null)
{
$this->errors = array();
if (!is_array($pa_fields)) {
$pa_fields = array($pa_fields => $pm_value);
}
foreach ($pa_fields as $vs_field => $vm_value) {
if (array_key_exists($vs_field, $this->FIELDS)) {
$pa_fields_type = $this->getFieldInfo($vs_field, "FIELD_TYPE");
$pb_need_reload = false;
if (!$this->verifyFieldValue($vs_field, $vm_value, $pb_need_reload)) {
return false;
}
if ($pb_need_reload) {
return true;
}
// was set to default
if ($vs_field == $this->primaryKey()) {
$vm_value = preg_replace("/[\"']/", "", $vm_value);
}
// what markup is supported for text fields?
$vs_markup_type = $this->getFieldInfo($vs_field, "MARKUP_TYPE");
// if markup is non-HTML then strip out HTML special chars for safety
if (!($vs_markup_type == __CA_MT_HTML__)) {
$vm_value = htmlspecialchars($vm_value, ENT_QUOTES, 'UTF-8');
}
$vs_cur_value = isset($this->_FIELD_VALUES[$vs_field]) ? $this->_FIELD_VALUES[$vs_field] : null;
switch ($pa_fields_type) {
case FT_NUMBER:
if ($vs_cur_value != $vm_value) {
$this->_FIELD_VALUE_CHANGED[$vs_field] = true;
}
if ($vm_value !== "" || $this->getFieldInfo($vs_field, "IS_NULL") && $vm_value == "") {
if ($vm_value) {
if (($vs_list_code = $this->getFieldInfo($vs_field, "LIST_CODE")) && !is_numeric($vm_value)) {
// translate ca_list_item idno's into item_ids if necessary
if ($vn_id = ca_lists::getItemID($vs_list_code, $vm_value)) {
$vm_value = $vn_id;
}
} else {
$vm_orig_value = $vm_value;
$vm_value = preg_replace("/[^\\d-.]+/", "", $vm_value);
# strip non-numeric characters
if (!preg_match("/^[\\-]{0,1}[\\d.]+\$/", $vm_value)) {
$this->postError(1100, _t("'%1' for %2 is not numeric", $vm_orig_value, $vs_field), "BaseModel->set()");
return "";
}
}
}
$this->_FIELD_VALUES[$vs_field] = $vm_value;
}
break;
case FT_BIT:
if ($vs_cur_value != $vm_value) {
$this->_FIELD_VALUE_CHANGED[$vs_field] = true;
}
$this->_FIELD_VALUES[$vs_field] = $vm_value ? 1 : 0;
break;
case FT_DATETIME:
case FT_HISTORIC_DATETIME:
case FT_DATE:
case FT_HISTORIC_DATE:
if ($this->DIRECT_DATETIMES || $pa_options["SET_DIRECT_DATE"]) {
$this->_FIELD_VALUES[$vs_field] = $vm_value;
$this->_FIELD_VALUE_CHANGED[$vs_field] = true;
} else {
if (!$vm_value && $this->FIELDS[$vs_field]["IS_NULL"]) {
if ($vs_cur_value) {
$this->_FIELD_VALUE_CHANGED[$vs_field] = true;
}
$this->_FIELD_VALUES[$vs_field] = null;
} else {
$o_tep = new TimeExpressionParser();
if ($pa_fields_type == FT_DATE || $pa_fields_type == FT_HISTORIC_DATE) {
$va_timestamps = $o_tep->parseDate($vm_value);
} else {
$va_timestamps = $o_tep->parseDatetime($vm_value);
}
if (!$va_timestamps) {
$this->postError(1805, $o_tep->getParseErrorMessage(), 'BaseModel->set()');
return false;
//.........这里部分代码省略.........