[Building Sakai] Does anyone know the PI I call to get the "Enrolled in" String in this screen shot below?
Schauer, Christopher R
cschauer at txstate.edu
Tue Feb 4 16:22:00 PST 2014
I had to do something similar not too long ago. The way I did it was to check each section using the CourseManagementService.isEnrolled method. Assuming you have a site with type org.sakaiproject.site.api.Site:
ArrayList<String> userProviders = new ArrayList<String>();
Set<String> providerIds = authzGroupService.getProviderIds(SiteService.siteReference(site.getId()));
for (String providerId : providerIds) {
try {
Section section = courseManagementService.getSection(providerId);
String enrollmentSetId = section.getEnrollmentSet().getEid();
if (courseManagementService.isEnrolled(user.getEid(), enrollmentSetId)) {
userProviders.add(providerId);
}
} catch (IdNotFoundException ex) {
// Skip this provider id if a section can't be found.
M_log.warn("No section found for provider id " + providerId);
}
}
String userProvidersString = StringUtils.join(userProviders, ",");
-Chris
On Feb 4, 2014, at 3:20 AM, Feliz Gouveia <fribeiro at ufp.edu.pt<mailto:fribeiro at ufp.edu.pt>> wrote:
The Site Membership list in MyWorkspace takes the site id and calls "/direct/site/SITE_ID.json", showing the result in a modal window. There is also a call for group membership, might be what you. want.
regards
Feliz
On 3 February 2014 23:08, Charles Severance <csev at umich.edu<mailto:csev at umich.edu>> wrote:
I am tracing through site-manage code and it looks scary. Just wondering if there is some easy call I can make to get the info.
/Chuck
<Enrolled-In.png>
_______________________________________________
sakai-dev mailing list
sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org<mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a subject of "unsubscribe"
--
Feliz Ribeiro Gouveia
Universidade Fernando Pessoa http://www.ufp.pt<http://www.ufp.pt/>
Centro de Recursos Multimediaticos Tel 351-22.507.13.06
M.I.N.D. Lab Fax 351-22.550.82.69
Pr 9 de Abril 349 fribeiro at ufp.edu.pt<mailto:fribeiro at ufp.edu.pt>
P-4249-004 Porto
_______________________________________________
sakai-dev mailing list
sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20140205/e61b61a4/attachment.html
More information about the sakai-dev
mailing list