Jump to content

Pilot Status


Kyle

Recommended Posts

  • Moderators

Hey Guys, I been on that for a while and I'm trying to firgure out how to add different status and I'm lost here,

So I have added the new options for the pilot status

6z4sav.png

And What I coded like that for the stats listing.....

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

And I'm trying to get the database to smarten up to get these numbers in the DB, becasue I I clicked Banned, then it'll just keep marking to 1 as retired, Is there anywhere I can manage the numbering to the database to which numbers goes to the database?

If I manually edit my DB, then if Banned is under retire 2, then it will work, but not in the backend of phpVMS.

Any help would be great!!! 1+rep!!

  • Like 1
Link to comment
Share on other sites

  • Moderators

Hey Nabeel, I don't see any of the configs for that.

Can you clear up what I am looking for?

Here's how I have in my Auth Class too.... for different classes of Retried.

if($userinfo->retired == 1)
	{
		self::$error_message = 'Your account was deactivated, please contact an admin';
		return false;
	}
	if($userinfo->retired == 2)
	{
		self::$error_message = 'Your account is Banned!!! Your not allowed to come back!!!';
		return false;
	}
	if($userinfo->retired == 3)
	{
		self::$error_message = 'Your account is On Leave, Please Contact the HR so they can put you back...';
		return false;
	}



Link to comment
Share on other sites

Guest lorathon

Check the following file.

/admin/modules/PilotAdmin/PilotAdmin.php

You should find what you need to modify in there.

This is what I did

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

$retired = $this->post->retired;

Link to comment
Share on other sites

  • Moderators

Awsome lorathon!! That did the trick, :D but one thing with the drop down list,

If I banned a Pilot, and It works, but If I want to go back to editing his profile, it'll will keep saying active but he's banned still, other hand, if I retire him, it will preslect him as retired.

How Can i get the drop down menu to know which retired class is the pilot in?

Here's my dropdown Meun coding, so it can clear what I'm talking about.....

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

Link to comment
Share on other sites

Guest lorathon

Change the pilot status to something like this

<td>Pilot Status</td>
<td><?php 
	if(intval($pilotinfo->retired) == 1) 
	{  
		$retsel='selected'; 
		$activesel = '';
		$loasel = ''; 
		$bansel='';
	}
	else if(intval($pilotinfo->retired) == 2)
	{
		$bansel='selected';
		$retsel='';
		$loasel='';
		$activesel='';
	}
	else if(intval($pilotinfo->retired) == 3)
	{
		$loasel='selected';
		$activesel = '';
		$retsel = '';
		$bansel='';
	}
	else
	{
		$activesel = 'selected'; 
		$retsel = '';
		$loasel='';
		$bansel='';
	}
	?>
	<select name="retired">
		<option value="0" <?php echo $activesel?>>Active</option>
		<option value="1" <?php echo $retsel?>>Retired</option>
		<option Value="2" <?php echo $bansel?>>Banned</option>
		<option value="3" <?php echo $loasel?>>LOA</option>
	</select>

</td>

Link to comment
Share on other sites

Guest lorathon

Jeff, are those the only changed needed for that? I can implement that into mainline

This is what I used. And then made front end checks.

Example -

Banned gets a message and sees nothing

Retired gets message and contact link

LOA gets limited acces (cant bid and such)

Link to comment
Share on other sites

  • 1 month later...

Hi,

I want to show that in pilot list but he doesn't work can you help me :

<td><div align="center"><?php
               if($pilot->retired == '1')
               {echo '<img src="'.SITE_URL.'/lib/skins/aer/images/no.png" alt="warning" /> - Inactif';}
	else if($pilot->retired == '2')
               {echo '<img src="'.SITE_URL.'/lib/skins/aer/images/no.png" alt="warning" /> - Suspendu';}
	else if($pilot->retired == '3')
               {echo '<img src="'.SITE_URL.'/lib/skins/aer/images/no.png" alt="warning" /> - En Congé';}
               else
               {echo '<img src="'.SITE_URL.'/lib/skins/aer/images/yes.png" alt="warning" /> - Actif';}
           ?></div></td>

Link to comment
Share on other sites

I have just missed a part of code. But when I set Inactive/Suspended/On Leave status, user can access on the website as active user. Can you help me ? 

Check /core/common/Auth.class.php

think its line 285 (or around about there), un-comment the code which will stop logins for in-active members

CD

Link to comment
Share on other sites

 /**
    * Log the user in
    */
   public static function ProcessLogin($useridoremail, $password) {
       # Allow them to login in any manner:
       #  Email: blah@blah.com
       #  Pilot ID: VMA0001, VMA 001, etc
       #  Just ID: 001
       if (is_numeric($useridoremail)) {
           $useridoremail = $useridoremail - intval(Config::Get('PILOTID_OFFSET'));
           $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'pilots
			   WHERE pilotid=' . $useridoremail;
       } else {
           # They're logging in with an email
           if (preg_match('/^.*\@.*$/i', $useridoremail) > 0) {
               $emailaddress = DB::escape($useridoremail);
               $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'pilots
					WHERE email=\'' . $useridoremail . '\'';
           }
           # They're loggin in with a pilot id
           elseif (preg_match('/^([A-Za-z]*)(.*)(\d*)/', $useridoremail, $matches) > 0) {
               $id = trim($matches[2]);
               $id = $id - intval(Config::Get('PILOTID_OFFSET'));

               $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'pilots
					WHERE pilotid=' . $id;
           }
           # No idea
           else {
               self::$error_message = 'Invalid user ID';
               return false;
           }
       }

       $password = DB::escape($password);
       $userinfo = DB::get_row($sql);

       if (!$userinfo) {
           self::$error_message = 'This user does not exist';
           return false;
       }

       /*if($userinfo->retired == 1)
               {
                       self::$error_message = 'Votre compte est désactivé, contactez un staff pour réactiver votre compte';
                       return false;
               }
               if($userinfo->retired == 2)
               {
                       self::$error_message = 'Votre compte est suspendu, veuillez contactez la direction pour avoir plus d'information';
                       return false;
               }
               if($userinfo->retired == 3)
               {
                       self::$error_message = 'Votre compte est en mode absent, Contacter la Direction RH pour le remettre en activité';
                       return false;
               }*/

       //ok now check it
       $hash = md5($password . $userinfo->salt);

       if ($hash == $userinfo->password) {
           self::$userinfo = $userinfo;

           self::update_session(self::$session_id, self::$userinfo->pilotid);

           SessionManager::Set('loggedin', 'true');
           SessionManager::Set('userinfo', $userinfo);
           SessionManager::Set('usergroups', PilotGroups::GetUserGroups($userinfo->pilotid));

           PilotData::updateProfile($pilotid, array('lastlogin' => 'NOW()', 'lastip' => $_SERVER['REMOTE_ADDR'], ));

      return true;
       } else {
           self::$error_message = 'Invalid login, please check your username and password';
           self::LogOut();

           return false;
       }
   }

   /**
    * Log them out
    */
   public static function LogOut() {
       #self::remove_sessions(SessionManager::GetValue('userinfo', 'pilotid'));

       # Mark them as guest
       self::update_session(self::$session_id, 0);

       # "Ghost" entry
       //self::start_session(self::$userinfo->pilotid); // Orphaned?

       SessionManager::Set('loggedin', false);
       SessionManager::Set('userinfo', '');
       SessionManager::Set('usergroups', '');

       # Delete cookie
       $_COOKIE[VMS_AUTH_COOKIE] = '';
       setcookie(VMS_AUTH_COOKIE, true);

       self::$loggedin = false;
   }
}

I don't see on line 285 a relation with in-active user.

Link to comment
Share on other sites

/*if($userinfo->retired == 1)
               {
                       self::$error_message = 'Votre compte est désactivé, contactez un staff pour réactiver votre compte';
                       return false;
               }
               if($userinfo->retired == 2)
               {
                       self::$error_message = 'Votre compte est suspendu, veuillez contactez la direction pour avoir plus d'information';
                       return false;
               }
               if($userinfo->retired == 3)
               {
                       self::$error_message = 'Votre compte est en mode absent, Contacter la Direction RH pour le remettre en activité';
                       return false;
               }*/

remove the comment code here

Link to comment
Share on other sites

  • 1 year later...

Hi, How can I have the "Pilot account history" in my site?

Hey Guys, I been on that for a while and I'm trying to firgure out how to add different status and I'm lost here,

So I have added the new options for the pilot status

6z4sav.png

And What I coded like that for the stats listing.....

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

And I'm trying to get the database to smarten up to get these numbers in the DB, becasue I I clicked Banned, then it'll just keep marking to 1 as retired, Is there anywhere I can manage the numbering to the database to which numbers goes to the database?

If I manually edit my DB, then if Banned is under retire 2, then it will work, but not in the backend of phpVMS.

Any help would be great!!! 1+rep!!

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