Whoops! There was an error.
core \ exception \ moodle_exception
No guests here! core\exception\moodle_exception thrown with message "No guests here!" Stacktrace: #10 core\exception\moodle_exception in /home/kurse.mos-muenchen.de/public_html/public/lib/filelib.php:336 #9 file_get_unused_draft_itemid in /home/kurse.mos-muenchen.de/public_html/public/lib/form/filepicker.php:138 #8 MoodleQuickForm_filepicker:toHtml in /home/kurse.mos-muenchen.de/public_html/public/lib/pear/HTML/QuickForm/Renderer/Tableless.php:192 #7 HTML_QuickForm_Renderer_Tableless:renderElement in /home/kurse.mos-muenchen.de/public_html/public/lib/formslib.php:3514 #6 MoodleQuickForm_Renderer:renderElement in /home/kurse.mos-muenchen.de/public_html/public/lib/pear/HTML/QuickForm/element.php:432 #5 HTML_QuickForm_element:accept in /home/kurse.mos-muenchen.de/public_html/public/lib/pear/HTML/QuickForm.php:1644 #4 HTML_QuickForm:accept in /home/kurse.mos-muenchen.de/public_html/public/lib/formslib.php:2140 #3 MoodleQuickForm:accept in /home/kurse.mos-muenchen.de/public_html/public/lib/pear/HTML/QuickForm.php:1687 #2 HTML_QuickForm:toHtml in /home/kurse.mos-muenchen.de/public_html/public/lib/pear/HTML/Common.php:445 #1 HTML_Common:display in /home/kurse.mos-muenchen.de/public_html/public/lib/formslib.php:1048 #0 moodleform:display in /home/kurse.mos-muenchen.de/public_html/public/local/audiotranscribe/index.php:56
Stack frames (11)
10
core\exception\moodle_exception
/public/lib/filelib.php336
9
file_get_unused_draft_itemid
/public/lib/form/filepicker.php138
8
MoodleQuickForm_filepicker toHtml
/public/lib/pear/HTML/QuickForm/Renderer/Tableless.php192
7
HTML_QuickForm_Renderer_Tableless renderElement
/public/lib/formslib.php3514
6
MoodleQuickForm_Renderer renderElement
/public/lib/pear/HTML/QuickForm/element.php432
5
HTML_QuickForm_element accept
/public/lib/pear/HTML/QuickForm.php1644
4
HTML_QuickForm accept
/public/lib/formslib.php2140
3
MoodleQuickForm accept
/public/lib/pear/HTML/QuickForm.php1687
2
HTML_QuickForm toHtml
/public/lib/pear/HTML/Common.php445
1
HTML_Common display
/public/lib/formslib.php1048
0
moodleform display
/public/local/audiotranscribe/index.php56
/home/kurse.mos-muenchen.de/public_html/public/lib/filelib.php
    }
 
    return $data;
}
 
/**
 * Generate a draft itemid
 *
 * @category files
 * @global moodle_database $DB
 * @global stdClass $USER
 * @return int a random but available draft itemid that can be used to create a new draft
 * file area.
 */
function file_get_unused_draft_itemid() {
    global $DB, $USER;
 
    if (isguestuser() or !isloggedin()) {
        // guests and not-logged-in users can not be allowed to upload anything!!!!!!
        throw new \moodle_exception('noguest');
    }
 
    $contextid = context_user::instance($USER->id)->id;
 
    $fs = get_file_storage();
    $draftitemid = rand(1, 999999999);
    while ($files = $fs->get_area_files($contextid, 'user', 'draft', $draftitemid)) {
        $draftitemid = rand(1, 999999999);
    }
 
    return $draftitemid;
}
 
/**
 * Initialise a draft file area from a real one by copying the files. A draft
 * area will be created if one does not already exist. Normally you should
 * get $draftitemid by calling file_get_submitted_draft_itemid('elementname');
 *
 * @category files
 * @global stdClass $CFG
/home/kurse.mos-muenchen.de/public_html/public/lib/form/filepicker.php
            return 'default';
        }
    }
 
    /**
     * Returns HTML for filepicker form element.
     *
     * @return string
     */
    function toHtml() {
        global $CFG, $COURSE, $USER, $PAGE, $OUTPUT;
        $id     = $this->_attributes['id'];
        $elname = $this->_attributes['name'];
 
        if ($this->_flagFrozen) {
            return $this->getFrozenHtml();
        }
        if (!$draftitemid = (int)$this->getValue()) {
            // no existing area info provided - let's use fresh new draft area
            $draftitemid = file_get_unused_draft_itemid();
            $this->setValue($draftitemid);
        }
 
        if ($COURSE->id == SITEID) {
            $context = context_system::instance();
        } else {
            $context = context_course::instance($COURSE->id);
        }
 
        $client_id = uniqid();
 
        $args = new stdClass();
        // need these three to filter repositories list
        $args->accepted_types = $this->_options['accepted_types']?$this->_options['accepted_types']:'*';
        $args->return_types = $this->_options['return_types'];
        $args->itemid = $draftitemid;
        $args->maxbytes = $this->_options['maxbytes'];
        $args->context = $PAGE->context;
        $args->buttonname = $elname.'choose';
        $args->elementid = $id;
/home/kurse.mos-muenchen.de/public_html/public/lib/pear/HTML/QuickForm/Renderer/Tableless.php
    function renderElement(&$element, $required, $error)
    {
        // if the element name indicates the end of a fieldset, close the fieldset
        if (   in_array($element->getName(), $this->_stopFieldsetElements)
            && $this->_fieldsetsOpen > 0
           ) {
            $this->_html .= $this->_closeFieldsetTemplate;
            $this->_fieldsetsOpen--;
        }
        // if no fieldset was opened, we need to open a hidden one here to get
        // XHTML validity
        if ($this->_fieldsetsOpen === 0) {
            $this->_html .= $this->_openHiddenFieldsetTemplate;
            $this->_fieldsetsOpen++;
        }
        if (!$this->_inGroup) {
            $html = $this->_prepareTemplate($element->getName(), $element->getLabel(), $required, $error);
            // the following lines (until the "elseif") were changed / added
            // compared to the default renderer
            $element_html = $element->toHtml();
            if (!is_null($element->getAttribute('id'))) {
                $id = $element->getAttribute('id');
            } else {
                $id = $element->getName();
            }
            if (!empty($id) and !is_a($element, 'MoodleQuickForm_group') and !is_a($element, 'HTML_QuickForm_static')) { // moodle hack
                $html = str_replace('<label', '<label for="' . $id . '"', $html);
                $element_html = preg_replace('#name="' . $id . '#',
                                             'id="' . $id . '" name="' . $id . '',
                                             $element_html,
                                             1);
            }
            $this->_html .= str_replace('{element}', $element_html, $html);
        } elseif (!empty($this->_groupElementTemplate)) {
            $html = str_replace('{label}', $element->getLabel(), $this->_groupElementTemplate);
            if ($required) {
                $html = str_replace('<!-- BEGIN required -->', '', $html);
                $html = str_replace('<!-- END required -->', '', $html);
            } else {
                $html = preg_replace("/([ \t\n\r]*)?<!-- BEGIN required -->(\s|\S)*<!-- END required -->([ \t\n\r]*)?/i", '', $html);
/home/kurse.mos-muenchen.de/public_html/public/lib/formslib.php
            }
        } else {
            if ($this->_inGroup) {
                $this->_groupElementTemplate = $html;
            }
        }
        if (($this->_inGroup) and !empty($this->_groupElementTemplate)) {
            $this->_groupElementTemplate = $html;
        } else if (!isset($this->_templates[$element->getName()])) {
            $this->_templates[$element->getName()] = $html;
        }
 
        // Check if the element should be displayed in the sticky footer.
        if ($element->getName() && ($this->_stickyfooterelement == $element->getName())) {
            $stickyfooter = new core\output\sticky_footer($html);
            $html = $OUTPUT->render($stickyfooter);
        }
 
        if (!$fromtemplate) {
            parent::renderElement($element, $required, $error);
        } else {
            if (in_array($element->getName(), $this->_stopFieldsetElements) && $this->_fieldsetsOpen > 0) {
                $this->_html .= $this->_closeFieldsetTemplate;
                $this->_fieldsetsOpen--;
            }
            $this->_html .= $html;
        }
    }
 
    /**
     * Called when visiting a form, after processing all form elements
     * Adds required note, form attributes, validation javascript and form content.
     *
     * @global moodle_page $PAGE
     * @param MoodleQuickForm $form Passed by reference
     */
    function finishForm(&$form){
        global $PAGE;
        if ($form->isFrozen()){
            $this->_hiddenHtml = '';
/home/kurse.mos-muenchen.de/public_html/public/lib/pear/HTML/QuickForm/element.php
                $this->setValue($arg);
        }
        return true;
    } // end func onQuickFormEvent
 
    // }}}
    // {{{ accept()
 
   /**
    * Accepts a renderer
    *
    * @param object     An HTML_QuickForm_Renderer object
    * @param bool       Whether an element is required
    * @param string     An error message associated with an element
    * @access public
    * @return void 
    */
    function accept(&$renderer, $required=false, $error=null)
    {
        $renderer->renderElement($this, $required, $error);
    } // end func accept
 
    // }}}
    // {{{ _generateId()
 
   /**
    * Automatically generates and assigns an 'id' attribute for the element.
    * 
    * Currently used to ensure that labels work on radio buttons and
    * checkboxes. Per idea of Alexander Radivanovich.
    *
    * @access private
    * @return void 
    */
    function _generateId() {
        if ($this->getAttribute('id')) {
            return;
        }
 
        $id = $this->getName() ?? '';
/home/kurse.mos-muenchen.de/public_html/public/lib/pear/HTML/QuickForm.php
    // }}}
    // {{{ accept()
 
   /**
    * Accepts a renderer
    *
    * @param object     An HTML_QuickForm_Renderer object
    * @since 3.0
    * @access public
    * @return void
    */
    function accept(&$renderer)
    {
        $renderer->startForm($this);
        foreach (array_keys($this->_elements) as $key) {
            $element =& $this->_elements[$key];
            $elementName = $element->getName();
            $required    = ($this->isElementRequired($elementName) && !$element->isFrozen());
            $error       = $this->getElementError($elementName);
            $element->accept($renderer, $required, $error);
        }
        $renderer->finishForm($this);
    } // end func accept
 
    // }}}
    // {{{ defaultRenderer()
 
   /**
    * Returns a reference to default renderer object
    *
    * @access public
    * @since 3.0
    * @return object a default renderer object
    */
    function &defaultRenderer()
    {
        if (!isset($GLOBALS['_HTML_QuickForm_default_renderer'])) {
            include_once('HTML/QuickForm/Renderer/Default.php');
            $GLOBALS['_HTML_QuickForm_default_renderer'] = new HTML_QuickForm_Renderer_Default(); //Moodle: PHP 5.3 compatibility
        }
/home/kurse.mos-muenchen.de/public_html/public/lib/formslib.php
                    }
                } else if ($anyrequiredorerror && (empty($headername) || $this->is_shown($headername))) {
                    // If any error or required field are present within the header, we need to expand it.
                    $this->setExpanded($headername, true, true);
                } else if (!isset($this->_collapsibleElements[$headername])) {
                    // Define element as collapsed by default.
                    $this->setExpanded($headername, false);
                }
            }
 
            // Pass the array to renderer object.
            $renderer->setCollapsibleElements($this->_collapsibleElements);
        }
 
        $this->accept_set_nonvisible_elements($renderer);
 
        if (method_exists($renderer, 'set_sticky_footer') && !empty($this->_stickyfooterelement)) {
            $renderer->set_sticky_footer($this->_stickyfooterelement);
        }
        parent::accept($renderer);
    }
 
    /**
     * Checking non-visible elements to set when accepting a renderer.
     * @param HTML_QuickForm_Renderer $renderer
     */
    private function accept_set_nonvisible_elements($renderer) {
        if (!method_exists($renderer, 'set_nonvisible_elements') || $this->_disableShortforms) {
            return;
        }
        $nonvisibles = [];
        foreach (array_keys($this->_elements) as $index) {
            $element =& $this->_elements[$index];
            if ($element->getType() != 'header') {
                continue;
            }
            $headername = $element->getName();
            if (!$this->is_shown($headername)) {
                $nonvisibles[] = $headername;
            }
/home/kurse.mos-muenchen.de/public_html/public/lib/pear/HTML/QuickForm.php
    // }}}
    // {{{ toHtml ()
 
    /**
     * Returns an HTML version of the form
     *
     * @param string $in_data (optional) Any extra data to insert right
     *               before form is rendered.  Useful when using templates.
     *
     * @return   string     Html version of the form
     * @since     1.0
     * @access   public
     */
    function toHtml ($in_data = null)
    {
        if (!is_null($in_data)) {
            $this->addElement('html', $in_data);
        }
        $renderer =& $this->defaultRenderer();
        $this->accept($renderer);
        return $renderer->toHtml();
    } // end func toHtml
 
    // }}}
    // {{{ getValidationScript()
 
    /**
     * Returns the client side validation script
     *
     * @since     2.0
     * @access    public
     * @return    string    Javascript to perform validation, empty string if no 'client' rules were added
     */
    function getValidationScript()
    {
        if (empty($this->_rules) || empty($this->_attributes['onsubmit'])) {
            return '';
        }
 
        include_once('HTML/QuickForm/RuleRegistry.php');
/home/kurse.mos-muenchen.de/public_html/public/lib/pear/HTML/Common.php
    /**
     * Abstract method.  Must be extended to return the objects HTML
     *
     * @access    public
     * @return    string
     * @abstract
     */
    function toHtml()
    {
        return '';
    } // end func toHtml
 
    /**
     * Displays the HTML to the screen
     *
     * @access    public
     */
    function display()
    {
        print $this->toHtml();
    } // end func display
 
} // end class HTML_Common
?>
 
/home/kurse.mos-muenchen.de/public_html/public/lib/formslib.php
            return $file->get_content();
 
        } else if (isset($_FILES[$elname])) {
            return file_get_contents($_FILES[$elname]['tmp_name']);
        }
 
        return false;
    }
 
    /**
     * Print html form.
     */
    function display() {
        //finalize the form definition if not yet done
        if (!$this->_definition_finalized) {
            $this->_definition_finalized = true;
            $this->definition_after_data();
        }
 
        $this->_form->display();
    }
 
    /**
     * Renders the html form (same as display, but returns the result).
     *
     * Note that you can only output this rendered result once per page, as
     * it contains IDs which must be unique.
     *
     * @return string HTML code for the form
     */
    public function render() {
        ob_start();
        $this->display();
        $out = ob_get_contents();
        ob_end_clean();
        return $out;
    }
 
    /**
     * Form definition. Abstract method - always override!
/home/kurse.mos-muenchen.de/public_html/public/local/audiotranscribe/index.php
        print_error('error:nofile', 'local_audiotranscribe');
    }
    $file = reset($files);
    $content = $file->get_content();
    $filename = $file->get_filename();
    $mimetype = $file->get_mimetype();
    $language = isset($data->language) ? (string)$data->language : 'de';
 
    try {
        $transcript = \local_audiotranscribe\service\stt_client::transcribe_from_content($filename, $content, $mimetype, $language);
    } finally {
        $fs->delete_area_files($context->id, 'local_audiotranscribe', 'upload', 0);
    }
}
 
echo $OUTPUT->header();
 
echo html_writer::tag('h2', get_string('heading', 'local_audiotranscribe'));
 
$mform->display();
 
if (!empty($transcript)) {
    echo html_writer::tag('h3', get_string('result', 'local_audiotranscribe'));
    $ta = html_writer::tag('textarea', s($transcript), ['id' => 'transcript', 'rows' => 16, 'style' => 'width:100%', 'readonly' => 'readonly']);
    $btn = html_writer::tag('button', get_string('copy', 'local_audiotranscribe'), ['type' => 'button', 'id' => 'copybtn', 'class' => 'btn btn-secondary', 'style' => 'margin-top:8px']);
    echo html_writer::div($ta . $btn);
    echo html_writer::tag('script', "(function(){var b=document.getElementById('copybtn');if(!b)return;b.addEventListener('click',function(){var t=document.getElementById('transcript');t.select();t.setSelectionRange(0, 99999);if(navigator.clipboard&&navigator.clipboard.writeText){navigator.clipboard.writeText(t.value).then(function(){b.innerText='" . get_string('copied', 'local_audiotranscribe') . "'; setTimeout(function(){b.innerText='" . get_string('copy', 'local_audiotranscribe') . "';},1500);});}else{document.execCommand('copy');b.innerText='" . get_string('copied', 'local_audiotranscribe') . "'; setTimeout(function(){b.innerText='" . get_string('copy', 'local_audiotranscribe') . "';},1500);}});})();");
}
 
echo $OUTPUT->footer();
 

Environment & details:

Key Value
lang en
empty
empty
Key Value
MoodleSession pos057pgrdh6b0vaarm1usimlg
Key Value
USER stdClass Object ( [id] => 1 [auth] => manual [confirmed] => 1 [policyagreed] => 0 [deleted] => 0 [suspended] => 0 [mnethostid] => 1 [username] => guest [idnumber] => [firstname] => Guest user [lastname] => [email] => root@localhost [emailstop] => 0 [phone1] => [phone2] => [institution] => [department] => [address] => [city] => [country] => [lang] => en [calendartype] => gregorian [theme] => [timezone] => 99 [firstaccess] => 0 [lastaccess] => 0 [lastlogin] => 0 [currentlogin] => 0 [lastip] => [secret] => [picture] => 0 [descriptionformat] => 1 [mailformat] => 1 [maildigest] => 0 [maildisplay] => 2 [autosubscribe] => 1 [trackforums] => 0 [timecreated] => 0 [timemodified] => 1697053809 [trustbitmask] => 0 [imagealt] => [lastnamephonetic] => [firstnamephonetic] => [middlename] => [alternatename] => [moodlenetprofile] => [lastcourseaccess] => Array ( ) [currentcourseaccess] => Array ( ) [profile] => Array ( ) [sesskey] => xmGLyYLUoc [preference] => Array ( ) [autologinguest] => 1 [access] => Array ( [ra] => Array ( [/1] => Array ( [6] => 6 ) ) [time] => 1775032143 [rsw] => Array ( ) ) [enrol] => Array ( [enrolled] => Array ( ) [tempguest] => Array ( ) ) )
SESSION stdClass Object ( [isnewsessioncookie] => 1 [cachestore_session] => Array ( [default_session-core/courseeditorstate] => Array ( ) [default_session-core/navigation_expandcourse] => Array ( [__lastaccess__u1_pos057pgrdh6b0vaarm1usimlg] => Array ( [0] => 1775032143 [1] => 0 ) [u1_pos057pgrdh6b0vaarm1usimlg_91-912bdadf2b510cc2a5362e112b247a8b] => Array ( [0] => 0 [1] => 0 ) [u1_pos057pgrdh6b0vaarm1usimlg_182-912bdadf2b510cc2a5362e112b247a8b] => Array ( [0] => 0 [1] => 0 ) [u1_pos057pgrdh6b0vaarm1usimlg_176-912bdadf2b510cc2a5362e112b247a8b] => Array ( [0] => 0 [1] => 0 ) [u1_pos057pgrdh6b0vaarm1usimlg_175-912bdadf2b510cc2a5362e112b247a8b] => Array ( [0] => 0 [1] => 0 ) [u1_pos057pgrdh6b0vaarm1usimlg_174-912bdadf2b510cc2a5362e112b247a8b] => Array ( [0] => 0 [1] => 0 ) [u1_pos057pgrdh6b0vaarm1usimlg_162-912bdadf2b510cc2a5362e112b247a8b] => Array ( [0] => 0 [1] => 0 ) [u1_pos057pgrdh6b0vaarm1usimlg_154-912bdadf2b510cc2a5362e112b247a8b] => Array ( [0] => 0 [1] => 0 ) [u1_pos057pgrdh6b0vaarm1usimlg_138-912bdadf2b510cc2a5362e112b247a8b] => Array ( [0] => 0 [1] => 0 ) [u1_pos057pgrdh6b0vaarm1usimlg_111-912bdadf2b510cc2a5362e112b247a8b] => Array ( [0] => 0 [1] => 0 ) [u1_pos057pgrdh6b0vaarm1usimlg_106-912bdadf2b510cc2a5362e112b247a8b] => Array ( [0] => 0 [1] => 0 ) [u1_pos057pgrdh6b0vaarm1usimlg_95-912bdadf2b510cc2a5362e112b247a8b] => Array ( [0] => 0 [1] => 0 ) [u1_pos057pgrdh6b0vaarm1usimlg_93-912bdadf2b510cc2a5362e112b247a8b] => Array ( [0] => 0 [1] => 0 ) ) ) [lang] => en )
Key Value
PATH /bin:/usr/bin
HTTP_ACCEPT */*
HTTP_ACCEPT_ENCODING gzip, br, zstd, deflate
HTTP_COOKIE MoodleSession=pos057pgrdh6b0vaarm1usimlg
HTTP_HOST kurse.mos-muenchen.de
HTTP_USER_AGENT Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
DOCUMENT_ROOT /home/kurse.mos-muenchen.de/public_html/public
REMOTE_ADDR 216.73.216.9
REMOTE_PORT 27389
SERVER_ADDR 5.9.20.90
SERVER_NAME kurse.mos-muenchen.de
SERVER_ADMIN s.endlicher@mos-muenchen.de
SERVER_PORT 443
REQUEST_URI /local/audiotranscribe/index.php?lang=en
HTTPS on
X_SPDY HTTP2
SSL_PROTOCOL TLSv1.3
SSL_CIPHER TLS_AES_256_GCM_SHA384
SSL_CIPHER_USEKEYSIZE 256
SSL_CIPHER_ALGKEYSIZE 256
LSWS_EDITION Openlitespeed 1.8.4
X-LSCACHE on,crawler
SCRIPT_FILENAME /home/kurse.mos-muenchen.de/public_html/public/local/audiotranscribe/index.php
QUERY_STRING lang=en
SCRIPT_NAME /local/audiotranscribe/index.php
SERVER_PROTOCOL HTTP/1.1
SERVER_SOFTWARE LiteSpeed
REQUEST_METHOD GET
PHP_SELF /local/audiotranscribe/index.php
REQUEST_TIME_FLOAT 1775032144.0431
REQUEST_TIME 1775032144
empty
0. Whoops\Handler\PrettyPageHandler
1. Whoops\Handler\CallbackHandler