本文整理汇总了PHP中TimeExpressionParser::setTimes方法的典型用法代码示例。如果您正苦于以下问题:PHP TimeExpressionParser::setTimes方法的具体用法?PHP TimeExpressionParser::setTimes怎么用?PHP TimeExpressionParser::setTimes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeExpressionParser
的用法示例。
在下文中一共展示了TimeExpressionParser::setTimes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
//.........这里部分代码省略.........
case FT_TIMESTAMP:
case FT_HISTORIC_DATETIME:
case FT_HISTORIC_DATE:
case FT_DATE:
$vn_timestamp = isset($this->_FIELD_VALUES[$ps_field]) ? $this->_FIELD_VALUES[$ps_field] : 0;
if ($vb_return_with_structure) {
$vs_prop = array('start' => $this->_FIELD_VALUES[$ps_field], 'end' => $this->_FIELD_VALUES[$ps_field]);
} elseif (caGetOption('GET_DIRECT_DATE', $pa_options, false) || caGetOption('getDirectDate', $pa_options, false) || caGetOption('rawDate', $pa_options, false)) {
$vs_prop = $this->_FIELD_VALUES[$ps_field];
} elseif (isset($pa_options['sortable']) && $pa_options['sortable']) {
$vs_prop = $vn_timestamp . "/" . $vn_timestamp;
} else {
$o_tep = new TimeExpressionParser();
if ($ps_field_type == FT_HISTORIC_DATETIME || $ps_field_type == FT_HISTORIC_DATE) {
$o_tep->setHistoricTimestamps($vn_timestamp, $vn_timestamp);
} else {
$o_tep->setUnixTimestamps($vn_timestamp, $vn_timestamp);
}
if ($ps_field_type == FT_DATE || $ps_field_type == FT_HISTORIC_DATE) {
$vs_prop = $o_tep->getText(array_merge(array('timeOmit' => true), $pa_options));
} else {
$vs_prop = $o_tep->getText($pa_options);
}
}
break;
case FT_TIME:
if ($vb_return_with_structure) {
$vs_prop = array('start' => $this->_FIELD_VALUES[$ps_field], 'end' => $this->_FIELD_VALUES[$ps_field]);
} elseif (caGetOption('GET_DIRECT_TIME', $pa_options, false) || caGetOption('getDirectTime', $pa_options, false) || caGetOption('rawTime', $pa_options, false)) {
$vs_prop = $this->_FIELD_VALUES[$ps_field];
} else {
$o_tep = new TimeExpressionParser();
$vn_timestamp = isset($this->_FIELD_VALUES[$ps_field]) ? $this->_FIELD_VALUES[$ps_field] : 0;
$o_tep->setTimes($vn_timestamp, $vn_timestamp);
$vs_prop = $o_tep->getText($pa_options);
}
break;
case FT_DATERANGE:
case FT_HISTORIC_DATERANGE:
$vs_start_field_name = $this->getFieldInfo($ps_field, "START");
$vs_end_field_name = $this->getFieldInfo($ps_field, "END");
$vn_start_date = isset($this->_FIELD_VALUES[$vs_start_field_name]) ? $this->_FIELD_VALUES[$vs_start_field_name] : null;
$vn_end_date = isset($this->_FIELD_VALUES[$vs_end_field_name]) ? $this->_FIELD_VALUES[$vs_end_field_name] : null;
if ($vb_return_with_structure) {
$vs_prop = array('start' => $vn_start_date, 'end' => $vn_end_date);
} elseif (!caGetOption('GET_DIRECT_DATE', $pa_options, false) && !caGetOption('getDirectDate', $pa_options, false) && !caGetOption('rawDate', $pa_options, false)) {
$o_tep = new TimeExpressionParser();
if ($ps_field_type == FT_HISTORIC_DATERANGE) {
$o_tep->setHistoricTimestamps($vn_start_date, $vn_end_date);
} else {
$o_tep->setUnixTimestamps($vn_start_date, $vn_end_date);
}
$vs_prop = $o_tep->getText($pa_options);
} elseif (isset($pa_options['sortable']) && $pa_options['sortable']) {
$vs_prop = $vn_start_date;
//."/".$vn_timestamp;
} else {
$vs_prop = $vn_start_date;
//array($vn_start_date, $vn_end_date);
}
break;
case FT_TIMERANGE:
$vs_start_field_name = $this->getFieldInfo($ps_field, "START");
$vs_end_field_name = $this->getFieldInfo($ps_field, "END");
$vn_start_date = isset($this->_FIELD_VALUES[$vs_start_field_name]) ? $this->_FIELD_VALUES[$vs_start_field_name] : null;
$vn_end_date = isset($this->_FIELD_VALUES[$vs_end_field_name]) ? $this->_FIELD_VALUES[$vs_end_field_name] : null;