示例#1
0
文件: DateRange.php 项目: acp3/core
 /**
  * @inheritdoc
  */
 public function process(array $params, \Smarty_Internal_Template $smarty)
 {
     $format = isset($params['format']) ? $params['format'] : 'long';
     if (isset($params['start']) && isset($params['end'])) {
         return $this->dateRangeFormatter->formatTimeRange($params['start'], $params['end'], $format);
     } elseif (isset($params['start'])) {
         return $this->dateRangeFormatter->formatTimeRange($params['start'], '', $format);
     }
     return '';
 }
示例#2
0
 /**
  * @inheritdoc
  */
 protected function getValue(array $column, array $dbResultRow)
 {
     $field = $this->getFirstDbField($column);
     $value = $this->getDbValueIfExists($dbResultRow, $field);
     if ($value === null) {
         $value = $this->getDefaultValue($column);
     } else {
         $fields = $this->getDbFields($column);
         $value = $this->dateRangeHelper->formatTimeRange($value, $this->getDbValueIfExists($dbResultRow, next($fields)));
     }
     return $value;
 }