Problem/Motivation
This is a nice module used within the Opigno LMS distribution. We are customizing the distribution and one of the requirements is to have list of certificates on the user's dashboard. It would have been very nice to have a way to prepare this with views. The problem is that such integration is not present for the certificate_* tables.
This way any list of user certificates, class certificates, etc will require quite a lot of custom code.
Proposed resolution
Integrate the module's custom tables data to views through hook_views_data and hook_views_data_alter (needed to add the reverse relationships from nodes and users).
It's pretty stand-alone task - pure feature addition through some hooks.
Remaining tasks
Discussion, patch, etc.
User interface changes
None - extending views UI.
API changes
New feature - API addition.
Data model changes
None. We will just expose the existing data model to be read from views.
Maybe add missing indexes to speed-up db queries.
Comment | File | Size | Author |
---|---|---|---|
#8 | 2751023-snapshot-management.patch | 20.9 KB | djdevin |
Comments
Comment #2
djdevinHi,
There's actually a 3.x version in the works (new) which turns the Certificate templates into Entities (they were nodes before) which is a start towards this functionality.
I think this would only work when "certificate snapshots" were turned on, because then it stores the record of which certificate(s) you received. If you exposed certificate snapshots as an entity too, then you could just relate it with an Entity API relationship and not have to write any custom views code.
For our purposes we use Certificate with the Course module (http://drupal.org/project/course) which provides a transcript of all courses, so that serves as the certificates list, but if you're using something other than Course it makes sense to want to display earned certificates somewhere.
Comment #3
ndobromirov CreditAttribution: ndobromirov commentedHi,
I know that you've moved the issue against version 3, but As Opigno LMS are using version 2 and updates of their dependencies are very, VERY risky... I went with my proposal.
I was then able to make a view that starts from the "User certificates" group in views UI and join with the user and course and providing a download link. Note the configuration that generates only 1 certificate for user/course pair, as otherwise downloads started duplicating the listing entries...
If you need the reverse relationships, you should implement the MY_MODULE_views_data_alter(&$data), and provide them. Examples can be found in views module integration with node.
I have not provided a patch, as this is not the way this should be extended as already stated in #2.
Here is the code that fixed it for me:
Comment #4
PetarB CreditAttribution: PetarB commentedI'm trying to get this to work.
Created a new module, gone to views, saw 'User Certificates' and made a new view:
https://i.imgur.com/stu7Ms2.png
Under 'Relationships' I have 'Certificate course relationship' and 'Certificate owner relationship' chosen.
Not sure what to do next...
Comment #5
PetarB CreditAttribution: PetarB commentedActually, I think I have solved this on a closer reading of the entire thread. I will write up a 'how to' shortly.
Comment #6
dquez9 CreditAttribution: dquez9 as a volunteer commentedHi,
I attempting to create the module above in order to use the solution on my Opigno LMS site.
Is there any other info concerning or tips for assistance in recreation. ?
Were you all successful with the function above?
Comment #7
dquez9 CreditAttribution: dquez9 as a volunteer commentedComment #8
djdevinComment #9
djdevin