コード例 #1
0
 protected function get_options()
 {
     $options = parent::get_options();
     $options['companyid'] = $this->companyid;
     $options['file'] = 'blocks/iomad_company_admin/lib/course_selectors.php';
     return $options;
 }
コード例 #2
0
 public function __construct($name, $options)
 {
     $this->selectedid = $options['selectedid'];
     parent::__construct($name, $options);
 }
コード例 #3
0
ファイル: lib.php プロジェクト: sumitnegi933/Moodle_lms_New
 /**
  * Output this course_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 courses.
     $search = optional_param($this->name . '_searchtext', '', PARAM_RAW);
     if (optional_param($this->name . '_clearbutton', false, PARAM_BOOL)) {
         $search = '';
     }
     $groupedcourses = $this->find_courses($search);
     // Output the select.
     $name = $this->name;
     $multiselect = '';
     if ($this->multiselect) {
         $name .= '[]';
         $multiselect = 'multiple="multiple" ';
     }
     $output = '<div class="courseselector" id="' . $this->name . '_wrapper">' . "\n" . '<select name="' . $name . '" id="' . $this->name . '" ' . $multiselect . 'size="' . $this->rows . '">' . "\n";
     // Populate the select.
     $output .= $this->output_options($groupedcourses, $search);
     // Output the search controls.
     $output .= "</select>\n<div class='search-box'>\n";
     $output .= '<input placeholder="Search" type="text" name="' . $this->name . '_searchtext" id="' . $this->name . '_searchtext" size="15" value="' . s($search) . '" />';
     /* GWL : Add Place Holder Inside Search */
     /*GWL : Remove Search Text */
     /* $output .= '<input type="submit" name="' . $this->name . '_searchbutton" id="' .
                $this->name . '_searchbutton" value="' . $this->search_button_caption() . '" />';
        */
     /*GWL : Remove Search Text */
     $output .= '<input type="submit" name="' . $this->name . '_searchbutton" id="' . $this->name . '_searchbutton" value="" />';
     /*GWL : Remove Search Text */
     $output .= '<input type="submit" name="' . $this->name . '_clearbutton" id="' . $this->name . '_clearbutton" value="' . get_string('clear') . '" />';
     // And the search options.
     $optionsoutput = false;
     if (!self::$searchoptionsoutput) {
         $output .= print_collapsible_region_start('', 'courseselector_options', get_string('searchoptions', 'local_course_selector'), 'courseselector_optionscollapsed', true, true);
         $output .= $this->option_checkbox('preserveselected', $this->preserveselected, get_string('courseselectorpreserveselected', 'local_course_selector'));
         $output .= $this->option_checkbox('autoselectunique', $this->autoselectunique, get_string('courseselectorautoselectunique', 'local_course_selector'));
         $output .= $this->option_checkbox('searchanywhere', $this->searchanywhere, get_string('courseselectorsearchanywhere', 'local_course_selector'));
         $output .= print_collapsible_region_end(true);
         $PAGE->requires->js_init_call('M.local_course_selector.init_course_selector_options_tracker', array(), false, self::$jsmodule);
         self::$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;
     }
 }