Date index for Jan 2005
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A cron script for scheduler
Hello there,
I downloaded and installed Achievo yesterday and it seems to be a nice tool. But I am really missing the absence of recurring tasks. Also another feature that I missed was the script for cron job to send reminders of scheduled tasks. In the night I wrote the following script. It sends the âscheduled itemsâ one week ahead of time to the owner of the scheduled items. You can set the frequency of the mails in crontab file. The script needs to be put in modules/calendar/cron. Then you should run the cron job using âruncron calendar.reminderâ
Any feedback is appreciated.
Best regards,
Asif
Note: Please name the following file as "reminder.cron"
------------------File Starts Here --------------------------
<?php
/*
* Scheduler reminder by Asif Iqbal <a.iqbal dot
*/
$todos = $g_db->getrows("SELECT
schedule.title,
schedule.description,
schedule.starttime,
schedule.startdate,
schedule.enddate,
schedule.allday,
schedule.endtime,
schedule.owner,
person.lastname,
person.firstname ,
person.email
FROM schedule, person
WHERE schedule.owner = person.id
AND schedule.startdate >= NOW()
AND schedule.startdate <= DATE_ADD(NOW(), INTERVAL 7 DAY)
ORDER BY schedule.startdate, schedule.starttime, schedule.title");
// Change the following to your email address.
$to = "someone dot
$today = date("d-M-y");
$subject = "Achievo Reminder for ".$today;
$body = "";
for ($i=0, $_i=count($todos); $i<$_i; $i++)
{
$body .= "\n(".($i+1).")\t".$todos[$i]["title"];
$body .= "\n\tStart Date:".$todos[$i]["startdate"].", Start Time: ".$todos[$i]["starttime"];
$body .= "\n\tFinish Date:".$todos[$i]["enddate"].", Finish Time: ".$todos[$i]["endtime"];
$body .= "\n";
}
mail($to, $subject, $body, "From: Achievo dot
?>