Jump to content

Pilot Status (Advanced) - Not Supported Now.


Kyle

Recommended Posts

  • Moderators

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
Link to comment
Share on other sites

  • Moderators

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? :)

Link to comment
Share on other sites

  • Moderators

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!

Link to comment
Share on other sites

  • Moderators

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

Link to comment
Share on other sites

  • Moderators

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
Link to comment
Share on other sites

  • Moderators

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:

Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
Share on other sites

  • Administrators

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!

Link to comment
Share on other sites

  • 1 year later...
  • Moderators

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.

Link to comment
Share on other sites

  • 2 years 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...