Moderators Parkho Posted November 27, 2011 Moderators Report Share Posted November 27, 2011 Hello All A while ago I posted a topic regarding a way to insert the A/C into the bids table and I figured out that part and was able to insert that value into the table. Now a new problem is come up and that's when I hit the "Add to bid" link it's supposed to change to "Bid Added" but it doesn't and when I look at the DB the bid was actually added with no problem. Some people were helping me out but they suddenly stopped responding and left me in the dark and I believe that has something to do with the browser but still can't figure out where the problem is. Please help with this issue I really appreciate it. Thanks Quote Link to comment Share on other sites More sharing options...
Kyle Watkins Posted November 27, 2011 Report Share Posted November 27, 2011 Hello All A while ago I posted a topic regarding a way to insert the A/C into the bids table and I figured out that part and was able to insert that value into the table. Now a new problem is come up and that's when I hit the "Add to bid" link it's supposed to change to "Bid Added" but it doesn't and when I look at the DB the bid was actually added with no problem. Some people were helping me out but they suddenly stopped responding and left me in the dark and I believe that has something to do with the browser but still can't figure out where the problem is. Please help with this issue I really appreciate it. Thanks I have had the same problem before. Try using a different browser. It might work. I will see if I can figure something our. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 27, 2011 Author Moderators Report Share Posted November 27, 2011 I have had the same problem before. Try using a different browser. It might work. I will see if I can figure something our. Thanks for the reply! IE and Fox are the same. Quote Link to comment Share on other sites More sharing options...
Kyle Watkins Posted November 27, 2011 Report Share Posted November 27, 2011 Thanks for the reply! IE and Fox are the same. True. I am working on it still till now I have no problems. I have tried all kind of different Add Bid coded still nothing. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 27, 2011 Author Moderators Report Share Posted November 27, 2011 True. I am working on it still till now I have no problems. I have tried all kind of different Add Bid coded still nothing. I changed the code of schedulesdata.class and schedules tpl in order to insert the aircraft into the bids. There is one part in the function that has to be returned true in order for the link to change but I'm not getting any false value either! Quote Link to comment Share on other sites More sharing options...
Kyle Watkins Posted November 27, 2011 Report Share Posted November 27, 2011 I changed the code of schedulesdata.class and schedules tpl in order to insert the aircraft into the bids. There is one part in the function that has to be returned true in order for the link to change but I'm not getting any false value either! Ummm.... I have no Idea. Quote Link to comment Share on other sites More sharing options...
Jeff Posted November 28, 2011 Report Share Posted November 28, 2011 You can also check in your core/modules/schedules.php file to see if the following code is correct. CodonEvent::Dispatch('bid_preadd', 'Schedules', $routeid); /* Block any other bids if they've already made a bid */ if(Config::Get('DISABLE_BIDS_ON_BID') == true) { $bids = SchedulesData::getBids(Auth::$userinfo->pilotid); # They've got somethin goin on if(count($bids) > 0) { echo 'Bid exists!'; return; } } $ret = SchedulesData::AddBid(Auth::$userinfo->pilotid, $routeid); CodonEvent::Dispatch('bid_added', 'Schedules', $routeid); if($ret == true) { echo 'Bid added'; } else { echo 'Already in bids!'; } } What I did (because I fully customized my schedules and schedule_results templates) is added a couple of images that pilots click on instead of the original "Add To Bid" text. To do that, change this (in modules.schedules.php) $ret = SchedulesData::AddBid(Auth::$userinfo->pilotid, $routeid); CodonEvent::Dispatch('bid_added', 'Schedules', $routeid); if($ret == true) { echo 'Bid added'; <<<<<<CHANGE THIS } else { echo 'Already in bids!'; <<<<<<<<CHANGE THIS } } To this: $ret = SchedulesData::AddBid(Auth::$userinfo->pilotid, $routeid); CodonEvent::Dispatch('bid_added', 'Schedules', $routeid); if($ret == true) { echo '<img src="http://www.yoursite.com/images/added.png" alt="Bid Added"/>'; } else { echo '<img src="http://www.yoursite.com/images/added.png" alt="Bid Added"/>'; } } ...and in your schedule_results.tpl, change: <?php # Don't allow overlapping bids and a bid exists if(Config::Get('DISABLE_SCHED_ON_BID') == true && $route->bidid != 0) { ?> <a id="<?php echo $route->id; ?>" class="addbid" href="<?php echo actionurl('/schedules/addbid');?>">Add to Bid</a> <<<<<<<<CHANGE THIS <?php } else { if(Auth::LoggedIn()) { ?> <a id="<?php echo $route->id; ?>" class="addbid" href="<?php echo url('/schedules/addbid');?>">Add to Bid</a> <<<<<<<CHANGE THIS To this: <?php # Don't allow overlapping bids and a bid exists if(Config::Get('DISABLE_SCHED_ON_BID') == true && $route->bidid != 0) { ?> <a id="<?php echo $route->id; ?>" class="addbid" href="<?php echo actionurl('/schedules/addbid');?>"><img src="http://www.yoursite.com/images/bidflight.png" alt="Bid Flight" /></a> <<<<<<<<TO THIS <?php } else { if(Auth::LoggedIn()) { ?> <a id="<?php echo $route->id; ?>" class="addbid" href="<?php echo url('/schedules/addbid');?>"><img src="http://www.yoursite.com/images/bidflight.png" alt="Bid Flight" /></a> <<<<<<<TO THIS hope you can get it sorted out. Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted November 28, 2011 Administrators Report Share Posted November 28, 2011 Jeff has the basic answer. It really depends on what code you changed, it's looking for specific output. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 28, 2011 Author Moderators Report Share Posted November 28, 2011 Jeff has the basic answer. It really depends on what code you changed, it's looking for specific output. Hi there Okay. Here is what I have changed in schedules.tpl and schedulesdata.class.tpl: public function addbid() { if(!Auth::LoggedIn()) return; $routeid = $this->get->id; $aircraft = $this->get->aircraft; <<<added this if($routeid == '') { echo 'No route passed'; return; } // See if this is a valid route $route = SchedulesData::findSchedules(array('s.id' => $routeid)); if(!is_array($route) && !isset($route[0])) { echo 'Invalid Route'; return; } CodonEvent::Dispatch('bid_preadd', 'Schedules', $routeid, $aircraft<<<added this); /* Block any other bids if they've already made a bid */ if(Config::Get('DISABLE_BIDS_ON_BID') == true) { $bids = SchedulesData::getBids(Auth::$userinfo->pilotid); # They've got somethin goin on if(count($bids) > 0) { echo 'bid exist'; return; } } $ret = SchedulesData::AddBid(Auth::$userinfo->pilotid, $routeid, $aircraft); CodonEvent::Dispatch('bid_added', 'Schedules', $routeid, $aircraft<<<<added this); if($ret == true) { echo 'Bid Added'; } else { echo 'Already in bids'; } } and: public static function addBid($pilotid, $routeid, $aircraft <<<<<<added this) { $pilotid = DB::escape($pilotid); $routeid = DB::escape($routeid); $aircraft = DB::escape($aircraft); if(DB::get_row('SELECT bidid, aircraft<<<<<added this FROM '.TABLE_PREFIX.'bids WHERE pilotid='.$pilotid.' AND routeid='.$routeid.' AND aircraft='.$aircraft)) { return false; } $pilotid = DB::escape($pilotid); $routeid = DB::escape($routeid); $aircraft = DB::escape($aircraft); $sql = 'INSERT INTO '.TABLE_PREFIX.'bids (pilotid, routeid, dateadded, aircraft<<<<<added this) VALUES ('.$pilotid.', '.$routeid.', NOW(), '.$aircraft.'<<<<<<added this)'; DB::query($sql); self::setBidOnSchedule($routeid, DB::$insert_id); if(DB::errno() != 0) return false; return true; } Also in schedulesresults.tpl: <td align="center"><a id="<?php echo $schedule->id.'added this>>>>>>&aircraft='.$schedule->aircraft; ?>" class="addbid" href="<?php echo url('/schedules/addbid');?>">add bid</a></td> Quote Link to comment Share on other sites More sharing options...
Jeff Posted November 28, 2011 Report Share Posted November 28, 2011 What is it doing when you changed those? What are you actually wanting the page to pull for you? Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 29, 2011 Author Moderators Report Share Posted November 29, 2011 What is it doing when you changed those? What are you actually wanting the page to pull for you? Hi As I mentioned in the first post, I wanted the "addbid" function to insert the aircraft into the bids table, so I added one column to the bids table and changed the code to insert the aircraft and that was successful as I checked the DB and the table was updated and the A/C was inserted. Then this problem came up that the "add to bid" link didn't change to "bid added" as it was supposed to, so I did check the code to see if it actually gave the Flase value in return but that didn't happen either meaning the function didn't return True value nor did return False value. All of these changes are for that i want to block the A/C with a unique id once the bid is placed, so that anyone else can't place the bid with that A/C. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 30, 2011 Author Moderators Report Share Posted November 30, 2011 Hi Any idea where the problem is? I appreciate it Quote Link to comment Share on other sites More sharing options...
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.