本文整理汇总了PHP中user_selector_base::searchoptionsoutput方法的典型用法代码示例。如果您正苦于以下问题:PHP user_selector_base::searchoptionsoutput方法的具体用法?PHP user_selector_base::searchoptionsoutput怎么用?PHP user_selector_base::searchoptionsoutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user_selector_base
的用法示例。
在下文中一共展示了user_selector_base::searchoptionsoutput方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Output this user_selector as HTML.
* @param boolean $return if true, return the HTML as a string instead of outputting it.
* @return mixed if $return is true, returns the HTML as a string, otherwise returns nothing.
*/
public function display($return = false)
{
global $PAGE;
// Get the list of requested users.
$search = optional_param($this->name . '_searchtext', '', PARAM_RAW);
if (optional_param($this->name . '_clearbutton', false, PARAM_BOOL)) {
$search = '';
}
$groupedusers = $this->find_users($search);
// Output the select.
$name = $this->name;
$multiselect = '';
if ($this->multiselect) {
$name .= '[]';
$multiselect = 'multiple="multiple" ';
}
$output = '<div class="userselector" id="' . $this->name . '_wrapper">' . "\n" . '<select name="' . $name . '" id="' . $this->name . '" ' . $multiselect . 'size="' . $this->rows . '">' . "\n";
// Populate the select.
$output .= $this->output_options($groupedusers, $search);
// Output the search controls.
$output .= "</select>\n<div>\n";
$output .= '<input type="text" name="' . $this->name . '_searchtext" id="' . $this->name . '_searchtext" size="15" value="' . s($search) . '" />';
$output .= '<input type="submit" name="' . $this->name . '_searchbutton" id="' . $this->name . '_searchbutton" value="' . $this->search_button_caption() . '" />';
$output .= '<input type="submit" name="' . $this->name . '_clearbutton" id="' . $this->name . '_clearbutton" value="' . get_string('clear') . '" />';
// And the search options.
$optionsoutput = false;
if (!user_selector_base::$searchoptionsoutput) {
$output .= print_collapsible_region_start('', 'userselector_options', get_string('searchoptions'), 'userselector_optionscollapsed', true, true);
$output .= $this->option_checkbox('preserveselected', $this->preserveselected, get_string('userselectorpreserveselected'));
$output .= $this->option_checkbox('autoselectunique', $this->autoselectunique, get_string('userselectorautoselectunique'));
$output .= $this->option_checkbox('searchanywhere', $this->searchanywhere, get_string('userselectorsearchanywhere'));
$output .= print_collapsible_region_end(true);
$PAGE->requires->js_init_call('M.core_user.init_user_selector_options_tracker', array(), false, self::$jsmodule);
user_selector_base::$searchoptionsoutput = true;
}
$output .= "</div>\n</div>\n\n";
// Initialise the ajax functionality.
$output .= $this->initialise_javascript($search);
// Return or output it.
if ($return) {
return $output;
} else {
echo $output;
}
}