/**
  * Renders the destination stage screen
  *
  * @param core_backup_renderer $renderer renderer instance to use
  * @return string HTML code
  */
 public function display(core_backup_renderer $renderer)
 {
     $format = backup_general_helper::detect_backup_format($this->filepath);
     if ($format === backup::FORMAT_MOODLE) {
         // Standard Moodle 2 format, let use get the type of the backup.
         $details = backup_general_helper::get_backup_information($this->filepath);
         if ($details->type === backup::TYPE_1COURSE) {
             $wholecourse = true;
         } else {
             $wholecourse = false;
         }
     } else {
         // Non-standard format to be converted. We assume it contains the
         // whole course for now. However, in the future there might be a callback
         // to the installed converters.
         $wholecourse = true;
     }
     $nextstageurl = new moodle_url('/backup/restore.php', array('contextid' => $this->contextid, 'filepath' => $this->filepath, 'stage' => restore_ui::STAGE_SETTINGS));
     $context = context::instance_by_id($this->contextid);
     if ($context->contextlevel == CONTEXT_COURSE and has_capability('moodle/restore:restorecourse', $context)) {
         $currentcourse = $context->instanceid;
     } else {
         $currentcourse = false;
     }
     return $renderer->course_selector($nextstageurl, $wholecourse, $this->categorysearch, $this->coursesearch, $currentcourse);
 }
 /**
  *
  * @global moodle_database $DB
  * @param core_backup_renderer $renderer
  * @return string
  */
 public function display($renderer)
 {
     global $DB, $USER, $PAGE;
     $format = backup_general_helper::detect_backup_format($this->filepath);
     if ($format !== 'moodle2') {
         return $renderer->invalid_format($format);
     }
     $this->details = backup_general_helper::get_backup_information($this->filepath);
     $url = new moodle_url('/backup/restore.php', array('contextid' => $this->contextid, 'filepath' => $this->filepath, 'stage' => restore_ui::STAGE_SETTINGS));
     $context = get_context_instance_by_id($this->contextid);
     $currentcourse = $context->contextlevel == CONTEXT_COURSE && has_capability('moodle/restore:restorecourse', $context) ? $context->instanceid : false;
     $html = $renderer->course_selector($url, $this->details, $this->categorysearch, $this->coursesearch, $currentcourse);
     return $html;
 }