Closed

The blogrums are now closed. If you wish to visit them on there new home then you can find it here ( InnerVisions Blogrums ).

AuthorLottery plugin - snippets of great beauty

PHP:

if( date'U' ) > $current_draw_date )
        { // New draw
            $array_picked_balls $this->lottery$number_required_balls$number_total_balls ); // Draw
            $next_draw_date_time $this->NextDrawDateTime$drawing_weekday$drawing_time ); // Calculate next day/time to draw
            
            // This is the trick: the settings are stored in the database, so the draw and the date are safe.
            // It circumvents having to write the database access myself. Great for tiny bits of information.
            $this->Settings->set'current_draw'$array_picked_balls );
            $this->Settings->set'date_current_draw'$next_draw_date_time );
            $this->Settings->dbupdate();
        }
 
Afwas
user avatar

Posts : 27

Location : Groningen, The Netherlands

Joined : 03/03/08 10:39 am

Posted on : 18/03/08 08:11 am

PHP:

function GetDefaultSettings()
    {
        return array(
            'current_draw' => array(
                'defaultvalue' => '',
            ),
            'date_current_draw' => array(
                'defaultvalue' => date'U'strtotime'last week' ) ), // 'U' gives Seconds since the Unix Epoch, 
                // 'last week' is not significant, just somewhere in the past.
            ),
        );
    }

The settings are 'hidden' meaning they don't have a label or note, so they are not visible in the plugin settings. This is what creates the settings for storing the data.