I've never written a php class before from scratch. But I guess you have to start somewhere right? I've got an idea, but need help with logic. Please tell me what you think. Below is shorthand obviously. In the planning stages.
Class - -> type (recurring, single, day) -> Recurring days (4,2,3,4,1,2....etc. for odd schedules- need even pairs) -> Shift Type (onshift, vacation, medical, etc...) -> Emp Id -> Start -> End -> Location Id -> Hours per day -> Day start time get schedule ( by account/location/company/unit/crew/individual ) select single entries separate array into days (1 day) increments if single entries have linking day entries, replace array with day entry information return mysql array of days for the time period; set schedule ( dates, emp id) if recurring if already exisits || conflicts with existing error create recurring template in db table create single db entries using recurring days for 1 year if single if date is between dates already in db || more than 1 year out error else insert into db if day if no existing single range error else insert into db under day table, with id linking to id of existing single. remove recurringOnly(emp id) delete all entries with recurring id remove all entries( from this date forward, emp id ) delete entries with start date > date cronUpdate( cron start / end dates) if cron start / end dates delete anything with dates bigger than nextUpdate (to make sure no errors) select recurring db entries with nextUpdate between cron start/ end insert into db the next set of "recurring days" for the employee update nextUpdate date for employee else - error