protected function coursecat_coursebox(coursecat_helper $chelper, $course, $additionalclasses = '') {
        global $CFG, $OUTPUT;

        $content = '';
        $arrow = '';

        $content .= html_writer::start_tag('div', array('class' => 'panel panel-default coursebox'));
        $content .= html_writer::start_tag('div', array('class' => 'panel-heading'));

        // Course name.
        $coursename = $chelper->get_course_formatted_name($course);
        $content .=  html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)),
            $coursename, array('class' => $course->visible ? '' : 'dimmed'));


        $content .= html_writer::end_tag('div'); // End .panel-heading.
        $content .= html_writer::start_tag('div', array('class' => 'panel-body'));

        // This gets the course image or files
        $content .= $this->coursecat_coursebox_content($chelper, $course);

        if ($chelper->get_show_courses() >= self::COURSECAT_SHOW_COURSES_EXPANDED) {
            $icondirection = 'left';
            if ('ltr' === get_string('thisdirection', 'langconfig')) {
                $icondirection = 'right';
            }
        }

        $content .= html_writer::end_tag('div'); // End .panel-body.
        $content .= html_writer::end_tag('div'); // End .panel.

        return $content;
    }
 protected function coursecat_coursebox(coursecat_helper $chelper, $course, $additionalclasses = '')
 {
     global $CFG;
     if (!isset($this->strings->summary)) {
         $this->strings->summary = get_string('summary');
     }
     if ($chelper->get_show_courses() <= self::COURSECAT_SHOW_COURSES_COUNT) {
         return '';
     }
     if ($course instanceof stdClass) {
         require_once $CFG->libdir . '/coursecatlib.php';
         $course = new course_in_list($course);
     }
     $content = '';
     $classes = trim('panel panel-default coursebox clearfix ' . $additionalclasses);
     if ($chelper->get_show_courses() < self::COURSECAT_SHOW_COURSES_EXPANDED) {
         $classes .= ' collapsed';
     }
     // Start .coursebox div.
     $content .= html_writer::start_tag('div', array('class' => $classes, 'data-courseid' => $course->id, 'data-type' => self::COURSECAT_TYPE_COURSE));
     $content .= html_writer::start_tag('div', array('class' => 'panel-heading info'));
     // Course name.
     $coursename = $chelper->get_course_formatted_name($course);
     $coursenamelink = html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)), $coursename, array('class' => $course->visible ? '' : 'dimmed'));
     $content .= html_writer::tag('span', $coursenamelink, array('class' => 'coursename'));
     // If we display course in collapsed form but the course has summary or course contacts, display the link to the info page.
     $content .= html_writer::start_tag('span', array('class' => 'moreinfo'));
     if ($chelper->get_show_courses() < self::COURSECAT_SHOW_COURSES_EXPANDED) {
         if ($course->has_summary() || $course->has_course_contacts() || $course->has_course_overviewfiles()) {
             $url = new moodle_url('/course/info.php', array('id' => $course->id));
             $image = html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/info'), 'alt' => $this->strings->summary));
             $content .= html_writer::link($url, $image, array('title' => $this->strings->summary));
             // Make sure JS file to expand course content is included.
             $this->coursecat_include_js();
         }
     }
     $content .= html_writer::end_tag('span');
     // End .moreinfo span.
     // Print enrolmenticons.
     if ($icons = enrol_get_course_info_icons($course)) {
         $content .= html_writer::start_tag('div', array('class' => 'enrolmenticons'));
         foreach ($icons as $pixicon) {
             $content .= $this->render($pixicon);
         }
         $content .= html_writer::end_tag('div');
         // End .enrolmenticons div.
     }
     $content .= html_writer::end_tag('div');
     // End .info div.
     $content .= html_writer::start_tag('div', array('class' => 'content panel-body'));
     $content .= $this->coursecat_coursebox_content($chelper, $course);
     $content .= html_writer::end_tag('div');
     // End .content div.
     $content .= html_writer::end_tag('div');
     // End .coursebox div.
     return $content;
 }
 public function get_content()
 {
     global $CFG;
     if ($this->content !== null) {
         return $this->content;
     }
     if (empty($this->instance)) {
         $this->content = '';
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     $this->content->text = '';
     // The user/index.php expect course context, so get one if page has module context.
     $currentcontext = $this->page->context->get_course_context(false);
     if (empty($currentcontext)) {
         return $this->content;
     }
     if ($this->page->course->id == SITEID) {
         $courses = self::get_featured_courses();
         require_once $CFG->libdir . '/coursecatlib.php';
         $chelper = new coursecat_helper();
         foreach ($courses as $course) {
             $course = new course_in_list($course);
             $this->content->text .= '<div class="container-fluid coursebox">';
             $content = '';
             $coursename = $chelper->get_course_formatted_name($course);
             $coursenamelink = html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)), $coursename, array('class' => $course->visible ? '' : 'dimmed'));
             $content .= html_writer::tag('div', $coursenamelink, array('class' => 'coursename'));
             if ($course->has_summary()) {
                 $content .= html_writer::start_tag('div', array('class' => 'summary'));
                 $content .= $chelper->get_course_formatted_summary($course, array('overflowdiv' => true, 'noclean' => true, 'para' => false));
                 $content .= html_writer::end_tag('div');
             }
             // Display course overview files.
             $contentimages = $contentfiles = '';
             foreach ($course->get_course_overviewfiles() as $file) {
                 $isimage = $file->is_valid_image();
                 $url = file_encode_url("{$CFG->wwwroot}/pluginfile.php", '/' . $file->get_contextid() . '/' . $file->get_component() . '/' . $file->get_filearea() . $file->get_filepath() . $file->get_filename(), !$isimage);
                 if ($isimage) {
                     $contentimages .= html_writer::tag('div', html_writer::empty_tag('img', array('src' => $url, 'style' => 'max-height: 150px')), array('class' => 'courseimage'));
                 } else {
                     $image = $this->output->pix_icon(file_file_icon($file, 24), $file->get_filename(), 'moodle');
                     $filename = html_writer::tag('span', $image, array('class' => 'fp-icon')) . html_writer::tag('span', $file->get_filename(), array('class' => 'fp-filename'));
                     $contentfiles .= html_writer::tag('span', html_writer::link($url, $filename), array('class' => 'coursefile fp-filename-icon'));
                 }
             }
             $content .= $contentimages . $contentfiles;
             $this->content->text .= $content . '</div>';
         }
     }
     return $this->content;
 }
Esempio n. 4
0
 /**
  * Displays one course in the list of courses.
  *
  * This is an internal function, to display an information about just one course
  * please use {@link core_course_renderer::course_info_box()}
  *
  * @param coursecat_helper $chelper various display options
  * @param course_in_list|stdClass $course
  * @param string $additionalclasses additional classes to add to the main <div> tag (usually
  *    depend on the course position in list - first/last/even/odd)
  * @return string
  */
 protected function coursecat_coursebox(coursecat_helper $chelper, $course, $additionalclasses = '')
 {
     global $CFG;
     if (!isset($this->strings->summary)) {
         $this->strings->summary = get_string('summary');
     }
     if ($chelper->get_show_courses() <= self::COURSECAT_SHOW_COURSES_COUNT) {
         return '';
     }
     if ($course instanceof stdClass) {
         require_once $CFG->libdir . '/coursecatlib.php';
         $course = new course_in_list($course);
     }
     $content = '';
     $classes = trim('coursebox clearfix ' . $additionalclasses);
     if ($chelper->get_show_courses() >= self::COURSECAT_SHOW_COURSES_EXPANDED) {
         $nametag = 'h3';
     } else {
         $classes .= ' collapsed';
         $nametag = 'div';
     }
     $content .= html_writer::start_tag('div', array('class' => $classes));
     // .coursebox
     $content .= html_writer::start_tag('div', array('class' => 'info'));
     // course name
     $coursename = $chelper->get_course_formatted_name($course);
     $coursenamelink = html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)), $coursename, array('class' => $course->visible ? '' : 'dimmed'));
     $content .= html_writer::tag($nametag, $coursenamelink, array('class' => 'name'));
     // If we display course in collapsed form but the course has summary or course contacts, display the link to the info page.
     $content .= html_writer::start_tag('div', array('class' => 'moreinfo'));
     if ($chelper->get_show_courses() < self::COURSECAT_SHOW_COURSES_EXPANDED) {
         if ($course->has_summary() || $course->has_course_contacts() || $course->has_course_overviewfiles()) {
             $url = new moodle_url('/course/info.php', array('id' => $course->id));
             $image = html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/info'), 'alt' => $this->strings->summary));
             $content .= html_writer::link($url, $image, array('title' => $this->strings->summary));
         }
     }
     $content .= html_writer::end_tag('div');
     // .moreinfo
     // print enrolmenticons
     if ($icons = enrol_get_course_info_icons($course)) {
         $content .= html_writer::start_tag('div', array('class' => 'enrolmenticons'));
         foreach ($icons as $pix_icon) {
             $content .= $this->render($pix_icon);
         }
         $content .= html_writer::end_tag('div');
         // .enrolmenticons
     }
     $content .= html_writer::end_tag('div');
     // .info
     $content .= html_writer::start_tag('div', array('class' => 'content'));
     $content .= $this->coursecat_coursebox_content($chelper, $course);
     $content .= html_writer::end_tag('div');
     // .content
     $content .= html_writer::end_tag('div');
     // .coursebox
     return $content;
 }
 protected function coursecat_coursebox(coursecat_helper $chelper, $course, $additionalclasses = '')
 {
     /**
      * This is used to output any course block - including inside AJAX or SEARCH 
      * We had to override this renderer to enable the section=1 to be added to any link
      **/
     global $CFG;
     if (!isset($this->strings->summary)) {
         $this->strings->summary = get_string('summary');
     }
     if ($chelper->get_show_courses() <= self::COURSECAT_SHOW_COURSES_COUNT) {
         return '';
     }
     if ($course instanceof stdClass) {
         require_once $CFG->libdir . '/coursecatlib.php';
         $course = new course_in_list($course);
     }
     $content = '';
     $classes = trim('panel panel-default coursebox clearfix ' . $additionalclasses);
     if ($chelper->get_show_courses() < self::COURSECAT_SHOW_COURSES_EXPANDED) {
         $classes .= ' collapsed';
     }
     // .coursebox
     $content .= html_writer::start_tag('div', array('class' => $classes, 'data-courseid' => $course->id, 'data-type' => self::COURSECAT_TYPE_COURSE));
     $content .= html_writer::start_tag('div', array('class' => 'panel-heading info'));
     // course name
     $coursename = $chelper->get_course_formatted_name($course);
     $coursenamelink = html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id, 'section' => 1)), $coursename, array('class' => $course->visible ? '' : 'dimmed'));
     $content .= html_writer::tag('span', $coursenamelink, array('class' => 'coursename'));
     // If we display course in collapsed form but the course has summary or course contacts, display the link to the info page.
     $content .= html_writer::start_tag('span', array('class' => 'moreinfo'));
     if ($chelper->get_show_courses() < self::COURSECAT_SHOW_COURSES_EXPANDED) {
         if ($course->has_summary() || $course->has_course_contacts() || $course->has_course_overviewfiles()) {
             $url = new moodle_url('/course/info.php', array('id' => $course->id, 'section' => 1));
             $image = html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/info'), 'alt' => $this->strings->summary));
             $content .= html_writer::link($url, $image, array('title' => $this->strings->summary));
             // Make sure JS file to expand course content is included.
             $this->coursecat_include_js();
         }
     }
     $content .= html_writer::end_tag('span');
     // .moreinfo
     // print enrolmenticons
     if ($icons = enrol_get_course_info_icons($course)) {
         $content .= html_writer::start_tag('div', array('class' => 'enrolmenticons'));
         foreach ($icons as $pix_icon) {
             $content .= $this->render($pix_icon);
         }
         $content .= html_writer::end_tag('div');
         // .enrolmenticons
     }
     $content .= html_writer::end_tag('div');
     // .info
     $content .= html_writer::start_tag('div', array('class' => 'content panel-body'));
     // this bit gets the details for the contents of the panel -
     // for a search this might be the CATEGORY: LINK
     //$content .= "<pre>" . print_r($chelper, true) . "</pre>";
     $content .= $this->coursecat_coursebox_content($chelper, $course);
     if ($chelper->get_show_courses() >= self::COURSECAT_SHOW_COURSES_EXPANDED) {
         $icondirection = 'left';
         if ('ltr' === get_string('thisdirection', 'langconfig')) {
             $icondirection = 'right';
         }
         /** HIDE THE course -> if the user is enrolled **/
         /** this annoyed Mark on the front page :-) **/
         // if (is_enrolled(context_course::instance($course->id))) {
         //     $arrow = html_writer::tag('span', '', array('class' => ' glyphicon glyphicon-arrow-'.$icondirection));
         //     $visit = html_writer::tag('span', get_string('course') . ' ' . $arrow);
         //     $visitlink = html_writer::link(new moodle_url('/course/view.php',
         //         array('id' => $course->id, 'section'=>1)), $visit);
         //     $content .= html_writer::tag('div', $visitlink, array('class' => 'visitlink'));
         // }
     }
     $content .= html_writer::end_tag('div');
     // .content
     $content .= html_writer::end_tag('div');
     // .coursebox
     return $content;
 }
Esempio n. 6
0
 /**
  * Displays one course in the list of courses.
  *
  * This is an internal function, to display an information about just one course
  * please use {@link core_course_renderer::course_info_box()}
  *
  * @param coursecat_helper $chelper various display options
  * @param course_in_list|stdClass $course
  * @param string $additionalclasses additional classes to add to the main <div> tag (usually
  *    depend on the course position in list - first/last/even/odd)
  * @return string
  */
 protected function coursecat_coursebox(coursecat_helper $chelper, $course, $additionalclasses = '')
 {
     global $CFG;
     if (!isset($this->strings->summary)) {
         $this->strings->summary = get_string('summary');
     }
     if ($chelper->get_show_courses() <= self::COURSECAT_SHOW_COURSES_COUNT) {
         return '';
     }
     if ($course instanceof stdClass) {
         require_once $CFG->libdir . '/coursecatlib.php';
         $course = new course_in_list($course);
     }
     $content = '';
     $classes = trim('coursebox clearfix ' . $additionalclasses);
     if ($chelper->get_show_courses() >= self::COURSECAT_SHOW_COURSES_EXPANDED) {
         $nametag = 'h3';
         $nametag1 = 'div';
         /* GWL*/
     } else {
         $classes .= ' collapsed';
         $nametag = 'div';
     }
     // .coursebox
     $content .= html_writer::start_tag('div', array('class' => $classes, 'data-courseid' => $course->id, 'data-type' => self::COURSECAT_TYPE_COURSE));
     $content .= html_writer::start_tag('div', array('class' => 'info'));
     // display course overview files
     $contentimages = $contentfiles = '';
     foreach ($course->get_course_overviewfiles() as $file) {
         $isimage = $file->is_valid_image();
         $url = file_encode_url("{$CFG->wwwroot}/pluginfile.php", '/' . $file->get_contextid() . '/' . $file->get_component() . '/' . $file->get_filearea() . $file->get_filepath() . $file->get_filename(), !$isimage);
         if ($isimage) {
             $contentimages .= html_writer::tag('div', html_writer::empty_tag('img', array('src' => $url)), array('class' => 'courseimage')) . html_writer::link(new moodle_url('#', array('' => '')), 'Plus', array('class' => 'icon-plus')) . html_writer::link(new moodle_url('#', array('' => '')), 'Minus', array('class' => 'icon-minus'));
         } else {
             $image = $this->output->pix_icon(file_file_icon($file, 24), $file->get_filename(), 'moodle');
             $filename = html_writer::tag('span', $image, array('class' => 'fp-icon')) . html_writer::tag('span', $file->get_filename(), array('class' => 'fp-filename'));
             $contentfiles .= html_writer::tag('span', html_writer::link($url, $filename), array('class' => 'coursefile fp-filename-icon'));
         }
     }
     $content .= $contentimages . $contentfiles;
     // course name
     $coursename = $chelper->get_course_formatted_name($course);
     $coursenamelink = html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)), $coursename, array('class' => $course->visible ? '' : 'dimmed'));
     $coursenamelink1 = html_writer::tag('span', '', array('class' => 'duration-time')) . html_writer::tag('span', '', array('class' => 'time-text')) . html_writer::link(new moodle_url('#page-footer'), 'CONTACT US', array('class' => 'anchor-1 join-now'));
     /* GWL : Add extra, Remove Duration, Remove Time & Change Contact Us url to Footer */
     /*GWL - Remove Contact Us Link */
     /*
             $coursenamelink1 = html_writer::tag('span','', array('class'=>'duration-time')).html_writer::tag('span','', array('class'=>'time-text')).html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)),
                               'CONTACT US', array('class' => 'anchor-1 join-now')); */
     /* GWL : Add extra, Remove Duration & Remove Time */
     /* GWL - Duration & Time */
     /*
             $coursenamelink1 = html_writer::tag('span','Duration', array('class'=>'duration-time')).html_writer::tag('span','10hrs', array('class'=>'time-text')).html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)),
                               'Join Now', array('class' => 'anchor-1 join-now')); */
     /* gwl */
     $content .= html_writer::tag($nametag, $coursenamelink, array('class' => 'coursename'));
     $content .= html_writer::tag($nametag1, $coursenamelink1, array('class' => 'course-bottom'));
     /* GWL*/
     // If we display course in collapsed form but the course has summary or course contacts, display the link to the info page.
     $content .= html_writer::start_tag('div', array('class' => 'moreinfo'));
     if ($chelper->get_show_courses() < self::COURSECAT_SHOW_COURSES_EXPANDED) {
         if ($course->has_summary() || $course->has_course_contacts() || $course->has_course_overviewfiles()) {
             $url = new moodle_url('/course/info.php', array('id' => $course->id));
             $image = html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/info'), 'alt' => $this->strings->summary));
             $content .= html_writer::link($url, $image, array('title' => $this->strings->summary));
             // Make sure JS file to expand course content is included.
             $this->coursecat_include_js();
         }
     }
     $content .= html_writer::end_tag('div');
     // .moreinfo
     // print enrolmenticons
     if ($icons = enrol_get_course_info_icons($course)) {
         $content .= html_writer::start_tag('div', array('class' => 'enrolmenticons'));
         foreach ($icons as $pix_icon) {
             $content .= $this->render($pix_icon);
         }
         $content .= html_writer::end_tag('div');
         // .enrolmenticons
     }
     $content .= html_writer::end_tag('div');
     // .info
     $content .= html_writer::start_tag('div', array('class' => 'content'));
     $content .= $this->coursecat_coursebox_content($chelper, $course);
     $content .= html_writer::end_tag('div');
     // .content
     $content .= html_writer::end_tag('div');
     // .coursebox
     return $content;
 }
 protected function coursecat_coursebox(coursecat_helper $chelper, $course, $additionalclasses = '')
 {
     global $CFG, $OUTPUT;
     if (!isset($this->strings->summary)) {
         $this->strings->summary = get_string('summary');
     }
     if ($chelper->get_show_courses() <= self::COURSECAT_SHOW_COURSES_COUNT) {
         return '';
     }
     if ($course instanceof stdClass) {
         require_once $CFG->libdir . '/coursecatlib.php';
         $course = new course_in_list($course);
     }
     $content = '';
     $classes = trim($additionalclasses);
     if ($chelper->get_show_courses() < self::COURSECAT_SHOW_COURSES_EXPANDED) {
         $classes .= ' collapsed';
     }
     $content .= html_writer::start_tag('div', array('class' => 'panel panel-default coursebox'));
     $content .= html_writer::start_tag('div', array('class' => 'panel-heading'));
     // Course name.
     $coursename = $chelper->get_course_formatted_name($course);
     $content .= html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)), $coursename, array('class' => $course->visible ? '' : 'dimmed'));
     // If we display course in collapsed form but the course has summary or course contacts, display the link to the info page.
     if ($chelper->get_show_courses() < self::COURSECAT_SHOW_COURSES_EXPANDED) {
         if ($course->has_summary() || $course->has_course_contacts() || $course->has_course_overviewfiles()) {
             $url = new moodle_url('/course/info.php', array('id' => $course->id));
             $arrow = html_writer::tag('span', '', array('class' => 'glyphicon glyphicon-info-sign'));
             $content .= html_writer::link('#coursecollapse' . $course->id, '&nbsp;' . $arrow, array('data-toggle' => 'collapse', 'data-parent' => '#frontpage-category-combo'));
         }
     }
     // print enrolmenticons
     if ($icons = enrol_get_course_info_icons($course)) {
         $content .= html_writer::start_tag('div', array('class' => 'enrolmenticons'));
         foreach ($icons as $pix_icon) {
             $content .= $this->render($pix_icon);
         }
         $content .= html_writer::end_tag('div');
         // .enrolmenticons
     }
     $content .= html_writer::end_tag('div');
     // End .panel-heading.
     if ($chelper->get_show_courses() < self::COURSECAT_SHOW_COURSES_EXPANDED) {
         $content .= html_writer::start_tag('div', array('id' => 'coursecollapse' . $course->id, 'class' => 'panel-collapse collapse'));
     }
     $content .= html_writer::start_tag('div', array('class' => 'panel-body'));
     // This gets the course image or files
     $content .= $this->coursecat_coursebox_content($chelper, $course);
     if ($chelper->get_show_courses() >= self::COURSECAT_SHOW_COURSES_EXPANDED) {
         $icondirection = 'left';
         if ('ltr' === get_string('thisdirection', 'langconfig')) {
             $icondirection = 'right';
         }
         $arrow = html_writer::tag('span', '', array('class' => ' glyphicon glyphicon-arrow-' . $icondirection));
         $btn = html_writer::tag('span', get_string('course') . ' ' . $arrow, array('class' => 'coursequicklink'));
         $content .= html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)), $btn, array('class' => 'coursebtn btn btn-info btn-sm pull-right'));
     }
     $content .= html_writer::end_tag('div');
     // End .panel-body.
     if ($chelper->get_show_courses() < self::COURSECAT_SHOW_COURSES_EXPANDED) {
         $content .= html_writer::end_tag('div');
         // End .collapse.
     }
     $content .= html_writer::end_tag('div');
     // End .panel.
     return $content;
 }
Esempio n. 8
0
 protected function coursecat_coursebox_content(coursecat_helper $chelper, $course, $type = 1)
 {
     global $CFG, $OUTPUT, $PAGE;
     if ($chelper->get_show_courses() < self::COURSECAT_SHOW_COURSES_EXPANDED) {
         return '';
     }
     if ($course instanceof stdClass) {
         require_once $CFG->libdir . '/coursecatlib.php';
         $course = new course_in_list($course);
     }
     $content = '';
     // Display course overview files.
     $contentimages = '';
     $contentfiles = '';
     foreach ($course->get_course_overviewfiles() as $file) {
         $isimage = $file->is_valid_image();
         $url = file_encode_url("{$CFG->wwwroot}/pluginfile.php", '/' . $file->get_contextid() . '/' . $file->get_component() . '/' . $file->get_filearea() . $file->get_filepath() . $file->get_filename(), !$isimage);
         if ($isimage) {
             if ($type == 1) {
                 $contentimages .= html_writer::start_tag('div', array('class' => 'courseimage'));
                 $link = new moodle_url('/course/view.php', array('id' => $course->id));
                 $contentimages .= html_writer::link($link, html_writer::empty_tag('img', array('src' => $url)));
                 $contentimages .= html_writer::end_tag('div');
             } else {
                 $contentimages .= "<div class='cimbox' style='background: #FFF url({$url}) no-repeat center center; background-size: contain;'></div>";
             }
         } else {
             $image = $this->output->pix_icon(file_file_icon($file, 24), $file->get_filename(), 'moodle');
             $filename = html_writer::tag('span', $image, array('class' => 'fp-icon')) . html_writer::tag('span', $file->get_filename(), array('class' => 'fp-filename'));
             $contentfiles .= html_writer::tag('span', html_writer::link($url, $filename), array('class' => 'coursefile fp-filename-icon'));
         }
     }
     if (strlen($contentimages) == 0 && $type == 2) {
         // Default image
         $url = $PAGE->theme->setting_file_url('frontpagerendererdefaultimage', 'frontpagerendererdefaultimage');
         $contentimages .= "<div class='cimbox' style='background: #FFF url({$url}) no-repeat center center; background-size: contain;'></div>";
     }
     $content .= $contentimages . $contentfiles;
     if ($type == 2) {
         $content .= $this->coursecat_coursebox_enrolmenticons($course);
     }
     if ($type == 2) {
         $content .= html_writer::start_tag('div', array('class' => 'coursebox-content'));
         $coursename = $chelper->get_course_formatted_name($course);
         $content .= html_writer::tag('h3', html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)), $coursename, array('class' => $course->visible ? '' : 'dimmed', 'title' => $coursename)));
     }
     $content .= html_writer::start_tag('div', array('class' => 'summary'));
     if (isset($coursename)) {
         $content .= html_writer::tag('p', html_writer::tag('b', $coursename));
     }
     // Display course summary.
     if ($course->has_summary()) {
         $summs = $chelper->get_course_formatted_summary($course, array('overflowdiv' => false, 'noclean' => true, 'para' => false));
         $summs = strip_tags($summs);
         $truncsum = strlen($summs) > 70 ? substr($summs, 0, 70) . "..." : $summs;
         $content .= html_writer::tag('span', $truncsum, array('title' => $summs));
     }
     // Display course contacts. See course_in_list::get_course_contacts().
     if ($course->has_course_contacts()) {
         $content .= html_writer::start_tag('ul', array('class' => 'teachers'));
         foreach ($course->get_course_contacts() as $userid => $coursecontact) {
             $name = $coursecontact['rolename'] . ': ' . html_writer::link(new moodle_url('/user/view.php', array('id' => $userid, 'course' => SITEID)), $coursecontact['username']);
             $content .= html_writer::tag('li', $name);
         }
         $content .= html_writer::end_tag('ul');
         // Teachers.
     }
     $content .= html_writer::end_tag('div');
     // Summary.
     // Display course category if necessary (for example in search results).
     if ($chelper->get_show_courses() == self::COURSECAT_SHOW_COURSES_EXPANDED_WITH_CAT) {
         require_once $CFG->libdir . '/coursecatlib.php';
         if ($cat = coursecat::get($course->category, IGNORE_MISSING)) {
             $content .= html_writer::start_tag('div', array('class' => 'coursecat'));
             $content .= get_string('category') . ': ' . html_writer::link(new moodle_url('/course/index.php', array('categoryid' => $cat->id)), $cat->get_formatted_name(), array('class' => $cat->visible ? '' : 'dimmed'));
             $content .= html_writer::end_tag('div');
             // Coursecat.
         }
     }
     if ($type == 2) {
         $content .= html_writer::end_tag('div');
     }
     $content .= html_writer::tag('div', '', array('class' => 'boxfooter'));
     // Coursecat.
     return $content;
 }
        else
        $classes .=' odd';
        $content = html_writer::start_tag('div', array(
            'class' => $classes,
            'data-courseid' => $course->id,
            'data-type' => 1,
        ));

        if ($course instanceof stdClass) {
            require_once($CFG->libdir. '/coursecatlib.php');
            $course = new course_in_list($course);
        }
        $content .= html_writer::start_tag('div', array('class' => 'info'));
            
        // course name
        $coursename = $chelper->get_course_formatted_name($course);
        $coursenamelink = html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)),
                                            $coursename, array('class' => $course->visible ? '' : 'dimmed'));
        $content .= html_writer::tag($nametag, $coursenamelink, array('class' => 'coursename'));        
        $category = coursecat::get($course->category);
         //echo  $renderer->course_listitem_actions($category,$course);
        $actions = \core_course\management\helper::get_course_listitem_actions($category, $course);
        if (empty($actions)) {
            return '';
        }
        $actionshtml = array();
        $actionshtml[] = html_writer::link(new moodle_url('/local/mass_enroll/mass_enroll.php',array('id'=>$course->id)),html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/groups'), 'title' => 'Bulk enroll', 'alt' => 'Bulk enroll', 'class' => 'iconsmall'))); 
        $actionshtml[] = html_writer::link(new moodle_url('/local/costcenter/course_enrol.php',array('id'=>$course->id,'enrolid'=>$DB->get_field('enrol','id',array('enrol'=>'manual','courseid'=>$course->id)))),html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/enrolusers'), 'title' => get_string('enrolusers','enrol'), 'alt' => get_string('enrolusers','enrol'), 'class' => 'iconsmall'))); 
        foreach ($actions as $action) {
            $action['attributes']['role'] = 'button';
            if($action['icon']->attributes['title']=== 'Edit' || $action['icon']->attributes['title']=== 'Delete')