本文整理汇总了PHP中DateTimeObj::fromGMT方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeObj::fromGMT方法的具体用法?PHP DateTimeObj::fromGMT怎么用?PHP DateTimeObj::fromGMT使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeObj
的用法示例。
在下文中一共展示了DateTimeObj::fromGMT方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getParameterOutputValue
public function getParameterOutputValue(StdClass $data, Entry $entry = NULL)
{
$timestamp = DateTimeObj::fromGMT($data->value);
return DateTimeObj::get('Y-m-d H:i:s', $timestamp);
}
示例2: 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);
if ($filter->gmt == 'yes') {
$value = strtotime($value);
} else {
$value = DateTimeObj::fromGMT($value);
}
$value = date('Y-m-d H:i:s', $value);
$statements[] = $db->prepareQuery("'%s' {$operator} {$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;
}
示例3: render
//.........这里部分代码省略.........
$included_elements->system[] = $mode;
} else {
$field = $section->fetchFieldByHandle($element_name);
if (!$field instanceof Field) {
continue;
}
$schema[] = $element_name;
$included_elements->fields[] = array('element-name' => $element_name, 'instance' => $field, 'mode' => !is_null($mode) > 0 ? trim($mode) : NULL);
}
}
}
// Do some pre-processing on the param output array
if (is_array($this->parameters()->{'parameter-output'}) && !empty($this->parameters()->{'parameter-output'})) {
$parameter_output = (object) array('system' => array(), 'fields' => array());
foreach ($this->parameters()->{'parameter-output'} as $element) {
if (preg_match('/^system:/i', $element)) {
$parameter_output->system[preg_replace('/^system:/i', NULL, $element)] = array();
} else {
$schema[] = $element;
$parameter_output->fields[$element] = array();
}
}
}
$entries->setSchema($schema);
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::fromGMT($e->creation_date), 'creation-date'));
break;
case 'modification-date':
$entry->appendChild(General::createXMLDateObject($result, DateTimeObj::fromGMT($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 ($parameter_output->system as $field => $existing_values) {
switch ($field) {
case 'id':
$parameter_output->system[$field][] = $e->id;
break;
case 'creation-date':
$parameter_output->system[$field][] = DateTimeObj::get('Y-m-d H:i:s', DateTimeObj::fromGMT($e->creation_date));
break;
case 'modification-date':
$parameter_output->system[$field][] = DateTimeObj::get('Y-m-d H:i:s', DateTimeObj::fromGMT($e->modification_date));
break;
case 'user':
$parameter_output->system[$field][] = $e->user_id;