Conditional activities: Activity Locking for 1.9?

Conditional activities: Activity Locking for 1.9?

by Todd Thornton -
Number of replies: 102

Does anyone have any version of activity locking working yet with the stable release of 1.9? I've tried Chardell's Dec 17th release, but I can't make any progress with 1.9 stable. It seems some significant changes occurred between the beta release and the actual release of 1.9?

I've also read a couple of posts about modified code for 1.8 working on 1.9. Any pointers (links to updated versions) would be appreciated.

Todd

Average of ratings: -
In reply to Todd Thornton

Re: Conditional activities: Activity Locking for 1.9?

by Clark Burns -

I would appreciate an update of the status of Activity Locking  for 1.9 stable as well. Thanks in advance!

Sincerely,

Clark

In reply to Clark Burns

Re: Conditional activities: Activity Locking for 1.9?

by Bernard Boucher -
Hi Clark and Todd,
unfortunately the is no update yet of activity locking for Moodle 1.9 stable. One version for 1.9 beta 3 were very promising but as Todd tested, it will need some update to works with 1.9 stable.

The best place to have immediate information about available versions is in that table. As soon as a new working version will be available the table will be updated.

Because activity locking was, is and will be dependent of Moodle the best practice is to choose from that table the activity locking version and after the corresponding version of Moodle.

I hope it may help!

Bernard

In reply to Bernard Boucher

Re: Conditional activities: Activity Locking for 1.9?

by Todd Thornton -

Thanks Bernard,

I just wanted to make sure I hadn't missed an updated version to try out.

Todd

In reply to Bernard Boucher

Re: Conditional activities: Activity Locking for 1.9?

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Hi,

I think that activity locking should just go in Moodle core, in Moodle 2.0 smile

Séverin
In reply to Bernard Boucher

Re: Conditional activities: Activity Locking for 1.9?

by Clark Burns -

Bernard,

Thank you for the information! I hate to bring up the same thing over and over but is there any update as far as actual development going on for this currently? Is there anything I can do to assist with this? I look forward to hearing back.

Thank you!!

Clark

In reply to Clark Burns

Re: Conditional activities: Activity Locking for 1.9?

by Bernard Boucher -
Hi Clark,
if you cannot livewink with an old version of Moodle like I do ( 1.6.1 blush ), the simplest way to make a new version of activity locking is to compare each file in the activity locking package 1.9Beta of Chardelle with their equivalent in 1.9 and reapply the differences. Many of the files will not be changed but moodlelib.php and some other will be. Generally it took me 2 or 3 hours to reapply the changes to a new version.

Activity locking is only a hack and it modify/use the most modified moodle file lib/moodlelib.php. If you want to keep an up to date version then you will have to repeat that process each day!!!

Have a good hacking,

Bernard

In reply to Bernard Boucher

Re: Conditional activities: Activity Locking for 1.9?

by Clark Burns -

Bernard,

Thank you for your speedy reply! I will attempt what you suggested and let you know how it goes. Thanks again!

Clark

In reply to Clark Burns

Re: Conditional activities: Activity Locking for 1.9?

by Clark Burns -

UPDATE:

Bernard,

I attempted to make the transition comparing the files you suggested. I copied everything over and went to test it...I got a 500 error and I can't get anything to come up. (My moodle setup FYI is: Windows Server 2003, IIS 6, PHP 5.2.5, SQL Server 2005) Any thoughts on why/how this could be happening? I'm guessing this is a very broad question but didn't know if it would spark a thought. Any comments would be appreciated. Thanks!

Clark

In reply to Clark Burns

Re: Conditional activities: Activity Locking for 1.9?

by Clark Burns -

Update to the Update:big grin

I've narrowed it down to /course/lib.php still not sure what is causing it but it brings down my entire Moodle installation when I overwrite the existing course/lib.phpblack eyemixed

Any help is greatly appreciated!! I'm attempting to get this going for 1.9 Official Release and will definitely share this if I can get it to stick!

Thanks!

-Clark

In reply to Clark Burns

Re: Conditional activities: Activity Locking for 1.9?

by Ger Tielemans -

I see that you live on windows, so install a tool like WinMerge and try to find by comparison the differences in the two code lists. http://winmerge.org/

It compares really on content, even the white spaces,  and you can switch of end-of-line differnece sduring compare.

if you want to compare three listings, then choose Kdiff3 smile

http://kdiff3.sourceforge.net/

In reply to Ger Tielemans

Re: Conditional activities: Activity Locking for 1.9?

by Clark Burns -
Thanks Ger. This saves a lot of time! smile
In reply to Clark Burns

Re: Conditional activities: Activity Locking for 1.9?

by Clark Burns -

http://promoodle.com/index.php?option=com_docman&task=cat_view&gid=16&Itemid=65

Check out the first listing...that's all I'm going to say.

Cheers,

Clark

In reply to Clark Burns

Re: Conditional activities: Activity Locking for 1.9?

by Bernard Boucher -
Hi Clark,
thanks for pointing that new version and many thanks to Chardelle and ProMoodle.com for the hard work and the support.

The table is now updated wink.

Salutations from Québec,

Bernard


In reply to Bernard Boucher

Re: Conditional activities: Activity Locking for 1.9?

by Eugene Voevodin -
Hi Bernard!

This AL version for 1.9 is a real salvation for me, thank you so much and real appreciation to developers who worked on it.

You mentioned that AL is neither upgradeable nor backupable. I wonder, is there a manual way to put AL onto Moodle, that had already been installed before? I've searched through the AL script to find things, that are dedicated to install process and found only mysql.sql, which creates and alters tables.

Can you tell me why AL is not working, if it's not installed with moodle itself? We have lots of courses, and if we backup them and transfer to another fresh server some settings won't go (calculated fields, wikis, some upgrades, that have been manually made, etc). Is there a way to set AL to old running server?

Thanks in advance

Eugene
In reply to Eugene Voevodin

Re: Conditional activities: Activity Locking for 1.9?

by Bernard Boucher -
Hi Eugene,
Chardelle and ProMoodle.com did the salvationwink

I don't understand your question: what is the old server for you? ( what version of Moodle is installed on it? )

When I said Activity locking is not backupable it mean that the locks of an old server will not be transeferred to a new one. But all normal activities of Moodle will be backuped ( dont forget logs backup ). If you install the new appropriate version of activity locking on the new server and if you redo all the locks manually then you will retreive all yours locks.

I hope it may help,

Bernard

In reply to Bernard Boucher

Re: Conditional activities: Activity Locking for 1.9?

by Eugene Voevodin -
Greetings Bernard!

When I said "old" server I meant server, wich is filled with courses and content already. My attempts to put AL on such a server were failed, AL is not working properly, but when I install on a fresh one everything is OK.

What do you think, is there a way to put AL on a server, which is filled with courses and then do locks on these courses?

Thanks for paying attention

Eugene
In reply to Eugene Voevodin

Re: Conditional activities: Activity Locking for 1.9?

by Bernard Boucher -
Hi Eugene,
If there were not another version of activity locking already installed, then the installation of the appropriate ( matching versions ) of activity locking should work first time.


I hope it may help,

Bernard

In reply to Bernard Boucher

Re: Conditional activities: Activity Locking for 1.9?

by Eugene Voevodin -

Hi Bernard,

That really makes situation more clear. I have moved AL-related code to my 1.9+ and it works fine now. Maybe it would be helpful to someone if I notice that some AL code is not commented when goes with module and it was pretty hard for me to find and to copy it to my moodle. Here that places are:

1. course\lib.php. Function make_editing_buttons. When setting up $str object pay attention to these lines in AL code:

        $str->lock           = get_string("lock","lock");
        $str->unlock         = get_string("unlock","lock");

They should be added to your course\lib.php too, and they are not commented - developers must have accidentially forgot to dedicate this code to AL module.

2. course\lib.php. The same function. Find this code and move to appropriate place into your course\lib.php this code should be added to see locking buttons and it's not commented too

            '<a title="'.$str->lock.'" href="'.$path.'/lock.php?id='.$mod->id.
     '&amp;sesskey='.$sesskey.$section.'"><img'.
           ' src="'.$CFG->pixpath.'/t/lock.gif" hspace="2" height="11" width="11" border="0" '.
           ' alt="'.$str->lock.'" /></a>'.$unlock.

Well, that moves helped me to set AL and it works.

Hope this can help someone, and thanks Bernard for his care and help.

Eugene

In reply to Bernard Boucher

Re: Conditional activities: Activity Locking for 1.9?

by Deb Burdick-Hinton -
YIPPPPPPPPPPPEEEEEEEEEE YAHOOOOOOOOOOOOOO
Thanks so much!

So any feedback on this? Any issues? We will install on our 1.9 Test server asap!

I really want to upgrade to 1.9 but can not live without AL!

You guys rock!
In reply to Deb Burdick-Hinton

Re: Conditional activities: Activity Locking for 1.9?

by Eugene Voevodin -

I would reccomend not to use module itself, because It's a hack (I'm on thinking how to make AL an installable module) - If you are somehow familiar with PHP It's better to set up neccesary code to your moodle than to replace files with files older versions, that may not work well IMHO. I searched code lines wich were commented out some like "//Activity locking" end ending with "//End Activity Locking" and found some lines wich were not commented as I mentioned above. So I moved this lines to the same places into my moodle files and it works.

Eugene

In reply to Eugene Voevodin

Re: Conditional activities: Activity Locking for 1.9?

by Grant Beevers -
I just tried installing this for Moodle 1.9, and when I turn editing on for a course, the locks appear against activities, then quickly disappear. Any ideas?
In reply to Grant Beevers

Re: Conditional activities: Activity Locking for 1.9?

by Bernard Boucher -
Hi Grant,
can you give precisions about 2 items:

1 - What exact version of Moodle are you using ? Activity locking for 1.9 works fine only with moodle 1.9 may 15 2008. Here is a link to it.

2- When you say locks disappear, does it mean that the oders icons stay aside of the activities. Can you take an screenshot?

I hope it may help,

Bernard

In reply to Bernard Boucher

Re: Conditional activities: Activity Locking for 1.9?

by Grant Beevers -

Hi Bernard,

Thanks for your replies. I disabled Ajax, and that fixed it. I missed that in the install notes. Seems to work OK now, although it would be good to have ajax back.

I'll take the punt and install it on my development server and see how things go.

Thanks again,

Grant

In reply to Eugene Voevodin

Re: Conditional activities: Activity Locking for 1.9?

by Deb Burdick-Hinton -
Eugene-
So is the general consensus that AL 1.9 is not ready for a production server. Bummer sad I really want to upgrade to 1.9 but can not live without AL as it is core to so many of our courses.

If that is the case - any idea when it might be ready for a production server?

Thanks!
In reply to Deb Burdick-Hinton

Re: Conditional activities: Activity Locking for 1.9?

by Bernard Boucher -
Hi Debra,
what I understand from Eugene posts is not that activity locking is not stable or not functionning. I understand that Eugene start with the most recent Moodle version, 1.9+ and he try to use activity locking for 1.9. He had to 'fit' activity locking code to that new version of Moodle and doing so he find that some lines of working code where not proprely commented in 2 files.

But if you install the appropriate Moodle version ( 1.9 mars 15 here ) with activity locking 1.9 you will have noting to change in the code, it will works the first time.

Please test it on a test server with a copy of yours courses ( users and data )

I hope it may help,

Bernard



In reply to Bernard Boucher

Re: Conditional activities: Activity Locking for 1.9?

by Grant Beevers -

Hi Bernard,

I notice the link you provide here is to a file which is 13MB in size. This seems to be an excessive size - are all these files needed for this solution, or is this simply copying over a number of files?

Grant

In reply to Bernard Boucher

Re: Conditional activities: Activity Locking for 1.9?

by Deb Burdick-Hinton -
Thanks Bernard - that is great news. Now I just got to get our Server Managers to get it installed on a test server. So psyched to use 1.9! Appreciate the post and everyone's hard work getting it to work.
In reply to Deb Burdick-Hinton

Re: Conditional activities: Activity Locking for 1.9?

by Eugene Voevodin -

Hi Debra,

Yes, Bernard is absolutely right. Of course you may use 1.9 with AL, if AL was developed EXACTLY for that version. But still if you want to upgrade to newer 1.9+ version of Moodle and want to use this AL - you have to move AL code to 1.9+ manually to prevent losing improvements made to this 1.9+.

Hope your upgrade to 1.9 will be fine

Eugene

In reply to Eugene Voevodin

Re: Conditional activities: Activity Locking for 1.9?

by Grant Beevers -

Hi Eugene,

The build we are running is 1.9+ (Build: 20080402). Can you let me know what version of AL I should install on this site? I am very keen to use it.

Thanks,

Grant

In reply to Grant Beevers

Re: Conditional activities: Activity Locking for 1.9?

by Eugene Voevodin -

Hi Grant,

As I mentioned above probably you should add AL to your site manually to avoid repacement of your 1.9+ files with older versions to prevent loosing some features you need in 1.9+.

1. If you are familiar with php, search AL files course\lib.php and lib\moodlelib.php for strings like "//Activity locking..." and "//END Activity locking..." and take code between these commented lines to transfer it to your moodle to appropriate places. There is some code wich is not commented but should be transfered too - follow my posts above to find it. Another files which go with the module should be copied to your moodle "as is". This is the best way to put AL to your moodle 1.9+.

2. I've tried to build AL module for 1.9+ 20080402, but I cannot attach it to post because it's more than 100 kbytes. So I can give you course\lib.php and moodlelib.php only, other files that are needed to use AL should be taken "as is" from the module you already have. Files are in attachment to the post in zip archive. I could miss some code while building it, but since that it works for me. Since these files are rapidly changing from version to version you should check your neccesary functionality after you use this build, as you can lose some important advantages you need. I reccomend to try it on a test server before applying to production server. Anyway, if you are going to use this build, inform me if it was a successful attempt, please.

Hope this may help, and sorry for my English, probably, I should spend the rest of my life to learn it well smile

Eugene

Average of ratings: Useful (1)
In reply to Eugene Voevodin

Re: Conditional activities: Activity Locking for 1.9?

by Deleted user -

I noticed in the table it shows NO listed under Quiz. Does that mean that it does not work for the Quiz Module?

Thanks

In reply to Deleted user

Re: Conditional activities: Activity Locking for 1.9?

by Bernard Boucher -
Hi Jeff,
if you check carefully in the table and in the page you will see that the header of the table is : Quiz Question That mean that some versions of activity locking are able to lock/unlock at the question level. But all other versions, including 1.9 allow lock/unlock at the quiz level, the quiz score, the total score of all questions.

I hope it may help,

Bernard


In reply to Bernard Boucher

Re: Conditional activities: Activity Locking for 1.9?

by Deleted user -

Okay, I installed Activity Locking for Moodle 1.9 on Moodle 1.9 (just MOODLE_19 not the  + _WEEKLY or +  _STABLE) and it worked fine with no major problems.

I had previously tried to use this a long time ago on 1.6 but could not get it to work. Because of the previous install, the database table and field modifications were still there, so when I went to the Notifications page to install Acitivity Locking, it gave errors about not being able to create the table and fields, and then said it was not setup properly because of those errors... but since the db mods were already there, it still worked fine, so it wasn't really a problem.

Those working on development of this mod may want to add a check statement to see if each field already exists in the table before trying to create it.

In reply to Deleted user

Re: Conditional activities: Activity Locking for 1.9?

by Deleted user -

I'm trying to figure out whether I have Moodle version 1.9 or 1.9.1, but when I go to Site Admin > Notifications I get the following:

Breadcrumb reads: MySite > Setting up block tables

This script generated 7 warnings

activity_locking

In reply to Deleted user

Re: Conditional activities: Activity Locking for 1.9?

by Bernard Boucher -
Hi Jeff,
sorry that you got problem with activity locking wich is not backupable nor uninstallable. Generally when we try to pass from one version to an other we copy production server ( php, mysql and moodledata ) to a sandbox server and do the testing. Did you do that or are you stuck with your production server?

The procedure will be different depending on your situation.

Let me know your actual situation with more precision than bla bla bla ( errors messages with table and fields names, Moodle version on front page (mouse over the icon), installed version of activity locking from that table, ... ) and in meantime check that post to have an idea of the answer.

I hope it may help,

Bernard

In reply to Bernard Boucher

Re: Conditional activities: Activity Locking for 1.9?

by Deleted user -

Thanks Bernard...

I'm using AL 2.5 with Moodle 1.9 on a production server.

It works perferct... there are no problems with how it is working. The only problem is when you go to Site Admin menu and click on Notifications, you always get the message below, which is the same message that appeared when I first installed it.

I think the problem is that the AL module doesn't think it got installed properly, when really everything is ok because the tables & columns were already in place (and it's actually working fine).

----------------------

This script generated 7 warnings

activity_locking

--------------------------------------------------------------------------------
(mysql): CREATE TABLE `mdl_course_module_locks` ( `id` int(10) unsigned NOT NULL auto_increment, `courseid` int(10) unsigned NOT NULL default '0', `moduleid` int(10) unsigned NOT NULL default '0', `lockid` int(10) unsigned NOT NULL default '0', `requirement` varchar(10) NOT NULL default '', PRIMARY KEY (id), UNIQUE KEY id (id), KEY lockid (lockid), KEY moduleid (moduleid), KEY courseid (courseid) ) TYPE=MyISAM  
--------------------------------------------------------------------------------
1050: Table 'mdl_course_module_locks' already exists

         ADOConnection._Execute(CREATE TABLE `mdl_course_module_locks` ( `id` int(10) unsigned NOT NULL auto_increment,   `courseid` int(10) unsigned NOT NULL d..., false) % line  891, file: adodb.inc.php
      ADOConnection.Execute(CREATE TABLE `mdl_course_module_locks` ( `id` int(10) unsigned NOT NULL auto_increment,   `courseid` int(10) unsigned NOT NULL d...) % line   89, file: dmllib.php
   execute_sql(CREATE TABLE `mdl_course_module_locks` ( `id` int(10) unsigned NOT NULL auto_increment,   `courseid` int(10) unsigned NOT NULL d...) % line  235, file: dmllib.php
modify_database(/home/mysite/public_html/members/blocks/activity_locking/db/mysql.sql) % line 1355, file: blocklib.php
upgrade_blocks_plugins(
http://www.mysite.com/members/admin/index.php) % line  441, file: index.php

--------------------------------------------------------------------------------
(mysql): ALTER TABLE `mdl_course_modules` ADD `delay` VARCHAR( 10 ) NOT NULL AFTER `added`  
--------------------------------------------------------------------------------
1060: Duplicate column name 'delay'

         ADOConnection._Execute(ALTER TABLE `mdl_course_modules` ADD `delay` VARCHAR( 10 ) NOT NULL AFTER `added`, false) % line  891, file: adodb.inc.php
      ADOConnection.Execute(ALTER TABLE `mdl_course_modules` ADD `delay` VARCHAR( 10 ) NOT NULL AFTER `added`) % line   89, file: dmllib.php
   execute_sql(ALTER TABLE `mdl_course_modules` ADD `delay` VARCHAR( 10 ) NOT NULL AFTER `added`) % line  235, file: dmllib.php
modify_database(/home/mysite/public_html/members/blocks/activity_locking/db/mysql.sql) % line 1355, file: blocklib.php
upgrade_blocks_plugins(
http://www.mysite.com/members/admin/index.php) % line  441, file: index.php

--------------------------------------------------------------------------------
(mysql): ALTER TABLE `mdl_course_modules` ADD `visiblewhenlocked` TINYINT( 1 ) UNSIGNED NOT NULL default '1' AFTER `visible`  
--------------------------------------------------------------------------------
1060: Duplicate column name 'visiblewhenlocked'

         ADOConnection._Execute(ALTER TABLE `mdl_course_modules` ADD `visiblewhenlocked` TINYINT( 1 ) UNSIGNED NOT NULL default '1' AFTER `visible`, false) % line  891, file: adodb.inc.php
      ADOConnection.Execute(ALTER TABLE `mdl_course_modules` ADD `visiblewhenlocked` TINYINT( 1 ) UNSIGNED NOT NULL default '1' AFTER `visible`) % line   89, file: dmllib.php
   execute_sql(ALTER TABLE `mdl_course_modules` ADD `visiblewhenlocked` TINYINT( 1 ) UNSIGNED NOT NULL default '1' AFTER `visible`) % line  235, file: dmllib.php
modify_database(/home/mysite/public_html/members/blocks/activity_locking/db/mysql.sql) % line 1355, file: blocklib.php
upgrade_blocks_plugins(
http://www.mysite.com/members/admin/index.php) % line  441, file: index.php

--------------------------------------------------------------------------------
(mysql): ALTER TABLE `mdl_course_modules` ADD `stylewhenlocked` VARCHAR( 200 ) NULL default 'locked' AFTER `visible`  
--------------------------------------------------------------------------------
1060: Duplicate column name 'stylewhenlocked'

         ADOConnection._Execute(ALTER TABLE `mdl_course_modules` ADD `stylewhenlocked` VARCHAR( 200 ) NULL default 'locked' AFTER `visible`, false) % line  891, file: adodb.inc.php
      ADOConnection.Execute(ALTER TABLE `mdl_course_modules` ADD `stylewhenlocked` VARCHAR( 200 ) NULL default 'locked' AFTER `visible`) % line   89, file: dmllib.php
   execute_sql(ALTER TABLE `mdl_course_modules` ADD `stylewhenlocked` VARCHAR( 200 ) NULL default 'locked' AFTER `visible`) % line  235, file: dmllib.php
modify_database(/home/mysite/public_html/members/blocks/activity_locking/db/mysql.sql) % line 1355, file: blocklib.php
upgrade_blocks_plugins(
http://www.mysite.com/members/admin/index.php) % line  441, file: index.php

--------------------------------------------------------------------------------
(mysql): ALTER TABLE `mdl_course_modules` ADD `checkboxforcomplete` TINYINT( 1 ) UNSIGNED NOT NULL default '0' AFTER `visible`  
--------------------------------------------------------------------------------
1060: Duplicate column name 'checkboxforcomplete'

         ADOConnection._Execute(ALTER TABLE `mdl_course_modules` ADD `checkboxforcomplete` TINYINT( 1 ) UNSIGNED NOT NULL default '0' AFTER `visible`, false) % line  891, file: adodb.inc.php
      ADOConnection.Execute(ALTER TABLE `mdl_course_modules` ADD `checkboxforcomplete` TINYINT( 1 ) UNSIGNED NOT NULL default '0' AFTER `visible`) % line   89, file: dmllib.php
   execute_sql(ALTER TABLE `mdl_course_modules` ADD `checkboxforcomplete` TINYINT( 1 ) UNSIGNED NOT NULL default '0' AFTER `visible`) % line  235, file: dmllib.php
modify_database(/home/mysite/public_html/members/blocks/activity_locking/db/mysql.sql) % line 1355, file: blocklib.php
upgrade_blocks_plugins(
http://www.mysite.com/members/admin/index.php) % line  441, file: index.php

-------------------------------------------------------------------------------
(mysql): ALTER TABLE `mdl_course_modules` ADD `stylewhencomplete` VARCHAR( 200 ) NULL default '' AFTER `visible`  
--------------------------------------------------------------------------------
1060: Duplicate column name 'stylewhencomplete'

         ADOConnection._Execute(ALTER TABLE `mdl_course_modules` ADD `stylewhencomplete` VARCHAR( 200 ) NULL default '' AFTER `visible`, false) % line  891, file: adodb.inc.php
      ADOConnection.Execute(ALTER TABLE `mdl_course_modules` ADD `stylewhencomplete` VARCHAR( 200 ) NULL default '' AFTER `visible`) % line   89, file: dmllib.php
   execute_sql(ALTER TABLE `mdl_course_modules` ADD `stylewhencomplete` VARCHAR( 200 ) NULL default '' AFTER `visible`) % line  235, file: dmllib.php
modify_database(/home/mysite/public_html/members/blocks/activity_locking/db/mysql.sql) % line 1355, file: blocklib.php
upgrade_blocks_plugins(
http://www.mysite.com/members/admin/index.php) % line  441, file: index.php

--------------------------------------------------------------------------------
(mysql): ALTER TABLE `mdl_course_modules` ADD `checkboxesforprereqs` TINYINT( 1 ) UNSIGNED NOT NULL default '1' AFTER `visible`  
--------------------------------------------------------------------------------
1060: Duplicate column name 'checkboxesforprereqs'

         ADOConnection._Execute(ALTER TABLE `mdl_course_modules` ADD `checkboxesforprereqs` TINYINT( 1 ) UNSIGNED NOT NULL default '1' AFTER `visible`, false) % line  891, file: adodb.inc.php
      ADOConnection.Execute(ALTER TABLE `mdl_course_modules` ADD `checkboxesforprereqs` TINYINT( 1 ) UNSIGNED NOT NULL default '1' AFTER `visible`) % line   89, file: dmllib.php
   execute_sql(ALTER TABLE `mdl_course_modules` ADD `checkboxesforprereqs` TINYINT( 1 ) UNSIGNED NOT NULL default '1' AFTER `visible`) % line  235, file: dmllib.php
modify_database(/home/mysite/public_html/members/blocks/activity_locking/db/mysql.sql) % line 1355, file: blocklib.php
upgrade_blocks_plugins(
http://www.mysite.com/members/admin/index.php) % line  441, file: index.php

Block activity_locking tables could NOT be set up successfully!

In reply to Deleted user

Re: Conditional activities: Activity Locking for 1.9?

by Bernard Boucher -
Hi Jeff,
it is more precise that bla bla bla wink

First I strongly recommand that you copy your production server ( php, database, moodledata ) on your personnal machine to practice yourself before trying it on your working production server. If you were more prudent you should have seen that error on a sandbox server not on your production server! If you loose something I don't want to have any responsability on that.

As you notice it seem to be only the installation that fail with reason because it is already installed. Activity locking is not backupable nor upgradable nor unsinstallable!

#1 - Check carefully the table mdl_block : you should not see a record with the "name" field containing "activity_locking".

#2 - If #1 is true, insert a new record in that table : add only the exact expression "activity_locking" in the field named "name" : let the others fields on that record empty, Moodle will fill them correctly.

#3 - Check that the record of #2 was added and that Moodle has given it an ID.

#4 - Got to your notifications page : you should see 5 warnings instead of 7.

#5 - Got to your notifications page again : you should see no more warningsbig grin.

#6 - Check that the record of #2 was modified and that Moodle has given it the correct version number.

#7 - Try your old locks and to add some others.

#7 - Do the same on your production server.


Please don't bypass the prudence stepevil.


I hope it may help,

Bernard










Average of ratings: Useful (1)
In reply to Bernard Boucher

Re: Conditional activities: Activity Locking for 1.9?

by Deleted user -

Thanks Bernard... that was it!

Just needed to insert a new record in mdl_block with acitivty_locking in the name field, and the problem was solved!

Thanks again

In reply to Deleted user

Re: Conditional activities: Activity Locking for 1.9?

by Todd Thornton -

We just had the same problem that was also fixed using Bernards method, but I seem to have lost the ability to have checkboxes on the left side to show whether the activities have just been accessed/completed. The locks still work and if you lock an activity you still get a lock/then checkmark when its complete on the right hand side of the activity, but you have to lock on something else. I can make it work as is, but I generally just like to have "access" boxes to help people keep track of where they are and then I only actually lock the end of section quizzes based on completing all activities. I'm just wondering if anyone else has experienced the same thing or has any ideas about a missing string in one of these updated files.

I think we used Chardell's latest version and the couple of files that were updated to account for recent moodle.lib changes.

Thanks,

Todd 

In reply to Todd Thornton

Re: Conditional activities: Activity Locking for 1.9?

by Chardelle Busch -
Picture of Core developers
Hi Todd,

When you click on the lock editing icon you should see the Activity completion option for that activity at the bottom of the page. It is independent of locking the activity on some other activity (the top section). Then when you save you should see an open square at the left of the activity--and then a checkmark when the activity is completed.

If you don't see it, maybe the icon is missing? Make sure you have the open and closed gifs in your pix/t/ folder.

If it still doesn't work, it's possible I don't have the latest code posted. Let me know. I am in the middle of moving this week so I won't be spending much time in front of a computer--but I will look at it when I can.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking for 1.9?

by Todd Thornton -

I've attached a picture of what I see when I try to lock an individual activity. This is different than what I see when I try to lock a section. In the section I see three choices including a check box for complete plus two CSS settings. 

I added a language string because I noticed a language problem   in one of the section options, but it's almost like it's not being called at all when you're trying to lock an individual activity.

Todd

Attachment alactivities.jpg
In reply to Todd Thornton

Re: Conditional activities: Activity Locking for 1.9?

by Todd Thornton -
Here's what the section lock settings look like.
Attachment al.jpg
In reply to Todd Thornton

Re: Conditional activities: Activity Locking for 1.9?

by Chardelle Busch -
Picture of Core developers
That's an older version. Here's what it should look like (I got rid of the css styles to simplify things--not sure that code was correct anyway). I haven't really looked at the section locking.

You lock the access to the activity based on requirements for other course activities in the top section, based on time in course, in next section, you set the requirements to show the completion icon in the next section.

The locking for right now only covers graded activities, choice answers, forum posts, and access based on logs.

Attachment al.gif
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking for 1.9?

by Chardelle Busch -
Picture of Core developers
Here are the lib/locklib.php and the course/lock.php files from the install of where I took the screenshot above. Give them a try and see if it works better.
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking for 1.9?

by Todd Thornton -

Thanks again for the code, but unfortunately this time the code doesn't solve the problem I've encountered. When I login as an administrator/teacher, the courses disappear completely (could be roles related on the homepage), but when I log in as a student, the courses appear, but it's impossible to view all sections. You only see one or two sections.

Because I needed some bugs fixes, I am using recent Moodle code 1.9.1+ that's only about two weeks old and I'm wondering if some changes have occurred in core that's creating havoc with this existing AL code. If someone has this working correctly with 1.9.1 or better, I'd appreciate a response. That way I'd know for sure if it's something with my individual setup. I'm guessing the Planet may come back online tomorrow and internal messaging will work, but if not feel free to click my profile and send a message via my email address.

Thanks,

Todd

In reply to Chardelle Busch

Re: Conditional activities: Activity Locking for 1.9?

by Todd Thornton -
Chardelle,

I'm trying to get AL working with the latest version of Moodle but I seem to somehow have gone back to the old CSS code. Can you tell me how many files use the CSS code and how that's referenced? I'd rather just try to take it out as opposed to starting over because I've gone through so many changes/merges already.

Thanks,

Todd
In reply to Bernard Boucher

Re: Conditional activities: Activity Locking for 1.9?

by Julian Ridden -
I have installed the block succsfully and followed your tips listed above.

My issue is that when i replace the moodlelib file my PHP throws up the following.

Fatal error: Cannot redeclare document_file() (previously declared in /home/playpen/public_html/lib/deprecatedlib.php:1590) in /home/playpen/public_html/lib/moodlelib.php on line 5736

In 1.9.2 this function is missing from the standard moodlelib. I just removed the function and all seems to be fine.

Am I missing something?

Julian
In reply to Julian Ridden

Re: Conditional activities: Activity Locking for 1.9?

by Chardelle Busch -
Picture of Core developers
Hi Julian,

The hacks to both the moodlelib file (just one hackthat's commented with "Activity Locking") and the course/lib.php file really should be made to your latest code rather than using the two files in the download since those files are changing weekly and it's too much to keep up with them.

The course lib file isn't particularly well commented, however, if you do a search for the "Activity Locking" comments as well as the word lock (for the icon link and the lock string toward the bottom of the file) you should be able to find those hacks and apply them to your latest file.
Average of ratings: Useful (2)
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking for 1.9?

by Andrew Chow -
Thanks, Chardelle,

I did as you suggested, and merged the Activity Locking code with the new 1.9.2+. It works like a charm. Thanks for the good work.
In reply to Andrew Chow

Re: Conditional activities: Activity Locking for 1.9?

by Chardelle Busch -
Picture of Core developers
That's fantastic Andrew. If you have a chance, perhaps you could zip up your moodlelib.php, and course/lib.php files and post them here? Others are wanting to get it working in 1.9.2 too.

Thanks!!!!
In reply to Chardelle Busch

Re: Conditional activities: Activity Locking for 1.9?

by Andrew Chow -
Sure thing, give me a bit of time, and I will zip up the files the same as the original, and upload it here. I have a few tight deadlines this week, but should be able to upload later.
In reply to Andrew Chow

Re: Conditional activities: Activity Locking for 1.9?

by Grant Beevers -

Thanks Andrew - really appreciate this. It will help us out no end with a major issue we have at the moment around release of content. Look forward to grabbing it smile

Cheers,

Grant

In reply to Grant Beevers

Re: Conditional activities: Activity Locking for 1.9?

by Andrew Chow -
Here is part 1 of the zipped archive of the files that works for us.

I've changed the readme.txt file to reflect the additional files and changes.

I have to split it into three parts because the original size of 170kb exceeds the maximum limit.

part 1: Activity_locking.zip - 59kb - unzips to folder
part 2: moodlelib.zip - place inside lib subfolder - unzips to moodlelib.php
part 3: accesslib.zip - place inside lib subfolder - unzips to accesslib.zip
Average of ratings: Useful (1)
In reply to Andrew Chow

Re: Conditional activities: Activity Locking for 1.9?

by Todd Thornton -
It looks like some of the files in Moodle have changed quite a bit in the last couple of weeks. Has anyone been able to get activity locking working in the latest bleeding edge version of Moodle? I just updated to the last weekly update, because I really need to keep the SCORM improvements, but I also need activity locking.

Todd
In reply to Grant Beevers

Re: Conditional activities: Activity Locking for 1.9?

by Andrew Chow -
Here is part 2.
In reply to Andrew Chow

Re: Conditional activities: Activity Locking for 1.9?

by Ashley Holman -
Hi Andrew,

Thanks for this code

Is it possible that you could post a patch rather than a complete copy of the files? I tried to make a patch by comparing the CVS code with the files in your zip, but the Id tags in the zips are blank so I've based it on the version you cited in the readme.txt file "1.9.2 + (Build: 20080811)".

The resulting patch for lib/moodlelib.php seems to have a lot more changes in it, ie. there are many parts of the code missing compared to what's in CVS, eg. some calls to user_accesstime_log have been removed, function definitions changed etc, which don't look like parts of the activity locking. I've attached a diff for you to see. I suspect this is also the case for other files in the zips.

I'd greatly appreciate if you would be able to generate a minimal patch that could be applied for activity locking so that I can keep the rest of the code in synch with CVS.

Thanks
Ashley
In reply to Ashley Holman

Re: Conditional activities: Activity Locking for 1.9?

by Andrew Chow -
Hi, Ashley, sorry for the late response, but deadlines on projects kept me busy.

I will look into this and let you know.

I may also need your help with creating the patch. I will contact you directly.
In reply to Andrew Chow

Re: Conditional activities: Activity Locking for 1.9?

by Ashley Holman -
Thanks Andrew. I've actually already made the patch (did it this morning before seeing your post!). We're testing at the moment and if there are no obvious bugs I'll send you copy so you can review it. The patch is against a recent 1.9.2+ Moodle.

Cheers
In reply to Ashley Holman

Re: Conditional activities: Activity Locking for 1.9?

by Murray Davis -

Ashley, did you get your patch to work on 1.9.2+? If so, can you supply either the patch or full AL to download as I tested the others listed in this forum and had no luck on my 1.9.2+ 20080827 build?

Thanks!

In reply to Bernard Boucher

Re: Conditional activities: Activity Locking for 1.9?

by R McPhee -

Sorry to jump in here, but I am having an issue and been trying on my own for some time to resolve...

With an install of the new Moodle, and latest of AL, all looks well and seems to perform as it should.  I mean it goes through all the correct steps and allows me to lock lock the previous lesson, however my students can still see ahead.  The locks are there, and a mouse over showes what is needed to proceed, however nothing is greyed out, and they can click through the lock...

I have tried the uninstall, and read through this post, following along with other suggestions, and still no further ahead...

Any advice???

In reply to Eugene Voevodin

Re: Conditional activities: Activity Locking for 1.9?

by Colin Matheson -
I am really interested in AL. I tried to install on a 1.9 test server (build 2007101509) with the code from Promoodle.
The database installation was all green and I can see the lock icon. However, when I click the lock icon I get an internal server error.

I checked my error logs and saw these errors:

[2008-07-26 15:00:37]: error: file is writable by others: (/home/colinmat/public_html/test/course/lock.php)
[Sat Jul 26 15:00:37 2008] [error] [client 207.177.225.136] File does not exist: /home/colinmat/public_html/500.shtml
[Sat Jul 26 15:00:37 2008] [error] [client 207.177.225.136] Premature end of script headers: /home/colinmat/public_html/test/course/lock.php

The link when I mouse over the lock icon is:
http://www.colinmatheson.com/test/course/lock.php?id=12&sesskey=AeV65Mpf2H&sr=1

Anyone else have this problem or know what might cause it?
The server did have a few courses on it and originally had AJAX enabled, but I turned that off.
In reply to Todd Thornton

Re: Conditional activities: Activity Locking for 1.9?

by Cristiano Leoni -
Hi there!

I have tried installing "Activity Locking for 1.9" on the Moodle 1.9.2+ (Build: 20080917) with no big luck.

By clicking on the Notifications page I got the error:

" Fatal error: Cannot redeclare document_file() (previously declared in /var/www/moodle/lib/deprecatedlib.php:1590) in /var/www/moodle/lib/moodlelib.php on line 5736"

As it seemed there was no patch for the current version of Moodle, I simply tried commenting out the "document_file()" function in order to resolve the duplicate definition.

I reloaded the Notifications page which successfully reported all installation messages correctly, but when I clicked on CONTINUE, my Moodle installation stopped working (blank screen whatever I do).

So I restored the files from the backup:
lib/moodlelib.php
course/lib.php
course/format/topics/format.php
course/format/weeks/format.php

and everything turned back to normal.

Now that's a real pity that I cannot get AL to work.

I am skilled on PHP, is there any chance that I can fix it by moving portions of code from the AL files to the standard ones?

Any indication is very appreciated and of course I am willing to share the patch once finished.

In reply to Cristiano Leoni

Re: Conditional activities: Activity Locking for 1.9?

by Cristiano Leoni -
I managed to produce an updated version of Activity Locking for Moodle 1.9.2+ Build 20080917.

It was not difficult, since code blocks I got from moodlelib and lib were small and well outlined.

It seems to work fine, and you can download it from this page (see Moodle section).

hope it can be useful to others - feel free to download, use and re-publish.






Average of ratings: Useful (1)
In reply to Cristiano Leoni

Re: Conditional activities: Activity Locking for 1.9?

by Chris Creed -
Hi everyone

Help please

I have tried to install activity locking in 1.9.3 I went to admin and pressed notification and now whenever I try to go to my modules it displays a blank page. Prior to installing I made a backup of:
lib/moodlelib.php
course/lib.php
course/formattopics/format.php
course/format/weeks/format.php

After seeing the blank page I tried reinstalling these 4 files but the same happens.

Does anyone have any ideas - I know that it says everywhere that it shouldn't be used on a production site but that's my natural trusting nature - oooooh dear!

Thanks for any replies / light / help

Thank you in advance

Chris
In reply to Chris Creed

Re: Conditional activities: Activity Locking for 1.9?

by Sharon Goodson -
Hi Chris, I hate to be the bearer of bad news, but you'll probably just have to uninstall AL and wait for conditional activities due to release with Moodle 2.

I had a very similar problem with AL on 1.9.3, I lost access to course categories and the add/edit courses link (blank pages/500 errors). I could still edit courses if I got to them from another route, but of course, that was little help.

I actually thought I had AL files configured together to be functional, as all the locks appeared as they should, settings were all there, I was able to lock/unlock all everything, etc. It wasn't until I noticed a few assignment submissions that should have been locked until I graded the prior assignment that I realized that looks were very deceiving.

I should have known better, but I 'assumed' everything was back. Too bad, since every course is set up to use the locks and we're having to go in and assign password locks the most important stuff while we wait for Moodle 2.

I don't believe anyone has gotten AL to work properly with 1.9.3 or 1.9.4. If they have, I would definitely be interested in what they did!
In reply to Sharon Goodson

Re: Conditional activities: Activity Locking for 1.9?

by Cathii Scott -
http://moodle.org/mod/forum/discuss.php?d=114948 has a version of AL for 1.9.3 that appears to be working fine... at least I have been unable to make it crash thus far and have installed it on the production server with no current feedback about failures. Crossing my fingers I don't receive any because we too rely heavily on locking of activities.
In reply to Cathii Scott

Re: Conditional activities: Activity Locking for 1.9?

by Sharon Goodson -
We do too - have you tested it as a student to see if items really are locked?
In reply to Sharon Goodson

Re: Conditional activities: Activity Locking for 1.9?

by Chris Creed -
Hi

Thanks for the replies.

I have tested it as a student and all white pages.

I tried uninstalling all the files I uploaded to my server and put a saved /lib file in but still the same.

I imagine that I have left something in that shouldn't be there, but can't think where / what.

i'm getting a bit desperate now and worried that I have completely ruined my site.

Another issue is that I have half of my blocks on the front page missing, which is a bit strange.

Thanks for any pointers

Kind regards

Chris
In reply to Sharon Goodson

Re: Conditional activities: Activity Locking for 1.9?

by Chris Creed -
Hi

I've just tried the activity lock posted on the forum as recommended but now I have this error:


Warning: main() [function.main]: Unable to access /moodle/lib/locklib.php in lib.php on line 4

Warning: main(/moodle/lib/locklib.php) [function.main]: failed to open stream: No such file or directory in lib.php on line 4

Fatal error: main() [function.require]: Failed opening required '/moodle/lib/locklib.php' (include_path='.:/include/') in lib.php on line 4

Any ideas would be gratefully received

Kind regards

Chris
In reply to Chris Creed

Re: Conditional activities: Activity Locking for 1.9?

by Cathii Scott -
This error can be caused by several different things.

The most likely is that $CFG->libdir is pointing in the wrong direction. Make sure that $CFG->dirroot is set to the FULL path to the moodle directory. On a Unix/Linux sever it is usually something like 'usr/your_user_name/htdocs/moodle' or on windows 'D:\xampp\htdocs\moodle'

-----------------

"include_path" is initially set in your php.ini file and points to your scripts directory. In the example below mine is set to point to the PEAR directory. It depends on what OS/software you are using as to where this resides. eg mine is in the .../apache/bin folder. I run win2003 server and a xampp install of apache php and mysql.

In the php.ini file you will find these lines (or something similar):

;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; Windows: "\path1;\path2"
include_path = ".;D:\xampp\php\pear\"

This value can be change programmatically (temporary only) by using the function set_include_path(). See http://au2.php.net/set_include_path for more detail


In reply to Sharon Goodson

Re: Conditional activities: Activity Locking for 1.9?

by Chris Creed -
Hi again,

I've been fiddling around - I must admit I don't really know what I'm doing though. Now I have this error:

Fatal error: Cannot redeclare update_category_button() (previously declared in /moodle/lib/weblib.php:5186) in lib.php on line 1961

Any ideas / help as I'm somewhat flapping around in the dark here and would hate to lose my site and its contents.

Chris
In reply to Chris Creed

Re: Conditional activities: Activity Locking for 1.9?

by Sharon Goodson -
Hi Chris, I wish I could help you more. I remember seeing those errors, especially the

Fatal error: Cannot redeclare update_category_button() (previously declared in /moodle/lib/weblib.php:5186) in lib.php on line 1961

In the end, it didn't have anything to do with either of the files.

First ,you need to get your site back and make sure everything is working correctly. Then, you can start over with AL.

Remove AL from manage blocks in admin>blocks. Then, remove every file and folder you ADDED (not replaced) relative to AL, including the activity_locking block folder. (I think I left the pix file in place, knowing for sure that wouldn't be an issue)

Then one by one, restore the originals files you replaced with AL modified files.

To double check if you got everything, on your computer, expand the folder you got the files from, then compare those to what's on the server. If your ftp program, you should also be able to sort your server files by 'time modified' and check that way too.

Hopefully this will get you back up. If you try AL again, combine the files from Christiano's and Andrews versions as noted in this thread. Doing it this way you don't replace moodlelib.php. (This ended up not working for me, but it apparently has for others, though I did come close *lol*)
In reply to Sharon Goodson

Re: Conditional activities: Activity Locking for 1.9?

by Cathii Scott -
It worked fine in testing as student, teacher and admin
In reply to Todd Thornton

Re: Conditional activities: Activity Locking for 1.9?

by Cristiano Leoni -
Hello,
I have produced a new version of Activity Locking module for use with the current Moodle 1.9.3+ (Build: 20081015)

Free download here: Activity Locking for Moodle 1.9.3+ (Build: 20081015) - see Moodle section on the page.

Tested on the "topics" lesson format (but should work on "week" format too) on this e-learning website (test course name is: Programmare con DimensioneX, I'm sorry all the course contents is in Italian but you should be able to see the messages in English too)


In reply to Cristiano Leoni

Re: Conditional activities: Activity Locking for 1.9?

by Frances Taylor -

Christiano - I tried this for my 1.93 install. The section lock does work but the activity locking doesn't. There are no locking icons next to the activities to lock them individually. I tried an earlier version where the icons did appear and I was able to try to lock them but the locking didn't work and even then, when the student logged in, the icons for prerequisites, completed, etc. completely disappeared.

I will use the section lock for now but the lock and unlock icons appear all the time - when I lock a section, for example, from the teacher and student view both icons still appear. Also the check boxes and complete/locked status doesn't appear either. Do you have any tips for these? Thanks! Fran

In reply to Frances Taylor

Re: Conditional activities: Activity Locking for 1.9?

by Frances Taylor -
I removed AL from my install and reloaded all the files and reinstalled it and now the sectionlocking doesn't work either.... sad
In reply to Frances Taylor

Re: Conditional activities: Activity Locking for 1.9?

by Frances Taylor -

ok...here is what i have for al to make the individual activity locks work - and they do work:

I am using all of Christiano's 193plus AL folders

EXCEPT I have replaced the BLOCKS AND COURSE folders with the blocks and course folders of Andrews 1.92 AL version.

The activity locking does work BUT the prerequisites, completed, etc. status icons and phrases don't appear in the course to the student. The icons do appear to the teacher though...

I needed individual activity locking so between the two versions this does work...I wish the icons would appear to the student though but this will work for me for now. Thanks to both of you! 

In reply to Frances Taylor

Re: Conditional activities: Activity Locking for 1.9?

by Deleted user -
Just an FYI, but I noticed the Promoodle.com website domain expired as of Oct 13/08... not sure if that was intentional or if the person hosting that just missed it.
In reply to Frances Taylor

Re: Conditional activities: Activity Locking for 1.9?

by Frances Taylor -
Actually - I was mistaken...depending on what role you are in the locks work - ie if you are a teacher they work, if you are a student they will keep you locked out. I just upgraded to the recommended 1.93...does anyone have AL that work with 1.93 that are not just section locks and work in all roles? Thanks!
In reply to Frances Taylor

Re: Conditional activities: Activity Locking for 1.9?

by Sharon Goodson -

I found the same thing, I followed your lead, Frances, and it works great! I packaged it up this way and included both README files, if anyone has a need for them. (should I go ahead and upload it? I don't know what the protocol is on that, especially since it's not my work).

Anyway, I thought it might be handier than having to unzip both versions then mix and match the files...

Great stuff! Will it be in Moodle 2??

Ah! one thing, though, while I'm thinking about it - when a teacher selects view a submitted assignment with a resource prerequisite, often times it will remain locked even to the teacher until he/she accesses the resource.

Has anybody else noted this?

In reply to Sharon Goodson

Re: Conditional activities: Activity Locking for 1.9?

by Deleted user -
Activity locking WILL be included as part of Moodle 2.0, although still only for within a course, and will not support pre-requisites from a different course.
In reply to Deleted user

Re: Conditional activities: Activity Locking for 1.9?

by Sharon Goodson -

Very Cool! That's actually what I meant, anyway. I saw course prerequisites as more of far off dream...

...now, I know that's the perfect lead-in for something about Moodle, and dreams, and coming true....but I'm not saying it...it's just too corny big grin

In reply to Daniel Denev

Re: Conditional activities: Activity Locking for 1.9?

by Sharon Goodson -

Thanks for those links! There is some very interesting materials there. 

Question: Is there something in particular you are trying to point me too (as in more effective ways to use prerequisites), or are you just sharing in general what appears to be a very through body of work on methods in general?  

In reply to Sharon Goodson

Re: Conditional activities: Activity Locking for 1.9?

by Daniel Denev -

Adaptive learning has its practical implementation. Software Application vased on Modified Moodle (3 years work after Moodle version 1.5.4) called BEST (Bulgarian Educational Site) This unique "fork" of Moodle is based on full new implementation of lock activities module and project management modules. After finishing the work we uploaded it on SourceForge http://sourceforge.net/search/?type_of_search=soft&words=freeknowledge    and you can downloade it from http://downloads.sourceforge.net/freeknowledge/best09.rar?modtime=1190196250&big_mirror=0    It is important after installation (you need very good administrators and developers skilled with Moodle architecture) to choose theme BEST.

All that have been written in my previous post is true and have its practical realisation (not onli pictures and research papers)

In reply to Daniel Denev

Re: Conditional activities: Activity Locking for 1.9?

by Sharon Goodson -
Sounds very interesting - I will certainly look at it further!

BTW - I said the mix and match method for AL worked great on my OLD install (which is still up after a recent migration), but for some reason, it's not working properly on my new install. The course categories all through 500 http errors (and the edit/add courses). It's the same version, 1.9.3, only much better hardware (a MP, actually). Any ideas?

In reply to Sharon Goodson

Re: Conditional activities: Activity Locking for 1.9?

by Rhonda Goetz -
I am still having trouble. I get section locks that show both the lock and unlock for both student and teacher, not activity locks at all. I have the open and closed gifs in my theme folder - so no go.

Everything is locking correctly and prerequisites are showing up when locking is triggered, but these icons are confusing my students and me. I can't tell what has been locked or unlocked.

Any ideas?

Using 1.9.3+ changed out the lib and locklib from Chardelle as well.
Rhonda
In reply to Rhonda Goetz

Re: Conditional activities: Activity Locking for 1.9?

by Sharon Goodson -
Ok, folks - I think I may have it - I'm keeping my fingers crossed it works for someone else...

Basically, use everything in Christiano's Activity_Locking_for_193plus, EXCEPT, use the attached php file as a template for course/lib.php.

You can try and use it as is, (it's a modified version of lib.php,v 1.538.2.66 2008/12/17 12:40:09 sam_marshall - I have no idea what the protocol is for signing or notating a modified file, so I simply added a note to "//Modified for Activity Locking...") - but considering the number of changes out there, I would do a diff compare and copy/insert anything relative to AL into your existing course/lib.php. I found that using a course/lib.php just a few weeks older then what you have can cause quiet the bottleneck with course/category.php and course/index.php

ALSO - the pix/t folder needs to go in the global (root) pix folder, not in themes.

This set up shows both section locks (on the right) and individual locks on the left (actually just to the right of the assignment). As far as I can tell, it's all working, though I doubt it's going to be that easy. I haven't tried to set section locks, as doing so overrides the individual locks (and they never appeared in my version for 1.9.2 anyway, so I never used them). Nonetheless, it's progress.

Also, for those migrating to another server, I'll back up just a bit - I had problems trying to reinstall AL until I deleted it through the Admin>Manage Blocks (as it said it wasn't compatible). Each time I tried to fix a file here or there, I would lose access to categories and sometimes courses.

After deleting it there, I reinstalled fresh, ran into what Jeff did, followed Bernard's most excellent instructions (dully noted his red font - though my sandbox never did that - probably because it's where the original database resides), got AL back, and then did the modifications (though I would certainly do the first had I known).

What's great is that all my locks from the other site were preserved. I was under the impression that deleting through Admin>Manage Blocks also deleted the locks. I was willing to start all over creating new ones, but didn't have to!

Good Luck!
In reply to Sharon Goodson

Re: Conditional activities: Activity Locking for 1.9?

by Sharon Goodson -
I meant to add too, I did not replace my lib/moodlelib.php, and I did a diff compare on topic/weeks format.php to copy/inserted AL references.

Sorry - I hope I'm not so brain dead that I got something backwards...

If anyone would like me to zip up my working files, I'd be happy to.
In reply to Sharon Goodson

Re: Conditional activities: Activity Locking for 1.9?

by Sharon Goodson -
ok - I'm back....I'm still having one issue: My error log reports:

PHP Warning: Invalid argument supplied for foreach() in /xxx/course/lib.php on line 1413...and on line 1418.

It doesn't seem to be causing any problems (though I'm sure it's doing something), but the warning is generated multiple times for every page accessed, thus blowing up my error log.

The following are the lines referenced (and includes surround code):

1411 $linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
1412 $locks = islocked($mod);
1413 foreach ( $locks as $lock=>$state ) {
1414 $locked = ($state=='closed'?true:false);
1415 }
1416 $completion = iscomplete($mod);
1417 $incomplete ='';
1418 foreach ( $completion as $completion=>$state ) {
1419 $incomplete = ($state=='closed'?true:false);
1420 }

I know very little about PHP, though I'm trying to learn, and I do enjoy making colorful new phrases about of the the acronym.

About the most I can come up with is that it's looking for an array that doesn't exist and/or it's actually a string? I don't know.

Any bail outs? *lol*

Thanks!
In reply to Sharon Goodson

Re: Conditional activities: Activity Locking for 1.9?

by Ian Scott -
Thank you Sandra - I added AL to 1.9.4 but only the whole topic could be locked - your lib.php fixed that.
In reply to Ian Scott

Re: Conditional activities: Activity Locking for 1.9?

by Deb Burdick-Hinton -
That is good news. We are having the same problem as I think you described so nice to know the lib.php will fix that. Is there anything else you did to get the locks working properly in 1.9.4 other than what Sharon describes above? Here is a screen shot of our challenge:


Attachment NoLocksOn1.9.4TestServerR.jpg
In reply to Deb Burdick-Hinton

Re: Conditional activities: Activity Locking for 1.9?

by Deb Burdick-Hinton -
Sharon's fix worked. No need to reply.
Another Note: AJAX and Activity Locking v1.9.4+ are not compatible. As soon as I enable AJAX the locks disappear smile Oh well guess I am going to have to wait until v2.0 to get this going unless someone knows of a work around.
In reply to Deb Burdick-Hinton

Re: Conditional activities: Activity Locking for 1.9?

by Cristiano Leoni -
Thanks to help from Debra Burdick I made a new version of Activity Locking for Moodle 1.9.5 stable, which includes the fixes by Sharon Goodson.

The result is a module which allows individual activities' locking - see attached picture for a preview.

It doesn't work with AJAX, though.

If anybody has a hint of how to made it compatible with AJAX, or to make the code more modular, just message me.

The module is available for free download from this page:

http://software.cristianoleoni.com/tiki-index.php?page=Moodle
Attachment al_195_a.jpg
In reply to Sharon Goodson

Re: Conditional activities: Activity Locking for 1.9?

by John Hannah -
This is great - works! It's a great add-on, but unfortunate that the install instructions ended up wasting so many man hours of Moodle users around the world. All's well that ends well, I guess...
In reply to John Hannah

Re: Conditional activities: Activity Locking for 1.9?

by Wayne Wenthin -
Any clue on how to make it work right with the weeklys? I upgraded to that not bothering to read that it only worked with the stable.

In reply to Wayne Wenthin

Re: Conditional activities: Activity Locking for 1.9?

by Chris Collman -
Picture of Documentation writers
Hi Wayne,
I have been installing activity locking on various Moodle localhost installs for the last 3 weeks on two different machines. My focus has been upon 1.9.5 weekly. Sometimes it works and sometimes it does not.

I can only tell you my consistent clean install that seems to work everytime. I use XAMPP for Windows 1.7.1 . Then I install the Weekly build on that. Works for the last 3 weekly builds. I create a course with two lessons, each with 1 question. Set the lock on Lesson 2 to get 1 correct on Lesson 1. Login as a student and the Lesson 2 is grayed. The Section locks still show for student.

What does not always work is placing AL 195_A in a new complete install package for windows that is the latest and greatest. I am not sure why and don't have that level of knowledge to compare the two site to figure out why.

This weekend I was reviewing MoodleDocs for the XAMPP for windows instructions and created my 7th XAMPP webserver. For work purposes, this morning I downloaded the latest weekly and installed it on my home computer. Just for giggles, I took AL for 1.9.5_A folders and files which I now have permenatly unzipped, and dropped them into htdocs/moodle folder. Did my course creation test and it worked both for admin and for a student.

I have 9 complete install packges installs on two computers, where I attempted to install AL 195_A. The only time I could seem to get that to work was by dropping the recommended May weekly build into the folder after I unpacked the latest complete install. I think I had to tweak something so I don't consider this a successful install or test. Other complete installs (upgrades of complete installs etc) had inconsistant results. Some times all the locks were there, but did not work, other times the AL install seemed to have no effect.

Since we will be doing an install on a clean new Moodle on a Linux server, I am very hopeful that it is going to work.