本文整理汇总了PHP中html_writer::select_time方法的典型用法代码示例。如果您正苦于以下问题:PHP html_writer::select_time方法的具体用法?PHP html_writer::select_time怎么用?PHP html_writer::select_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html_writer
的用法示例。
在下文中一共展示了html_writer::select_time方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_search_field
function display_search_field($value=0) {
$selectors = html_writer::select_time('days', 'f_'.$this->field->id.'_d', $value)
. html_writer::select_time('months', 'f_'.$this->field->id.'_m', $value)
. html_writer::select_time('years', 'f_'.$this->field->id.'_y', $value);
return $selectors;
//return print_date_selector('f_'.$this->field->id.'_d', 'f_'.$this->field->id.'_m', 'f_'.$this->field->id.'_y', $value, true);
}
示例2: display_search_field
function display_search_field($value = 0)
{
$selectors = html_writer::select_time('days', 'f_' . $this->field->id . '_d', $value['timestamp']) . html_writer::select_time('months', 'f_' . $this->field->id . '_m', $value['timestamp']) . html_writer::select_time('years', 'f_' . $this->field->id . '_y', $value['timestamp']);
$datecheck = html_writer::checkbox('f_' . $this->field->id . '_z', 1, $value['usedate']);
$str = $selectors . ' ' . $datecheck . ' ' . get_string('usedate', 'data');
return $str;
}
示例3: print_date_selector
/**
* Prints form items with the names $day, $month and $year
*
* @deprecated since Moodle 2.0
*
* @param string $day fieldname
* @param string $month fieldname
* @param string $year fieldname
* @param int $currenttime A default timestamp in GMT
* @param boolean $return If set to true returns rather than echo's
* @return string|bool Depending on value of $return
*/
function print_date_selector($day, $month, $year, $currenttime=0, $return=false) {
debugging('print_date_selector() has been deprecated. Please change your code to use html_writer.');
$dayselector = html_writer::select_time('days', $day, $currenttime);
$monthselector = html_writer::select_time('months', $month, $currenttime);
$yearselector = html_writer::select_time('years', $year, $currenttime);
$output = $dayselector . $monthselector . $yearselector;
if ($return) {
return $output;
} else {
echo $output;
}
}
示例4: forum_print_big_search_form
/**
* @todo Document this function
*/
function forum_print_big_search_form($course)
{
global $CFG, $DB, $words, $subject, $phrase, $user, $userid, $fullwords, $notwords, $datefrom, $dateto, $PAGE, $OUTPUT;
echo $OUTPUT->box(get_string('searchforumintro', 'forum'), 'searchbox boxaligncenter', 'intro');
echo $OUTPUT->box_start('generalbox boxaligncenter');
echo html_writer::script('', $CFG->wwwroot . '/mod/forum/forum.js');
echo '<form id="searchform" action="search.php" method="get">';
echo '<table cellpadding="10" class="searchbox" id="form">';
echo '<tr>';
echo '<td class="c0"><label for="words">' . get_string('searchwords', 'forum') . '</label>';
echo '<input type="hidden" value="' . $course->id . '" name="id" alt="" /></td>';
echo '<td class="c1"><input type="text" size="35" name="words" id="words"value="' . s($words, true) . '" alt="" /></td>';
echo '</tr>';
echo '<tr>';
echo '<td class="c0"><label for="phrase">' . get_string('searchphrase', 'forum') . '</label></td>';
echo '<td class="c1"><input type="text" size="35" name="phrase" id="phrase" value="' . s($phrase, true) . '" alt="" /></td>';
echo '</tr>';
echo '<tr>';
echo '<td class="c0"><label for="notwords">' . get_string('searchnotwords', 'forum') . '</label></td>';
echo '<td class="c1"><input type="text" size="35" name="notwords" id="notwords" value="' . s($notwords, true) . '" alt="" /></td>';
echo '</tr>';
if ($DB->get_dbfamily() == 'mysql' || $DB->get_dbfamily() == 'postgres') {
echo '<tr>';
echo '<td class="c0"><label for="fullwords">' . get_string('searchfullwords', 'forum') . '</label></td>';
echo '<td class="c1"><input type="text" size="35" name="fullwords" id="fullwords" value="' . s($fullwords, true) . '" alt="" /></td>';
echo '</tr>';
}
echo '<tr>';
echo '<td class="c0">' . get_string('searchdatefrom', 'forum') . '</td>';
echo '<td class="c1">';
if (empty($datefrom)) {
$datefromchecked = '';
$datefrom = make_timestamp(2000, 1, 1, 0, 0, 0);
} else {
$datefromchecked = 'checked="checked"';
}
echo '<input name="timefromrestrict" type="checkbox" value="1" alt="' . get_string('searchdatefrom', 'forum') . '" onclick="return lockoptions(\'searchform\', \'timefromrestrict\', timefromitems)" ' . $datefromchecked . ' /> ';
$selectors = html_writer::select_time('days', 'fromday', $datefrom) . html_writer::select_time('months', 'frommonth', $datefrom) . html_writer::select_time('years', 'fromyear', $datefrom) . html_writer::select_time('hours', 'fromhour', $datefrom) . html_writer::select_time('minutes', 'fromminute', $datefrom);
echo $selectors;
echo '<input type="hidden" name="hfromday" value="0" />';
echo '<input type="hidden" name="hfrommonth" value="0" />';
echo '<input type="hidden" name="hfromyear" value="0" />';
echo '<input type="hidden" name="hfromhour" value="0" />';
echo '<input type="hidden" name="hfromminute" value="0" />';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td class="c0">' . get_string('searchdateto', 'forum') . '</td>';
echo '<td class="c1">';
if (empty($dateto)) {
$datetochecked = '';
$dateto = time() + 3600;
} else {
$datetochecked = 'checked="checked"';
}
echo '<input name="timetorestrict" type="checkbox" value="1" alt="' . get_string('searchdateto', 'forum') . '" onclick="return lockoptions(\'searchform\', \'timetorestrict\', timetoitems)" ' . $datetochecked . ' /> ';
$selectors = html_writer::select_time('days', 'today', $dateto) . html_writer::select_time('months', 'tomonth', $dateto) . html_writer::select_time('years', 'toyear', $dateto) . html_writer::select_time('hours', 'tohour', $dateto) . html_writer::select_time('minutes', 'tominute', $dateto);
echo $selectors;
echo '<input type="hidden" name="htoday" value="0" />';
echo '<input type="hidden" name="htomonth" value="0" />';
echo '<input type="hidden" name="htoyear" value="0" />';
echo '<input type="hidden" name="htohour" value="0" />';
echo '<input type="hidden" name="htominute" value="0" />';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td class="c0"><label for="menuforumid">' . get_string('searchwhichforums', 'forum') . '</label></td>';
echo '<td class="c1">';
echo html_writer::select(forum_menu_list($course), 'forumid', '', array('' => get_string('allforums', 'forum')));
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td class="c0"><label for="subject">' . get_string('searchsubject', 'forum') . '</label></td>';
echo '<td class="c1"><input type="text" size="35" name="subject" id="subject" value="' . s($subject, true) . '" alt="" /></td>';
echo '</tr>';
echo '<tr>';
echo '<td class="c0"><label for="user">' . get_string('searchuser', 'forum') . '</label></td>';
echo '<td class="c1"><input type="text" size="35" name="user" id="user" value="' . s($user, true) . '" alt="" /></td>';
echo '</tr>';
echo '<tr>';
echo '<td class="submit" colspan="2" align="center">';
echo '<input type="submit" value="' . get_string('searchforums', 'forum') . '" alt="" /></td>';
echo '</tr>';
echo '</table>';
echo '</form>';
echo html_writer::script(js_writer::function_call('lockoptions_timetoitems'));
echo html_writer::script(js_writer::function_call('lockoptions_timefromitems'));
echo $OUTPUT->box_end();
}
示例5: array
echo $OUTPUT->container_start();
echo html_writer::tag('p', '');
echo html_writer::tag('p', 'To render a single checkbox:');
$attr = array();
// other attributes;
echo html_writer::checkbox('name', 'value', true, 'Checkbox label', $attr);
echo html_writer::tag('p', 'To render a single yes/no select:');
echo html_writer::select_yes_no('name2', true, $attr);
echo html_writer::tag('p', 'To render a normal single select:');
$options = array(1 => 'One', 2 => 'Two', 3 => 'Three');
echo html_writer::select($options, 'name3', 1, array('' => 'choosedots'), $attr);
echo html_writer::tag('p', 'Or a single select with option grouping:');
$optoptions = array(array('Group 1' => array(1 => 'Option 1a', 2 => 'Option 1b', 3 => 'Option 1c')), array('Group 2' => array(4 => 'Option 2a', 5 => 'Option 2b', 6 => 'Option 2c')));
echo html_writer::select($optoptions, 'name4');
echo html_writer::tag('p', 'To render a time selector - you can choose the units (years, months, days, hours, minutes):');
echo html_writer::select_time('years', 'name5', time(), 5, $attr);
echo html_writer::tag('p', 'Generate a hidden input field for every parameter in a moodle_url object (output displayed below instead of rendered):');
$url = new moodle_url('index.php', array('a' => 1, 'b' => 2, 'exclude' => 'this'));
echo html_writer::tag('pre', htmlentities(html_writer::input_hidden_params($url, array('exclude'))));
echo html_writer::tag('p', 'Generate a script tag (output displayed below instead of rendered):');
echo html_writer::tag('pre', htmlentities(html_writer::script('alert(\'hi\');')));
echo html_writer::tag('p', 'Generate a form label:');
echo html_writer::label('Label text', 'checkbox1');
echo html_writer::checkbox('name', 'value', false, null, array('id' => 'checkbox1'));
echo html_writer::tag('p', 'A confirm form with continue/cancel options (just providing urls to go to):');
$continueurl = new moodle_url('index.php');
$cancelurl = new moodle_url('index.php');
echo $OUTPUT->confirm('This is the message', $continueurl, $cancelurl);
echo html_writer::tag('p', 'A confirm form with continue/cancel options (with custom buttons):');
$continueurl = new moodle_url('index.php');
$cancelurl = new moodle_url('index.php');
示例6: settings_form
public function settings_form($type, $items, $edit = '', $range = false, $sort = false)
{
global $PAGE;
$output = '';
$output .= $this->output->heading(get_string($type, 'report_cpd'), 3, 'cpd_settingshead');
$url = $PAGE->url;
$list = '';
if ($items) {
foreach ($items as $item) {
if ($range) {
$strrange = date("d/m/Y", $item->startdate) . " - " . date("d/m/Y", $item->enddate);
$listitem = html_writer::tag('span', $strrange);
} else {
$listitem = html_writer::tag('span', $item->name);
}
if ($sort) {
$icon = $this->output->pix_icon('t/up', get_string('up'));
$urlparams = array('moveup' => $type, 'id' => $item->id);
$listitem .= html_writer::link($url->out(false, $urlparams), $icon);
$icon = $this->output->pix_icon('t/down', get_string('down'));
$urlparams = array('movedown' => $type, 'id' => $item->id);
$listitem .= html_writer::link($url->out(false, $urlparams), $icon);
}
$icon = $this->output->pix_icon('t/edit', get_string('edit'));
$urlparams = array('edit' => $type, 'id' => $item->id);
$listitem .= html_writer::link($url->out(false, $urlparams), $icon);
$icon = $this->output->pix_icon('t/delete', get_string('delete'));
$urlparams = array('delete' => $type, 'id' => $item->id);
$linkparams = array('class' => 'cpd_delete', 'onclick' => 'return confirm("' . get_string('confirmdelete', 'report_cpd') . '");');
$listitem .= html_writer::link($url->out(false, $urlparams), $icon, $linkparams);
$list .= html_writer::tag('li', $listitem);
}
}
$output .= html_writer::tag('ul', $list, array('class' => 'cpd_itemlist'));
$addorupdate = isset($edit) ? get_string('update') : get_string('addnew', 'report_cpd');
$form = $this->output->heading($addorupdate . ' ' . get_string($type, 'report_cpd'), 4);
$value = '';
if (!empty($edit)) {
if ($range) {
$params = array('type' => 'hidden', 'name' => 'frmid', 'value' => $edit->id);
$form .= html_writer::empty_tag('input', $params);
$value = array('start' => $edit->startdate, 'end' => $edit->enddate);
} else {
$params = array('type' => 'hidden', 'name' => 'frmid', 'value' => $edit->id);
$form .= html_writer::empty_tag('input', $params);
$value = $edit->name;
}
} else {
if ($range) {
$value = array('start' => time(), 'end' => time());
}
}
$params = array('type' => 'hidden', 'name' => 'process', 'value' => $type);
$form .= html_writer::empty_tag('input', $params);
if ($range) {
$startselector = html_writer::label(get_string('start', 'report_cpd'), 'startday', true) . ':';
$startselector .= html_writer::select_time('days', 'startday', $value['start']);
$startselector .= html_writer::select_time('months', 'startmonth', $value['start']);
$startselector .= html_writer::select_time('years', 'startyear', $value['start']);
$form .= $this->output->container($startselector);
$endselector = html_writer::label(get_string('end', 'report_cpd'), 'endday', true) . ':';
$endselector .= html_writer::select_time('days', 'endday', $value['end']);
$endselector .= html_writer::select_time('months', 'endmonth', $value['end']);
$endselector .= html_writer::select_time('years', 'endyear', $value['end']);
$form .= $this->output->container($endselector);
} else {
$params = array('type' => 'text', 'name' => $type, 'value' => $value);
$form .= html_writer::empty_tag('input', $params);
}
$form .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => $addorupdate));
$params = array('class' => 'cpd_itemform', 'method' => 'post', 'name' => 'frmactivitytype');
$output .= html_writer::tag('form', $form, $params);
return $output;
}
示例7: moodle_url
$onlyOneURL = new moodle_url('/mod/booking/view.php', array('id' => $id, 'optionid' => $optionid, 'action' => 'showonlyone', 'whichview' => 'showonlyone'));
$onlyOneURL->set_anchor('goenrol');
echo '<br>' . html_writer::start_span('') . get_string('onlythisbookingurl', 'booking') . ': ' . html_writer::link($onlyOneURL, $onlyOneURL, array()) . html_writer::end_span() . '<br><br>';
$hidden = "";
foreach ($urlParams as $key => $value) {
if (!in_array($key, array('searchName', 'searchSurname', 'searchDate', 'searchFinished'))) {
$hidden .= '<input value="' . $value . '" type="hidden" name="' . $key . '">';
}
}
$row = new html_table_row(array(get_string('searchName', "booking"), '<form>' . $hidden . '<input value="' . $urlParams['searchName'] . '" id="searchName" type="text" name="searchName">', "", ""));
$tabledata[] = $row;
$rowclasses[] = "";
$row = new html_table_row(array(get_string('searchSurname', "booking"), '<input value="' . $urlParams['searchSurname'] . '" id="searchSurname" type="text" name="searchSurname">', "", ""));
$tabledata[] = $row;
$rowclasses[] = "";
$row = new html_table_row(array(get_string('searchDate', "booking"), html_writer::checkbox('searchDate', '1', $checked, '', array('id' => 'searchDate')) . html_writer::select_time('days', 'searchDateDay', $timestamp, 5) . ' ' . html_writer::select_time('months', 'searchDateMonth', $timestamp, 5) . ' ' . html_writer::select_time('years', 'searchDateYear', $timestamp, 5), "", ""));
$tabledata[] = $row;
$rowclasses[] = "";
$row = new html_table_row(array(get_string('searchFinished', "booking"), html_writer::select(array('0' => get_string('no', "booking"), '1' => get_string('yes', "booking")), 'searchFinished', $urlParams['searchFinished']), "", ""));
$tabledata[] = $row;
$rowclasses[] = "";
$row = new html_table_row(array("", '<input type="submit" id="searchButton" value="' . get_string('search') . '"><input id="buttonclear" type="button" value="' . get_string('reset', 'booking') . '"></form>', "", ""));
$tabledata[] = $row;
$rowclasses[] = "";
$table = new html_table();
$table->head = array('', '', '');
$table->data = $tabledata;
$table->id = "tableSearch";
if (!$searching) {
$table->attributes = array('style' => "display: none;");
}
示例8: print_facetoface_filters
/**
* Prints form items with the names $day, $month and $year
*
* @param int $filtername - the name of the filter to set up i.e coursename, courseid, location, trainer
* @param int $currentvalue
* @param boolean $return
*/
function print_facetoface_filters($startdate, $enddate, $currentcoursename, $currentcourseid, $currentlocation, $currenttrainer) {
global $CFG, $DB, $USER;
$coursenames = array();
$sessions = array();
$locations = array();
$courseids = array();
$trainers = array();
if (is_siteadmin()) {
$coscentercondition = "";
} else {
// to get costcenter info of the logged in user
if (isset($USER->id)) {
$training_managercostcenterinfo = $DB->get_record('local_costcenter_permissions', array('userid' => $USER->id));
if (isset($training_managercostcenterinfo->costcenterid)) {
$costcenterid = $training_managercostcenterinfo->costcenterid;
} else {
$userinfo = $DB->get_record('local_userdata', array('userid' => $USER->id));
$costcenterid = $userinfo->costcenterid;
}
$coscentercondition = " AND c.costcenter=$costcenterid ";
}
}
$results = $DB->get_records_sql("SELECT s.id AS sessionid, c.id as courseid, c.idnumber, c.fullname,
f.id AS facetofaceid
FROM {course} c
JOIN {facetoface} f ON f.course = c.id
JOIN {facetoface_sessions} s ON f.id = s.facetoface
WHERE c.visible = 1 $coscentercondition
GROUP BY c.id, c.idnumber, c.fullname, s.id, f.id
ORDER BY c.fullname ASC");
add_location_info($results);
if (!empty($results)) {
foreach ($results as $result) {
// create unique list of coursenames
if (!array_key_exists($result->fullname, $coursenames)) {
$coursenames[$result->fullname] = $result->fullname;
}
// created unique list of locations
if (isset($result->location)) {
if (!array_key_exists($result->location, $locations)) {
$locations[$result->location] = $result->location;
}
}
// create unique list of courseids
if (!array_key_exists($result->idnumber, $courseids) and $result->idnumber) {
$courseids[$result->idnumber] = $result->idnumber;
}
// create unique list of trainers
// check if $trainers hasn't already been populated by the cached list
if (empty($trainers)) {
if (isset($result->trainers)) {
foreach ($result->trainers as $trainer) {
if (!array_key_exists($trainer, $trainers)) {
$trainers[$trainer] = $trainer;
}
}
}
}
}
}
// Build or print result
$table = new html_table();
$table->tablealign = 'left';
$table->data[] = array(html_writer::tag('label', get_string('daterange', 'block_facetoface'), array('for' => 'menustartdate')),
html_writer::select_time('days', 'startday', $startdate) .
html_writer::select_time('months', 'startmonth', $startdate) .
html_writer::select_time('years', 'startyear', $startdate) . ' ' . strtolower(get_string('to')) . ' ' .
html_writer::select_time('days', 'endday', $enddate) .
html_writer::select_time('months', 'endmonth', $enddate) .
html_writer::select_time('years', 'endyear', $enddate));
$table->data[] = array(html_writer::tag('label', get_string('coursefullname', 'block_facetoface') . ':', array('for' => 'menucoursename')),
html_writer::select($coursenames, 'coursename', $currentcoursename, array('' => get_string('all'))));
if ($locations) {
$table->data[] = array(html_writer::tag('label', get_string('location', 'facetoface') . ':', array('for' => 'menulocation')),
html_writer::select($locations, 'location', $currentlocation, array('' => get_string('all'))));
}
echo html_writer::table($table);
}
示例9: include_once
include_once('tabs.php');
if (empty($users)) {
$renderer = $PAGE->get_renderer('block_facetoface');
// Date range form
echo html_writer::start_tag('form', array('method' => 'get', 'action' => "")) . html_writer::start_tag('p');
echo get_string('daterange', 'block_facetoface') . ' ';
echo html_writer::select_time('days', 'startday', $startdate);
echo html_writer::select_time('months', 'startmonth', $startdate);
echo html_writer::select_time('years', 'startyear', $startdate);
echo ' ' . strtolower(get_string('to')) . ' ';
echo html_writer::select_time('days', 'endday', $enddate);
echo html_writer::select_time('months', 'endmonth', $enddate);
echo html_writer::select_time('years', 'endyear', $enddate);
echo ' ' . html_writer::empty_tag('input', array('type' => 'hidden', 'value' => $userid, 'name' => 'userid'));
echo ' ' . html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('apply', 'block_facetoface'))) . html_writer::end_tag('p') . html_writer::end_tag('form');
// Show sign-ups
if ($userid != $USER->id) {
echo $OUTPUT->heading(get_string('futurebookingsfor', 'block_facetoface', fullname($user)));
} else {
echo $OUTPUT->heading(get_string('futurebookings', 'block_facetoface'));
}
if ($nbfuture > 0) {
echo $renderer->print_dates($futuresessions, false, false, true, false, false, $show_location);
}
else{
echo html_writer::tag('p', get_string('signedupinzero', 'block_facetoface'));
}
示例10: taskchain_navigation_accesscontrol_form
//.........这里部分代码省略.........
// =====================
//
//echo '<tr>'."\n";
//echo '<td class="itemname">'.get_string('completionview', 'completion').':</td>'."\n";
//echo '<td class="itemvalue">';
//echo html_writer::checkbox('completionview', 1, $completionview, get_string('completionview_desc', 'completion'));
//echo '</td>'."\n";
//echo '<td class="itemselect">';
//$script = "return set_disabled(this.form, new Array('completionview'), (! this.checked), true)";
//echo html_writer::checkbox('select_completionview', 1, optional_param('select_completionview', 0, PARAM_INT), '', array('onclick' => $script));
//echo '</td>'."\n";
//echo '</tr>'."\n";
// =====================
// require grade
// =====================
//
//echo '<tr>'."\n";
//echo '<td class="itemname">'.get_string('completionusegrade', 'completion').':</td>'."\n";
//echo '<td class="itemvalue">';
//echo html_writer::checkbox('completiongrade', 1, $completiongrade, get_string('completionusegrade_desc', 'completion'));
//echo '</td>'."\n";
//echo '<td class="itemselect">';
//$script = "return set_disabled(this.form, new Array('completiongrade'), (! this.checked), true)";
//echo html_writer::checkbox('select_completiongrade', 1, optional_param('select_completiongrade', 0, PARAM_INT), '', array('onclick' => $script));
//echo '</td>'."\n";
//echo '</tr>'."\n";
// =====================
// completion date
// =====================
//
echo '<tr>' . "\n";
echo '<td class="itemname">' . get_string('completionexpected', 'completion') . ':</td>' . "\n";
echo '<td class="itemvalue">';
echo html_writer::select_time('days', 'completionday', $completiondate, 1) . ' ';
echo html_writer::select_time('months', 'completionmonth', $completiondate, 1) . ' ';
echo html_writer::select_time('years', 'completionyear', $completiondate, 1);
echo html_writer::empty_tag('br') . '(' . get_string('usedbyall', $plugin) . ')';
echo '</td>' . "\n";
echo '<td class="itemselect">';
$script = "return set_disabled(this.form, new Array('completionday', 'completionmonth', 'completionyear'), (! this.checked))";
echo html_writer::checkbox('select_completiondate', 1, optional_param('select_completiondate', 0, PARAM_INT), '', array('onclick' => $script));
echo '</td>' . "\n";
echo '</tr>' . "\n";
// =====================
// activity-specific
// completion settings
// =====================
//
foreach ($completionfields as $name => $field) {
$text = $field->text;
$desc = $field->desc;
$type = $field->type;
if ($text == $desc) {
$desc = '';
}
if (empty($field->params['name'])) {
$fieldname = $name;
} else {
$fieldname = $field->params['name'];
}
if ($modnames = implode(', ', $field->mods)) {
$modnames = get_string('completionfieldactivities', $plugin, $modnames);
$modnames = html_writer::tag('span', "({$modnames})", array('class' => 'completionfieldmodnames'));
if ($desc) {
$modnames = html_writer::empty_tag('br') . $modnames;
}