0

I need some help regarding the implementation of the following alarm.. Here's the flow of the program, user login to the system and then they can click the hyperlink create schedule and then from there they can create schedules using the form. After which, user can choose to start this schedules that they created and they can allocate a timeframe to it. For eg, if the user assign the schedule to run at 2pm the system will have a pop up to notify and inform the user to run this schedule probably 15 mins before 2pm..

I would like to know what are the ways to implement this in php and if possible is there any reference i can use on the website? I've tried to find but apparently most scripts are paid etc.

user3015758
  • 1
  • 1
  • 5

3 Answers3

0

I think you are looking for scheduler kind of thing, to do this in php you can use scheduler for windows os cron job for *nix based os

Sivagopal Manpragada
  • 1,554
  • 13
  • 33
0

Yes the answer to this question is pretty much related to CRON job. Take a look at this answer

Execute Query on a Specific Date and Time

You need to write a PHP script that scans the db and sees for the user who should be notified (i.e their deadline has arrived). Run this script in the scheduler (maybe every 1 hour) and it will do the magic for you. Good luck with your notifications :)

Community
  • 1
  • 1
Talha Masood
  • 993
  • 1
  • 7
  • 22
0

No cron job is needed if you only notify user with popup on the web site, however, you will need a cronjob if you want to send emails.

  1. You will have to store users schedules (possibly in a db table)
  2. When the user logs in php should check if there's a task due in the schedules table for that user: if yes show the pop up.
  3. You will need to create an ajax call (with users id) that will call a certain php (say ajax.php) file every minute. You can help yourself with jquery.
  4. The ajax.php should check if there was a task due in the past. If yes it returns job details (as json or html, you chose) else it just returns that there are no jobs.
  5. When the calling ajax code recieves an answer from ajax.php, it does nothing if the answer is that there are no jobs or displays a popup with job details recieved from ajax.php.
  6. The user can dismiss the call (delete it from the schedules db table) snooze or reschedule it (update the due date in the schedules db table).
  7. Don't forget about security especially in the ajax.php: it has to check if the user is logged in.

Only if you want to prompt non logged in users by email you will need to set up a cron jobs, that will ping the ajax.php file periodically.

Gregor
  • 592
  • 7
  • 20