About the Registration number for the student

About the Registration number for the student

Pietro Marafiga Monteiro -
回帖数:3

Hi, people

I will explain my problem. I'm learning SQL to perform queries in the database that returns the registration number of the students for a specific course.

Using this, for example:

SELECT rs.id,
u.firstname,
u.lastname
FROM mdl_role_assignments rs
INNER JOIN mdl_user u
ON u.id = rs.userid
INNER JOIN mdl_context e
ON rs.contextid = e.id
WHERE e.contextlevel = 50
AND rs.roleid = 5
AND e.instanceid = 26

 

Where "26" is the course ID that I want. Very well. I alredy know the number using this query.

But how the student will know his own number?

I had the idea of write a PHP script in somewhere in Moodle, when the student logs in, the number is printed in a block or something like that. But I don't have idea where to put the PHP piece of code and what piece of code would be! (I'm designer, not a developer, but I'm learning)   =)

 

As a suggestion to Moodle developer team, I really would appreciate if Moodle has a built in resource that provides a registration number by default for the student.

Thanks and sorry by my english.

- best regards from Brazil!

回复Pietro Marafiga Monteiro

Re: About the Registration number for the student

Hubert Chathi -
The record IDs are meant for internal use only, and users should (normally) not need to worry about the IDs, especially not the role assignment ID. Perhaps if you explain what you are trying to do, there may be a better way to do what you want.
回复Hubert Chathi

Re: About the Registration number for the student

Pietro Marafiga Monteiro -

Just a example:

When we are registered in a school or a college we receceive a unique number. A special number that identifies us in the institution, right?

The students in my system require a number like this.

Got the idea?

回复Pietro Marafiga Monteiro

Re: About the Registration number for the student

Patrick Pollet -

I guess you are talking about Moodle's field named idnumber that is present at least in courses and user tables. Moodle stores it but never use it.

You can set it manually when editing user's profile, or by enrolment plugins, such as the flatfile one or get it by synching accounts against an LDAP directory.

See http://www.installationwiki.org/Moodle#Enrolment_Choices

But you may have to patch Moodle code to display it in user's profile and in some other pages.

Cheers.

Edit : a Google search Moodle idnumber should give you quite a lot of solutions.