Event Manager Class:
- it will be executed automatically with (a timer every minute or 10 seconds). (CAUTION: I don't events to start twice)
- It will start events every:
1. Day in a certain hh:mm. EX: 20:00 so at 20:00 it will start.
2. Day of week wd:hh:mm. EX: 06:18:00 it will start on Saturday 18:00
3. Week of month (1st week) and Day of that week (saturday). w:wd:hh:mm (w = first/second/third/fourth week wd=weekday)
4. Day of a month example: 1st of Jan. or 24th of Dec. md:hh:mm (md = month day 0-31)
5. Month of a year and week of the month and day of the week. example: Jun 3rd week Fri. mm:ww:wd:hh:mm (mm = month 12 / ww= week (1/2/3/4) / wd = weekday)
- Also it will have a time to end the event and that could be optional.
- It will print a sentence : Event has started. inside a method StartEvent()
- It will print a sentence when ends: Event has ended. inside a method EndEvent().
(optional if there is an end time or just a time set like 1 hour or 2 hours or so.)
- Calculating the time it will end at. example: in the start echo the even will end in x hours. (optional: if there is an end time)
- It will print a message every x hour (Next Event is EVENT_X it will start in Saturday May 23 2016).
MySQL table example:
DROP TABLE IF EXISTS `events`;
CREATE TABLE `events` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`Event_name` varchar(255) NOT NULL,
`Period` set('DAILY','WEEKLY','MONTHLY','ANNUALLY') NOT NULL DEFAULT '',
`start_time` varchar(255) NOT NULL, `end_time` varchar(255) DEFAULT NULL,
`start_command` varchar(255) NOT NULL,
`end_command` varchar(255) DEFAULT NULL,
`started` int(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Examples just to give an idea how I want it to work. start_time:
Period(MONTHLY) "week:weekday:hh:mm:ss" so it will be like 1:Sat:20:00:00 1 stands for 1st week or the month. Another example: Period(ANUALLY) "month:week:weekday:hh:mm:ss" so it will be like May:1:Sat:20:00:00 1 stands for 1st week or the month.