Jump to content

I desperately need help


Parkho

Recommended Posts

  • Moderators

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Moderators

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Moderators

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>

Link to comment
Share on other sites

  • Moderators

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.

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