1
|
<?php
|
2
|
|
3
|
// $Id: modify.php 317 2006-03-01 14:18:22Z stefan $
|
4
|
|
5
|
/*
|
6
|
|
7
|
Website Baker Project <http://www.websitebaker.org/>
|
8
|
Copyright (C) 2004-2006, Ryan Djurovich
|
9
|
|
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
|
?>
|
35
|
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
36
|
<tr>
|
37
|
<td align="left" width="33%">
|
38
|
<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; ?>§ion_id=<?php echo $section_id; ?>';" style="width: 100%;" />
|
39
|
</td>
|
40
|
<td align="right" width="33%">
|
41
|
<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; ?>§ion_id=<?php echo $section_id; ?>';" style="width: 100%;" />
|
42
|
</td>
|
43
|
</tr>
|
44
|
</table>
|
45
|
|
46
|
<br />
|
47
|
|
48
|
<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['FIELD']; ?></h2>
|
49
|
<?php
|
50
|
|
51
|
// Loop through existing fields
|
52
|
$query_fields = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_form_fields` WHERE section_id = '$section_id' ORDER BY position ASC");
|
53
|
if($query_fields->numRows() > 0) {
|
54
|
$num_fields = $query_fields->numRows();
|
55
|
$row = 'a';
|
56
|
?>
|
57
|
<table cellpadding="2" cellspacing="0" border="0" width="100%">
|
58
|
<?php
|
59
|
while($field = $query_fields->fetchRow()) {
|
60
|
?>
|
61
|
<tr class="row_<?php echo $row; ?>" height="20">
|
62
|
<td width="20" style="padding-left: 5px;">
|
63
|
<a href="<?php echo WB_URL; ?>/modules/form/modify_field.php?page_id=<?php echo $page_id; ?>§ion_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
|
64
|
<img src="<?php echo ADMIN_URL; ?>/images/modify_16.png" border="0" alt="^" />
|
65
|
</a>
|
66
|
</td>
|
67
|
<td>
|
68
|
<a href="<?php echo WB_URL; ?>/modules/form/modify_field.php?page_id=<?php echo $page_id; ?>§ion_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>">
|
69
|
<?php echo $field['title']; ?>
|
70
|
</a>
|
71
|
</td>
|
72
|
<td width="175">
|
73
|
<?php
|
74
|
echo $TEXT['TYPE'].':';
|
75
|
if($field['type'] == 'textfield') {
|
76
|
echo $TEXT['SHORT_TEXT'];
|
77
|
} elseif($field['type'] == 'textarea') {
|
78
|
echo $TEXT['LONG_TEXT'];
|
79
|
} elseif($field['type'] == 'heading') {
|
80
|
echo $TEXT['HEADING'];
|
81
|
} elseif($field['type'] == 'select') {
|
82
|
echo $TEXT['SELECT_BOX'];
|
83
|
} elseif($field['type'] == 'checkbox') {
|
84
|
echo $TEXT['CHECKBOX_GROUP'];
|
85
|
} elseif($field['type'] == 'radio') {
|
86
|
echo $TEXT['RADIO_BUTTON_GROUP'];
|
87
|
} elseif($field['type'] == 'email') {
|
88
|
echo $TEXT['EMAIL_ADDRESS'];
|
89
|
}
|
90
|
?>
|
91
|
</td>
|
92
|
<td width="95">
|
93
|
<?php
|
94
|
if ($field['type'] != 'group_begin') {
|
95
|
echo $TEXT['REQUIRED'].': '; if($field['required'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; }
|
96
|
}
|
97
|
?>
|
98
|
</td>
|
99
|
<td width="110">
|
100
|
<?php
|
101
|
if ($field['type'] == 'select') {
|
102
|
$field['extra'] = explode(',',$field['extra']);
|
103
|
echo $TEXT['MULTISELECT'].': '; if($field['extra'][1] == 'multiple') { echo $TEXT['YES']; } else { echo $TEXT['NO']; }
|
104
|
}
|
105
|
?>
|
106
|
</td>
|
107
|
<td width="20">
|
108
|
<?php if($field['position'] != 1) { ?>
|
109
|
<a href="<?php echo WB_URL; ?>/modules/form/move_up.php?page_id=<?php echo $page_id; ?>§ion_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
|
110
|
<img src="<?php echo ADMIN_URL; ?>/images/up_16.png" border="0" alt="^" />
|
111
|
</a>
|
112
|
<?php } ?>
|
113
|
</td>
|
114
|
<td width="20">
|
115
|
<?php if($field['position'] != $num_fields) { ?>
|
116
|
<a href="<?php echo WB_URL; ?>/modules/form/move_down.php?page_id=<?php echo $page_id; ?>§ion_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
|
117
|
<img src="<?php echo ADMIN_URL; ?>/images/down_16.png" border="0" alt="v" />
|
118
|
</a>
|
119
|
<?php } ?>
|
120
|
</td>
|
121
|
<td width="20">
|
122
|
<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; ?>§ion_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
|
123
|
<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />
|
124
|
</a>
|
125
|
</td>
|
126
|
</tr>
|
127
|
<?php
|
128
|
// Alternate row color
|
129
|
if($row == 'a') {
|
130
|
$row = 'b';
|
131
|
} else {
|
132
|
$row = 'a';
|
133
|
}
|
134
|
}
|
135
|
?>
|
136
|
</table>
|
137
|
<?php
|
138
|
} else {
|
139
|
echo $TEXT['NONE_FOUND'];
|
140
|
}
|
141
|
|
142
|
?>
|
143
|
|
144
|
<br /><br />
|
145
|
|
146
|
<h2><?php echo $TEXT['SUBMISSIONS']; ?></h2>
|
147
|
|
148
|
<?php
|
149
|
|
150
|
// Query submissions table
|
151
|
$query_submissions = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_form_submissions` WHERE section_id = '$section_id' ORDER BY submitted_when ASC");
|
152
|
if($query_submissions->numRows() > 0) {
|
153
|
?>
|
154
|
<table cellpadding="2" cellspacing="0" border="0" width="100%">
|
155
|
<?php
|
156
|
// List submissions
|
157
|
$row = 'a';
|
158
|
while($submission = $query_submissions->fetchRow()) {
|
159
|
?>
|
160
|
<tr class="row_<?php echo $row; ?>" height="20">
|
161
|
<td width="20" style="padding-left: 5px;">
|
162
|
<a href="<?php echo WB_URL; ?>/modules/form/view_submission.php?page_id=<?php echo $page_id; ?>§ion_id=<?php echo $section_id; ?>&submission_id=<?php echo $submission['submission_id']; ?>">
|
163
|
<img src="<?php echo ADMIN_URL; ?>/images/folder_16.png" alt="<?php echo $TEXT['OPEN']; ?>" border="0" />
|
164
|
</a>
|
165
|
</td>
|
166
|
<td width="237"><?php echo $TEXT['SUBMISSION_ID'].': '.$submission['submission_id']; ?></td>
|
167
|
<td><?php echo $TEXT['SUBMITTED'].': '.gmdate(TIME_FORMAT.', '.DATE_FORMAT, $submission['submitted_when']+TIMEZONE); ?></td>
|
168
|
<td width="20">
|
169
|
<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; ?>§ion_id=<?php echo $section_id; ?>&submission_id=<?php echo $submission['submission_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
|
170
|
<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />
|
171
|
</a>
|
172
|
</td>
|
173
|
</tr>
|
174
|
<?php
|
175
|
// Alternate row color
|
176
|
if($row == 'a') {
|
177
|
$row = 'b';
|
178
|
} else {
|
179
|
$row = 'a';
|
180
|
}
|
181
|
}
|
182
|
?>
|
183
|
</table>
|
184
|
<?php
|
185
|
} else {
|
186
|
echo $TEXT['NONE_FOUND'];
|
187
|
}
|
188
|
|
189
|
?>
|
190
|
|
191
|
<br />
|