本文整理汇总了PHP中html_select::make_yes_no方法的典型用法代码示例。如果您正苦于以下问题:PHP html_select::make_yes_no方法的具体用法?PHP html_select::make_yes_no怎么用?PHP html_select::make_yes_no使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html_select
的用法示例。
在下文中一共展示了html_select::make_yes_no方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_select_yesno
public function test_select_yesno()
{
$select = html_select::make_yes_no('question', 1);
$html = $this->renderer->select($select);
$this->assert(new ContainsTagWithAttributes('select', array('class' => 'menuquestion select', 'name' => 'question', 'id' => 'menuquestion')), $html);
$this->assert(new ContainsTagWithContents('option', get_string('choosedots')), $html);
$this->assert(new ContainsTagWithContents('option', get_string('yes')), $html);
$this->assert(new ContainsTagWithContents('option', get_string('no')), $html);
$this->assert(new ContainsTagWithAttributes('option', array('value' => '1', 'selected' => 'selected')), $html);
}
示例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 $OUTPUT->select($select).');
global $OUTPUT;
if ($script) {
debugging('The $script parameter has been deprecated. You must use component_actions instead', DEBUG_DEVELOPER);
}
$select = html_select::make_yes_no($name, $selected);
$select->disabled = $disabled;
$select->tabindex = $tabindex;
$output = $OUTPUT->select($select);
if ($return) {
return $output;
} else {
echo $output;
}
}