function get_content()
 {
     global $USER, $CFG, $COURSE;
     if ($this->content !== NULL || !isset($COURSE->id) || $COURSE->id == 1) {
         return $this->content;
     }
     $this->content = new stdClass();
     if (!has_capability('block/oppia_mobile_export:addinstance', context_course::instance($COURSE->id))) {
         return $this->content;
     }
     $this->content->text = "<form action='" . $CFG->wwwroot . "/blocks/oppia_mobile_export/export1.php' method='post'>";
     $this->content->text .= "<input type='hidden' name='id' value='" . $COURSE->id . "'>";
     $this->content->text .= "<input type='hidden' name='sesskey' value='" . sesskey() . "'>";
     // show the OppiaServer options
     $servers = get_oppiaservers();
     $this->content->text .= "<p>" . get_string('servers_block_select_connection', 'block_oppia_mobile_export') . "<br/>";
     $this->content->text .= "<select name='server'>";
     foreach ($servers as $s) {
         $this->content->text .= "<option value='{$s->id}' ";
         if ($s->defaultserver != 0) {
             $this->content->text .= "selected='selected'";
         }
         $this->content->text .= ">" . $s->servername . " (" . $s->username . ")</option>";
     }
     if (count($servers) == 0) {
         $this->content->text .= "<option value='default' selected='selected'>" . $CFG->block_oppia_mobile_export_default_server . "</option>";
     }
     $this->content->text .= "</select></p>";
     $this->content->text .= "<p>" . get_string('servers_block_add', 'block_oppia_mobile_export', $CFG->wwwroot . "/blocks/oppia_mobile_export/servers.php") . "</p>";
     // Show the style options
     if ($handle = opendir(dirname(__FILE__) . '/styles/')) {
         $this->content->text .= "<p>" . get_string('oppia_block_style', 'block_oppia_mobile_export') . "<br/>";
         $this->content->text .= "<select name='stylesheet'>";
         while (false !== ($file = readdir($handle))) {
             if ($file != "." && $file != ".." && !is_dir(dirname(__FILE__) . '/styles/' . $file)) {
                 $this->content->text .= "<option value='" . $file . "'>" . $file . "</option>";
             }
         }
         $this->content->text .= "</select>";
         $this->content->text .= "</p>";
     }
     $this->content->text .= "<p><input type='submit' name='submit' value='" . get_string('oppia_block_export_button', 'block_oppia_mobile_export') . "'>";
     $this->content->text .= "</form>";
     $this->content->text .= "<form action='" . $CFG->wwwroot . "/blocks/oppia_mobile_export/export2print.php' method='post'>";
     $this->content->text .= "<input type='hidden' name='courseid' value='" . $COURSE->id . "'>";
     $this->content->text .= "<input type='hidden' name='sesskey' value='" . sesskey() . "'>";
     if ($handle = opendir(dirname(__FILE__) . '/styles/')) {
         $this->content->text .= "<p>" . get_string('oppia_block_style', 'block_oppia_mobile_export') . "<br/>";
         $this->content->text .= "<select name='stylesheet'>";
         while (false !== ($file = readdir($handle))) {
             if ($file != "." && $file != ".." && !is_dir(dirname(__FILE__) . '/styles/' . $file)) {
                 $this->content->text .= "<option value='" . $file . "'>" . $file . "</option>";
             }
         }
         $this->content->text .= "</select>";
         $this->content->text .= "</p>";
     }
     $this->content->text .= "<input type='submit' name='submit' value='" . get_string('oppia_block_export2print_button', 'block_oppia_mobile_export') . "'>";
     $this->content->text .= "</form></p>";
     $this->content->footer = '<a href="https://digital-campus.org/oppiamobile/overview/">OppiaMobile</a>';
     if (empty($this->instance)) {
         return $this->content;
     }
     return $this->content;
 }
$serverform = new oppiaserver_form();
if ($serverform->is_cancelled()) {
    // do nothing
} else {
    if ($fromform = $serverform->get_data()) {
        $record = new stdClass();
        $record->servername = $fromform->server_ref;
        $record->url = $fromform->server_url;
        $record->moodleuserid = $USER->id;
        $record->username = $fromform->server_username;
        $record->apikey = $fromform->server_apikey;
        $DB->insert_record('block_oppia_mobile_server', $record, false);
    }
}
// get users current servers
$servers = get_oppiaservers();
echo "<h2>" . get_string('servers_current', 'block_oppia_mobile_export') . "</h2>";
if (count($servers) == 0) {
    echo "<p>" . get_string('servers_none', 'block_oppia_mobile_export') . "</p>";
} else {
    echo "<ul>";
    foreach ($servers as $s) {
        echo "<li>";
        echo $s->servername;
        echo " (<a href='" . $s->url . "' target='_blank'>" . $s->url . "</a> - " . $s->username . ":" . $s->apikey . ")";
        echo "</li>";
    }
    echo "</ul>";
}
echo "<h2>" . get_string('servers_add', 'block_oppia_mobile_export') . "</h2>";
$serverform->display();