Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 99... Línea 99...
99
     * The the URL to use for actions relating to this preview.
99
     * The the URL to use for actions relating to this preview.
100
     *
100
     *
101
     * @param int $questionid the question being previewed
101
     * @param int $questionid the question being previewed
102
     * @param int $qubaid the id of the question usage for this preview
102
     * @param int $qubaid the id of the question usage for this preview
103
     * @param question_preview_options $options the options in use
103
     * @param question_preview_options $options the options in use
104
     * @param context $context context for the question preview
104
     * @param context $context module context for the question preview
105
     * @param moodle_url $returnurl url of the page to return to
105
     * @param moodle_url $returnurl url of the page to return to
106
     * @param int|null $restartversion version of the question to use when next restarting the preview.
106
     * @param int|null $restartversion version of the question to use when next restarting the preview.
107
     * @return moodle_url
107
     * @return moodle_url
108
     */
108
     */
109
    public static function question_preview_action_url($questionid, $qubaid,
109
    public static function question_preview_action_url($questionid, $qubaid,
110
            question_preview_options $options, $context, $returnurl = null, $restartversion = null): moodle_url {
110
            question_preview_options $options, $context, $returnurl = null, $restartversion = null): moodle_url {
111
        $params = [
111
        $params = [
112
                'id' => $questionid,
112
                'id' => $questionid,
113
                'previewid' => $qubaid,
113
                'previewid' => $qubaid,
114
        ];
114
        ];
-
 
115
 
115
        if ($context->contextlevel == CONTEXT_MODULE) {
116
        if ($context->contextlevel !== CONTEXT_MODULE) {
116
            $params['cmid'] = $context->instanceid;
-
 
117
        } else if ($context->contextlevel == CONTEXT_COURSE) {
117
            debugging("Invalid contextlevel: {$context->contextlevel} must be CONTEXT_MODULE");
118
            $params['courseid'] = $context->instanceid;
-
 
119
        }
118
        }
-
 
119
 
-
 
120
        $params['cmid'] = $context->instanceid;
-
 
121
 
120
        if ($returnurl !== null) {
122
        if ($returnurl !== null) {
121
            $params['returnurl'] = $returnurl;
123
            $params['returnurl'] = $returnurl;
122
        }
124
        }
123
        if ($restartversion !== null) {
125
        if ($restartversion !== null) {
124
            $params['restartversion'] = $restartversion;
126
            $params['restartversion'] = $restartversion;
Línea 129... Línea 131...
129
 
131
 
130
    /**
132
    /**
131
     * The the URL to use for actions relating to this preview.
133
     * The the URL to use for actions relating to this preview.
132
     *
134
     *
133
     * @param int $questionid the question being previewed
135
     * @param int $questionid the question being previewed
134
     * @param context $context the current moodle context
136
     * @param context $context the current moodle module context
135
     * @param int $previewid optional previewid to sign post saved previewed answers
137
     * @param int $previewid optional previewid to sign post saved previewed answers
136
     * @param moodle_url $returnurl url of the page to return to
138
     * @param moodle_url $returnurl url of the page to return to
137
     * @return moodle_url
139
     * @return moodle_url
138
     */
140
     */
139
    public static function question_preview_form_url($questionid, $context, $previewid = null, $returnurl = null): moodle_url {
141
    public static function question_preview_form_url($questionid, $context, $previewid = null, $returnurl = null): moodle_url {
140
        $params = [
142
        $params = [
141
                'id' => $questionid,
143
                'id' => $questionid,
-
 
144
        ];
142
        ];
145
 
143
        if ($context->contextlevel == CONTEXT_MODULE) {
-
 
144
            $params['cmid'] = $context->instanceid;
146
        if ($context->contextlevel !== CONTEXT_MODULE) {
145
        } else if ($context->contextlevel == CONTEXT_COURSE) {
-
 
146
            $params['courseid'] = $context->instanceid;
147
            debugging("Invalid contextlevel: {$context->contextlevel} must be CONTEXT_MODULE");
-
 
148
        }
-
 
149
 
-
 
150
        $params['cmid'] = $context->instanceid;
147
        }
151
 
148
        if ($previewid) {
152
        if ($previewid) {
149
            $params['previewid'] = $previewid;
153
            $params['previewid'] = $previewid;
150
        }
154
        }
151
        if ($returnurl !== null) {
155
        if ($returnurl !== null) {