Block with random text

Block with random text

by Jan Dierckx -
Number of replies: 11

WP1,

I'm trying to find my way inside the moodle code and I made something a (littleshy) bit like what you want... it's a block which displays a random text everytime a person views a page.

However ...

it doesn't come with a GUI tongueout! In fact the only way you can add texts to the pool at this time is by sad manually adding them to the file 'block_random_quote.php'

like this:

$quote[] = "I am not young enough to know everything.";
$author[]="Oscar Wilde";

but that's the only thing you have to change! (And you do seem to hack a lot! smile

Attachment screenshot.gif
Average of ratings: -
In reply to Jan Dierckx

Re: Cool Moodle Sites

by Jan Dierckx -

I've noticed that students like it when a site shows them something new everytime they enter. I'm planning on collecting some quotes, interesting links, pictures, books, that don't really fit into one of the courses and publish them randomly inside my course.

To achieve this I'd like to link one of the glossaries to this block. The glossary already has an excellent GUI with possibilities to add pictures, include entries submitted by students after approval, etc... I only need the correct SQL-statements to extract just one entry out of a given glossary. I'm still working on that one though. blush 

In the meantime feel free to try out / comment my first program in PHP.

In reply to Jan Dierckx

Re: Cool Moodle Sites

by Steven Day -
Great idea! I did get an error message however. "Block_random_quote.php not readable". Rather strange. Any ideas.

This is a wonderful addition to Moodle Blocks.

Thanks Jan.
In reply to Steven Day

Re: Cool Moodle Sites

by Art Lader -
Yes,

For language teachers it would be nice for a random word block, for example.

-- Art
In reply to Jan Dierckx

Re: Cool Moodle Sites

by W Page -
Hi Jan!

Thanks for the info and or sharing the script.

Sure I would really like to use it.  Is it the script posted on this thread??

WP1
In reply to W Page

Re: Cool Moodle Sites

by Jan Dierckx -

it is!

Don't know what could be wrong with the "not readable" error? sad

In reply to Jan Dierckx

Re: Cool Moodle Sites

by Sean S -
Is there anyway to get this block on the front page? as far as I can tell it can only be added to a course.

Additionally, is there some way to have two different sets of quotes called in seperate blocks? I would like to have a random language learning inspirational quote as well as a vocabulary of the day.
In reply to Sean S

Re: Cool Moodle Sites

by Jan Dierckx -

Putting blocks on the frontpage is not possible in Moodle 1.3.1;

It's nice to hear that people want to use this block (and even nicer that they want to use two of them tongueout), but right know I really want to focus on linking it to the glossary module.

Asking people to change lines of code when they want to adapt things, is certainly not an elegant solution.

In reply to Jan Dierckx

Re: Cool Moodle Sites

by Floyd Collins -

Jan,

I like your quote script. I have a suggestion, why not make the quote and author area an include file. You could simple include the file into the script and have it point to a path in the course file directory where the lets say, quotes.php resides. Then the end user would have one file to update that would not be located in the block folder. If you want some help with this project maybe I can help create a GUI where the end user can update the quote and author file from a web browser.
Just some ideas.

Good work

In reply to Floyd Collins

Re: Cool Moodle Sites

by Jan Dierckx -

Thanks for your comments.

Nice suggestion about making the list of quotes an include file

However, I really want it to be able to randomly choose an entry from the glossary. That way the only thing the GUI must do, is to be able to choose out of which glossary the entries need to come (and maybe later the possibility to make the choice not random, but dependent on the date; that way you could turn the block into a kind of 'This day in history' - block.)

Can you help me with a suggestion on how to refer to the mdl_glossaryentries table?

Or should I use one of the pre-created functions in glossary/lib.php ?  

In reply to Jan Dierckx

Re: Cool Moodle Sites

by Steven Day -
I'll try re-installing. If no one else has the problem, it could be on my end.

I like Art's suggestion for a "word du jour" for language teachers. The RQ block is easily hackable, I assume.

Thanks again.