Jump to content

Accept/Rejecting Pilots


dmks1234

Recommended Posts

Hello All,

I have since made my own bootstrap based skin for phpvms and since I have done that the accept/rejecting pilots function nolonger works. You can click it however it does nothing. I am not really sure what is causing it however I have refrenced the core_htmlhead.tpl in the header.tpl so all phpvms functions are still included.

Here is some of my code:

<div class="airlinelist">
				 <div class="panel panel-default">
					 <div class="panel-heading">
						 <h3 class="panel-title"><i class="fa fa-bar-chart-o fa-fw"></i></h3>
					 </div>
					 <div class="panel-body">
 <h3>Pending Pilots</h3>
 <?php
 if(!$allpilots)
 {
	 echo '<p>There are no pilots!</p>';
	 return;
 }
 ?>
 <table id="tabledlist" class="table tablesorter">
 <thead>
 <tr>
	 <th>Pilot Name</th>
	 <th>Email Address</th>
	 <th>Location</th>
	 <th>Hub</th>
	 <th>Options</th>
 </tr>
 </thead>
 <tbody>
 <?php
 foreach($allpilots as $pilot)
 {
 ?>
 <tr>
	 <td><a href="<?php echo SITE_URL?>/admin/index.php/pilotadmin/viewpilots?action=viewoptions&pilotid=<?php echo $pilot->pilotid;?>"><?php echo $pilot->firstname . ' ' . $pilot->lastname; ?></a></td>
	 <td align="center"><?php echo $pilot->email; ?></td>
	 <td align="center"><?php echo $pilot->location; ?></td>
	 <td align="center"><?php echo $pilot->hub; ?></td>
	 <td align="center" width="1%" nowrap>
		 <button href="<?php echo SITE_URL?>/admin/action.php/pilotadmin/pendingpilots" action="approvepilot"
	 class="btn btn-danger" id="<?php echo $pilot->pilotid;?>">Accept</button>

		 <button href="<?php echo SITE_URL?>/admin/action.php/pilotadmin/pendingpilots" action="rejectpilot"
	 id="<?php echo $pilot->pilotid;?>" class="btn btn-danger ajaxcall {button:{icons:{primary:'ui-icon-circle-close'}}}">Reject</button>
	 </td>
 </tr>
 <?php
 }
 ?>
 </tbody>
 </table>
					 </div>
				 </div>
			 </div>
		 </div>

If anyone has any suggestions on how to get this working that would be great!!

Thanks,

Dmk

  • Like 1
Link to comment
Share on other sites

I assume this is for an admin skin,

As per my discoveries here http://forum.phpvms.net/topic/23055-vacentral-pireps-to-export-wont-display-when-inside-another-div/#entry122172

Any version of jquery above 1.8.3 breaks the Ajax functions required to run phpvms. So I'd change your jquery version back. this will give you a "jQuery 1.9.1 or higher is required for Bootstrap" however the function will still work.

If they don't, then you can have your newest version of jQuery placed upin the skin as normal and for the pages such as pilots, schedules and PIREPS,

and at the end of the page do a

jQuery.noconflict(true)

And that should reset the global variable for phpVMS everywhere else but those pages.

Link to comment
Share on other sites

I assume this is for an admin skin,

As per my discoveries here http://forum.phpvms....iv/#entry122172

Any version of jquery above 1.8.3 breaks the Ajax functions required to run phpvms. So I'd change your jquery version back. this will give you a "jQuery 1.9.1 or higher is required for Bootstrap" however the function will still work.

If they don't, then you can have your newest version of jQuery placed upin the skin as normal and for the pages such as pilots, schedules and PIREPS,

and at the end of the page do a

jQuery.noconflict(true)

And that should reset the global variable for phpVMS everywhere else but those pages.

Okay, so downgrading jquery 1.8 fixes the issue however bootstrap's javascript stops working. And requires 1.9. What is the best way to get around this?

Thanks In Advance.

Link to comment
Share on other sites

You could do 1 of two things which worked for me (I only tried 2 though)

1. Rewrite all the ajax functions to work with an up-to-date jQuery library

2. At the start of each page that you need those ajax calls (e.g. pilots, pireps, schedules, etc.) the best way around that is to put this before any of your code at the very top of the page

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

Then this at the very bottom after all your code

<script type="text/javascript">
jQuery.noConflict(true)
</script>

So for me, this worked with your code

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<div class="airlinelist">
<div class="panel panel-default">
	 <div class="panel-heading">
			 <h3 class="panel-title"><i class="fa fa-bar-chart-o fa-fw"></i> VGroupVirtual Staff Mail</h3>
	 </div>
	 <div class="panel-body">
		 <h3>Pending Pilots</h3>
		 <?php
		 if(!$allpilots)
		 {
			 echo '<p>There are no pilots!</p>';
			 return;
		 }
		 ?>
		 <table id="tabledlist" class="table tablesorter">
			 <thead>
				 <tr>
					 <th>Pilot Name</th>
					 <th>Email Address</th>
					 <th>Location</th>
					 <th>Hub</th>
					 <th>Options</th>
				 </tr>
			 </thead>
			 <tbody>
				 <?php
				 foreach($allpilots as $pilot)
				 {
				 ?>
				 <tr>
					 <td><a href="<?php echo SITE_URL?>/admin/index.php/pilotadmin/viewpilots?action=viewoptions&pilotid=<?php echo $pilot->pilotid;?>"><?php echo $pilot->firstname . ' ' . $pilot->lastname; ?></a></td>
					 <td align="center"><?php echo $pilot->email; ?></td>
					 <td align="center"><?php echo $pilot->location; ?></td>
					 <td align="center"><?php echo $pilot->hub; ?></td>
					 <td align="center" width="1%" nowrap>
					 <button href="<?php echo SITE_URL?>/admin/action.php/pilotadmin/pendingpilots" action="approvepilot"
		 class="btn btn-danger" id="<?php echo $pilot->pilotid;?>">Accept</button>

					 <button href="<?php echo SITE_URL?>/admin/action.php/pilotadmin/pendingpilots" action="rejectpilot"
		 id="<?php echo $pilot->pilotid;?>" class="btn btn-danger ajaxcall {button:{icons:{primary:'ui-icon-circle-close'}}}">Reject</button>
					 </td>
				 </tr>
				 <?php
				 }
				 ?>
			 </tbody>
		 </table>
	 </div>
 </div>
</div>
</div>
<script type="text/javascript">
jQuery.noConflict(true)
</script>

Remember to keep jQuery 1.8.3 referenced in your core_htmlhead.tpl/.php file

And just FYI, if you're using bootstrap dropdowns in your core_navigation file then you may find that they don't work with the fix above, instead what I did was use this (as it only restores $)

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type='text/javascript'> 

jQuery.noConflict(false); 

</script>

At the very top of the core_navigation file and that seemed to fix those issues entirely.

Link to comment
Share on other sites

Ok, again multiple options to choose from.

-> phpVMS Utilises jqModal.js for the popup boxes and again requires those ajax calls to function properly

1. You could try and convert the pop up code into a bootstrap modal

2. [What I did] In the sidebar_awards.tpl/php you will see something like this

<li><span class="file">
<a id="dialog" class="jqModal" href="<?php echo SITE_URL?>/admin/action.php/pilotranking/addaward">Add Award</a>
</span></li>

But instead of rendering it through the jqmodal, I just rendered it through index.php without it popping up like this

<li><span class="file">
<a href="<?php echo SITE_URL?>/admin/index.php/pilotranking/addaward">Add Award</a>
</span></li>

You may encounter some pages where once you submit the form, it will duplicate at the bottom or top, but it still submits properly.

And also, if the tablesorter grids do not show up or work with the newer version of jquery, you could try going here and updating lib/js/jqgrid/jquery.jqGrid.min.js to the latest version.

Link to comment
Share on other sites

Okay, one issue. The submit button does not work. Here is the code:

<h3><?php echo $title?></h3>
<form id="form" action="<?php echo SITE_URL?>/admin/index.php/pilotranking/awards" method="post">
<dl>
<dt>Award Name</dt>
<dd><input name="name" type="text" value="<?php echo $award->name;?>" /></dd>

<dt>Description</dt>
<dd><input name="descrip" type="text" value="<?php echo $award->descrip;?>" /></dd>

<dt>Image URL</dt>
<dd><input name="image" type="text" value="<?php echo $award->image;?>" />
 <p>Enter the full URL, or path from root to the image</p>
</dd>

<dt></dt>
<dd><input type="hidden" name="awardid" value="<?php echo $award->awardid;?>" />
 <input type="hidden" name="action" value="<?php echo $action;?>">
 <input type="submit" name="submit" value="<?php echo $title;?>" /></dd>
</dl>
</form>

Once it is working, ill style it and add the bootstrap classes though.

Thanks

Link to comment
Share on other sites

Oh, I meant only put the link through index.php, the form itself should be going through action.php

so in your sidebar, put

<li><span class="file">
<a href="<?php echo SITE_URL?>/admin/index.php/pilotranking/addaward">Add Award</a>
</span></li>

And in the form itself put

<h3><?php echo $title?></h3>
<form id="form" action="<?php echo SITE_URL?>/admin/action.php/pilotranking/awards" method="post">
<dl>
<dt>Award Name</dt>
<dd><input name="name" type="text" value="<?php echo $award->name;?>" /></dd>
<dt>Description</dt>
<dd><input name="descrip" type="text" value="<?php echo $award->descrip;?>" /></dd>

<dt>Image URL</dt>
<dd><input name="image" type="text" value="<?php echo $award->image;?>" />
<p>Enter the full URL, or path from root to the image</p>
</dd>
<dt></dt>
<dd><input type="hidden" name="awardid" value="<?php echo $award->awardid;?>" />
<input type="hidden" name="action" value="<?php echo $action;?>">
<input type="submit" name="submit" value="<?php echo $title;?>" /></dd>
</dl>
</form>

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