Moderators Kyle Posted April 14, 2011 Moderators Report Posted April 14, 2011 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. 2 Quote
Moderators Kyle Posted April 15, 2011 Author Moderators Report Posted April 15, 2011 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? Quote
Jon Posted April 15, 2011 Report Posted April 15, 2011 Tested it on a pilot this morning, working great. Thanks Jon 1 Quote
Moderators Kyle Posted April 15, 2011 Author Moderators Report Posted April 15, 2011 Tested it on a pilot this morning, working great. Thanks Jon Thanks for letting me know. glad you got it working. Quote
Moderators Kyle Posted April 15, 2011 Author Moderators Report Posted April 15, 2011 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! Quote
Moderators mark1million Posted April 15, 2011 Moderators Report Posted April 15, 2011 Nabeel can you roll this in to a release or everytime an update is performed it will get lost? Quote
Moderators Kyle Posted April 15, 2011 Author Moderators Report Posted April 15, 2011 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! My offer to the community Quote
Moderators mark1million Posted April 15, 2011 Moderators Report Posted April 15, 2011 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 1 Quote
Moderators Kyle Posted April 15, 2011 Author Moderators Report Posted April 15, 2011 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!!! Quote
Moderators joeri Posted April 15, 2011 Moderators Report Posted April 15, 2011 just added a request for it he will add it in to one off the next beta's i think Quote
Jeff Posted April 15, 2011 Report Posted April 15, 2011 That would be great. It sure would take a lot of extra work off from us Admins with this feature...thanks Kyle. Quote
Moderators Kyle Posted April 15, 2011 Author Moderators Report Posted April 15, 2011 Your welcome guys. I'm glad to share something. Quote
FiveStar Posted April 25, 2011 Report Posted April 25, 2011 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 Quote
Administrators Nabeel Posted April 25, 2011 Administrators Report Posted April 25, 2011 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! Quote
Administrators Nabeel Posted April 25, 2011 Administrators Report Posted April 25, 2011 This has been added to the latest beta, statuses can be customized by copying the section from app.config.php to local.config.php Quote
Moderators mark1million Posted April 25, 2011 Moderators Report Posted April 25, 2011 Looks like this will be the 3rd update tonight lol Thanks, will make things more definable. Quote
FiveStar Posted April 25, 2011 Report Posted April 25, 2011 Nabeel can you be more specific where to add that code of yours and do we need to add anything in Authorization.class file? Quote
Moderators mark1million Posted April 25, 2011 Moderators Report Posted April 25, 2011 Nabeel can you be more specific where to add that code of yours and do we need to add anything in Authorization.class file? See Here http://forum.phpvms.net/topic/5026-rev-v21934-126-g35a51d1-close-24-added-different-pilot-statuses/ Quote
FiveStar Posted April 25, 2011 Report Posted April 25, 2011 Hey nabeel this one Worked for me Lots of thank goes to you............... PHPVMS i love you Quote
Administrators Nabeel Posted April 25, 2011 Administrators Report Posted April 25, 2011 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 Quote
FiveStar Posted April 26, 2011 Report Posted April 26, 2011 Nabeel let me ask you this when 3.0 will be released what necessary files i have to backup so they will not be overridden in a update? Quote
Moderators Kyle Posted April 26, 2011 Author Moderators Report Posted April 26, 2011 Hey, Nabeel will release it whenever we feel if it's ready, I think there are still some work to do though. Quote
LuxuryCEO Posted July 28, 2012 Report Posted July 28, 2012 if neebal has intrgrated it into phpvms were is it and what version is it in i have Version 2.1.934 and i dont see it in the system can you help me pleasee Quote
Sava Posted July 28, 2012 Report Posted July 28, 2012 I believe it has been only added to the beta version, not 2.1.934 which is the last stable version. Quote
Moderators Kyle Posted July 28, 2012 Author Moderators Report Posted July 28, 2012 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. Quote
Jonathan Posted April 3, 2015 Report Posted April 3, 2015 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.