I have built in to allow for actions to be triggered when a user completes a quiz. When creating a quiz, you can select an action to be performed after the quiz has been completed. The drop down menu is populated from the Actions Settings Page (Where you create new actions). Then once the quiz has been completed, the assigned action is then fired. This still needs some testing on different types of actions as I am not passing any objects to the action callbacks. I gave you tons of notes =). Also changed the db schema to add in the aid (action ID) so when applying this you will need to manually add in the aid column or reinstall the module.

Let me know of any problems and I will fix them!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mbutcher’s picture

Status: Needs review » Fixed

This patch seems to meet several requirements that have been lurking in the queue, so I am very happy to see it!

It has been checked in with only minor alterations.

First, a database change needs an implementation of hook_update_N(). I added that -- no big deal at all.

Second, I fixed a few comments. Again, not a big deal, but here's the convention:

/** */ comments should only be used for docblocks. Inside of function bodies, use /* */ or // instead.

And one other nit: Please try to name the patches with the issue number (and the comment number, if you are adding it to a comment) so that I can keep track of the patches better. It's best if there is only one patch file per patch ( a patch file can patch multiple source files), but I don't insist on that as long as your patches apply cleanly. ;-)

Hopefully I will be able to check out your other patches next week. So far, you've been hitting items that are definitely of broad use to the Quiz community, and that is fantastic.

Adding some configuration items for this action support would be very good. One other thing that could be great for this module would be to define a standard action or two (like 'Email quiz results' or something) that could then illustrate the benefits of actions to quiz module users. If I have time, I may do these things. But if you'd like to tackle them... go ahead.

Thanks again!

iLLin’s picture

Ok I read that about naming the patch the name of the issue. So i am assuming I need to create the issue first and then upload the patches with the issue id as the name? If you don't mind giving me an example of how you would like the format of the patches I would appreciate it and I will follow that naming scheme.

This "CVS" thing I just learned (believe it or not) last week. The actions patch was my first patch ever and I have been using drupal for 3 weeks now so I am still learning the right way to do things.

Also when you say that you have "checked them in", does that mean I can get the latest from the CVS and these patches are applied?

The configurations I was going to extend this part was the filter on the actions dropdown (by type). I was going to build into your admin settings page and add another variable for that with a default value of 'all'.

I don't need a "score" per say on what I am going to use your module for so that is why I did not add in the if your score > x this action will happen. I think that this part could be expanded to fire different actions based on the score achieved, support for multiple actions. I think a better approach would be is to work the actions into the Results that are already their. Sort of extend the results from the score that is achieved. I'm not sure if this was your original plan or not but I'm guessing it was.

Anyway let me know your thoughts on this.

Also complain all you want and I will conform to how you want things accomplished. I'm a coder too so I am just as picky with "my" stuff. This is your module so I have no problems doing it whatever way you want it done. =)

Later!

Summit’s picture

Status: Fixed » Active

Hi,
I set this to active if it is ok?
I installed the 27 nove 3.dev version. Great to integrate actions, but..I can't see them yet in my admin.
Actions I see are:

comment Unpublish comment   
node Publish post   
node Unpublish post   
node Make post sticky   
node Make post unsticky   
node Promote post to front page   
node Remove post from front page   
node Save post   
user Block current user   
user Ban IP address of current user 

I would love to test this.

Thanks in advance for going into this, and sorry if it is a mistake on my part.

greetings,
Martijn

iLLin’s picture

You see the actions that you have created in your Actions settings page. For any action you want to accomplish, you will need to create your own and it will automatically populate in that dropdown box. I think the best way to go is probably add a quiz extension module/file that could hold custom actions for the quizzes. I think maybe the best way to start this is to start a thread with "actions" you would like to see and start out with some basics for people to choose and do. Figure out the most dynamic of the actions and then setup the form when adding a custom module to allow for multiple parameters to choose/create.

Summit’s picture

Hi Dennis,

Are you saying I have to code an action?
Do you have example code doing this for quiz?

Thanks a lot in advance for your reply!
greetings,
Martijn

iLLin’s picture

Sort of, you can take the basic actions that are there now and expand/change them. But if you want a specific action that is not a basic action from drupal (99% of time I would imagine) then yes you need to code your own actions. I think an action module should be built to expand into quiz that could hold actions to perform after the quiz is completed. For example the actions that I am going to do will be from a different custom module I have created that would assign "playing cards" (well not really but sort of, not sure if I can talk about what im doing) after they take the quiz (In my case competition). Anyway when creating the quiz I can select which playing card to assign the person (which would be my action) after they complete it.

Well back on topic to the actions extension module. In adding this as an addon, we could probably build in dependencies and allow people to either turn it on of off. This would also allow people to add custom actions easily and submit more actions to be included with the quiz project. When I get back to work tomorrow I will build a very basic module that should accomplish this.

Later

iLLin’s picture

FileSize
4.21 KB

I have created a very basic documented file for actions. I have not defined any actions within this include only provided a lot of comments for someone if they want custom actions. If you have any questions let me know.

I figure this file can be included and hold only actions as to prevent any mishaps or clutter within the main module file.

iLLin’s picture

FileSize
1.97 KB

Here is another patch for the quiz module. I named it quiz_issue#_comment#.patch. Hopefully that is the right naming convention for you.

What this patch fixex:
(1) I didn't use the @quiz (QUIZ_NAME) define in the description for the actions dropdown .
(2) I added a system variable to the options dropdown for retrieving actions. You can now filter by type which is a system variable.
(3) I fixed the actions dropdown when filtering the results by a type to include the option "choose action".

iLLin’s picture

FileSize
522 bytes

This is the admin patch that will include the option for changing the action type. I don't know how to make ONE file for patching.

Also let me know if I am doing these patches wrong.

Thanks

mbutcher’s picture

iLLin: The three patches above have been committed.

I removed a menu change from quiz_339068_8.patch, since I think that was part of another patch you submitted. Other than that, there were no notable changes.

Summit: Actions still require custom code. I would like to add a very basic action (like send a notification email on quiz completion). If you have some other ideas on actions you'd like to see, we should probably open a new issue in the queue and track the requests there.

I'm very excited about the new action support... but to make it really useful to non-coders, we do have to come up with some default (useful) actions.

Summit’s picture

Hi,
Started this thread about possible actions: http://drupal.org/node/341296
Looking forward to what you think of them!
greetings,
Martijn

mbutcher’s picture

Status: Active » Fixed

Great. I am going to mark this thread as fixed, and we can use that thread for discussion of features.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.