Hello,
We need to customize the unique code like some text and number(ABC0001).
i am trying from 2 weeks i am not getting where to change the code and what to change.
Can anyone help me? I am using moodle 3.1
Thank you
Hi,
Not sure exactly what you want and why, but it is not simple.
Are you saying that you want to assign some alpha-numeric string to every certificate and after that to add a number which increments up 1 every time that certificate is issued. For example the 5th certificate issued in Biology101 might read BIO101-1005.
Guessing that will require two new fields associated with the certificate tables, modification of the certificate settings for the initial printed alpha string and some more php code to add the incremental numeric string. Not simple.
Perhaps your goal is to have a course name and an unique number (no letters) following it, which is printed on the certificate. You could use the existing custom field for the alpha string and see how to print the certificate id from the mysql database. I don't know how to print the mysql id for a certificate. I believe the certificate module assigns a site wide unique certificate id every time it creates a certificate. This id is not based upon the course or the certificate activity.
Not sure this was any help,
Chris
Hi Chris,
Thank you for your time. We need to issue certificate with some alpha numeric as you mentioned above. When students complete the quiz the certificate we are issuing should contain unique id such as BIO-0001 and it should auto increment for the next certificate as BIO-0002.. I have some knowledge on PHP and sql.
Thank You
Hi,
Ya you are correct. Please let me know how to create the auto generation of index number.
Thank You
Hi,
If it was in access, I would rewrite certificate_generate_code().
There are two tables: certificate and certificate_issues. Initially, I would not edit the function certificate_get_code in locallib.php. I believe you want to edit the locallib.php file's function certificate_generate_code().
To generate the next sequential number using Access, I would do a countif of the certificate id in the certificate_issues table. If the count was zero, then I would assign it the starting number, say 1001, else add the count+1001 and put that as a string variable called "nextnumber". Basically the new "code" is the customtext field from the matching id in the certificate table and "nextnumber" as the new code string. This should be a unique string.
Again, I do not program in php. I would be playing around on a localhost.
Did you try something like the above.
Chris