本文整理汇总了PHP中Skin::build_input_time方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::build_input_time方法的具体用法?PHP Skin::build_input_time怎么用?PHP Skin::build_input_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::build_input_time方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
//.........这里部分代码省略.........
}
if ($hours == '16' && $minutes == '30') {
$options .= '<option selected="selected">16:30</option>';
} else {
$options .= '<option>16:30</option>';
}
if ($hours == '17' && $minutes == '00') {
$options .= '<option selected="selected">17:00</option>';
} else {
$options .= '<option>17:00</option>';
}
if ($hours == '17' && $minutes == '30') {
$options .= '<option selected="selected">17:30</option>';
} else {
$options .= '<option>17:30</option>';
}
if ($hours == '18' && $minutes == '00') {
$options .= '<option selected="selected">18:00</option>';
} else {
$options .= '<option>18:00</option>';
}
if ($hours == '18' && $minutes == '30') {
$options .= '<option selected="selected">18:30</option>';
} else {
$options .= '<option>18:30</option>';
}
if ($hours == '19' && $minutes == '00') {
$options .= '<option selected="selected">19:00</option>';
} else {
$options .= '<option>19:00</option>';
}
if ($hours == '19' && $minutes == '30') {
$options .= '<option selected="selected">19:30</option>';
} else {
$options .= '<option>19:30</option>';
}
if ($hours == '20' && $minutes == '00') {
$options .= '<option selected="selected">20:00</option>';
} else {
$options .= '<option>20:00</option>';
}
if ($hours == '20' && $minutes == '30') {
$options .= '<option selected="selected">20:30</option>';
} else {
$options .= '<option>20:30</option>';
}
if ($hours == '21' && $minutes == '00') {
$options .= '<option selected="selected">21:00</option>';
} else {
$options .= '<option>21:00</option>';
}
if ($hours == '21' && $minutes == '30') {
$options .= '<option selected="selected">21:30</option>';
} else {
$options .= '<option>21:30</option>';
}
if ($hours == '22' && $minutes == '00') {
$options .= '<option selected="selected">22:00</option>';
} else {
$options .= '<option>22:00</option>';
}
if ($hours == '22' && $minutes == '30') {
$options .= '<option selected="selected">22:30</option>';
} else {
$options .= '<option>22:30</option>';
}
if ($hours == '23' && $minutes == '00') {
$options .= '<option selected="selected">23:00</option>';
} else {
$options .= '<option>23:00</option>';
}
if ($hours == '23' && $minutes == '30') {
$options .= '<option selected="selected">23:30</option>';
} else {
$options .= '<option>23:30</option>';
}
$options .= '</select>';
// 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" . ' 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" . ' return true;' . "\n" . '}' . "\n");
// duration
$label = i18n::s('Duration');
$input = '<select name="duration">';
if (!isset($this->attributes['duration']) || $this->attributes['duration'] < 15 || $this->attributes['duration'] > 1440) {
$this->attributes['duration'] = 60;
}
$input .= '<option value="15"' . ($this->attributes['duration'] == 15 ? ' selected="selected"' : '') . '>' . sprintf(i18n::s('%d minutes'), 15) . '</option>';
$input .= '<option value="30"' . ($this->attributes['duration'] == 30 ? ' selected="selected"' : '') . '>' . sprintf(i18n::s('%d minutes'), 30) . '</option>';
$input .= '<option value="45"' . ($this->attributes['duration'] == 45 ? ' selected="selected"' : '') . '>' . sprintf(i18n::s('%d minutes'), 45) . '</option>';
$input .= '<option value="60"' . ($this->attributes['duration'] == 60 ? ' selected="selected"' : '') . '>' . i18n::s('one hour') . '</option>';
$input .= '<option value="120"' . ($this->attributes['duration'] == 120 ? ' selected="selected"' : '') . '>' . i18n::s('two hours') . '</option>';
$input .= '<option value="1440"' . ($this->attributes['duration'] == 1440 ? ' selected="selected"' : '') . '>' . i18n::s('all day') . '</option>';
$input .= '</select>';
$fields[] = array($label, $input);
return $fields;
}
示例3: validateDocumentPost
}
// the form to edit an date
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" onsubmit="return validateDocumentPost(this)" id="main_form"><div>';
// form fields
$fields = array();
// display info on current version
if (isset($item['id'])) {
// the last poster
if (isset($item['edit_id']) && $item['edit_id']) {
$text = Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']) . ' ' . Skin::build_date($item['edit_date']);
$fields[] = array(i18n::s('Posted by'), $text);
}
}
// date
$label = i18n::s('Target date');
$input = Skin::build_input_time('date_stamp', $item['date_stamp'], 'date');
$hint = i18n::s('YYYY-MM-DD');
$fields[] = array($label, $input, $hint);
// build the form
$context['text'] .= Skin::build_form($fields);
$fields = array();
// associates may decide to not stamp changes -- complex command
if (Surfer::is_associate() && Surfer::has_all()) {
$context['text'] .= '<p><input type="checkbox" name="silent" value="Y" /> ' . i18n::s('Do not change modification date of the main page.') . '</p>';
}
// the submit button
$context['text'] .= '<p>' . Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's') . '</p>' . "\n";
// transmit the id as a hidden field
if (isset($item['id']) && $item['id']) {
$context['text'] .= '<input type="hidden" name="id" value="' . $item['id'] . '" />';
}
示例4: array
// 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()) {
$label = i18n::s('Section');
$input =& Skin::build_box(i18n::s('Select parent container'), Sections::get_radio_buttons($ref, $me), 'folded');
示例5: 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') {
//.........这里部分代码省略.........
示例6: sprintf
$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'])) {
$referer = $_SERVER['HTTP_REFERER'];
} else {
$referer = 'articles/review.php';
}