本文整理汇总了PHP中html_writer::select_yes_no方法的典型用法代码示例。如果您正苦于以下问题:PHP html_writer::select_yes_no方法的具体用法?PHP html_writer::select_yes_no怎么用?PHP html_writer::select_yes_no使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html_writer
的用法示例。
在下文中一共展示了html_writer::select_yes_no方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin_externalpage_setup
$PAGE->set_title($strheading);
$PAGE->set_heading($strheading);
admin_externalpage_setup('toolelementlibrary');
echo $OUTPUT->header();
echo html_writer::link(new moodle_url('index.php'), '« Back to index');
echo $OUTPUT->heading($strheading);
echo $OUTPUT->box_start();
echo $OUTPUT->container('Examples of different types of stand-alone form elements (without using formslib).');
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');
示例2: choose_from_menu_yesno
/**
* Choose value 0 or 1 from a menu with options 'No' and 'Yes'.
* Other options like choose_from_menu.
*
* @deprecated since Moodle 2.0
*
* Calls {@link choose_from_menu()} with preset arguments
* @see choose_from_menu()
*
* @param string $name the name of this form control, as in <select name="..." ...
* @param string $selected the option to select initially, default none.
* @param string $script if not '', then this is added to the <select> element as an onchange handler.
* @param boolean $return Whether this function should return a string or output it (defaults to false)
* @param boolean $disabled (defaults to false)
* @param int $tabindex
* @return string|void If $return=true returns string, else echo's and returns void
*/
function choose_from_menu_yesno($name, $selected, $script = '', $return = false, $disabled = false, $tabindex = 0) {
debugging('choose_from_menu_yesno() has been deprecated. Please change your code to use html_writer.');
global $OUTPUT;
if ($script) {
debugging('The $script parameter has been deprecated. You must use component_actions instead', DEBUG_DEVELOPER);
}
$output = html_writer::select_yes_no($name, $selected, array('disabled'=>($disabled ? 'disabled' : null), 'tabindex'=>$tabindex));
if ($return) {
return $output;
} else {
echo $output;
}
}
示例3: taskchain_navigation_accesscontrol_form
//.........这里部分代码省略.........
echo '<tr>' . "\n";
echo '<td class="itemname">' . get_string('maximumgrade', $plugin) . ':</td>' . "\n";
echo '<td class="itemvalue">';
echo html_writer::select($maxgrades, 'maxgrade', $maxgrade, '');
echo '</td>' . "\n";
echo '<td class="itemselect">';
$script = "return set_disabled(this.form, new Array('maxgrade'), (! this.checked))";
echo html_writer::checkbox('select_maxgrade', 1, optional_param('select_maxgrade', 0, PARAM_INT), '', array('onclick' => $script));
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo '<tr>' . "\n";
echo '<td class="itemname">' . get_string('gradepass', 'grades') . ':</td>' . "\n";
echo '<td class="itemvalue">';
echo html_writer::select($gradepassmenu, 'gradepass', $gradepass, '');
echo '</td>' . "\n";
echo '<td class="itemselect">';
$script = "return set_disabled(this.form, new Array('gradepass'), (! this.checked))";
echo html_writer::checkbox('select_gradepass', 1, optional_param('select_gradepass', 0, PARAM_INT), '', array('onclick' => $script));
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo '<tr>' . "\n";
echo '<td class="itemname">' . get_string('gradecategory', 'grades') . ':</td>' . "\n";
echo '<td class="itemvalue">';
echo html_writer::select($gradecategories, 'gradecat', $gradecat, '');
echo '</td>' . "\n";
echo '<td class="itemselect">';
$script = "return set_disabled(this.form, new Array('gradecat'), (! this.checked))";
echo html_writer::checkbox('select_gradecat', 1, optional_param('select_gradecat', 0, PARAM_INT), '', array('onclick' => $script));
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo '<tr>' . "\n";
echo '<td class="itemname">' . get_string('gradeitemhidden', $plugin) . ':</td>' . "\n";
echo '<td class="itemvalue">';
echo html_writer::select_yes_no('gradeitemhidden', $gradeitemhidden);
echo '</td>' . "\n";
echo '<td class="itemselect">';
$script = "return set_disabled(this.form, new Array('gradeitemhidden'), (! this.checked))";
echo html_writer::checkbox('select_gradeitemhidden', 1, optional_param('select_gradeitemhidden', 0, PARAM_INT), '', array('onclick' => $script));
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo '<tr>' . "\n";
echo '<td class="itemname">' . get_string('aggregationcoefextra', 'grades') . ':</td>' . "\n";
echo '<td class="itemvalue">';
echo html_writer::select_yes_no('extracredit', $extracredit);
echo '</td>' . "\n";
echo '<td class="itemselect">';
$script = "return set_disabled(this.form, new Array('extracredit'), (! this.checked))";
echo html_writer::checkbox('select_extracredit', 1, optional_param('select_extracredit', 0, PARAM_INT), '', array('onclick' => $script));
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo '<tr>' . "\n";
echo '<td class="itemname">' . get_string('regrade', $plugin) . ':</td>' . "\n";
echo '<td class="itemvalue">';
echo html_writer::select_yes_no('regrade', $regrade);
echo '</td>' . "\n";
echo '<td class="itemselect">';
$script = "return set_disabled(this.form, new Array('regrade'), (! this.checked))";
echo html_writer::checkbox('select_regrade', 1, optional_param('select_regrade', 0, PARAM_INT), '', array('onclick' => $script));
echo '</td>' . "\n";
echo '</tr>' . "\n";
// ============================
// Groups
// ============================
//
print_sectionheading(get_string('groups'), 'groups', true);
echo '<tr>' . "\n";