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


PHP DateTimeObj::toGMT方法代码示例

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


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

示例1: buildFilterQuery

 public function buildFilterQuery($filter, &$joins, array &$where, Register $parameter_output = null)
 {
     $filter = $this->processFilter($filter);
     $db = Symphony::Database();
     $statements = array();
     if (!is_array($values)) {
         $values = array();
     }
     // Exact matches:
     switch ($filter->type) {
         case 'is':
             $operator = '=';
             break;
         case 'is-not':
             $operator = '!=';
             break;
         case 'earlier-than':
             $operator = '>';
             break;
         case 'earlier-than-or-equal':
             $operator = '>=';
             break;
         case 'later-than':
             $operator = '<';
             break;
         case 'later-than-or-equal':
             $operator = '<=';
             break;
     }
     if (empty($this->last_handle)) {
         $this->join_handle = $this->buildFilterJoin($joins);
     }
     $handle = $this->join_handle;
     $value = DataSource::replaceParametersInString(trim($filter->value), $parameter_output);
     $value = DateTimeObj::toGMT($value);
     $statements[] = $db->prepareQuery("%d {$operator} UNIX_TIMESTAMP({$handle}.value)", array($value));
     if (empty($statements)) {
         return true;
     }
     if ($filter_join == DataSource::FILTER_OR) {
         $statement = "(\n\t" . implode("\n\tOR ", $statements) . "\n)";
     } else {
         $statement = "(\n\t" . implode("\n\tAND ", $statements) . "\n)";
     }
     $where[] = $statement;
     return true;
 }
开发者ID:pointybeard,项目名称:symphony-3,代码行数:47,代码来源:field.date.php

示例2: getParameterOutputValue

 public function getParameterOutputValue(StdClass $data, Entry $entry = NULL)
 {
     if (is_null($d->value)) {
         return;
     }
     $timestamp = DateTimeObj::toGMT($data->value);
     return DateTimeObj::get('Y-m-d H:i:s', $timestamp);
 }
开发者ID:symphonycms,项目名称:symphony-3,代码行数:8,代码来源:field.date.php

示例3: render


//.........这里部分代码省略.........
                    foreach ($this->parameters()->{'parameter-output'} as $element) {
                        if (preg_match('/^system:/i', $element)) {
                            $output_parameters->system[preg_replace('/^system:/i', NULL, $element)] = array();
                        } else {
                            $field = $section->fetchFieldByHandle($element);
                            if (!$field instanceof Field) {
                                continue;
                            }
                            $schema[$element] = $field;
                            $output_parameters->fields[$element] = array();
                        }
                    }
                }
                $ids = array();
                $data = array();
                foreach ($entries as $e) {
                    $ids[] = $e->id;
                }
                $schema = array_unique($schema);
                foreach ($schema as $field => $instance) {
                    $data[$field] = $instance->loadDataFromDatabaseEntries($section->handle, $ids);
                }
                $entries->setSchema($schema);
                $entries->setData($data);
                foreach ($entries as $e) {
                    // If there are included elements, need an entry element.
                    if (is_array($this->parameters()->{'included-elements'}) && !empty($this->parameters()->{'included-elements'})) {
                        $entry = $result->createElement('entry');
                        $entry->setAttribute('id', $e->id);
                        $root->appendChild($entry);
                        foreach ($included_elements->system as $field) {
                            switch ($field) {
                                case 'creation-date':
                                    $entry->appendChild(General::createXMLDateObject($result, DateTimeObj::toGMT($e->creation_date), 'creation-date'));
                                    break;
                                case 'modification-date':
                                    $entry->appendChild(General::createXMLDateObject($result, DateTimeObj::toGMT($e->modification_date), 'modification-date'));
                                    break;
                                case 'user':
                                    $obj = User::load($e->user_id);
                                    $user = $result->createElement('user', $obj->getFullName());
                                    $user->setAttribute('id', $e->user_id);
                                    $user->setAttribute('username', $obj->username);
                                    $user->setAttribute('email-address', $obj->email);
                                    $entry->appendChild($user);
                                    break;
                            }
                        }
                        foreach ($included_elements->fields as $field) {
                            $field['instance']->appendFormattedElement($entry, $e->data()->{$field['element-name']}, false, $field['mode'], $e);
                        }
                    }
                    if (is_array($this->parameters()->{'parameter-output'}) && !empty($this->parameters()->{'parameter-output'})) {
                        foreach ($output_parameters->system as $field => $existing_values) {
                            switch ($field) {
                                case 'id':
                                    $output_parameters->system[$field][] = $e->id;
                                    break;
                                case 'creation-date':
                                    $output_parameters->system[$field][] = DateTimeObj::get('Y-m-d H:i:s', DateTimeObj::toGMT($e->creation_date));
                                    break;
                                case 'modification-date':
                                    $output_parameters->system[$field][] = DateTimeObj::get('Y-m-d H:i:s', DateTimeObj::toGMT($e->modification_date));
                                    break;
                                case 'user':
                                    $output_parameters->system[$field][] = $e->user_id;
开发者ID:symphonycms,项目名称:symphony-3,代码行数:67,代码来源:class.datasource.php


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