/**
 * The the URL to use for actions relating to this preview.
 * @param int $questionid the question being previewed.
 * @param int $qubaid the id of the question usage for this preview.
 * @param question_preview_options $options the options in use.
 */
function question_preview_action_url($questionid, $qubaid, question_preview_options $options, $context)
{
    $params = array('id' => $questionid, 'previewid' => $qubaid);
    if ($context->contextlevel == CONTEXT_MODULE) {
        $params['cmid'] = $context->instanceid;
    } else {
        if ($context->contextlevel == CONTEXT_COURSE) {
            $params['courseid'] = $context->instanceid;
        }
    }
    $params = array_merge($params, $options->get_url_params());
    return new moodle_url('/question/preview.php', $params);
}
예제 #2
0
/**
 * The the URL to use for actions relating to this preview.
 * @param int $questionid the question being previewed.
 * @param int $qubaid the id of the question usage for this preview.
 * @param question_preview_options $options the options in use.
 */
function question_preview_action_url($questionid, $qubaid,
        question_preview_options $options) {
    $params = array(
        'id' => $questionid,
        'previewid' => $qubaid,
    );
    $params = array_merge($params, $options->get_url_params());
    return new moodle_url('/question/preview.php', $params);
}