当前位置: 首页>>代码示例>>PHP>>正文


PHP user_selector_base::searchoptionsoutput方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:nmicha,项目名称:moodle,代码行数:50,代码来源:lib.php


注:本文中的user_selector_base::searchoptionsoutput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。