PHP Classes

PHP Sweepstakes: Calculate the days of periodical events

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog (2)    
Ratings Unique User Downloads Download Rankings
StarStarStar 57%Total: 432 This week: 1All time: 6,299 This week: 571Up
Version License PHP version Categories
sweepstakes 0.1BSD License5HTML, PHP 5, Time and Date
Description 

Author

This class can calculate the days of periodical events.

It can take an array with the definition of one more events, that includes the start and end day, the event period cycle (weekly or monthly), as well a list of exceptions that may be holidays for instance.

The class returns a HTML message display the next and previous editions of each of the listed events.

Innovation Award
PHP Programming Innovation award nominee
August 2014
Number 8


Prize: One downloadable copy of PhpED Professional
Some applications need to execute tasks that should happen regularly after a given period of time.

This class provides a solution for computing the dates of events that happen over a span of dates, considering exceptions caused by the occurrence of holidays during the expected event schedule.

Manuel Lemos
Picture of Chi H.
  Performance   Level  
Name: Chi H. <contact>
Classes: 28 packages by
Country: France France
Age: 39
All time rank: 34222 in France France
Week rank: 103 Up6 in France France Up
Innovation award
Innovation award
Nominee: 22x

Winner: 3x

Recommendations

Example

<?php
/***************************************************************
* Copyright notice
*
* (c) 2012-2014 Chi Hoang <info@chihoang.de>
* All rights reserved
*
***************************************************************/
require ("main.php");

//title = sweepstake title
//uid = unique ID
//day = day of the week
//cycle = weekly or monthly cycle
//end = duration of sweepstake
//table = exceptions

$table = array(
                array(
                   
"title" => "Sweepstake 1",
                   
"uid" => "1",
                   
"day" => "2",
                   
"cycle" => "0",
                   
"end" => "0",
                   
"table" => array(array
                                (
                                   
"ST" => "18 December",
                                   
"SD" => 1355785200,
                                   
"SUID" => "4",
                                ),
                                array
                                (
                                   
"ST" => "24 December",
                                   
"SD" => 1356303600,
                                   
"SUID" => "5",
                                ),
                                array
                                (
                                   
"ST" => "2 October",
                                   
"SD" => 1349128800,
                                   
"SUID" => "6"
                               
)
                          )
                     ),
           array(
                
"title" => "Sweepstake 2",
               
"uid" => "2",
               
"day" => "2",
               
"cycle" => "0",
               
"end" => "0",
               
"table" => array(array
                            (
                               
"ST" => "18 December",
                               
"SD" => 1355785200,
                               
"SUID" => "4",
                            ),
                            array
                            (
                               
"ST" => "24 December",
                               
"SD" => 1356303600,
                               
"SUID" => "5",
                            ),
                            array
                            (
                               
"ST" => "2 October",
                               
"SD" => 1349128800,
                               
"SUID" => "6"
                           
)
                      )
                 ),
            array(
               
"title" => "Sweepstake 3",
               
"uid" => "3",
               
"day" => "2",
               
"cycle" => "0",
               
"end" => "1",
               
"table" => array(array
                    (
                       
"ST" => "18 December",
                       
"SD" => 1355785200,
                       
"SUID" => "4",
                    ),
                    array
                    (
                       
"ST" => "24 December",
                       
"SD" => 1356303600,
                       
"SUID" => "5",
                    ),
                    array
                    (
                       
"ST" => "2 October",
                       
"SD" => 1349128800,
                       
"SUID" => "6"
                   
)
                    )
                 ),
                array(
                      
"title" => "Sweepstake 4",
                       
"uid" => "4",
                       
"day" => "2",
                       
"cycle" => "0",
                       
"end" => "1",
                       
"table" => array(array
                            (
                               
"ST" => "18 December",
                               
"SD" => 1355785200,
                               
"SUID" => "4",
                            ),
                            array
                            (
                               
"ST" => "24 December",
                               
"SD" => 1356303600,
                               
"SUID" => "5",
                            ),
                            array
                            (
                               
"ST" => "2 October",
                               
"SD" => 1349128800,
                               
"SUID" => "6"
                           
)
                        )
                 ),
               array(
               
"title" => "Sweepstake 5",
               
"uid" => "5",
               
"day" => "2",
               
"cycle" => "0",
               
"end" => "0",
               
"table" => array(array
                            (
                               
"ST" => "18 December",
                               
"SD" => 1355785200,
                               
"SUID" => 4,
                            ),
                            array
                            (
                               
"ST" => "24 December",
                               
"SD" => 1356303600,
                               
"SUID" => 5,
                            ),
                            array
                            (
                               
"ST" => "2 October",
                               
"SD" => 1349128800,
                               
"SUID" => "6"
                           
)
                       )
                 ),
           array(
               
"title" => "Sweepstake 6",
               
"uid" => "6",
               
"day" => "2",
               
"cycle" => "1",
               
"end" => "2",
               
"table" => array(
                        array
                        (
                           
"ST" => "2 October",
                           
"SD" => 1349128800,
                           
"SUID" => "6"
                       
)
                 )
           )
        );
       
       
$s = new sweepstake();
$result=$s->main($table,31);
echo
$result;
?>


Screenshots  
  • screenshot.png
  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example example
Plain text file main.php Class main class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:432
This week:1
All time:6,299
This week:571Up
User Ratings User Comments (1)
 All time
Utility:83%StarStarStarStarStar
Consistency:75%StarStarStarStar
Documentation:-
Examples:83%StarStarStarStarStar
Tests:-
Videos:-
Overall:57%StarStarStar
Rank:1648
 
very innovative and creative package
9 years ago (pooya sabramooz)
70%StarStarStarStar