troycosentino

index

Jul 28th, 2012
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 15.69 KB | None | 0 0
  1. <?php
  2.     include 'php/connection.php';
  3.     include 'php/globals.php';
  4.    
  5.     //var to hold which page we're on - default home
  6.     $which_page = 'home';
  7.    
  8.     //which page is it?
  9.     if(!empty($_GET['section'])) {
  10.         switch ($_GET['section']) {
  11.             case 'eat':
  12.             case 'sleep':
  13.             case 'drink':
  14.                 $which_page = $_GET['section'];
  15.                 break;
  16.             default:
  17.                 $which_page = 'home';
  18.                 break;
  19.         }
  20.     } else {
  21.         $which_page = 'home';
  22.     }
  23.    
  24.     $db = new Database();
  25.    
  26.     switch ($which_page) {
  27.         case 'eat':
  28.             $tile_data = $db->fetch_eat_tiles();
  29.             break;
  30.         case 'sleep':
  31.             $tile_data = $db->fetch_sleep_tiles();
  32.             break;
  33.         case 'drink':
  34.             $tile_data = $db->fetch_drink_tiles();
  35.             break;
  36.         case 'home':
  37.             $tile_data = $db->fetch_home_tiles();
  38.             break;
  39.     }
  40. ?>
  41.  
  42. <!DOCTYPE html>
  43.     <!--[if lt IE 7 ]<html class="ie6"><![endif]-->
  44.     <!--[if IE 7 ]><html class="ie7"> <![endif]-->
  45.     <!--[if IE 8 ]><html class="ie8"> <![endif]-->
  46.     <!--[if IE 9 ]><html class="ie9"> <![endif]-->
  47.     <!--[if (gt IE 9)|!(IE)]><!--><!--<![endif]-->
  48.    
  49.     <!-- begin head -->
  50.     <head>
  51.         <link rel="icon" type="image/ico" href="/icon.ico"></link>
  52.         <link rel="shortcut icon" href="/icon.ico" >
  53.         <!--include jquery -->  
  54.         <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  55.        
  56.         <!-- javascript for changing the search based on drop down menu -->
  57.         <script type="text/javascript">
  58.             var _sf_startpt = (new Date()).getTime()  
  59.            
  60.             <?php
  61.                 $js_array = json_encode($tile_data);
  62.                 echo 'var $js_tile_data = '. $js_array . ';';
  63.             ?>
  64.            
  65.             $(document).ready(function() {
  66.                 $('.info_pane').hide();
  67.                 $("button").addClass(".notsticky");
  68.                
  69.                 $('#search_option').change(function() {
  70.                     if( $('#search_option').val() == "wiki" ) {
  71.                         $('#search_form').attr('action', "http://www.wikipedia.org/search-redirect.php");
  72.                         $('#search_bar').attr('name', "search");
  73.                     } else {
  74.                         $('#search_form').attr('action', "http://www.google.com/search");
  75.                         $('#search_bar').attr('name', "q");
  76.                     }
  77.                 });
  78.                
  79.             });
  80.            
  81.             function getTileSelector(row, column) {
  82.                 var $result = 'button.';
  83.                 switch (row) {
  84.                     case 1:
  85.                         $result += 'row_1';
  86.                         break;
  87.                     case 2:
  88.                         $result += 'row_2';
  89.                         break;
  90.                     case 3:
  91.                         $result += 'row_3';
  92.                         break;
  93.                     case 4:
  94.                         $result += 'row_4';
  95.                         break;
  96.                 }
  97.                 switch (column) {
  98.                     case 1:
  99.                         $result += '.col_1';
  100.                         break;
  101.                     case 2:
  102.                         $result += '.col_2';
  103.                         break;
  104.                     case 3:
  105.                         $result += '.col_3';
  106.                         break;
  107.                     case 4:
  108.                         $result += '.col_4';
  109.                         break;
  110.                     case 5:
  111.                         $result += '.col_5';
  112.                         break;
  113.                 }
  114.                 return $result;
  115.             }
  116.            
  117.             function getInfoPaneSelector(row) {
  118.                 var $result = '.info_pane.';
  119.                 switch (row) {
  120.                     case 1:
  121.                         $result += 'row_1';
  122.                         break;
  123.                     case 2:
  124.                         $result += 'row_2';
  125.                         break;
  126.                     case 3:
  127.                         $result += 'row_3';
  128.                         break;
  129.                     case 4:
  130.                         $result += 'row_4';
  131.                         break;
  132.                 }
  133.                 return $result;
  134.             }
  135.            
  136.             function expand(row, column) {
  137.                 var $tileSelector = getTileSelector(row, column);
  138.                 var $infoPaneSelector = getInfoPaneSelector(row);
  139.                 var $sameTile = false;
  140.                 var $sameRow = false;
  141.                 var $posValue = '';
  142.                
  143.                 switch (row) {
  144.                     case 1:
  145.                         $posValue = column-1;
  146.                         break;
  147.                     case 2:
  148.                         $posValue = column+4;
  149.                         break;
  150.                     case 3:
  151.                         $posValue = column+9;
  152.                         break;
  153.                     case 4:
  154.                         $posValue = column+14;
  155.                         break;
  156.                 }
  157.                
  158.                 //make the panel show the correct data
  159.                 <?php
  160.                     switch ($which_page) {
  161.                         case 'eat':
  162.                             echo $info_eat;
  163.                             break;
  164.                         case 'sleep':
  165.                             echo $info_sleep;
  166.                             break;
  167.                         case 'drink':
  168.                             echo $info_drink;
  169.                             break;
  170.                     }
  171.                 ?>
  172.                
  173.                 $(".info_pane").html($inner);
  174.                
  175.                 if ($($infoPaneSelector).is(':visible'))
  176.                     $sameRow = true;
  177.                
  178.                 if(row == 1) {
  179.                     if($($tileSelector).height() > '108')
  180.                         $sameTile = true;
  181.                 } else {
  182.                     if($($tileSelector).height() > '50')
  183.                         $sameTile = true;
  184.                 }
  185.                
  186.                 //make text color on button stick
  187.                 $('.stick-state').addClass('.not-sticky');
  188.                 $('button').removeClass('.sticky-state');
  189.                 $($tileSelector).addClass('.sticky-state');
  190.                    
  191.                 //return all heights to correct height
  192.                 $('.primary').each(function() {
  193.                     if ($(this).height() > '108')
  194.                         $(this).animate({height:'108'});
  195.                 });
  196.                 $('.secondary').each(function() {
  197.                     if ($(this).height() > '50')
  198.                         $(this).animate({height:'50'});
  199.                 });
  200.                
  201.                 if($sameTile) {
  202.                     $($infoPaneSelector).slideToggle();
  203.                 } else if ($sameRow) {
  204.                     if(!$sameTile) {
  205.                         if (row == 1)
  206.                             $($tileSelector).animate({height:'118'});
  207.                         else
  208.                             $($tileSelector).animate({height:'60'});
  209.                     }
  210.                 } else {
  211.                     //close the pane that is open
  212.                     $('.info_pane:visible').slideToggle();
  213.                     if(!$sameTile) {
  214.                         $($infoPaneSelector).slideToggle();
  215.                         if (row == 1)
  216.                             $($tileSelector).animate({height:'118'});
  217.                         else
  218.                             $($tileSelector).animate({height:'60'});
  219.                     }
  220.                 }
  221.             }
  222.  
  223.         </script>  
  224.        
  225.        
  226.         <!-- meta data -->
  227.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>  
  228.        
  229.         <!-- page title -->
  230.         <?php
  231.             switch ($which_page) {
  232.                 case 'eat':
  233.                     echo "<title>eZag - eat</title> ";
  234.                     break;
  235.                 case 'sleep':
  236.                     echo "<title>eZag - sleep</title> ";
  237.                     break;
  238.                 case 'drink':
  239.                     echo "<title>eZag - drink</title> ";
  240.                     break;
  241.                 case 'home':
  242.                     echo "<title>eZag - home</title> ";
  243.                     break;
  244.             }
  245.         ?>
  246.         <title>eZag</title>  
  247.        
  248.         <!-- css style include -->
  249.         <link rel="stylesheet" type="text/css" href="style.css"/>  
  250.        
  251.         <!-- javascript for analytics -->
  252.         <script type="text/javascript">      
  253.             var _gaq = _gaq || [];      
  254.             _gaq.push(['_setAccount', 'UA-30918008-1']);      
  255.             _gaq.push(['_trackPageview']);      
  256.             (function () {        
  257.                 var ga = document.createElement('script');        
  258.                 ga.type = 'text/javascript';        
  259.                 ga.async = true;        
  260.                 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';        
  261.                 var s = document.getElementsByTagName('script')[0];        
  262.                 s.parentNode.insertBefore(ga, s);      
  263.             })();  
  264.         </script>
  265.     </head>
  266.    
  267.     <!--begin body -->
  268.     <body>
  269.         <div id="header">
  270.             <div id="logo"><a href="http://www.easyzag.com"><img src="images/ezag_logo.jpg" alt="eZag" /></a></div>
  271.         </div>
  272.        
  273.         <div id="HESD">
  274.             <?php
  275.                 switch ($which_page) {
  276.                     case 'eat':
  277.                         echo '<a href="index.php"><img src="images/white_eat.png"></a>';
  278.                         echo '<a href="index.php?section=eat"><img src="images/red_eat.png"></a>';
  279.                         echo '<a href="index.php?section=drink"><img src="images/white_drink.png"></a>';
  280.                         echo '<a href="index.php?section=sleep"><img src="images/white_sleep.png"></a>';
  281.                         break;
  282.                     case 'sleep':
  283.                         echo '<a href="index.php"><img src="images/white_eat.png"></a>';
  284.                         echo '<a href="index.php?section=eat"><img src="images/white_eat.png"></a>';
  285.                         echo '<a href="index.php?section=drink"><img src="images/white_drink.png"></a>';
  286.                         echo '<a href="index.php?section=sleep"><img src="images/red_sleep.png"></a>';
  287.                         break;
  288.                     case 'drink':
  289.                         echo '<a href="index.php"><img src="images/white_eat.png"></a>';
  290.                         echo '<a href="index.php?section=eat"><img src="images/white_eat.png"></a>';
  291.                         echo '<a href="index.php?section=drink"><img src="images/red_drink.png"></a>';
  292.                         echo '<a href="index.php?section=sleep"><img src="images/white_sleep.png"></a>';
  293.                         break;
  294.                     case 'home':
  295.                         echo '<a href="index.php"><img src="images/red_eat.png"></a>';
  296.                         echo '<a href="index.php?section=eat"><img src="images/white_eat.png"></a>';
  297.                         echo '<a href="index.php?section=drink"><img src="images/white_drink.png"></a>';
  298.                         echo '<a href="index.php?section=sleep"><img src="images/white_sleep.png"></a>';
  299.                         break;
  300.                 }
  301.             ?>
  302.         </div>
  303.        
  304.         <div style="height: 30px; width: 100%;" id="search_wrapper">
  305.             <form id="search_form" action="http://www.google.com/search" method="get">
  306.                 <input id="search_bar" type="text" name="q" style="width: 490px;" maxlength="255" value="Search Google or Wikipedia right from eZag!" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" />
  307.                 <input type="hidden" name="language" value="en" />
  308.                 <select name="search_type" id="search_option" style="width: 112px;">
  309.                     <option value="google">Google</option>
  310.                     <option value="wiki">Wikipedia</option>
  311.                 </select>
  312.                 <input type="submit" id='submit_button' style="width: 113px;" name="go" value=" Search " />
  313.             </form>
  314.         </div>
  315.        
  316.         <!-- begin tiles -->
  317.         <div id="selection_menu">
  318.             <!-- row 1 -->
  319.             <div class="primary_options">
  320.                 <button class="primary col_1 row_1" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[0][2]."'"; else echo "javascript:expand(1, 1)"; ?>"><?php echo $tile_data[0][1]; ?></button>
  321.                 <button class="primary col_2 row_1" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[1][2]."'"; else echo "javascript:expand(1, 2)"; ?>"><?php echo $tile_data[1][1]; ?></button>
  322.                 <button class="primary col_3 row_1" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[2][2]."'"; else echo "javascript:expand(1, 3)"; ?>"><?php echo $tile_data[2][1]; ?></button>
  323.                 <button class="primary col_4 row_1" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[3][2]."'"; else echo "javascript:expand(1, 4)"; ?>"><?php echo $tile_data[3][1]; ?></button>
  324.                 <button class="primary col_5 row_1" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[4][2]."'"; else echo "javascript:expand(1, 5)"; ?>"><?php echo $tile_data[4][1]; ?></button>
  325.             </div>
  326.            
  327.             <div class='info_pane row_1'>
  328.                 <div class='left_columns'>
  329.                     <b>Category</b><br>
  330.                     Seafood
  331.                 </div>
  332.                 <div class='left_columns'>
  333.                     <b>Price</b><br>
  334.                     $$
  335.                 </div>
  336.                 <div class='mid_column'>
  337.                     Link<br>
  338.                     Map
  339.                 </div>
  340.                 <div class='third_column'>
  341.                     ***
  342.                 </div>
  343.             </div>
  344.            
  345.             <!-- row 2 -->
  346.             <div class="secondary_options">
  347.                 <button class="secondary col_1 row_2" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[5][2]."'"; else echo "javascript:expand(2, 1)"; ?>"><?php echo $tile_data[5][1]; ?></button>
  348.                 <button class="secondary col_2 row_2" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[6][2]."'"; else echo "javascript:expand(2, 2)"; ?>"><?php echo $tile_data[6][1]; ?></button>
  349.                 <button class="secondary col_3 row_2" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[7][2]."'"; else echo "javascript:expand(2, 3)"; ?>"><?php echo $tile_data[7][1]; ?></button>
  350.                 <button class="secondary col_4 row_2" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[8][2]."'"; else echo "javascript:expand(2, 4)"; ?>"><?php echo $tile_data[8][1]; ?></button>
  351.                 <button class="secondary col_5 row_2" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[9][2]."'"; else echo "javascript:expand(2, 5)"; ?>"><?php echo $tile_data[9][1]; ?></button>
  352.             </div>
  353.            
  354.             <div class='info_pane row_2'>
  355.                 Style:<br>
  356.                 Price:<br>
  357.             </div>
  358.            
  359.             <!-- row 3 -->
  360.             <div class="secondary_options">
  361.                 <button class="secondary col_1 row_3" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[10][2]."'"; else echo "javascript:expand(3, 1)"; ?>"><?php echo $tile_data[10][1]; ?></button>
  362.                 <button class="secondary col_2 row_3" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[11][2]."'"; else echo "javascript:expand(3, 2)"; ?>"><?php echo $tile_data[11][1]; ?></button>
  363.                 <button class="secondary col_3 row_3" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[12][2]."'"; else echo "javascript:expand(3, 3)"; ?>"><?php echo $tile_data[12][1]; ?></button>
  364.                 <button class="secondary col_4 row_3" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[13][2]."'"; else echo "javascript:expand(3, 4)"; ?>"><?php echo $tile_data[13][1]; ?></button>
  365.                 <button class="secondary col_5 row_3" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[14][2]."'"; else echo "javascript:expand(3, 5)"; ?>"><?php echo $tile_data[14][1]; ?></button>
  366.             </div>
  367.            
  368.             <div class='info_pane row_3'>
  369.                 Style:<br>
  370.                 Price:<br>
  371.             </div>
  372.            
  373.             <!-- row 4 -->
  374.             <div class="secondary_options">
  375.                 <button class="secondary col_1 row_4" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[15][2]."'"; else echo "javascript:expand(4, 1)"; ?>"><?php echo $tile_data[15][1]; ?></button>
  376.                 <button class="secondary col_2 row_4" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[16][2]."'"; else echo "javascript:expand(4, 2)"; ?>"><?php echo $tile_data[16][1]; ?></button>
  377.                 <button class="secondary col_3 row_4" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[17][2]."'"; else echo "javascript:expand(4, 3)"; ?>"><?php echo $tile_data[17][1]; ?></button>
  378.                 <button class="secondary col_4 row_4" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[18][2]."'"; else echo "javascript:expand(4, 4)"; ?>"><?php echo $tile_data[18][1]; ?></button>
  379.                 <button class="secondary col_5 row_4" onClick="<?php if ($which_page == 'home') echo "window.location.href = '".$tile_data[19][2]."'"; else echo "javascript:expand(4, 5)"; ?>"><?php echo $tile_data[19][1]; ?></button>
  380.             </div>
  381.            
  382.             <div class='info_pane row_4'>
  383.                 Style:<br>
  384.                 Price:<br>
  385.             </div>
  386.            
  387.             <div class='announcements'>
  388.                 <marquee><B>These are the announcements!</B></marquee>
  389.             </div>
  390.            
  391.         </div>
  392.        
  393.         <!-- footer -->
  394.         <?php echo $footer; ?>
  395.     </body>
  396. </html>
Advertisement
Add Comment
Please, Sign In to add comment