-
Notifications
You must be signed in to change notification settings - Fork 0
/
me.php
275 lines (232 loc) · 8.51 KB
/
me.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<head>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Merriweather|Source Sans Pro">
<style>
body {
font-family: "Merriweather", sans-serif;
font-size: 16px;
}
</style>
</head>
<?php
include_once("lib/db.php");
include_once("lib/nccp_simulator.php");
include_once("lib/frs_note.php");
//include_once("../../sps_data/nccp_tool.php");
include("../../inc/headers_sps.php");
?>
<?php
session_start();
$_SESSION['state2'] = $_GET['state'];
$_SESSION['demo'] = 0;
$_SESSION['test'] = 0;
if( isset($_POST['input']) ) {
foreach( $_POST as $k=>$v) {
$_SESSION[$k] = $v;
}
}
$simulator = new NCCP_Simulator();
/*$notes_table = Sps_TableFactory::create_table("FRS_Note");
$help_table = Sps_TableFactory::create_table("FRS_Help");
$tools_table = Sps_TableFactory::create_table("NCCP_Tool");
$tool = $tools_table->fetch_item(6);
$page_header = $tool->get_field("header_photo")->get_relative_path();*/
$page_title = "Family Resource Simulator";
$page_section = "tools";
$scripts = array("prototype.js", "scriptaculous.js", "validation.js");
if($_SESSION['mode'] == 'budget') { # if we're coming from the budget, we want to reset everything
$simulator->reset();
}
elseif($_SERVER['REQUEST_METHOD'] == 'POST') {
# If there's data to be stored, the proper input function is called
# and it returns the # of the page that gets displayed
$page = $simulator->{'input_page_'.($_POST['input'])}($_POST);
$simulator->{'calc_page_'.($_POST['input'])}();
$simulator->{'log_page_'.($_POST['input'])}();
}
elseif($_GET['mode'] == 'test') {
$page = $simulator->run_test();
}
elseif($_GET['mode'] == 'quick') {
$page = $simulator->input_page_1($_GET);
$simulator->log_page_1();
}
# Alternately, a specific page could be requested (if we're going backwards through the steps, for instance)
elseif($_GET['p']) { $page = $_GET['p']; }
if($_GET['reset']) { $simulator->reset(); }
$page_layout = "content-left";
# Finally, if no specific page was requested than we go to step one
if(!$page) $page = 1;
# put information about this session into the log
if($page == 1) $simulator->log_start();
$titles = array('','Location & Family Size','Household','Current Benefits','Work & Income','Child Care','Health Care','Other Expenses','Results');
$titles_long = array('',
'Location and family size',
'Household Information',
'Current Benefits',
'Employment and Other Household Income',
'Child Care Information',
'Health Insurance Information',
'Other Expenses',
'Results'
);
if (!isset($_SESSION['mode']) || $_SESSION['mode'] == 'budget') { $_SESSION['mode'] = 'step'; }
?>
<?php include("../../inc/headers_html.php"); ?>
<link rel="stylesheet" href="frs.css" type="text/css" media="screen" />
<script type="text/javascript">
function next()
{
var valid = new Validation('main-id', {onSubmit:false})
var result = valid.validate()
if(result) { document.main.submit(); return true; }
else { void(0) }
}
// Make sure that the form gets validated before it's submitted
addLoadEvent(function() { registerDependencies('main-id') })
addLoadEvent(function() {
new Validation('main-id');
})
<?php if($page != 8) {
// SAM IS COMMENTING THIS OUT HERE
//addLoadEvent(function() { $('button_continue').onclick = function() { next(); }})
} ?>
function changeCities(currentSelection)
{
simulator_box = document.forms['main'].simulator
residence_box = document.forms['main'].residence
code = simulator_box.options[simulator_box.selectedIndex].value
if(!code) {
residence_box.disabled = true
return
}
list = cities[code]
residence_box.options.length = 0
for(i=0;i<list.length;i+=2)
{
residence_box.options[i/2] = new Option(list[i+1],list[i])
if(currentSelection == list[i]) {
residence_box.selectedIndex = i/2
}
}
residence_box.disabled = false
/*
if(!currentSelection) {
residence_box.selectedIndex = default_cities[code];
}
*/
}
</script>
<?php include("../../inc/headers_page.php"); ?>
<form id="main-id" name="main" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post" class="grid_12">
<div id="content" class="content frs grid_8 alpha">
<h1>Benefit Cliffs Calculator</h1>
<?php if ($page == 1): ?>
<p>This tool will show you how your benefits change when your income changes. There are 7 steps with questions for you to answer. Step 8 will show your results and suggest next steps.</p>
<!--Old text:<p>The Benefit Cliffs Calculator shows what happens to your benefits when your income changes. After you answer the questions on the next few screens, you will see a graph showing how your resources and expenses change as your income changes. Along with the graph, the calculator will list some next steps that you can take.</p>-->
<?php
$_SESSION['state'] = 'ME';
$_SESSION['year'] = 2021;
$_SESSION['simulator'] = 'ME';
$s['code'] = 'ME';
$s['year'] = 2021;
endif;
include("../../inc/frs_steps.php");
?>
<!-- SAM IS INLINING FRS_BUTTONS.PHP HERE -->
<h2 class="steptitle noborder noprint">
<div class="squarebutton mini">
<?php echo $page ?>
</div>
<?php echo $titles_long[$page] ?>
</h2>
<div class="buttons">
<?php if($page == 1) { ?>
<a title="Reset" alt="Reset" class="roundbutton reset" href="<?php echo $_SERVER['PHP_SELF'] ?>?p=1&reset=1">
<img src="images/button-round-blank.gif" height="35" width="35" alt="" />
</a>
<?php } ?>
<?php if($page > 1) { ?>
<a title="Back" alt="Back" class="roundbutton back" href="<?php echo $_SERVER['PHP_SELF'] ?>?p=<?php echo $page - 1 ?>">
<img src="images/button-round-blank.gif" height="35" width="35" alt="" />
</a>
<?php } else { ?>
<a class="roundbutton back inactive" href="javascript:void(0);">
<img src="images/button-round-blank.gif" height="35" width="35" alt="" />
</a>
<?php } ?>
<?php if($page < 8) { ?>
<a title="Next" alt="Next" class="roundbutton next" href="javascript:next();" id="button_continue">
<img src="images/button-round-blank.gif" height="35" width="35" alt="" />
</a>
<?php } else { ?>
<a class="roundbutton next inactive" href="javascript:void(0);">
<img src="images/button-round-blank.gif" height="35" width="35" alt="" />
</a>
<?php } ?>
</div>
<br class="clearing" />
<!-- END SAM HACK HERE -->
<div class="container">
<input type="hidden" name="input" value="<?php echo $page ?>" />
<?php include("inc/page_$page.php") ?>
<div class="frs-note">
<?php /*echo $notes_table->endnotes->get_list_with_stars()*/ ?>
</div>
</div>
</div>
<?php if($page < 8) { ?>
<div class="sidebar grid_4 omega">
<?php if($page == 1) {
//echo $assets_table->fetch('simulator_sidebar_text');
} ?>
<div id="help-box" class="help">
<img src="images/frs_help_big.gif" />
</div>
</div>
<?php } else { ?>
<div class="sidebar forceprint grid_4 omega" style="background-color:white;">
<div class="container" >
<?php for($i=1;$i<8;$i++) { ?>
<h2><?php printf('Step <a href="%s?p=%d">%d. %s</a>', $_SERVER['PHP_SELF'], $i, $i, $titles[$i]) ?></h2>
<?php include("inc/choice_$i.php") ?>
<br/>
<?php } ?>
</div>
</div>
<?php } ?>
<?php if($page > 1) { ?>
<div id="content" class="content frs grid_8 alpha">
<div class="buttons">
<a title="Reset" alt="Reset" class="roundbutton reset" href="<?php echo $_SERVER['PHP_SELF'] ?>?p=1&reset=1">
<img src="images/button-round-blank.gif" height="35" width="35" alt="" />
</a>
<?php if($page > 1) { ?>
<a title="Back" alt="Back" class="roundbutton back" href="<?php echo $_SERVER['PHP_SELF'] ?>?p=<?php echo $page - 1 ?>">
<img src="images/button-round-blank.gif" height="35" width="35" alt="" />
</a>
<?php } else { ?>
<a class="roundbutton back inactive" href="javascript:void(0);">
<img src="images/button-round-blank.gif" height="35" width="35" alt="" />
</a>
<?php } ?>
<?php if($page < 8) { ?>
<a title="Next" alt="Next" class="roundbutton next" href="javascript:next();" id="button_continue">
<img src="images/button-round-blank.gif" height="35" width="35" alt="" />
</a>
<?php } else { ?>
<a class="roundbutton next inactive" href="javascript:void(0);">
<img src="images/button-round-blank.gif" height="35" width="35" alt="" />
</a>
<?php } ?>
</div>
</div>
<?php } ?>
</form>
<pre>
<!--
<?php print_r($_SESSION) ?>
-->
</pre>
<!--
<?php include("../../inc/footers.php"); ?>
<!---->