All pastes #80210 Raw Edit

Phoenix786

public text v1 · immutable
·published 2006-07-06 05:17 UTC
rendered paste body
function CarDealer(){
parent::Company();
}

function setWhichPage(){
  if ($_GET['whichpage']=='sales')
     $whichpage=sales;
  else if ($_GET['whichpage']=='support')
  	 $whichpage=support;
  else if ($_GET['whichpage']=='contact')
  	 $whichpage=contact;
  else
  	 $whichpage=home;
}//end of setWhichPage()

function getMainSection(){
   global $whichpage;
   return "<center><H1>The ".$whichpage." Page</H1></center>";
} 
function getLeftNavBar($array){
$tableNav;
$tableNav = '<table width="100%" border="0" cellspacing="0">';
  $tableNav .= "<tr>";
    $tableNav .= "<td><A HREF='".$array['Home Page']."'>Home Page</A></td>";
  $tableNav .= "</tr>";
  $tableNav .= "<tr>";
    $tableNav .= "<td><A HREF='".$array['Sales']."'>Sales</A></td>";
  $tableNav .= "</tr>";
  $tableNav .= "<tr>";
    $tableNav .= "<td><A HREF='".$array['Support']."'>Support</A></td>";
  $tableNav .= "</tr>";
  $tableNav .= "<tr>";
    $tableNav .= "<td><A HREF='".$array['Contacts']."'>Contacts</A></td>";
  $tableNav .= "</tr>";
$tableNav .= "</table>";
return $tableNav;
}

# create array for a Car/house/travel Nav Bar
function  create_navbar_array ( )  {
    $mainurl = $this->company_url;  // get the main url address of this web page
    $this->navbar_array = array( "Home Page"=>"$mainurl?whichpage=home", "Sales"=>"$mainurl?whichpage=sales",
       "Support" => "$mainurl?whichpage=support", "Contacts" => "$mainurl?whichpage=contact" );
 }

}// end of CarDealer Class

 class Company {
var $company_name = "O-dogg's Exotic Cars";
var $company_address = "12345 Valencia Blvd";
var $company_citystatezip = "Valencia, CA 91355";
var $car_array;
var $whichpage="home";

function Company(){

}

function display_company_name($text){
print "<h1>$text</h1>";
} // end of display_company_name

function display_company_address(){
global $company_name;
global $company_address; 
global $company_citystatezip;
print "<br><strong><u>".$company_name."</u></strong>"; 
print "<br><strong><u>".$company_address."</u></strong>";
print "<br><strong><u>".$company_citystatezip."</u></strong>";
} //end of display_company_address

# create array for a Car Dealership
function  create_array_cars (  )  {
    global $car_array;
    $car_array = array();
    $car_array[] = array( "12345", "2002 Ford Ranger", "6500.00", "Excellent condition, low 68000 miles" );
    $car_array[] = array( "45678", "1998 Chevy Corvette", "19995.00", "Low miles 54000, Great car 4 cruising" );
    $car_array[] = array( "67890", "2000 Toyota Camry", "9990.00", "Mom wants you 2 buy a conservative car" );
    $car_array[] = array( "89123", "1995 Honda Civic", "4500.00", "140000 miles, but a Honda, it will last" );
}

function displayProduct($c_array){
   print '<table width="100%" border="0" cellspacing="0">';
   print "<tr>";
   print "<td>Item Number</td>";
   print "<td>Car</td>";
   print "<td>Price</td>";
   print "<td>Comments</td>";
   print "</tr>";
   for ($i=0;$i<sizeof($c_array);$i++){
   print "<tr>";
       for ($j=0;$j<sizeof($c_array[$i]);$j++){
	    	print "<td>".$c_array[$i][$j]."</td>";
       }
   print "</tr>";
   }
   print "</table>";
}

function getHeader($company_name, $color){
   $data = "<TABLE BGCOLOR='".$color."' WIDTH='100%'><TR><TD ALIGN='CENTER'>";
   $data .= "<H1>".$company_name."</H1>";    
   $data = $data . "</TD></TR></TABLE>";   
   return $data;
}

function getFooter($color){
   global $company_name;
   global $company_address;
   global $company_citystatezip;
   $data = "<TABLE BGCOLOR='".$color."' WIDTH='100%'>";
   $data .= "<TR><TD ALIGN='CENTER'>".$company_name."</TD></TR>";
   $data .= "<TR><TD ALIGN='CENTER'>".$company_address."</TD></TR>";
   $data .= "<TR><TD ALIGN='CENTER'>".$company_citystatezip."</TD></TR>";
   $data = $data . "</TABLE>";
   return $data;
}

 }  // end class company

$carobject2 = new CarDealer();
$carobject2->create_navbar_array();
print $carobject2->getLeftNavBar($carobject2->$navbar_array);
$carobject2->setWhichPage();
print $carobject2->getMainSection();