Aquesta pàgina forma part de la documentació de Moodle en català, tot i que no ha estat traduïda encara. Podeu contribuir obertament a les tasques de traducció. Podeu consultar la Guia d'edició de la documentació i també participar ens els debats del fòrum de traductors de la documentació a moodle.org

course display

De MoodleDocs
La revisió el 11:54, 22 set 2010 per Nadav Kavalerchik (discussió | contribucions) (New page: an old way to get roles of users in a course. (as far as i can understand the code, it is deprecated) and as suggested by Tim Hunt: mdl_course_display is wrong. You need role_assignmen...)
(dif.) ← Versió més antiga | Versió actual (dif.) | Versió més nova → (dif.)
Salta a:navegació, cerca

an old way to get roles of users in a course.

(as far as i can understand the code, it is deprecated)

and as suggested by Tim Hunt:

mdl_course_display is wrong. You need role_assignments, which means you also need contexts. Something like

SELECT * FROM mdl_user u
JOIN mdl_role_assignments ra ON ra.userid = u.id
JOIN mdl_role r ON ra.roleid = r.id
JOIN mdl_context con ON ra.contextid = con.id
JOIN mdl_course c ON c.id = con.instanceid AND con.contextlevel = 50
WHERE r.shortname = 'student' AND c.id = XXX

will get you all the students in a course. mdl_context.instanceid points to different things depending on mdl_context.contextlevel. 50 means course, the other levels can be looked up in the accesslib.php code here, For example, mdl_context.contextlevel 70 is modules, then instanceid points to the mdl_course_modules table.

If you really want to understand this, you need to read the Development:Roles documentation.