本文整理匯總了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;
}
}