Moodle 数据库中的教师表示

Teacher representation in Moodle database

我想知道在庞大的 Moodle DB 中如何表示讲师。具体tablewith属性列在哪里存储每个老师的数据?

虽然有类似上图的相关内容,但我需要一些描述老师的内容table。

有什么想法吗?

图片取自:http://www.examulator.com/er/

Moodle 具有以下默认原型,供您称为讲师;

  • 经理
  • 课程创建者
  • 编辑老师
  • 老师

可以在特定上下文(例如课程或课程类别)中为用户分配这些角色之一。

数据库跨多个表存储教师数据。查看您显示的数据库模式图,您要查找的表在角色分组中。具体作用和role_assignments。通过将这些表与用户、上下文和课程表链接起来,您可以找到与课程关联的员工。

获取与特定课程关联的员工的示例函数是

function get_course_staff($courseid) {
    global $DB;

    $sql = "SELECT u.firstname,
                   u.lastname
              FROM {role_assignments} ra
             WHERE c.contextlevel = 50 // Numeric value of the course context
               AND c.instanceid = ?
               AND r.id < 5
              JOIN {role} r ON ra.roleid = r.id
              JOIN {user} u ON ra.userid = u.id
              JOIN {context} c ON ra.contextid = c.id
              JOIN {course} co ON c.instanceid = co.id
          ORDER BY r.sortorder ASC";
    return $DB->get_records_sql($sql, array($courseid));
}

一个角色可以分配给多个用户。 一个用户可以有多个角色。 用户在特定上下文中被分配角色。