Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'php/connection.php';
- include 'php/globals.php';
- //var to hold which page we're on - default home
- $which_page = 'home';
- //which page is it?
- if(!empty($_GET['section'])) {
- switch ($_GET['section']) {
- case 'eat':
- case 'sleep':
- case 'drink':
- $which_page = $_GET['section'];
- break;
- default:
- $which_page = 'home';
- break;
- }
- } else {
- $which_page = 'home';
- }
- $db = new Database();
- switch ($which_page) {
- case 'eat':
- $tile_data = $db->fetch_eat_tiles();
- break;
- case 'sleep':
- $tile_data = $db->fetch_sleep_tiles();
- break;
- case 'drink':
- $tile_data = $db->fetch_drink_tiles();
- break;
- case 'home':
- $tile_data = $db->fetch_home_tiles();
- break;
- }
- ?>
- <!DOCTYPE html>
- <!--[if lt IE 7 ]<html class="ie6"><![endif]-->
- <!--[if IE 7 ]><html class="ie7"> <![endif]-->
- <!--[if IE 8 ]><html class="ie8"> <![endif]-->
- <!--[if IE 9 ]><html class="ie9"> <![endif]-->
- <!--[if (gt IE 9)|!(IE)]><!--><!--<![endif]-->
- <!-- begin head -->
- <head>
- <link rel="icon" type="image/ico" href="/icon.ico"></link>
- <link rel="shortcut icon" href="/icon.ico" >
- <!--include jquery -->
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
- <!-- javascript for changing the search based on drop down menu -->
- <script type="text/javascript">
- var _sf_startpt = (new Date()).getTime()
- <?php
- $js_array = json_encode($tile_data);
- echo 'var $js_tile_data = '. $js_array . ';';
- ?>
- $(document).ready(function() {
- $('.info_pane').hide();
- $("button").addClass(".notsticky");
- $('#search_option').change(function() {
- if( $('#search_option').val() == "wiki" ) {
- $('#search_form').attr('action', "http://www.wikipedia.org/search-redirect.php");
- $('#search_bar').attr('name', "search");
- } else {
- $('#search_form').attr('action', "http://www.google.com/search");
- $('#search_bar').attr('name', "q");
- }
- });
- });
- function getTileSelector(row, column) {
- var $result = 'button.';
- switch (row) {
- case 1:
- $result += 'row_1';
- break;
- case 2:
- $result += 'row_2';
- break;
- case 3:
- $result += 'row_3';
- break;
- case 4:
- $result += 'row_4';
- break;
- }
- switch (column) {
- case 1:
- $result += '.col_1';
- break;
- case 2:
- $result += '.col_2';
- break;
- case 3:
- $result += '.col_3';
- break;
- case 4:
- $result += '.col_4';
- break;
- case 5:
- $result += '.col_5';
- break;
- }
- return $result;
- }
- function getInfoPaneSelector(row) {
- var $result = '.info_pane.';
- switch (row) {
- case 1:
- $result += 'row_1';
- break;
- case 2:
- $result += 'row_2';
- break;
- case 3:
- $result += 'row_3';
- break;
- case 4:
- $result += 'row_4';
- break;
- }
- return $result;
- }
- function expand(row, column) {
- var $tileSelector = getTileSelector(row, column);
- var $infoPaneSelector = getInfoPaneSelector(row);
- var $sameTile = false;
- var $sameRow = false;
- var $posValue = '';
- switch (row) {
- case 1:
- $posValue = column-1;
- break;
- case 2:
- $posValue = column+4;
- break;
- case 3:
- $posValue = column+9;
- break;
- case 4:
- $posValue = column+14;
- break;
- }
- //make the panel show the correct data
- <?php
- switch ($which_page) {
- case 'eat':
- echo $info_eat;
- break;
- case 'sleep':
- echo $info_sleep;
- break;
- case 'drink':
- echo $info_drink;
- break;
- }
- ?>
- $(".info_pane").html($inner);
- if ($($infoPaneSelector).is(':visible'))
- $sameRow = true;
- if(row == 1) {
- if($($tileSelector).height() > '108')
- $sameTile = true;
- } else {
- if($($tileSelector).height() > '50')
- $sameTile = true;
- }
- //make text color on button stick
- $('.stick-state').addClass('.not-sticky');
- $('button').removeClass('.sticky-state');
- $($tileSelector).addClass('.sticky-state');
- //return all heights to correct height
- $('.primary').each(function() {
- if ($(this).height() > '108')
- $(this).animate({height:'108'});
- });
- $('.secondary').each(function() {
- if ($(this).height() > '50')
- $(this).animate({height:'50'});
- });
- if($sameTile) {
- $($infoPaneSelector).slideToggle();
- } else if ($sameRow) {
- if(!$sameTile) {
- if (row == 1)
- $($tileSelector).animate({height:'118'});
- else
- $($tileSelector).animate({height:'60'});
- }
- } else {
- //close the pane that is open
- $('.info_pane:visible').slideToggle();
- if(!$sameTile) {
- $($infoPaneSelector).slideToggle();
- if (row == 1)
- $($tileSelector).animate({height:'118'});
- else
- $($tileSelector).animate({height:'60'});
- }
- }
- }
- </script>
- <!-- meta data -->
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <!-- page title -->
- <?php
- switch ($which_page) {
- case 'eat':
- echo "<title>eZag - eat</title> ";
- break;
- case 'sleep':
- echo "<title>eZag - sleep</title> ";
- break;
- case 'drink':
- echo "<title>eZag - drink</title> ";
- break;
- case 'home':
- echo "<title>eZag - home</title> ";
- break;
- }
- ?>
- <title>eZag</title>
- <!-- css style include -->
- <link rel="stylesheet" type="text/css" href="style.css"/>
- <!-- javascript for analytics -->
- <script type="text/javascript">
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-30918008-1']);
- _gaq.push(['_trackPageview']);
- (function () {
- var ga = document.createElement('script');
- ga.type = 'text/javascript';
- ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0];
- s.parentNode.insertBefore(ga, s);
- })();
- </script>
- </head>
- <!--begin body -->
- <body>
- <div id="header">
- <div id="logo"><a href="http://www.easyzag.com"><img src="images/ezag_logo.jpg" alt="eZag" /></a></div>
- </div>
- <div id="HESD">
- <?php
- switch ($which_page) {
- case 'eat':
- echo '<a href="index.php"><img src="images/white_eat.png"></a>';
- echo '<a href="index.php?section=eat"><img src="images/red_eat.png"></a>';
- echo '<a href="index.php?section=drink"><img src="images/white_drink.png"></a>';
- echo '<a href="index.php?section=sleep"><img src="images/white_sleep.png"></a>';
- break;
- case 'sleep':
- echo '<a href="index.php"><img src="images/white_eat.png"></a>';
- echo '<a href="index.php?section=eat"><img src="images/white_eat.png"></a>';
- echo '<a href="index.php?section=drink"><img src="images/white_drink.png"></a>';
- echo '<a href="index.php?section=sleep"><img src="images/red_sleep.png"></a>';
- break;
- case 'drink':
- echo '<a href="index.php"><img src="images/white_eat.png"></a>';
- echo '<a href="index.php?section=eat"><img src="images/white_eat.png"></a>';
- echo '<a href="index.php?section=drink"><img src="images/red_drink.png"></a>';
- echo '<a href="index.php?section=sleep"><img src="images/white_sleep.png"></a>';
- break;
- case 'home':
- echo '<a href="index.php"><img src="images/red_eat.png"></a>';
- echo '<a href="index.php?section=eat"><img src="images/white_eat.png"></a>';
- echo '<a href="index.php?section=drink"><img src="images/white_drink.png"></a>';
- echo '<a href="index.php?section=sleep"><img src="images/white_sleep.png"></a>';
- break;
- }
- ?>
- </div>
- <div style="height: 30px; width: 100%;" id="search_wrapper">
- <form id="search_form" action="http://www.google.com/search" method="get">
- <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;" />
- <input type="hidden" name="language" value="en" />
- <select name="search_type" id="search_option" style="width: 112px;">
- <option value="google">Google</option>
- <option value="wiki">Wikipedia</option>
- </select>
- <input type="submit" id='submit_button' style="width: 113px;" name="go" value=" Search " />
- </form>
- </div>
- <!-- begin tiles -->
- <div id="selection_menu">
- <!-- row 1 -->
- <div class="primary_options">
- <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>
- <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>
- <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>
- <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>
- <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>
- </div>
- <div class='info_pane row_1'>
- <div class='left_columns'>
- <b>Category</b><br>
- Seafood
- </div>
- <div class='left_columns'>
- <b>Price</b><br>
- $$
- </div>
- <div class='mid_column'>
- Link<br>
- Map
- </div>
- <div class='third_column'>
- ***
- </div>
- </div>
- <!-- row 2 -->
- <div class="secondary_options">
- <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>
- <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>
- <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>
- <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>
- <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>
- </div>
- <div class='info_pane row_2'>
- Style:<br>
- Price:<br>
- </div>
- <!-- row 3 -->
- <div class="secondary_options">
- <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>
- <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>
- <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>
- <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>
- <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>
- </div>
- <div class='info_pane row_3'>
- Style:<br>
- Price:<br>
- </div>
- <!-- row 4 -->
- <div class="secondary_options">
- <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>
- <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>
- <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>
- <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>
- <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>
- </div>
- <div class='info_pane row_4'>
- Style:<br>
- Price:<br>
- </div>
- <div class='announcements'>
- <marquee><B>These are the announcements!</B></marquee>
- </div>
- </div>
- <!-- footer -->
- <?php echo $footer; ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment