如何在显示块的页面上更改默认区域? [英] How to change the default region on the page where the block is displayed?

查看:102
本文介绍了如何在显示块的页面上更改默认区域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想扩展 中的主题,并想更改显示问题(测验)的位置(页面上)

我已经看到了想要扩展的主题结构.首先,我认为对于包含问题的代码块,必须针对 layout选项(如standardcourse等....所有选项列表此处),它代表测验的页面.

I have seen the structure of the theme I want to extend. Firstly, I believed that I will have to change the default region (from regions like $side-pre and $side-post etc.) for the block containing the question, for the layout option (like front-page, standard, course etc. ... list of all options here) which represents the page for the quiz.

  1. 但是我找不到表示页面的布局选项 在测验中显示问题的地方. 所以有人可以建议 我从链接表中应该选择哪个布局选项,在哪里 我可以简单地更改显示问题的区域 (例如,如果问题显示在$side-pre区域中, 我想更改它,使其显示在$side-post中 地区)

  1. But I can't find the layout option which represents the page where a question in a quiz is displayed. So can somebody suggest me from the linked table which layout option should I choose, where I can simply change the region where the question is displayed (e.g. if the question is being displayed in the $side-pre region, I want to change it such that it is displayed in the $side-post region)

还是错误的解决方法?我必须覆盖 问题插件renderer? 如果是这样,我如何找出哪个 渲染器的一部分控制问题的默认区域 会显示块吗?

Or is the the wrong way around it? Shall I have to override the renderer of the question plugin? If so, how can I find out which part of the renderer controls the default-region where the question block will be displayed?

推荐答案

我将使用第二个选项- http://docs.moodle.org/dev/Overriding_a_renderer#Finding_renderers_to_override

I would use the second option - http://docs.moodle.org/dev/Overriding_a_renderer#Finding_renderers_to_override

总结

创建包含2个文件的主题目录

create a theme directory with 2 files

theme/overridetest/config.php
theme/overridetest/renderers.php

在config.php中

In config.php

$THEME->name = 'overridetest';
$THEME->parents = array('standard', 'base');
$THEME->rendererfactory = 'theme_overridden_renderer_factory';

然后在renderers.php中有类似的内容,我不确定要覆盖哪个函数,因此以view_page为例

Then in renderers.php have something like this, I'm not sure which function to override so have picked view_page as an example

class theme_overridetest_core_renderer extends core_renderer {

}

include_once($CFG->dirroot . '/mod/quiz/renderer.php');

class theme_overridetest_mod_quiz_renderer extends mod_quiz_renderer {

    public function view_page($course, $quiz, $cm, $context, $viewobj) {
        $output = '';
        // Change the output here.
        return $output;
    }
}

这篇关于如何在显示块的页面上更改默认区域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆