public function get_content()

in block_microsoft.php [59:95]


    public function get_content() {
        global $USER, $DB;

        if (!isloggedin()) {
            return null;
        }

        if ($this->content !== null) {
            return $this->content;
        }

        $this->content = new stdClass();
        $this->content->text = '';
        $this->content->footer = '';

        try {
            $o365connected = \local_o365\utils::is_o365_connected($USER->id);
            if ($o365connected === true) {
                $this->content->text .= $this->get_user_content_connected();
            } else {
                $connection = $DB->get_record('local_o365_connections', ['muserid' => $USER->id]);
                if (!empty($connection) && (auth_oidc_connectioncapability($USER->id, 'connect') ||
                        local_o365_connectioncapability($USER->id, 'link'))) {
                    $uselogin = (!empty($connection->uselogin)) ? true : false;
                    $this->content->text .= $this->get_user_content_matched($connection->aadupn, $uselogin);
                } else {
                    $this->content->text .= $this->get_user_content_not_connected();
                }
            }

            $this->content->text .= $this->get_course_content();
        } catch (\Exception $e) {
            $this->content->text = $e->getMessage();
        }

        return $this->content;
    }