/**
  * Renders an import course search object
  *
  * @param import_course_search $component
  * @return string
  */
 public function render_import_course_search(import_course_search $component)
 {
     $url = $component->get_url();
     $output = html_writer::start_tag('div', array('class' => 'import-course-search'));
     if ($component->get_count() === 0) {
         $output .= $this->output->notification(get_string('nomatchingcourses', 'backup'));
         $output .= html_writer::start_tag('div', array('class' => 'ics-search'));
         $output .= html_writer::empty_tag('input', array('type' => 'text', 'name' => restore_course_search::$VAR_SEARCH, 'value' => $component->get_search()));
         $output .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'searchcourses', 'value' => get_string('search')));
         $output .= html_writer::end_tag('div');
         $output .= html_writer::end_tag('div');
         return $output;
     }
     $countstr = '';
     if ($component->has_more_results()) {
         $countstr = get_string('morecoursesearchresults', 'backup', $component->get_count());
     } else {
         $countstr = get_string('totalcoursesearchresults', 'backup', $component->get_count());
     }
     $output .= html_writer::tag('div', $countstr, array('class' => 'ics-totalresults'));
     $output .= html_writer::start_tag('div', array('class' => 'ics-results'));
     $table = new html_table();
     $table->head = array('', get_string('shortnamecourse'), get_string('fullnamecourse'));
     $table->data = array();
     foreach ($component->get_results() as $course) {
         $row = new html_table_row();
         $row->attributes['class'] = 'ics-course';
         if (!$course->visible) {
             $row->attributes['class'] .= ' dimmed';
         }
         $row->cells = array(html_writer::empty_tag('input', array('type' => 'radio', 'name' => 'importid', 'value' => $course->id)), format_string($course->shortname, true, array('context' => context_course::instance($course->id))), format_string($course->fullname, true, array('context' => context_course::instance($course->id))));
         $table->data[] = $row;
     }
     if ($component->has_more_results()) {
         $cell = new html_table_cell(get_string('moreresults', 'backup'));
         $cell->colspan = 3;
         $cell->attributes['class'] = 'notifyproblem';
         $row = new html_table_row(array($cell));
         $row->attributes['class'] = 'rcs-course';
         $table->data[] = $row;
     }
     $output .= html_writer::table($table);
     $output .= html_writer::end_tag('div');
     $output .= html_writer::start_tag('div', array('class' => 'ics-search'));
     $output .= html_writer::empty_tag('input', array('type' => 'text', 'name' => restore_course_search::$VAR_SEARCH, 'value' => $component->get_search()));
     $output .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'searchcourses', 'value' => get_string('search')));
     $output .= html_writer::end_tag('div');
     $output .= html_writer::end_tag('div');
     return $output;
 }
 public function render_import_course_search(import_course_search $component)
 {
     $output = '';
     if ($component->get_count() === 0) {
         $output .= bootstrap::alert_error(get_string('nomatchingcourses', 'backup'));
         $output .= html_writer::empty_tag('input', array('type' => 'text', 'name' => restore_course_search::$VAR_SEARCH, 'value' => $component->get_search()));
         $output .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'searchcourses', 'value' => get_string('search')));
         return $output;
     }
     $output .= html_writer::tag('div', get_string('totalcoursesearchresults', 'backup', $component->get_count()), array('class' => 'ics-totalresults'));
     $table = new html_table();
     $table->attributes['class'] = 'table table-striped table-hover';
     $table->head = array('', get_string('shortnamecourse'), get_string('fullnamecourse'));
     $table->data = array();
     foreach ($component->get_results() as $course) {
         $row = new html_table_row();
         $row->attributes['class'] = 'ics-course';
         if (!$course->visible) {
             $row->attributes['class'] .= ' muted';
         }
         $row->cells = array(html_writer::empty_tag('input', array('type' => 'radio', 'name' => 'importid', 'value' => $course->id)), format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id))), format_string($course->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id))));
         $table->data[] = $row;
     }
     $output .= html_writer::table($table);
     $output .= html_writer::empty_tag('input', array('type' => 'text', 'name' => restore_course_search::$VAR_SEARCH, 'value' => $component->get_search()));
     $output .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'searchcourses', 'value' => get_string('search')));
     $output .= html_writer::end_tag('div');
     return $output;
 }