public function search_listitem(core_course_list_element $course, $selectedcourse) {

        $text = $course->get_formatted_name();
        $attributes = array(
                'class' => 'listitem listitem-course list-group-item list-group-item-action',
                'data-id' => $course->id,
                'data-selected' => ($selectedcourse == $course->id) ? '1' : '0',
                'data-visible' => $course->visible ? '1' : '0'
        );
        $bulkcourseinput = '';
        if (core_course_category::get($course->category)->can_move_courses_out_of()) {
            $bulkcourseinput = array(
                    'type' => 'checkbox',
                    'name' => 'bc[]',
                    'value' => $course->id,
                    'class' => 'bulk-action-checkbox',
                    'aria-label' => get_string('bulkactionselect', 'moodle', $text),
                    'data-action' => 'select'
            );
        }
        $viewcourseurl = new moodle_url($this->page->url, array('courseid' => $course->id));
        $categoryname = core_course_category::get($course->category)->get_formatted_name();

        $html  = html_writer::start_tag('li', $attributes);
        $html .= html_writer::start_div('clearfix');
        $html .= html_writer::start_div('float-left');
        if ($bulkcourseinput) {
            $html .= html_writer::empty_tag('input', $bulkcourseinput).'&nbsp;';
        }
        $html .= html_writer::end_div();
        $html .= html_writer::link($viewcourseurl, $text, array('class' => 'float-left coursename'));
        $html .= html_writer::tag('span', $categoryname, array('class' => 'float-left categoryname'));
        $html .= html_writer::start_div('float-right');
        $html .= $this->search_listitem_actions($course);
        $html .= html_writer::tag('span', s($course->idnumber), array('class' => 'dimmed idnumber'));
        $html .= html_writer::end_div();
        $html .= html_writer::end_div();
        $html .= html_writer::end_tag('li');
        return $html;
    }
public function search_listitem(core_course_list_element $course, $selectedcourse) {

        $text = $course->get_formatted_name();
        $attributes = array(
                'class' => 'listitem listitem-course list-group-item list-group-item-action',
                'data-id' => $course->id,
                'data-selected' => ($selectedcourse == $course->id) ? '1' : '0',
                'data-visible' => $course->visible ? '1' : '0'
        );
        $bulkcourseinput = '';
        if (core_course_category::get($course->category)->can_move_courses_out_of()) {
            $bulkcourseinput = array(
                    'type' => 'checkbox',
                    'name' => 'bc[]',
                    'value' => $course->id,
                    'class' => 'bulk-action-checkbox',
                    'aria-label' => get_string('bulkactionselect', 'moodle', $text),
                    'data-action' => 'select'
            );
        }
        $viewcourseurl = new moodle_url($this->page->url, array('courseid' => $course->id));
        $categoryname = core_course_category::get($course->category)->get_formatted_name();

        $html  = html_writer::start_tag('li', $attributes);
        $html .= html_writer::start_div('clearfix');
        $html .= html_writer::start_div('float-left');
        if ($bulkcourseinput) {
            $html .= html_writer::empty_tag('input', $bulkcourseinput).'&nbsp;';
        }
        $html .= html_writer::end_div();
        $html .= html_writer::link($viewcourseurl, $text, array('class' => 'float-left coursename'));
        $html .= html_writer::tag('span', $categoryname, array('class' => 'float-left categoryname'));
        $html .= html_writer::start_div('float-right');
        $html .= $this->search_listitem_actions($course);
        $html .= html_writer::tag('span', s($course->idnumber), array('class' => 'dimmed idnumber'));
        $html .= html_writer::end_div();
        $html .= html_writer::end_div();
        $html .= html_writer::end_tag('li');
        return $html;
    }
public function search_listitem ( core_course_list_element $ course , $ selectedcourse ) { $ text = $ course -> get_formatted_name ( ) ; $ attributes = array ( 'class' => 'listitem listitem-course list-group-item list-group-item-action' , 'data-id' => $ course -> id , 'data-selected' => ( $ selectedcourse == $ course -> id ) ? '1' : '0' , 'data-visible' => $ course -> visible ? '1' : '0' ) ; $ bulkcourseinput = '' ; if ( core_course_category :: get ( $ course -> category ) -> can_move_courses_out_of ( ) ) { $ bulkcourseinput = array ( 'type' => 'checkbox' , 'name' => 'bc[]' , 'value' => $ course -> id , 'class' => 'bulk-action-checkbox' , 'aria-label' => get_string ( 'bulkactionselect' , 'moodle' , $ text ) , 'data-action' => 'select' ) ; } $ viewcourseurl = new moodle_url ( $ this -> page -> url , array ( 'courseid' => $ course -> id ) ) ; $ categoryname = core_course_category :: get ( $ course -> category ) -> get_formatted_name ( ) ; $ html = html_writer :: start_tag ( 'li' , $ attributes ) ; $ html .= html_writer :: start_div ( 'clearfix' ) ; $ html .= html_writer :: start_div ( 'float-left' ) ; if ( $ bulkcourseinput ) { $ html .= html_writer :: empty_tag ( 'input' , $ bulkcourseinput ) . '&nbsp;' ; } $ html .= html_writer :: end_div ( ) ; $ html .= html_writer :: link ( $ viewcourseurl , $ text , array ( 'class' => 'float-left coursename' ) ) ; $ html .= html_writer :: tag ( 'span' , $ categoryname , array ( 'class' => 'float-left categoryname' ) ) ; $ html .= html_writer :: start_div ( 'float-right' ) ; $ html .= $ this -> search_listitem_actions ( $ course ) ; $ html .= html_writer :: tag ( 'span' , s ( $ course -> idnumber ) , array ( 'class' => 'dimmed idnumber' ) ) ; $ html .= html_writer :: end_div ( ) ; $ html .= html_writer :: end_div ( ) ; $ html .= html_writer :: end_tag ( 'li' ) ; return $ html ; }
Renderers a search result course list item.

This function will be called for every course being displayed by course_listing.

@param core_course_list_element $course The course to produce HTML for.
@param int $selectedcourse The id of the currently selected course.
@return string
Renderers a search result course list item .