Jump to content

Pilot Status (Advanced) - Not Supported Now.


Recommended Posts

  • Moderators
Posted

Hey Everyone,

Someone had requested me to show how to make a advanced pilot status so here's it is.

Pilot Status - Advanced

Follow this carefully so you don't hit a brick. AND BACK UP YOUR FILES BEFORE DOING IT!

1) Go to core/common/Auth.class and go to the following line

        /*if($userinfo->retired == 1)
       {
       self::$error_message = 'Your account was deactivated, please contact an admin';
       return false;
       }*/

2) Replace that to.....

if($userinfo->retired == 1)
	{
		self::$error_message = 'Your account was marked inactive, please contact to Human Resources for more information.';
		return false;
	}

	if($userinfo->retired == 2)
	{
		self::$error_message = 'Your account is banned!';
		return false;
	}

	if($userinfo->retired == 3)
	{
		self::$error_message = 'Your account is marked on Leave! Please Contact to the Human Resources to ask them to reactive you in.';
		return false;
	}

But if you want to still let the LOA pilot to login, uncomment the code like this....

/*
if($userinfo->retired == 2)
	{
		self::$error_message = 'Your account is banned!';
		return false;
	}*/

3)Go to /admin/templates/pilots_details.tpl and change the following from....

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

</td>

To...

<td>Pilot active?</td>
<td>
<?php 
               if(intval($pilotinfo->retired) == 1) 
               {  
                       $retsel1='selected'; 
                       $activesel = '';
                       $retsel3 = ''; 
                       $retsel2='';
               }
               else if(intval($pilotinfo->retired) == 2)
               {
                       $retsel2='selected';
                       $retsel1='';
                       $retsel3='';
                       $activesel='';
               }
               else if(intval($pilotinfo->retired) == 3)
               {
                       $retsel3='selected';
                       $activesel = '';
                       $retsel = '';
                       $retsel2='';
               }
               else
               {
                       $activesel = 'selected'; 
                       $retsel1 = '';
                       $retsel3='';
                       $retsel2='';
               }
               ?>
               <select name="retired">
                       <option value="0" <?php echo $activesel?>>Active</option>
                       <option value="1" <?php echo $retsel1?>>Retired</option>
                       <option Value="2" <?php echo $retsel2?>>Banned</option>
                       <option value="3" <?php echo $retsel3?>>On Leave</option>
               </select>


</td>

4) Last Thing! Go to /admin/modules/PilotAdmin/PilotAdmin.php and find the following lines.....

if(intval($this->post->retired) == 1)
			{
				$retired = true;
			}
			else
			{
				$retired = false;
			}

And Change to the following....

			/*
			if(intval($this->post->retired) == 1)
			{
				$retired = true;
			}
			else
			{
				$retired = false;
			}
			*/
			$retired = $this->post->retired;

To display pilot status in their profile or public profile, add the following....

<?php

	if($userinfo->retired == 0)
		echo 'Active';
	elseif($userinfo->retired == 1)
		echo 'Inactive';
	elseif($userinfo->retired == 2)
		echo 'Banned';
	elseif($userinfo->retired == 3)
		echo 'On Leave';

	?>

And That's It!!! It should be working now. Any problems, report here in this topic.

Also, and a big thanks to lorathon for helping to complete this feature that I rquested.

NOTE:*

I'm not responsibility for any damages at all, you are responsible to back up your files before changes.

UPDATE: This IS NOT SUPPORTED ANYMORE - It has been integrated into phpVMS. - Thanks Nabeel for putting in.

  • Like 2
  • Moderators
Posted

Umm No lol. Sorry. :(

But I can tell you what it does....

Basicly, like for example, if you want to ban a pilot from the VA. You go to the PilotAdmin and change the Pilot Status to banned and then when a banned pilot trys to log in, it won't let him in, and he will get the message in the login form like "Your account is banned!"

Does that clear you up? :)

  • Moderators
Posted

Tested it on a pilot this morning, working great.

Thanks

Jon

Thanks for letting me know. :) glad you got it working.

  • Moderators
Posted

To display the pilot status.....

<?php

	if($userinfo->retired == 0)
		echo 'Active';
	elseif($userinfo->retired == 1)
		echo 'Inactive';
	elseif($userinfo->retired == 2)
		echo 'Banned';
	elseif($userinfo->retired == 3)
		echo 'On Leave';

	?>

Enjoy! First Post Updated!

  • Moderators
Posted

Nabeel can you roll this in to a release or everytime an update is performed it will get lost?

Hey, joeri told me that Nabeel might. So I'm okay with Nabeel putting it in! :D My offer to the community :D

  • Moderators
Posted

If were going down this route updating this code what about a leave system?

Something simple,

Define max leave days in local config

Pilot has a checkbox in his profile to go on leave, if ticked places account on leave, Also echo remaining days in the profile, after all leave expired pilot enters the usual inactivity rules.

Would be nice to roll this up in to a beta release ;)

  • Like 1
  • Moderators
Posted

If were going down this route updating this code what about a leave system?

Something simple,

Define max leave days in local config

Pilot has a checkbox in his profile to go on leave, if ticked places account on leave, Also echo remaining days in the profile, after all leave expired pilot enters the usual inactivity rules.

Would be nice to roll this up in to a beta release ;)

Yeah that would be cool!!! Good IDEA MARK!!!

Nabeel? Pretty Please!!! :lol:

  • 2 weeks later...
Posted

hi there i have a problem with this function i just checked i have created one fake account and tried there but nothing happening i tried all of the options when i banned my fake account it was still letting me Log in and also not changing Status Re checked all of my files each & every code is there but still no luck any help would be appreciated.

Regards

Asmara

  • Administrators
Posted

I will integrate this, but instead, doing config options such as:

Config::Set('PILOT_STATUS_TYPES', array(
0 => array(
   	'name' => 'Active',
   	'message' => '',
   	'canlogin' => false,
),
1 => array(
   	'name' => 'Inactive',
   	'message' => 'Your account was marked inactive',
   	'canlogin' => false,
),
2 => array(
   	'name' => 'Banned',
   	'message' => 'Your account is banned, please contact an admin!',
   	'canlogin' => false,
),
3 => array(
   	'name' => 'On Leave',
   	'message' => 'You have been marked as on leave',
   	'canlogin' => false,
),
));

That way you can add some more specifics.

Thanks for the code, Kyle!

  • Administrators
Posted

This has been added to the latest beta, statuses can be customized by copying the section from app.config.php to local.config.php

  • Administrators
Posted

I wouldn't copy individual changes over, if you're going to run a full beta then OK, but don't nitpick at changes.

A TON has changed under the hood for 3.0

  • Moderators
Posted

Hey, Nabeel will release it whenever we feel if it's ready, I think there are still some work to do though.

  • 1 year later...
  • Moderators
Posted

It's added in the Beta Version where you can create different status types.

I'll close this topic since this is not really supported anymore. Check the beta version for more info.

  • 2 years later...
Posted

hello,

I have a question, How to display the status of the driver in the Pilotadmin.php page line 365 without jumped the site.

My status: Active/ Inactive / Suspend / On leave

code

$ status = ($ row-> retired == 0)? 'Active', 'Inactive';

I thank you for you help.

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