Newer
Older
watercalc / pledge.php
@Evan Linde Evan Linde on 20 Jun 2017 6 KB initial import
<?php
	$cms->auth();
	$cms->scripts('jquery, form, common, bgiframe, dimensions, jqmodal');
	
	// DECODES FORM DATA
	$json = stripslashes($_POST['data']);
	$data = json_decode($json, true);	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta http-equiv="content-script-type" content="text/javascript" />
	<meta http-equiv="content-style-type" content="text/css" />
	<title>The power of 10% - pledge to reduce your water use by 10%</title>
	<style type="text/css" media="all">
		@import "/level3_new.css";
		@import "calculator.css";
	</style>
	<script type="text/javascript" src="calculator2.js"></script>
	<script type="text/javascript" src="/code/jquery.checkize.js"></script>
	<script type="text/javascript">
		$(function(){
			$("input").checkize({
				checked:"img/checked.png",
				checked_down:"img/checked.png",
				checked_hover:"img/checked.png",
				unchecked:"img/check.png",
				unchecked_down:"img/check.png",
				unchecked_hover:"img/check.png"
			});
		});
	</script>
</head>
<body id="home">
<p id="banner"><a href="/">www.WaterMatters.org</a></p>
<?php CMS::inc("include/dialog.php","cms"); ?>
<div id="outsidehead-bluelink">
	<a href="/">Home Page</a> &rarr; <a href="/conservation/">Water Conservation</a> &rarr; <a href="/conservation/thepowerof10/">Water Use Calculator</a> &rarr; Pledge to Save 10%
</div>
<div id="wrapper">
	<h1 id="graphic_header"><img src="img/header_power.jpg" /></h1>
	<form id="form1" action="" method="post">
		<input type="hidden" name="event" value="PowerOfTen" />
		<input type="hidden" name="page" value="thankyou.php" />
		<input type='hidden' name='data' value='<?=$json?>' />
		<input type="hidden" name="required" value="pledges[],audience" />
		<div id="sidetext">
			<p class="intro">Water plays an important role in our lives. Because we live in a state that is surrounded by so much water, we often forget about the importance of conservation.</p>
			<br class="clear" />
		</div>
		<div id="pledge">
			<h2>Choose your pledge activities:</h2>
			<ul id="pledges">
				<li>
					<input type="checkbox" checked="checked" />
					<label>Reduce my <strong>daily water use</strong> by <span><?=$data["total_individual_percent"]?></span> gallons (10%)</label><br class="clear" />
				</li>
				<?php
					$rows = DAO::init("site_pledges")->getWhere("category==Indoor");
					foreach($rows as $row){
						$id = $row->id;
						$show = true;
						$show = ($data["shower_flow"] == 1 && $id == 16) ? false : $show;
						$show = ($data["shower_minutes"] < 6 && $id == 17) ? false : $show;
						if($show){
				?>
				<li>
					<input type="checkbox" id="pledges<?=$id?>" name="pledges[]" title="I pledge to:" value="<?=$id?>" />
					<label for="pledges<?=$id?>" title="I pledge to:"><?=$row->render('pledge')?></label><br class="clear" />
				</li>
				<?php } } ?>
				<?php
					$rows = DAO::init("site_pledges")->getWhere("category==Outdoor");
					foreach($rows as $row){
					  $id = $row->id;
					  $show = true;
					  $show = ($data["outside_minutes"] == 0 && $id == 20) ? false : $show;
					  $show = ($data["lawn"] > 0 && $data["lawn_sensors"] == 1 && $id == 21) ? false : $show;				
					  $show = ($data["has_pool"] == 1 && $data["pool_cover"] == 1 && $id == 22) ? false : $show;
					  if($show){
				?>
				<li>
					<input type="checkbox" id="pledges<?=$id?>" name="pledges[]" title="I pledge to:" value="<?=$id?>" />
					<label for="pledges<?=$id?>" title="I pledge to:"><?=$row->render('pledge')?></label><br class="clear" />
				</li>
				<?php }} ?>
			</ul>
			<ul id="yourinfo">
				<li><h3>Your information</h3></li>
				<li>
					<label for="first_name" title="first_name">Your first name:</label>
					<input type="text" id="first_name" name="first_name" title="first_name" value="" />
				</li>
				<li>
					<label for="last_name" title="last_name">Your last name:</label>
					<input type="text" id="last_name" name="last_name" title="last_name" value="" />
				</li>
				<li>
					<label for="email" title="Email">Your email:</label>
					<input type="text" id="email" name="email" title="Email" value="" />
				</li>
				<li>
					<label for="county">State</label>
					<select id="county" name="states_id" title="State">
						<option value=''>Select...</option>
						<option value='9' selected='selected'>Florida</option>
					<?php foreach(DAO::init('states')->getAll("name") as $row){ ?>
						<option value='<?=$row->id?>'><?=$row->name?></option>
					<?php } ?>
					</select>
				</li>
				<li>
					<label for="county">County (optional)</label>
					<select id="county" name="counties_id" title="County">
						<option value=''>Select...</option>
					<?php foreach(DAO::init('counties')->getAll("name") as $row){ ?>
						<option value='<?=$row->id?>'><?=$row->name?></option>
					<?php } ?>
					</select>
				</li>
				<li>
					<label for="audience" title="audience">Which category best describes you?</label>
					<select id="audience" name="audience_id" title="Audience">
						<option value=''>Select...</option>
					<?php foreach(DAO::init('audience')->getAll("name") as $row){ ?>
						<option value='<?=$row->id?>'><?=$row->name?></option>
					<?php } ?>
					</select>
				</li>
				<li>
					<label for="opt_in" title="audience">Can we follow up with you in three months to check on your progress?<br />
					<!--<span>If yes, we&#8217;ll add you to our monthly drawing to win a rain barrel or micro-irrigation kit. (One winner per household; while supplies last.)</span>--></label>
					<select id="opt_in" name="opt_in" title="Opt-In">
						<option value='1'>Yes</option>
						<option value='0'>No</option>
					</select>
				</li>
				<li class="submit">
					<a href="#" onclick="submitForm(1); return false;"><img src="img/pledge.png" /></a>
				</li>
			</ul>
		</div>
	</form>
	<hr class="clear" />
	<h3>Comments or questions? <a href="mailto:webmaster@watermatters.org">Email us.</a></h3>
	<div id="footer"></div>
</div>
<div id="contactfoot">
    <p>
		<a href="/">Home Page</a> &nbsp;&bull;&nbsp; 
		<a href="/about/mission/">Who We Are &amp; What We Do</a> &nbsp;&bull;&nbsp; 
		<a href="/search/">Search &amp; Site Map</a> &nbsp;&bull;&nbsp; 
		<a href="/contact/">Contact Us</a> &nbsp;&bull;&nbsp; 
		<a href="/about/privacy.html">Privacy &amp; Disclaimer</a> &nbsp;&bull;&nbsp; 
		<span class="cite">&#169; </span><a href="/about/copyright.html">Copyright</a>  &nbsp;&bull;&nbsp; 
        <img src="/img/pdf.gif" alt="pdf" /> <a href="http://get.adobe.com/reader/">Download PDF Reader</a> 
	</p>
</div>
</body>
</html>