Project

General

Profile

1 560 Ruebenwurz
<?php
2
3
// $Id$
4
5
/*
6
7
 Website Baker Project <http://www.websitebaker.org/>
8 915 Ruebenwurz
 Copyright (C) 2004-2009, Ryan Djurovich
9 560 Ruebenwurz
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
24
*/
25
26
/*
27
The Website Baker Project would like to thank Rudolph Lartey <www.carbonect.com>
28
for his contributions to this module - adding extra field types
29
*/
30
31
// Must include code to stop this file being access directly
32
if(!defined('WB_PATH')) { exit("Cannot access this file directly"); }
33
34 1079 Ruebenwurz
//overwrite php.ini on Apache servers for valid SESSION ID Separator
35
if(function_exists('ini_set')) {
36
	ini_set('arg_separator.output', '&amp;');
37
}
38
39 560 Ruebenwurz
//Delete all form fields with no title
40
$database->query("DELETE FROM ".TABLE_PREFIX."mod_form_fields  WHERE page_id = '$page_id' and section_id = '$section_id' and title=''");
41
42
?>
43
<table cellpadding="0" cellspacing="0" border="0" width="100%">
44
<tr>
45
	<td align="left" width="33%">
46 1079 Ruebenwurz
		<input type="button" value="<?php echo $TEXT['ADD'].' '.$TEXT['FIELD']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/form/add_field.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
47 560 Ruebenwurz
	</td>
48
	<td align="right" width="33%">
49 1079 Ruebenwurz
		<input type="button" value="<?php echo $TEXT['SETTINGS']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/form/modify_settings.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
50 560 Ruebenwurz
	</td>
51
</tr>
52
</table>
53
54
<br />
55
56
<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['FIELD']; ?></h2>
57
<?php
58
59
// Loop through existing fields
60
$query_fields = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_form_fields` WHERE section_id = '$section_id' ORDER BY position ASC");
61
if($query_fields->numRows() > 0) {
62
	$num_fields = $query_fields->numRows();
63
	$row = 'a';
64
	?>
65
	<table cellpadding="2" cellspacing="0" border="0" width="100%">
66
	<?php
67
	while($field = $query_fields->fetchRow()) {
68
		?>
69 1069 Ruebenwurz
		<tr class="row_<?php echo $row; ?>">
70 560 Ruebenwurz
			<td width="20" style="padding-left: 5px;">
71 1074 Ruebenwurz
				<a href="<?php echo WB_URL; ?>/modules/form/modify_field.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
72 953 Ruebenwurz
					<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="^" />
73 560 Ruebenwurz
				</a>
74
			</td>
75
			<td>
76 1074 Ruebenwurz
				<a href="<?php echo WB_URL; ?>/modules/form/modify_field.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>">
77 560 Ruebenwurz
					<?php echo $field['title']; ?>
78
				</a>
79
			</td>
80
			<td width="175">
81
				<?php
82
				echo $TEXT['TYPE'].':';
83
				if($field['type'] == 'textfield') {
84
					echo $TEXT['SHORT_TEXT'];
85
				} elseif($field['type'] == 'textarea') {
86
					echo $TEXT['LONG_TEXT'];
87
				} elseif($field['type'] == 'heading') {
88
					echo $TEXT['HEADING'];
89
				} elseif($field['type'] == 'select') {
90
					echo $TEXT['SELECT_BOX'];
91
				} elseif($field['type'] == 'checkbox') {
92
					echo $TEXT['CHECKBOX_GROUP'];
93
				} elseif($field['type'] == 'radio') {
94
					echo $TEXT['RADIO_BUTTON_GROUP'];
95
				} elseif($field['type'] == 'email') {
96
					echo $TEXT['EMAIL_ADDRESS'];
97
				}
98
				?>
99
			</td>
100
			<td width="95">
101
			<?php
102
			if ($field['type'] != 'group_begin') {
103
				echo $TEXT['REQUIRED'].': '; if($field['required'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; }
104
			}
105
			?>
106
			</td>
107
			<td width="110">
108
			<?php
109
			if ($field['type'] == 'select') {
110
				$field['extra'] = explode(',',$field['extra']);
111
				echo $TEXT['MULTISELECT'].': '; if($field['extra'][1] == 'multiple') { echo $TEXT['YES']; } else { echo $TEXT['NO']; }
112
			}
113
			?>
114
			</td>
115
			<td width="20">
116
			<?php if($field['position'] != 1) { ?>
117 1074 Ruebenwurz
				<a href="<?php echo WB_URL; ?>/modules/form/move_up.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
118 953 Ruebenwurz
					<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="^" />
119 560 Ruebenwurz
				</a>
120
			<?php } ?>
121
			</td>
122
			<td width="20">
123
			<?php if($field['position'] != $num_fields) { ?>
124 1074 Ruebenwurz
				<a href="<?php echo WB_URL; ?>/modules/form/move_down.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
125 953 Ruebenwurz
					<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="v" />
126 560 Ruebenwurz
				</a>
127
			<?php } ?>
128
			</td>
129
			<td width="20">
130 1074 Ruebenwurz
				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/form/delete_field.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
131 953 Ruebenwurz
					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
132 560 Ruebenwurz
				</a>
133
			</td>
134
		</tr>
135
		<?php
136
		// Alternate row color
137
		if($row == 'a') {
138
			$row = 'b';
139
		} else {
140
			$row = 'a';
141
		}
142
	}
143
	?>
144
	</table>
145
	<?php
146
} else {
147
	echo $TEXT['NONE_FOUND'];
148
}
149
150
?>
151
152
<br /><br />
153
154
<h2><?php echo $TEXT['SUBMISSIONS']; ?></h2>
155
156
<?php
157
158
// Query submissions table
159
$query_submissions = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_form_submissions` WHERE section_id = '$section_id' ORDER BY submitted_when ASC");
160
if($query_submissions->numRows() > 0) {
161
	?>
162
	<table cellpadding="2" cellspacing="0" border="0" width="100%">
163
	<?php
164
	// List submissions
165
	$row = 'a';
166
	while($submission = $query_submissions->fetchRow()) {
167
		?>
168 1069 Ruebenwurz
		<tr class="row_<?php echo $row; ?>">
169 560 Ruebenwurz
			<td width="20" style="padding-left: 5px;">
170 1074 Ruebenwurz
				<a href="<?php echo WB_URL; ?>/modules/form/view_submission.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&submission_id=<?php echo $submission['submission_id']; ?>" title="<?php echo $TEXT['OPEN']; ?>">
171 953 Ruebenwurz
					<img src="<?php echo THEME_URL; ?>/images/folder_16.png" alt="<?php echo $TEXT['OPEN']; ?>" border="0" />
172 560 Ruebenwurz
				</a>
173
			</td>
174
			<td width="237"><?php echo $TEXT['SUBMISSION_ID'].': '.$submission['submission_id']; ?></td>
175
			<td><?php echo $TEXT['SUBMITTED'].': '.gmdate(TIME_FORMAT.', '.DATE_FORMAT, $submission['submitted_when']+TIMEZONE); ?></td>
176
			<td width="20">
177 1074 Ruebenwurz
				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/form/delete_submission.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&submission_id=<?php echo $submission['submission_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
178 953 Ruebenwurz
					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
179 560 Ruebenwurz
				</a>
180
			</td>
181
		</tr>
182
		<?php
183
		// Alternate row color
184
		if($row == 'a') {
185
			$row = 'b';
186
		} else {
187
			$row = 'a';
188
		}
189
	}
190
	?>
191
	</table>
192
	<?php
193
} else {
194
	echo $TEXT['NONE_FOUND'];
195
}
196
197
?>