cannod / moodle-drupalservices

Moodle plugin to connect to Drupal services
36 stars 25 forks source link

Documentation for Cohorts View #17

Open rarelywrongjared opened 10 years ago

rarelywrongjared commented 10 years ago

Can you provide documentation for the cohorts view for this plugin? Example settings you used would be fine!

jeffhonnold commented 10 years ago

This is largely an unsupported module/connection. I'm in the process of diving in and understanding how the cohort sync works in this module (I'd previously put a sync process together with the old drupal login module and might copy/paste that one in - however that assumed moodle and drupal lived in the same database, and I ultimately prefer the views services approach, so making this work would be great). If cannod can pitch in here, it would help! Otherwise I'll post what I can figure out.

rarelywrongjared commented 10 years ago

The cohorts option does work. I figured it out by trial and error. Make sure your drupal view has a 'cohorts' field that the muser service shows. I had to modify my services views module to make the cohort field display the cohort name instead of the uid. i can post my configs if someone wants them

jeffhonnold commented 10 years ago

That would be great - if you could post the views config (possibly the export of the drupal view?). Thanks much.

cannod commented 10 years ago

Hi Guys,

Yes the cohort option does work and I removed those warning messages from the moodle config. The docs are overdue for a write up on how to setup cohorts and I'll try and do that today.

cannod commented 10 years ago

I'll update the wiki soon but here is a quick howto.

We need to create a view that displays the following custom keys.

uid, cohort_name, cohort_id, cohort_description

So for example here is a preview of the cohort preview I am using.

array (
  0 => 
  stdClass::__set_state(array(
     'uid' => '1994',
     'cohort_name' => 'INTRO-MOODLE',
     'cohort_id' => '405',
     'cohort_description' => 'Introduction to Moodle',
  )),

Where you get your fields from will depend on your particular drupal setup. For me I get it from drupal commerce orders. For example here are the fields I use in the view. The custom key values are in the brackets. As you can see I am getting the fields from the commerce product that the user has purchased. So if a user buys the Intro to moodle course, the view pulls this data from the orders.

(Order) Commerce Order: Uid (uid)
(Product) Commerce Product: SKU (cohort_name)
(Product) Commerce Product: Product ID (cohort_id)
(Product) Commerce Product: Title (cohort_description) 

Hope this can get you started.

netw3rker commented 10 years ago

Sounds like this is a documentation issue. I'm adding it to the 1.0 release milestone and assigning it to @cannod to update. This should also be added as a todo for issue #12 , and is primarily related to #26 (getting documentation updated)