本文整理汇总了PHP中Surfer::from_GMT方法的典型用法代码示例。如果您正苦于以下问题:PHP Surfer::from_GMT方法的具体用法?PHP Surfer::from_GMT怎么用?PHP Surfer::from_GMT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Surfer
的用法示例。
在下文中一共展示了Surfer::from_GMT方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_fields
/**
* get form fields to change the day
*
* @see overlays/overlay.php
*
* @param array hosting attributes
* @return a list of ($label, $input, $hint)
*/
function get_fields($host, $field_pos = NULL)
{
global $context;
$options = '<input type="hidden" name="time_stamp" value="12:00" />' . '<input type="hidden" name="duration" value="1440" />';
// default value is now
if (!isset($this->attributes['date_stamp']) || $this->attributes['date_stamp'] <= NULL_DATE) {
$this->attributes['date_stamp'] = gmstrftime('%Y-%m-%d %H:%M', time() + Surfer::get_gmt_offset() * 3600);
} else {
$this->attributes['date_stamp'] = Surfer::from_GMT($this->attributes['date_stamp']);
}
// split date from time
list($date, $time) = explode(' ', $this->attributes['date_stamp']);
// event time
$label = i18n::s('Date');
$input = Skin::build_input_time('date_stamp', $date, 'date') . $options;
$hint = i18n::s('Use format YYYY-MM-DD');
$fields[] = array($label, $input, $hint);
// ensure that we do have a date
Page::insert_script('func' . 'tion validateOnSubmit(container) {' . "\n" . "\n" . ' if(!Yacs.trim(container.date_stamp.value)) {' . "\n" . ' alert("' . i18n::s('Please provide a date.') . '");' . "\n" . ' container.date_stamp.focus();' . "\n" . ' Yacs.stopWorking();' . "\n" . ' return false;' . "\n" . ' }' . "\n\n" . ' return true;' . "\n" . '}' . "\n");
return $fields;
}
示例2: get_fields
/**
* build the list of fields for one overlay
*
* @see overlays/overlay.php
*
* @param the hosting attributes
* @return a list of ($label, $input, $hint)
*/
function get_fields($host, $field_pos = NULL)
{
global $context;
// accepted voters
$label = i18n::s('Scope');
$input = '<input type="radio" name="voters" value="members"';
if (!isset($this->attributes['voters']) || $this->attributes['voters'] == 'members') {
$input .= ' checked="checked"';
}
$input .= ' /> ' . i18n::s('All members of the community') . BR . "\n";
$input .= '<input type="radio" name="voters" value="editors"';
if (isset($this->attributes['voters']) && $this->attributes['voters'] == 'editors') {
$input .= ' checked="checked"';
}
$input .= ' /> ' . i18n::s('Editors of this section') . BR . "\n";
$input .= '<input type="radio" name="voters" value="associates"';
if (isset($this->attributes['voters']) && $this->attributes['voters'] == 'associates') {
$input .= ' checked="checked"';
}
$input .= ' /> ' . i18n::s('Associates only') . BR . "\n";
$input .= '<input type="radio" name="voters" value="custom"';
if (isset($this->attributes['voters']) && $this->attributes['voters'] == 'custom') {
$input .= ' checked="checked"';
}
$input .= ' /> ' . i18n::s('Following people:') . ' <input type="text" name="voter_list" onfocus="document.main_form.voters[3].checked=\'checked\'" size="40" />' . BR . "\n";
$fields[] = array($label, $input);
// end date
$label = i18n::s('End date');
// adjust date from UTC time zone to surfer time zone
$value = '';
if (isset($this->attributes['end_date']) && $this->attributes['end_date'] > NULL_DATE) {
$value = Surfer::from_GMT($this->attributes['end_date']);
}
$input = '<input type="text" name="end_date" value ="' . encode_field($value) . '" size="32" maxlength="64" />';
$hint = i18n::s('YYYY-MM-AA HH:MM');
$fields[] = array($label, $input, $hint);
return $fields;
}
示例3: elseif
// the publication date
$label = i18n::s('Publication date');
if (isset($item['publish_date']) && $item['publish_date'] > NULL_DATE) {
$input = Surfer::from_GMT($item['publish_date']);
} elseif (isset($item['id']) && (Surfer::is_associate() || Surfer::is_member() && is_object($anchor) && $anchor->is_assigned())) {
Skin::define_img('ARTICLES_PUBLISH_IMG', 'articles/publish.gif');
$input = Skin::build_link(Articles::get_url($item['id'], 'publish'), ARTICLES_PUBLISH_IMG . i18n::s('Publish'), 'basic');
} else {
Skin::define_img('ARTICLES_UNPUBLISH_IMG', 'articles/unpublish.gif');
$input = ARTICLES_UNPUBLISH_IMG . i18n::s('not published');
}
$fields[] = array($label, $input);
// the expiry date
$label = i18n::s('Expiry date');
if (isset($item['expiry_date']) && $item['expiry_date'] > NULL_DATE) {
$input = Surfer::from_GMT($item['expiry_date']);
} else {
$input = i18n::s('never');
}
$fields[] = array($label, $input);
// the parent section
if (is_object($anchor)) {
if (isset($item['id']) && Articles::is_owned($item, $anchor)) {
$label = i18n::s('Section');
$input =& Skin::build_box(i18n::s('Select parent container'), Sections::get_radio_buttons($anchor->get_reference()), 'folded');
$fields[] = array($label, $input);
} else {
$text .= '<input type="hidden" name="anchor" value="' . $anchor->get_reference() . '" />';
}
}
// append fields
示例4: array
}
// display in a separate panel
if (trim($events)) {
$panels[] = array('events', i18n::s('Events'), 'events_panel', $events);
}
//
// values updated in the background
//
$values = '';
$query = "SELECT * FROM " . SQL::table_name('values') . " ORDER BY id";
if (!($result = SQL::query($query))) {
$values .= Logger::error_pop() . BR . "\n";
} else {
$values .= Skin::table_prefix('yc-grid');
while ($row = SQL::fetch($result)) {
$values .= '<tr><td>' . $row['id'] . '</td><td>' . str_replace("\n", BR, $row['value']) . '</td><td>' . Surfer::from_GMT($row['edit_date']) . "</td></tr>\n";
}
$values .= "</table>\n";
}
// display in a separate panel
if (trim($values)) {
$panels[] = array('values', i18n::s('Values'), 'values_panel', $values);
}
//
// script profiles
//
$profiles = '';
include_once $context['path_to_root'] . 'agents/profiles.php';
if ($rows = Profiles::list_by_hits(0, 50)) {
// splash message
$profiles .= '<p>' . i18n::s('You can sort the table below by clicking on column headers.') . "</p>\n";
示例5: get_fields
/**
* get form fields to change the day
*
* @see overlays/overlay.php
*
* @param array hosting attributes
* @return a list of ($label, $input, $hint)
*/
function get_fields($host, $field_pos = NULL)
{
global $context;
// default value is now
if (!isset($this->attributes['date_stamp']) || $this->attributes['date_stamp'] <= NULL_DATE) {
$this->attributes['date_stamp'] = gmstrftime('%Y-%m-%d %H:%M', time() + Surfer::get_gmt_offset() * 3600);
} else {
$this->attributes['date_stamp'] = Surfer::from_GMT($this->attributes['date_stamp']);
}
// split date from time
list($date, $time) = explode(' ', $this->attributes['date_stamp']);
// a list for time
$options = '<select name="time_stamp">';
list($hours, $minutes) = explode(':', $time);
if ($hours > '23') {
$minutes = '23';
}
if ($minutes > '30') {
$minutes = '30';
} else {
$minutes = '00';
}
if ($hours == '00' && $minutes == '00') {
$options .= '<option selected="selected">00:00</option>';
} else {
$options .= '<option>00:00</option>';
}
if ($hours == '00' && $minutes == '30') {
$options .= '<option selected="selected">00:30</option>';
} else {
$options .= '<option>00:30</option>';
}
if ($hours == '01' && $minutes == '00') {
$options .= '<option selected="selected">01:00</option>';
} else {
$options .= '<option>01:00</option>';
}
if ($hours == '01' && $minutes == '30') {
$options .= '<option selected="selected">01:30</option>';
} else {
$options .= '<option>01:30</option>';
}
if ($hours == '02' && $minutes == '00') {
$options .= '<option selected="selected">02:00</option>';
} else {
$options .= '<option>02:00</option>';
}
if ($hours == '02' && $minutes == '30') {
$options .= '<option selected="selected">02:30</option>';
} else {
$options .= '<option>02:30</option>';
}
if ($hours == '03' && $minutes == '00') {
$options .= '<option selected="selected">03:00</option>';
} else {
$options .= '<option>03:00</option>';
}
if ($hours == '03' && $minutes == '30') {
$options .= '<option selected="selected">03:30</option>';
} else {
$options .= '<option>03:30</option>';
}
if ($hours == '04' && $minutes == '00') {
$options .= '<option selected="selected">04:00</option>';
} else {
$options .= '<option>04:00</option>';
}
if ($hours == '04' && $minutes == '30') {
$options .= '<option selected="selected">04:30</option>';
} else {
$options .= '<option>04:30</option>';
}
if ($hours == '05' && $minutes == '00') {
$options .= '<option selected="selected">05:00</option>';
} else {
$options .= '<option>05:00</option>';
}
if ($hours == '05' && $minutes == '30') {
$options .= '<option selected="selected">05:30</option>';
} else {
$options .= '<option>05:30</option>';
}
if ($hours == '06' && $minutes == '00') {
$options .= '<option selected="selected">06:00</option>';
} else {
$options .= '<option>06:00</option>';
}
if ($hours == '06' && $minutes == '30') {
$options .= '<option selected="selected">06:30</option>';
} else {
$options .= '<option>06:30</option>';
}
//.........这里部分代码省略.........
示例6: array
// the activation date
$label = i18n::s('Activation date');
// adjust date from UTC time zone to surfer time zone
$value = '';
if (isset($item['activation_date']) && $item['activation_date'] > NULL_DATE) {
$value = Surfer::from_GMT($item['activation_date']);
}
$input = Skin::build_input_time('activation_date', $value, 'date_time');
$hint = i18n::s('Publish content in the future - automatically');
$fields[] = array($label, $input, $hint);
// the expiry date
$label = i18n::s('Expiry date');
// adjust date from UTC time zone to surfer time zone
$value = '';
if (isset($item['expiry_date']) && $item['expiry_date'] > NULL_DATE) {
$value = Surfer::from_GMT($item['expiry_date']);
}
$input = Skin::build_input_time('expiry_date', $value, 'date_time');
$hint = i18n::s('Remove content on dead-line - automatically');
$fields[] = array($label, $input, $hint);
// provide my id
$me = isset($item['id']) ? $item['id'] : NULL;
// reference to parent section
$ref = is_object($anchor) ? $anchor->get_reference() : NULL;
// associates can anchor the section anywhere
if (Surfer::is_associate()) {
$label = i18n::s('Section');
$input =& Skin::build_box(i18n::s('Select parent container'), Sections::get_radio_buttons($ref, $me), 'folded');
$fields[] = array($label, $input);
// parent section is defined and surfer is an editor of it
} elseif (is_object($anchor) && $anchor->is_assigned()) {
示例7: array
/**
* add some tabs
*
* Display additional information in panels.
*
* Accepted action codes:
* - 'edit' - embedded into the main form page
*
* @see overlays/overlay.php
*
* @param string the on-going action
* @param array the hosting record
* @return an array of array('tab_id', 'tab_label', 'panel_id', 'panel_content') or NULL
*/
function &get_tabs($variant = 'view', $host = NULL)
{
global $context, $local;
// returned tabs
$tabs = array();
$now = strftime('%Y-%m-%d %H:%M:%S', time() + (Surfer::get_gmt_offset() - intval($context['gmt_offset'])) * 3600);
// trackings
//
$tracking = '';
// only associates and page owners can change the status
if ($variant == 'edit' && isset($this->anchor) && $this->anchor->is_owned()) {
// a table of fields
$fields = array();
// owner
$label = i18n::s('Owner');
if (isset($host['owner_id']) && ($user = Users::get($host['owner_id']))) {
$value = $user['nick_name'];
} else {
$value = '';
}
$input = '<input type="text" name="owner" id="owner" value ="' . encode_field($value) . '" size="25" maxlength="32" />';
$hint = i18n::s('Type some letters of the name and select in the list');
$fields[] = array($label, $input, $hint);
// enable owner autocompletion
Page::insert_script('$(function() { Yacs.autocomplete_names("owner",true); });');
// priority
$label = i18n::s('Priority');
if (!isset($this->attributes['color'])) {
$this->attributes['color'] = 'green';
}
$input = self::get_color_as_radio_buttons($this->attributes['color']);
$fields[] = array($label, $input);
// type
$label = i18n::s('Workflow');
if (!isset($this->attributes['type'])) {
$this->attributes['type'] = 'incident';
}
$input = '<select name="type" id="type">' . self::get_type_options($this->attributes['type']) . '</select>';
$fields[] = array($label, $input);
// format these fields
$tracking .= Skin::build_form($fields);
$fields = array();
// to represent transitions from one step to the next one
Skin::define_img('NEXT_STEP', 'overlays/next_step.gif', 'V');
// status
if (!isset($this->attributes['status'])) {
$this->attributes['status'] = 'on-going:suspect';
}
// create_date
if (!isset($host['create_date']) || !$host['create_date']) {
$host['create_date'] = gmstrftime('%Y-%m-%d %H:%M:%S');
}
$host['create_date'] = Surfer::from_GMT($host['create_date']);
if ($this->attributes['type'] == 'feature') {
$label = i18n::s('Feature request has been created on %s');
} elseif ($this->attributes['type'] == 'patch') {
$label = i18n::s('Patch has been submitted on %s');
} else {
$label = i18n::s('Page has been created on %s');
}
$tracking .= '<div class="bottom" style="margin-bottom: 1em;">' . sprintf($label, Skin::build_input_time('create_date', $host['create_date'], 'date_time') . ' <a onclick="$(\'#create_date\').val(\'' . $now . '\')" style="cursor: pointer;" class="details">' . i18n::s('now') . '</a>') . '</div>';
$tracking .= NEXT_STEP;
// qualification_date
if (isset($this->attributes['qualification_date'])) {
$this->attributes['qualification_date'] = Surfer::from_GMT($this->attributes['qualification_date']);
}
$tracking .= '<div style="margin-top: 1em">' . sprintf(i18n::s('Qualification has taken place on %s'), Skin::build_input_time('qualification_date', isset($this->attributes['qualification_date']) ? $this->attributes['qualification_date'] : NULL_DATE, 'date_time') . ' <a onclick="$(\'#qualification_date\').val(\'' . $now . '\')" style="cursor: pointer;" class="details">' . i18n::s('now') . '</a>') . '<p>';
$checked = '';
if (isset($this->attributes['status']) && $this->attributes['status'] == 'on-going:problem') {
$checked = 'checked="checked"';
}
$tracking .= '<input type="radio" name="status" value ="on-going:problem" ' . $checked . ' /> ' . $this->get_status_label('on-going:problem');
$checked = '';
if (isset($this->attributes['status']) && $this->attributes['status'] == 'cancelled:suspect') {
$checked = 'checked="checked"';
}
$tracking .= BR . '<input type="radio" name="status" value ="cancelled:suspect" ' . $checked . ' /> ' . $this->get_status_label('cancelled:suspect') . '</p></div>';
$tracking .= NEXT_STEP;
// analysis_date, except for maintenance cases
if ($this->attributes['type'] != 'maintenance') {
if (isset($this->attributes['analysis_date'])) {
$this->attributes['analysis_date'] = Surfer::from_GMT($this->attributes['analysis_date']);
}
$tracking .= '<div style="margin-top: 1em">' . sprintf(i18n::s('Analysis has ended on %s'), Skin::build_input_time('analysis_date', isset($this->attributes['analysis_date']) ? $this->attributes['analysis_date'] : NULL_DATE, 'date_time') . ' <a onclick="$(\'#analysis_date\').val(\'' . $now . '\')" style="cursor: pointer;" class="details">' . i18n::s('now') . '</a>') . '<p>';
$checked = '';
if (isset($this->attributes['status']) && $this->attributes['status'] == 'on-going:issue') {
//.........这里部分代码省略.........
示例8: sprintf
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '"><div>' . "\n" . Skin::build_submit_button(i18n::s('Remove expiry date')) . "\n" . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="action" value="expiry" />' . "\n" . '<input type="hidden" name="expiry_date" value="" />' . "\n" . '</div></form>' . "\n";
// set a new expiry date
} else {
// a form to change the date
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" name="form_2"><div>' . "\n";
// catch user input
$context['text'] .= sprintf(i18n::s('Expire the page after the %s'), Skin::build_input_time('expiry_date', NULL, 'date_time'));
// the submit button
$context['text'] .= Skin::build_submit_button(i18n::s('Save the date')) . "\n" . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="action" value="expiry" />' . "\n" . '</div></form>' . "\n";
}
// change or delete the publishing date
$context['text'] .= Skin::build_block(i18n::s('Publication date'), 'title');
// change the publication date
if (isset($item['publish_date']) && $item['publish_date'] > NULL_DATE) {
// adjust date from server time zone to surfer time zone
$value = Surfer::from_GMT($item['publish_date']);
// a form to change the date
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" name="form_3"><div>' . "\n";
// catch user input
$context['text'] .= sprintf(i18n::s('Change the publication date to %s'), Skin::build_input_time('publish_date', $value, 'date_time'));
// the submit button
$context['text'] .= Skin::build_submit_button(i18n::s('Save the date')) . "\n" . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="action" value="publish" />' . "\n" . '</div></form>' . "\n";
// a form to remove the date
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '"><div>' . "\n" . Skin::build_submit_button(i18n::s('Change to draft mode')) . "\n" . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="action" value="publish" />' . "\n" . '<input type="hidden" name="publish_date" value="" />' . "\n" . '</div></form>' . "\n";
// set a new publication date
} else {
// go to the dedicated page
$context['text'] .= '<p>' . Skin::build_link(Articles::get_url($item['id'], 'publish'), i18n::s('Publish the page'), 'shortcut') . '</p>';
}
// cancel
if (isset($_SERVER['HTTP_REFERER'])) {