Development:Activity Locking: Difference between revisions

From MoodleDocs
Line 67: Line 67:
= Table of Versions, to be completed... =
= Table of Versions, to be completed... =
{| border="3" padding="4"
{| border="3" padding="4"
|+ Activity Locking updated 10 July 2006 17:50 AM EDT
|+ Activity Locking updated 10 July 2006 17:50 EDT
! -Version-   
! -Version-   
! Moodle version
! Moodle version

Revision as of 12:50, 12 July 2006

Overview

This page is an attempt to consolidate and explain the available activity locking (AL) code that is present for Moodle 1.5.x and 1.6.x. This page will hopefully help explain all the available versions and their respective features. Some of the reference here will overlap with the existing MoodleDoc page covering Conditional activities.

Please be patient as this page is new and under development. See page comments for reference material.

Types of activity locking code

For the purpose of this MoodleDoc article: AL is any code that allows the user to make decisions on the next available resource or item the student will be able to use based on student events or quiz performance. There is some activity locking code that is very quick and dirty to simply lock future activities and then there is much more complex code based on the conditional activity though structure which attempts to progress the student through the course in a thought out progression based on activities and performance. Again we hope to clarify some of this here.

AL Branch 0.1 (Bernard Boucher)

Bernard started all this with a hack to lock quiz and resources in october 2003. The certificate based on a quiz score was added in september 2004 with version 0.7. It was a great start!

AL Branch 2.0 for Moodle 1.6 (Stuart Mayor)

  • This has been virtually a complete rewrite and as such there are areas of functionality the were available in older versions of AL that are not in this.
  • Conditional locking: Lock based on a user's performance in previous activities. You can also choose to unlock and activity if a user scores less than a certain grade.
  • Show activity completion: The checkbox that appears before each activity to show it have been done.
  • A variation on this also hides future activities, see AL Branch 2.2 for Moodle 1.6 (John Gschnaidner-Chardelle Busch) below.
  • Bernard Boucher reworked Stuart's version for Moolde 1.6, initially on June 20, 2006 and updated on July 10, 2006 posted Activity Locking V 2.0 for Moodle 1.6 on Activity Locking v3 or v2 for testing only.

Installation for 2.1 for Moodle 1.6(Stuart Mayor)

activitylocking20051201.zip the initial version

  • Firstly, you need the stable build of Moodle 1.6. This version of AL might work on earlier releases but I didn't write it with them in mind and I certainly can't support them.

Next, you need to modify one table in the database and add a new one (I use phpmyadmin for this).

  • The table you need to modify is mdl_course_modules and you need to add the following fields:

completedbox TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' completedscore VARCHAR(255) NOT NULL completedstyle VARCHAR(255) NOT NULL lockedbox TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' lockedstyle VARCHAR(255) NOT NULL DEFAULT 'locked' lockedvisible TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' delay INT(10) UNSIGNED NOT NULL DEFAULT '0'

  • The table you need to create is as follows:

CREATE TABLE `mdl_course_locks` ( `id` int(10) unsigned NOT NULL auto_increment, `courseid` int(10) unsigned NOT NULL default '0', `locktype` varchar(10) NOT NULL default , `targetid` int(10) unsigned NOT NULL default '0', `locks` longtext NOT NULL, PRIMARY KEY (`id`) ) TYPE=MyISAM COMMENT='Contains locks for sections and modules';

  • Lastly, you need to copy the following files from the zip file:

lib/moodlelib.php to moodle/lib/moodlelib.php lib/locklib.php to moodle/lib/locklib.php course/lib.php to moodle/course/lib.php course/lock.php to moodle/course/lock.php course/mod.php to moodle/course/mod.php course/settings.html to moodle/course/settings.html pix/t/open.gif to moodle/pix/t/open.gif pix/t/closed.gif to moodle/pix/t/closed.gif lang/en/lock.php to moodle/lang/en/lock.php

AL Branch 2.2 for Moodle 1.6 (John Gschnaidner-Chardelle Busch and others)

John's versionincludes the settings tab--making it possible to set the hide/visible options, as well as the completion (a checkmark in front of a resource/activity) options, says Chardelle.

  • A variation on Stuart Mayor's 2.1, it hides topics dependent upon conditions set on specific activities/resources ALV2_1_debug.ZIP (John). Had bug which Benard tweaked out.
  • A build of Stuarts Mayor's 2.1 it locks and/or hides specific activities depending upon conditions set on specific activities/resources. Was posted by Chardelle in ActivityLockingWithHide-1.6.zip. Probably same as above. Had bug which Benard tweaked out.
  • A tweak by Bernard Boucher on June 27, 2006 was posted moodle/lib/locklib.php file and called locklib.zip seems to fix known bug in both the above downloads.

AL Branch 3.s for Moodle 1.6 (Stuart Mayor)

Similar to the 2.x versions. Major difference is that a question to the student unlocks activities. Being actively developed and tested.

CA Branch 1.0 for Moodle 1.5.2 (Borja Rubio Reyes)

Details and discussed in the thread "NEW research on CONDITIONAL ACTIVITIES in Moodle"

Table of Versions, to be completed...

Activity Locking updated 10 July 2006 17:50 EDT
-Version- Moodle version Who Status MySql Install Docs Download Teacher Interface Hide Option Completion Box Option Section Lock Quiz Question Comments Feature Feature Feature Bug Bug
AL 3.0 1.5.2 Stuart Mayor not finished [1] Yes A/R dep on questions
AL 2.3 1.6 Stuart Mayor Testing [2] Yes A/R/T dep on A/Rs
AL 2.2 1.6 Gschnaidner, Mayor, Busch Testing [3] Tabs Yes almost A/R dep on A/Rs +Hide bug fix
AL 2.0 1.6 Stuart Mayor, Bernard Boucher Updated Automatic [4] [5] Padlock Icons Yes Yes Yes No see above
C A 1.0 1.5.2 Borja Rubio Reyes, David Delgado [6] Yes

General installation instructions DRAFT

Installing AL on a localhost (desktop) machine was not difficult! Some months ago I must have downloaded and connected phpAdministration and that came in handy for step 6. I just did a conversion and it took me less than 30 minutes (actually I think the AL part was done in 3 minutes ) because I wanted to install the latest version of Moodle 1.6 and then zipped my entire Moodle16 file structure before I attempted the AL installation.

  • 1. Perform any backups you think are necessary (I zipped everything in my localhost path).
  • 2. Select the zip file flavor of AL you want and download it (I used Chardelle's zip plus Bernards tweak found in 2.2 above)
  • 3. Unzip it to a non Moodle place. (Like to keep the folder structures option)
  • 4. Locate the MySQL.sql file so you can find it again.
  • 5. In Moodle as admin, go to Administration, Configuration and turn on Maintence Mode.
  • 6. Go to Administration, Database. In the home query window, on the left, click on moodle (mine says Moodle16 and has a bunch of mdl_ listings under it).
  • 7. Best: Click on the SQL tab. In the location of the text file, browse to the file in #4, then click go.
  • 7. Alternative: use the MySQL document and make or changes in
  • 8. Leave Moodle, shut that browser window.
  • 9. Now you need to move the files in the folders located in #3 to your Moodle file structure. (See my tip below). In your non moodle area you have unpack the file to a folder called ActivityLockingWithHide. It has a folder called Moodle in it, with sub folders under it, for example ActivityLockingWithHide\Moodle\Course. You should copy ever file from there to your local host file structure in the same spot. (Mine is Moodle16\Moodle\Course ).
  • 10. Go back into Moodle, log in as Admin, go to Administration. Moodle will adjust itself.
  • 11 Check in Administration, Configuration, Maintence to make sure it is disabled.
  • 12. You are done, check out a lesson with weeks or topics, go to lesson settings and notice the new tabs.
  • TIP? There is probably a slicker way but after I unzipped the file in #3, I went down a level and zipped the Moodle folder. Then I unpacked the files to Moodle16\, told the unzip program to keep the folder structure and overwrite existing files.




See Also

  • Adding_activity_locks will give the reader an idea of what one of the flavors of Activity Locking looks like for a student and teacher setting it up.

Please visit the Moodle Forum for more information concerning Activity Locking and Conditional Activities-

There is a very specialized-limited type of activity locking under a lesson (activity) setting called dependency in 1.6. See: *https://docs.moodle.org/en/Adding/editing_a_lesson#Dependent_on .