specification for the study planner gadget

advertisement
Study planner gadget - Specification
Summary
The study planner gadget displays a copy of the planner element from the user’s
module website. This is essentially exactly the same as would be displayed on the
VLE except that it any unsupported features that require interaction such as creating
notes would be unavailable.
Functionality
The gadget will display any Modules that the user is enrolled on that are currently
‘live’ (so if the user has a tutor or staff role on the course these will also be included).
Only Modules that use the study planner format will be included.
Where there are multiple Modules available to display these will be displayed
individually; selected by a tab system (where tab name is the Module short-name).
The default view for the Module is that of the current week; alternatively the user can
choose to view a three week view (previous, current and next) or to show the entire
planner. Where the Module uses a ‘Topic-based’ layout these options will not be
available and the only view will be of the entire planner.
A link to the Module website will be shown within the gadget; this will open the site in
a new window.
An example of the screen layout for
the gadget (showing the old theme).
Development
The gadget will need to connect to the SNAPP Moodle plugin produced in DOULS so
that it can securely connect to the VLE to request information.
The gadget will request a Moodle web service that will be located within the study
planner. The gadget will need to know the following information (for each course the
user is enrolled on):
1. The short-name of the Module
2. The URL of the Module website
3. HTML of the entire planner
4. If running OU theme the course theme variant (purple, green etc)
The web service will be sent the user id of the user that ‘owns’ the gadget (this is
inserted by the SNAPP plugin).
The gadget will expect the entire data for the user and will selectively display the
appropriate data based on the view the user has selected e.g. current week of
ABC101-11K (can do this through manipulating the un-required week rows to css
display:none).
The web service will be called get_studyplan. Two parameters will be
supported:
 userid – The id of the user to get data for
 courseid (optional) – Specific course to get data for. If not used will get all
for the user in userid.
The web service will need to:
1. Get all of the courses the user is enrolled on. This can be achieved through the
function call: enrol_get_users_courses($userid, true, 'id,
visible, shortname, format');
2. This list will need to be filtered to omit courses that are not visible or do not have
the ‘studyplan’ format.
3. Get all of the data for each course by calling studyplan_get_alldata
function in studyplan/lib.php.
4. Construct the return object from the studyplan data using any studyplan functions
that are available to ensure as little code repetition as possible (using the same
mechanism as standard printable calendar).
5. Determine if there is a valid entry in the theme_ou_courseoptions table for the
course id and return the variant value.
The web service should return a ‘courses’ multiple structure with an array for each
course consisting of the following elements:
 shortname – string: Module short name
 url – string: Module website address
 curweek – integer: The section number of the current week (if this cannot
be determined separately then it can be determined by the table row with
the ‘current’ class)
 content – string: HTML of the entire planner
 variant – string: Variant value (empty if none).
Completion
In order for completion ticks to work within the gadget specialist code will be required
to set the completion status of the selected activity.
Because the completion status is cached in the Moodle user session multiple
methods will be required to set completion status so that the gadget and Moodle
remain synchronised.
A Moodle web service (in format/studyplan so not a core change) is the main
method and will:
1. Set completion status
2. Return correct icon url for new status
3. Return correct alt text for new status
4. Be able to work in ‘dummy’ mode (not set status).
A JavaScript call to a Moodle web page that sets completion is the second method;
this will only work when the user is logged in to Moodle and as such can update their
user session so the completion status reflects the requested change. The page calls
the standard course/togglecompletion.php.
The process followed when selecting a completion tick is as follows:
1. Information from the form the tick resides in is obtained; this includes the cmid
and status to switch to (e.g. completed).
2. Make a cross-domain AJAX call to the completion page.
3. If this is successful then also make a call to the web service with ‘dummy’ set
to get the correct image/text to display.
4. If this fails (either because user is not logged in or browser does not support
cross-domain AJAX) then:
a. Make a JSON-P call to the completion page
b. Make a standard call to the web service.
5. Switch the completion image and alt text to reflect the changed status.
Testing
Requirements:
1. Google account (to use iGoogle)
2. Moodle instance on an external facing site
3. Student account that is enrolled on multiple courses
Installing the gadget (SPG1)
1. Go to iGoogle and log in using a Google account.
2. Select ‘Add gadgets’ link on the top right of the iGoogle interface.
3. Select ‘Add feed or gadget’ link and then enter:
[MoodleURL]/local/snapp/gadgetserv/gadgetxml.php?gurl=gadgets/studyplan/
gadget.xml
and select add.
4. Go back to iGoogle, the OU Module website gadget should have been added
to the current tab.
5. The gadget should display a message alerting to the fact that it needs to
authenticate to your OU account. (This will not occur if this process has
already taken place either with this gadget or others using the same method.
In this instance this test is then complete.)
6. Select the link to go to the authorisation screen in Moodle (this should open in
a new window/tab).
7. Log-in in to Moodle using the student account.
8. Select the button that accepts granting access to the gadget.
9. The window/tab should close.
10. In iGoogle the gadget should recognise that access has been granted and the
initial message should be replaced by the gadget contents.
Viewing Modules (SPG2)
1. The gadget should display a tab for each (‘live’) course the test student is
enrolled on (no tabs will be displayed if it is only one). Tabs are labelled with
the course short-name and are ordered by start date.
2. Each course that has a current week and is in calendar mode (not topic) will
automatically display the current week, along with options to select the
surrounding (current, previous and next) and all weeks.
3. Select each of the week selector radio buttons. The gadget should update the
display to show the selected weeks of the planner. The scrollbar on the
gadget should reflect the changes to the display (so if the display is shorter
than the gadget height the scrollbar should turn off).
4. Test the previous step in gadget ‘canvas’ mode. This is accessed by selecting
the ‘maximise’ button on the gadget title bar.
5. All activity links shown within the planner view in the gadget should open in a
new window/tab.
6. The ‘Go to your module website’ link at the bottom of the planner view in the
gadget should link to the correct module website address. Again, this should
open in a new window/tab.
7. Check that the study planner display in the gadget mirrors that shown within
the module website. The gadget display should match in all areas including:
 Font
 Text sizes
 Icons
 Colours
 Content.
Testing completion (SPG3)
1. Select a course shown in the gadget that contains manual activity completion
buttons (the box/tick alongside activity links).
2. Ensure that the student user is no longer logged in to the Moodle instance.
3. Select an activity completion button, noting the current state.
4. The state should change; the image and alt tags of the button should reflect
the change.
5. Select the link to the module website and log in as the student user. The
completion status of the activity should match that shown in the gadget. Keep
this window/tab open.
6. Within the gadget select the activity completion button again.
7. The state should change.
8. Switch to the module website and refresh the browser. The completion status
of the activity should reflect that of the gadget.
Download