Jump to content

Set a pilot to active / Inactive / Retired (resigned)


Recommended Posts

Posted

Hi everyone !

The auto-retire system was not enough for our VA since some people resigned and we don't want to loose their hours for the company...

We had to include one more status to pilot profile :

Active

Inactive

Resigned

The hack consist of editing 3 files :

/admin/templates/pilots_details.tpl 

Find :

156	        <tr>
157	                <td>Pilot active?</td>
158	                <td><?php
159	                        if(intval($pilotinfo->retired) == 1)
160	                        { 
161	                                $retsel='selected';
162	                                $activesel = '';
163	                        }
164	                        else
165	                        {
166	                                $activesel = 'selected';
167	                                $retsel = '';
168	                        }
169	                        ?>
170	                        <select name="retired">
171	                                <option value="0" <?php echo $activesel?>>Active</option>
172	                                <option value="1" <?php echo $retsel?>>Inactive</option>
173	                        </select>
174	               
175	                </td>
176	        </tr>

replace by :

	<tr>
	<td>Pilot active?</td>
	<td><?php 
		if (intval($pilotinfo->retired) == 2) 
		{  
			$resignsel='selected';
			$retsel=''; 
			$activesel = ''; 
		}
		elseif (intval($pilotinfo->retired) == 1)
		{
			$resignsel='';
			$retsel='selected'; 
			$activesel = ''; 
		}
		else
		{
			$resignsel='';
			$retsel=''; 
			$activesel = 'selected'; 
		}
		?>
		<select name="retired">
			<option value="0" <?php echo $activesel?>>Active</option>
			<option value="1" <?php echo $retsel?>>Inactive</option>
			<option value="2" <?php echo $resignsel?>>Resigned</option>
		</select>

	</td>
</tr>

admin/modules/PilotAdmin/PilotAdmin.php

find :

107	            case 'saveprofile':
108	
109	                if($this->post->firstname == '' || $this->post->lastname == '')
110	                {
111	                    $this->set('message', 'The first or lastname cannot be blank!');
112	                    $this->render('core_error.tpl');
113	                    return;
114	                }
115	               
116	                if(intval($this->post->retired) == 1)
117	                {
118	                    $retired = true;
119	                }
120	                else
121	                {
122	                    $retired = false;
123	                }

Replace by :

			case 'saveprofile':

			if($this->post->firstname == '' || $this->post->lastname == '')
			{
				$this->set('message', 'The first or lastname cannot be blank!');
				$this->render('core_error.tpl');
				return;
			}

			if(intval($this->post->retired) == 2)
			{
				$retired = 2;
			}
			elseif(intval($this->post->retired) == 1)
			{
				$retired = 1;
			}
			else
			{
				$retired = 0;
			}

core/templates/pilots_list.tpl

find :

22	foreach($allpilots as $pilot)
23	{
24	        /*
25	                To include a custom field, use the following example:
26	
27	                <td>
28	                        <?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?>
29	                </td>
30	
31	                For instance, if you added a field called "IVAO Callsign":
32	
33	                        echo PilotData::GetFieldValue($pilot->pilotid, 'IVAO Callsign');               
34	         */
35	?>
36	<tr>

Replace by :

foreach($allpilots as $pilot)
{
if(intval($pilot->retired)  >  1)  {  continue;  } 
/* 
	To include a custom field, use the following example:

	<td>
		<?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?>
	</td>

	For instance, if you added a field called "IVAO Callsign":

		echo PilotData::GetFieldValue($pilot->pilotid, 'IVAO Callsign');		
 */
?>
<tr <?php if($pilot->retired == 1)
	echo 'class="inactive"';
	else
	echo 'class="active"'; ?> >

If you want to hack the mass mailer to exclude "resigned or retired" pilots, you can try to use the

	if(intval($pilot->retired)  >  1)  {  continue;  } 

trick somewhere...

I'll try to post the hack when finished !

Hope Nabeel will improve this !

Cheers !  ;D

  • Like 1
  • 3 weeks later...

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...