Moderators joeri Posted March 26, 2011 Moderators Report Share Posted March 26, 2011 hello all but mainly our php guru's you all know the autoretire part off phpvms you set a date (30 days and the pilot goes retired iff he makes no flight befor that date. now my question is is it possible to expand this part to something with an els/if statemend ex: pilot registers needs to make first flight within 14day of registration. iff not retire but for the active pilots it needs to be 30 days hope you all are getting me gr joeri Quote Link to comment Share on other sites More sharing options...
TAV1702 Posted March 26, 2011 Report Share Posted March 26, 2011 I had thought about this too. Except for now it would have been a manual thing I guess. That actually is what ai was thinking about and it would be really great. I suppose if a pilot registers he or she wanted to fly. If they don't fly within X amount of days then good bye. Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted March 26, 2011 Report Share Posted March 26, 2011 The following has NOT been tested but it should retire those ACTIVE pilots who have been with the VA for longer than 14 days (Changeable) and have a tolalflights number of zero. I named it findRookiePilots because I could think of nothing better. public static function findRookiePilots() { $days = 14; // Number of days to allow a flight before retirement $sql = "SELECT * FROM ".TABLE_PREFIX."pilots WHERE DATE_SUB(CURDATE(), INTERVAL {$days} DAY) > `joindate` AND `totalflights` = 0 AND `retired` = 0"; $results = DB::get_results($sql); foreach($results as $row) { // Set them retired self::updateProfile($row->pilotid, array('retired'=>1)); Template::Set('pilot', $row); $pilot_retired_template = Template::Get('email_pilot_retired.tpl', true, true, true); Util::SendEmail($row->email, Lang::get('email.pilot.retired.subject'), $pilot_retired_template); } } Quote Link to comment Share on other sites More sharing options...
Moderators joeri Posted March 26, 2011 Author Moderators Report Share Posted March 26, 2011 i presume i put this in the maint module Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted March 26, 2011 Report Share Posted March 26, 2011 you can put it anywhere and call it from anywhere. I would actually make a new data class and then add a line to the maintenance.php so that it runs with cron. I have added all types of clean up scripts to my cron to keep things up to date and clear unwanted items. Quote Link to comment Share on other sites More sharing options...
Cor Posted March 27, 2011 Report Share Posted March 27, 2011 Thanks Jeff, I had something like that with the old websit. I can use this one Regards, Cor Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.