Disable random block queue on weekends...

Disable random block queue on weekends...

by Gain Oloya -
Number of replies: 1

Hi! I have created a glossary of motivational videos on the front page and linked it to a random glossary block. It works fine and students and teachers love it. I have set the random glossary block to change its entry everyday. My concern is, how to stop the queue on weekends as we don't have classes on these days and I don't want them to miss or skip a couple of videos on the weekend?

I edited the block_random_glossary.php with what I hope were instructions to ignore entry of entry in the cache on saturdays and sundays like this (highlighted):

//check if it's time to put a new entry in cache
//if it's sunday(0) or saturday(6) then don't change the entry
$dw = date( "w", time());
if ($dw == 0 || $dw == 6) {
// Do nothing...
}
else if (time() > $this->config->nexttime) {

// place glossary concept and definition in $pref->cache
if (!$numberofentries = count_records('glossary_entries','glossaryid',$this->config->glossary,
'approved',1)) {
$this->config->cache = get_string('noentriesyet','block_glossary_random');
$this->instance_config_commit();
}

...

and it appears to be working because on saturdays and sundays the videos don't change but when I check the queue in the glossary of videos I see that 2 videos are skipped on weekends.

What am I doing wrong?

Average of ratings: -
In reply to Gain Oloya

Re: Disable random block queue on weekends...

by Gain Oloya -
Well, the code above works but it did not take effect immediately because the queue has already been created. Resetting the queue did it.