A toy for Xmas (editing layout, copying stuff into course)

A toy for Xmas (editing layout, copying stuff into course)

by Audun Hauge -
Number of replies: 13
A few more features added (can move sections) and the code has been worked over a bit.
  • Thrash works, drop mods onto trash
  • Available resources from other courses are shown as a scrunched list under mod-icon, click icon to expand list.
  • The calendar icon works, click on day,h,m to adjust. Drag the module (preexisting, not blue) to desired week, drag calendar onto mod and click (changes color, day show). Mods with date limits get their dates set.
Enjoy  (try on development system only)
Average of ratings: -
In reply to Audun Hauge

Re: A toy for Xmas (editing layout, copying stuff into course)

by Teemu Sumi -
This is very impressive. There are many tools which save teacher's time. There are also some new tools, which are really needed:

  1. Remove many activities fast
  2. Share activities to other courses

Name field of the module has "+" sign when there should be " ".

I have two questions:

  1. Can admin bring all the modules from other courses?
  2. Can teacher bring all the modules from all the courses, where he is teacher?


Cheers,
Teemu
In reply to Teemu Sumi

Re: A toy for Xmas (editing layout, copying stuff into course)

by Audun Hauge -
The '+' for space is most likely due to effect of sending names as param to script (I think, havn't looked into it). I never see the '+' signs appearing on the real course page, so I'm not very motivated to track this down.

The code for finding available modules for copying is:

$mycourseids = 'select id,course from user_teachers where userid='.$USER->id

SELECT r.id,r.name,c.shortname
                FROM $thismod->name  r
                    ,course c
                WHERE  r.course = c.id and r.course != '.$course->id.'
                AND ( INSTR(r.name,"[PUBLIC_COPY]")
                OR r.course IN ('.$mycourseidlist.') )

Thus a teacher gets copies from all her courses and also from mods where [PUBLIC_COPY] is part of the name

I just tested as admin, I get nothing to copy. The list could be rather big if admin was to be able to copy from all courses. Perhaps an option to select course to copy from ?
In reply to Audun Hauge

Re: A toy for Xmas (editing layout, copying stuff into course)

by Jan Dierckx -
Very impressive feature. Thank you, Santa!
There are some functions in lib/datalib.php which maybe could be of use:
get_my_courses , get_courses_page, etc...
In reply to Audun Hauge

Re: A toy for Xmas (editing layout, copying stuff into course)

by Teemu Sumi -

It's better if admin must be in actual list of teachers to get copies. No option is needed.

Teemu

In reply to Audun Hauge

Re: A toy for Xmas (editing layout, copying stuff into course)

by 'Alim Beveridge -
Hi Audun,

This "toy" sounds really useful. In my use of moode I frequently need to copy or move activities or even whole sections from one course to another. I have some money to fund the development of a tool that will let you do that and the most sensible thing it seems would be to expand and build on the work you have already done. Would you be interested in that?
If yes, please send me an e-mail at alim(AT)nur(DOT)edu.

Thanks for your contribution!
Peace,
'Alim
In reply to Audun Hauge

Re: A toy for Xmas (editing layout, copying stuff into course)

by Michelle Ricketts -
How cool Audin!

I have one problem. . . I am working locally on 1.5dev - I have an error popping up when I attempt to go to my admin page
Fatal error: Class courseblock_layout: Cannot inherit from undefined class moodleblock in ../../moodle/blocks/layout/block_layout.php on line 5
I am just not sure if I have done everything right and beyond that, I don't know if you intended for .layout to be used for this version, so no worries there.
I have also tried with 1.4.2 with no luck. All of my blocks disappear.

I have concluded that I am doing something kookie and was hoping for some guidance.

The nooB strikes again
Thanks! wink
Michelle
In reply to Michelle Ricketts

Re: A toy for Xmas (editing layout, copying stuff into course)

by Audun Hauge -
I picked up a version of 1.5 before the new blocks were released.
I'll post a new version sometime before the new year. You can get the script to work by following suggestion by Darren:

$this->content->items[]='<a href="'.$CFG->wwwroot.'/blocks/layout/layout.php?id='.$this->course->id.'">Edit Layout</a>';

... in block_admin.php you just get a link in the admin menu rather than having to add the block to every course

Also you can enter   .../blocks/layout/layout.php?id=xxx
into the adress line of your browser.
xxx is id of your course (will show on adress line).


In reply to Audun Hauge

Re: A toy for Xmas (editing layout, copying stuff into course)

by Darren Smith -
Hello.

This has some excellent features - thee ability to just grab and move weeks and resources around is superb but I am also having problems under 1.4.3 with IE and firefox1. When I try to load the page both browsers complain about:

moodle_layout.jpg

Thinking about it more, this is possibly because we have 100s of resources it is trying to load - The unexpanded resource lines do take up around 5 screens worth of scrolling down. Perhaps a drop down list of course so the user can select which course he wants to view resources from instead of getting the full list may spread the initial load up?

On a minor note, it may be useful if the icons were labelled and the save changes button doesn't appear - it just appears as text but was a button in the last version. Is that deliberate?

Hope that was helpful rather that critical shy

Darren


In reply to Darren Smith

Re: A toy for Xmas (editing layout, copying stuff into course)

by Audun Hauge -
I agree, will have to remake with a different solution for external resources. Making them all draggable divs is too costly.
I've left of labeling icons so that I didn't have to add language strings (icons work in all languages), will add text & stuff later.
The GUI is just a prelim version, I didn't get the behavior I wanted from a submit-button. I expect I'll either add a button or an imitation.

Thanks for the helpful critisism! big grin
In reply to Audun Hauge

Re: A toy for Xmas (editing layout, copying stuff into course)

by Audun Hauge -
I've just tested the layout-editor on a fresh 1.5 download. The block system has changed quite a bit, so I can't move blocks yet (in fact they don't show up at all). Seems there have been a few changes to db in adition to changes for coding of blocks. In previous versions there was a field course.blockinfo with id's of blocks to display for each course. Rearanging blocks was simply a reordering of this list. Now this has been split up into a new table: block_instance.
So - will have some fun figuring out new code for shifting blocks in this new version. Also fixing code so that the layout-editor can handle any number of external resources/mods.
I'm surprised that the code degraded so gracefully - would have expected total collapse (testing on fresh 1.5). Coding for moodle is fun smile. Thanks to Martin and Jon and .. and ...
In reply to Audun Hauge

Re: A toy for Xmas (editing layout, copying stuff into course)

by Ger Tielemans -

Very very nice, tested under 1.4.3: gives you the feeling that you really create/rearrange a course on the fly. Brings Moodle to a new level of user friendlyness, thanks...

How difficult is it to create a second (empty) course next to the first one and drag and drop resources from the first to the second (and then save the second?)  

In reply to Audun Hauge

Re: A toy for Xmas (editing layout, copying stuff into course)

by Timothy Takemoto -
Dear Audun,

With one thing or another I have been very lazy about getting your block to work. I failed to get the 1.4 version to work with 1.5 (no surprises) as reported at another post.

But today, at last, I tried to get the 1.4 (and when that failed the 1.5) version to work with my 1.4.4+. Neither version of the block seem to have been recognised when I went to the admin or blocks screen. No tables were created. All was quiet, as if I had not uploaded the layout folder to the blocks folder of moodle.

My guess is that it is a something to do with my version
Moodle 1.4.4 + (2004083140)

Suggestiosn would be gratefully recieved.

Timothy

In reply to Timothy Takemoto

Re: A toy for Xmas (editing layout, copying stuff into course)

by Timothy Takemoto -
It is working fine with 1.6. No worries.