测验尝试页面上每个角色的Moodle块可见性

问题描述 投票:1回答:1

我一直在成功地关注this教程并创建了一个小的自定义块。

我需要这个块显示在maths quiz / attempt.php页面上,但我有两个问题。

  • 该块显示为admin用户,但不显示给学生
  • 如何仅在选定的测验中显示块:e数学而不是英语测验 码:

class block_customfeedback extends block_base {
    public function init() {
        $this->title = get_string('customfeedback', 'block_customfeedback');
    }

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

        $form .= "<form action='http://www.remoteserver.com/response.php' method='post'>";
        $form .= "<label>Question ID</label>    <input name='QuestionID' id='questionid' type='text' />";
        $form .= "<label>Quiz Name</label>      <input name='QuizName' id='quizname' type='text' />";
        $form .= "<label>Your Feedback</label>  <textarea name='Feedback' id='feedback' type='text' ></textarea>";
        $form .= "<input type='submit' value='Submit' />";
        $form .= "</form>";

        $this->content         =  new stdClass;
        $this->content->text   = $form;
        // $this->content->footer = 'Footer here...';

        return $this->content;
    }

    public function applicable_formats() {
        return array(
            'all'   => true
        );
    }

} // close class
plugins block moodle
1个回答
0
投票

您可以在测验尝试页面上显示您的块。

脚步:

  1. 转到您的测验设置页面。
  2. 点击外观
  3. 点击显示更多
  4. 将“在测验尝试期间显示块”的值更改为“是”。

现在登录学生并检查。

© www.soinside.com 2019 - 2024. All rights reserved.