Jump to content

question for our guru's


joeri

Recommended Posts

  • Moderators

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Guest lorathon

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);
	}
}

Link to comment
Share on other sites

Guest lorathon

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...